Urgent! How can play music after connected call

[out1]
exten=>.,1,Set(CALLERID(num)=${cid})
exten=>
.,n,Gosub(monitor,${EXTEN},1)
exten=>.,n,Answer()
exten=>
.,n,WaitForSilence(800,1)
same => n,Read(dtmfno,text.wav,20)
same => n,NoOp(${dtmfno})
same => n,AGI(cx_agi/dtmf.py,${CALLERID(number)},${dst},${dtmfno},${getuser})
same => n,GotoIf($[${EXISTS(${dtmfno})}]?endcall:curstep)
same => n(curstep),set(curstep=1)
same => n,WaitForSilence(1500,1)
same => n,Read(dtmfno,text.wav,20)
same => n,NoOp(${dtmfno})
same => n,AGI(cx_agi/dtmf.py,${CALLERID(number)},${dst},${dtmfno},${getuser})
same => n,WaitForSilence(1500,1)
same => n,GotoIf($[${EXISTS(${dtmfno})}]?endcall:curstep1)
same => n(curstep1),set(curstep1=1)
same => n,Read(dtmfno,text.wav,20)
same => n,NoOp(${dtmfno})
same => n,AGI(cx_agi/dtmf.py,${CALLERID(number)},${dst},${dtmfno},${getuser})
same => n,WaitForSilence(1500,1)
same => n(endcall),set(endcall=1)
same => n,hangup()

[monitor]
exten=>.,1,set(path=/var/www/html/rec/)
same=>n,Mixmonitor(${path}${STRFTIME(${EPOCH},%Y-%m-%d
%H-%M-%S)}-${EXTEN}${type}${src}.wav)
same=>n,return()

this is my dialplan
current I can hear first text.wav file while during calling.
so sometimes, after connected calling, I can hear first text.wav file correctly.
and sometimes during calling-- before connect calling, I can hear first text.wav file.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.