[asterisk-users] asterisk and IVR

A J Stiles asterisk_list at earthshod.co.uk
Fri Jul 26 05:45:23 CDT 2013


* THIS IS NOT WHERE YOUR RESPONSE GOES *

On Friday 26 July 2013, Salaheddine Elharit wrote:
> in the CLI  i have :
> 
> 
> 1) for CONGESTION i get the status is 'CONGESTION'
> 
> 
> 
> Accepting call from '0666666666' to '534' on channel 0/12, span 1
>     -- Executing [534 at default:1] Dial("Zap/12-1", "SIP/228| 10") in new
> stack
>     -- Called 228
>     -- SIP/228-08361358 is ringing
>     -- Got SIP response 480 "Temporarily Unavailable" back from
> 192.168.5.131
>     -- SIP/228-08361358 is circuit-busy
>   == Everyone is busy/congested at this time (1:0/1/0)
>   == Auto fallthrough, channel 'Zap/12-1' status is 'CONGESTION'
> 
> 
> 2) for no answer i get status is 'NOANSWER'
> 
> 
> Accepting call from '0666666666' to '534' on channel 0/4, span 1
>     -- Executing [534 at default:1] Dial("Zap/4-1", "SIP/228| 10") in new
> stack -- Called 228
>     -- SIP/228-08362880 is ringing
>  -- Nobody picked up in 10000 ms
>   == Auto fallthrough, channel 'Zap/4-1' status is 'NOANSWER'
> 
> 
> 3) for answered i don't get the status is 'answered'
> 
> 
> Accepting call from '0666666666' to '534' on channel 0/15, span 1
>     -- Executing [534 at default:1] Dial("Zap/15-1", "SIP/228| 10") in new
> stack
>     -- Called 228
>     -- SIP/228-08363bb8 is ringing
>     -- SIP/228-08363bb8 answered Zap/15-1
> 
> when i have the result is 'CONGESTION'  or 'NOANSWER'i can go to the next
> (home,s,1)
> 
> exten => 534,1,Dial(SIP/228, 10)
> exten => 534,n,NoOp(Dial status is ${DIALSTATUS})
> exten => 534,n,GotoIf($["${DIALSTATUS}" = "CONGESTION"])
> exten => 534,n,Goto(home,s,1)
> 
> 
> how to do in order to go to the next if the result is answered
> 
> exten => 534,1,Dial(SIP/228, 10)
> exten => 534,n,NoOp(Dial status is ${DIALSTATUS})
> exten => 534,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?answered)
> exten => 534,n,Goto(home,s,1)

You're nearly there; you need to have a label "answered" in your dialplan.  
This is done by inserting the name, in round brackets, after the priority and 
before the following comma.  After a Goto() would be an excellent place to put 
it.  Try this:

exten => 534,1,Dial(SIP/228, 10)
exten => 534,n,NoOp(Dial status is ${DIALSTATUS})
exten => 534,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?answered)
exten => 534,n,Goto(home,s,1)
exten => 534,n(answered),NoOp(Call was answered)
...

Note that if you answer the phone, as far as Asterisk is concerned, the Dial() 
statement is still being executed; so it won't fall through to the next 
priority until the phone is hung up.


-- 
AJS

Answers come *after* questions.



More information about the asterisk-users mailing list