[asterisk-users] asterisk and IVR

A J Stiles asterisk_list at earthshod.co.uk
Thu Jul 25 11:07:02 CDT 2013


On Thursday 25 July 2013, Salaheddine Elharit wrote:
> thanks for your help when i use
> 
> exten => s,1,NoOp(User chose support option)
> exten => s,n,Dial(SIP/228, 10)
> exten => s,n,Goto(${DIALSTATUS},1)
> exten => NOANSWER,1,Goto(call,s,1)
> 
> with no answer i can coto [call] without issue but with answer like below i
> can't get [call]
> 
> exten => s,1,NoOp(User chose support option)
> exten => s,n,Dial(SIP/228, 10)
> exten => s,n,Goto(${DIALSTATUS},1)
> exten => ANSWER,1,Goto(call,s,1)


Immediately after the Dial() statement, add a line like
exten => s,nNoOp(Dial status is ${DIALSTATUS})

That will show you the actual contents of ${DIALSTATUS} in the CLI  (in case 
it is not what you are expecting).  Call your extension a few times, and see 
exactly what you get when the line is answered, unanswered, engaged and maybe 
if the phone is unplugged.

Instead of having a separate extension named after every possible value of 
${DIALSTATUS} it might be easier to use a GotoIf() statement to jump away in 
one case  (most sensibly, if the call was answered),  and fall through to the 
default otherwise  ("engaged" and "phone not connected" are similar enough to 
"no answer" for that probably to be what you want, barring special values -- 
feel free to use more GotoIf() statements if required).

Something like:

exten => s,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?answered)
exten => s,n,NoOp(execution continues here if no answer)
...
exten => s,n,Hangup()
exten => s,n(answered),NoOp(we jump here if call was answered)
...
exten => s,n,Hangup()




More information about the asterisk-users mailing list