Thanks for the answer!
Maybe you can tell me how to do it right?
My goal is to make a call to a mobile number through the originate command, and if the subscriber does not answer, then call him back several times and if the call is successful, play the audio file. I can’t use сall files, because I plan to launch originate command via ARI (via post request)
[outbound]
exten=>_x.,1,verbose( calling to ${EXTEN})
same=>n,Set(CALLERID(num)=${calleridnumber}) ;callerid to use
same=>n,Dial(SIP/${EXTEN}@sip,25) ;trunk to use
same=>n,RetryDial(hello-world|5|3:SIP/${EXTEN}@sip|5|d)
exten=>_xxx,1,verbose( calling to ${EXTEN})
same=>n,Set(CALLERID(num)=${calleridnumber}) ;callerid to use
same=>n,Dial(SIP/${EXTEN},25)
[play]
exten=>s,1,Noop(///${caller}///)
same=>n,Answer()
same=n,Playback(demo-thanks)
same=>n,MusicOnHold(default)
same=>n,Hangup()
You will need to provide sufficiently detailed logging, but note that the nett effect of your GotoIf’s is Noop, as both paths end on the same priority.
[outbound3]
exten => _x.,1,Dial(SIP/${EXTEN}@sip,15,t)
exten => _x.,n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial1)
exten => _x.,n(redial1),Dial(SIP/${EXTEN}@sip,15,t)
same => n,Set(secondary=79001112233)
same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial2)
same => n(redial2),Dial(SIP/${EXTEN}@sip,15,t)
same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial3)
same => n(redial3),Dial(SIP/${secondary}@sip,15,t)
same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial4)
same => n(redial4),Dial(SIP/${secondary}@sip,15,t)
same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial5)
same => n(redial5),Dial(SIP/${secondary}@sip,15,t)
I use command originate to run it, and everything fine:
With your dialplan, DIALSTATUS will never be ANSWER, and, as I said, even if were ANSWER, the GotoIf would go to the same place as wit would if it hadn’t been.