[Asterisk-Users] manager api: how to handle failed calls

Luca Casavola luca at softpi.it
Mon Nov 15 07:58:02 MST 2004


Hello Nicolas, first of all I want to thank you. You are the first guy 
give me an answer. I already posted this issue two times but nobody was 
interested in it.
I tried your sugggestion but it doesn't work. In the mean time I 
upgraded to v1.0.2 but things remain the same or even worse ( I have in 
the log a new channel name OutgoingSpoolFailed but the behaviour is the 
same).
Any way perhaps I found a solution and I would like to ask what do you 
think about it:
This is the request:
/bin/echo "Action: Originate";\
/bin/echo "Channel: Local/XXXXX at chiamamezzi3";\
/bin/echo "Variable: 
callid=123456|number=XXXXX|url=pippo|menuid=FOP|redirectnum=YYYYY";\
/bin/echo "Context: chiamamezzi3";\
/bin/echo "Exten: s";\
/bin/echo "Priority: 1";\
/bin/echo "Callerid: Asterisk Automatic Wardial";\
/bin/echo "Timeout: 10000";\
/bin/echo "Async: True";\  ** this is important otherwise fail extension 
doesn't work **
/bin/echo "ActionId: 10";\

This is the context
[chiamamezzi3]
exten => _.X,1,Dial(ZAP/g1/${EXTEN})
exten => _.X,2,NoOp( _.X  DIALSTATUS is ${DIALSTATUS}, number is ${number} )
exten => _.X,3,SetGlobalVar(status=${DIALSTATUS})
exten => s,1,Wait,1
exten => s,2,Answer
exten => s,3,DigitTimeout,5
exten => s,4,ResponseTimeout,10
exten => s,5,system(/prd/asterisk/log.sh "Variabili: [menuid=${menuid}] 
[number=${number}] [redirectnum=${redirectnum}] [url=${url}] 
[callid=${callid}]")
exten => s,6,Goto(chiamamezzi-${menuid},s,1)
exten => t,1,Goto(noanswer,s,1)
exten => failed,1,NoOp( failed  DIALSTATUS is ${status} number is ${number})
exten => failed,2,Hangup()
exten => h,1,Hangup()


As I told you, If the call is ok dialplan goes on s, 1
If the call fails I proceed on _.X,2 and 3 and I need to set a 
globalvariable to let to handle it  in the failed extension.
It works but I don't know if it could work on multi request environment 
. It would be much better to use a channel variable or even better, to 
have DIALSTATUS directly available .
Regards
Luca Casavola


Nicolás Gudiño wrote:

>Hello,
>
>Comments inline..
>
>  
>
>> The question is how to correctly handle failed calls. 
>> In my application I want to make  hundreds of outgoing calls automatically.
>> When the callee  pick up the phone he gets a playback message and give an
>>acknowledge by means of dtmf code. 
>> I make use of manager command originate, something like 
>> Action:originate 
>> channel: ZAP/g1/XXXX 
>> Variable:X|Y|Z 
>> extension: test 
>> the extension test is something like 
>> [test] 
>> exten  s,1 , wait ()
>> exten  s, 2 , answer ()
>> exten s, 3 playback(XX) 
>> The problem is since I don't use the application dial  inside the extension
>>I cannot get any value from 
>> DIALSTATUS or HANGUPCAUSE variable 
>> I tried several strategies: 
>> 1) 
>> change the logic and use local pseudo channel 
>> In the originate command if I use channel: local/XXXXX at test1/n 
>> where test1 is:
>> [test1] 
>> exten => _.,1,Dial(ZAP/g1/g${EXTEN}) 
>> exten => _.,2,NoOp( 2 HANGUPCAUSE is ${HANGUPCAUSE}) 
>> exten => _.,3,NoOp( 2 DIALSTATUS is ${DIALSTATUS}) 
>> exten => _.,4,NoOp(  number is ${number}) 
>> exten => _.,5,Hangup 
>> 
>> I got the correct HANGUP value ( ie BUSY) but unfortunately  I cannot see
>>the variables set on the originate command.
>> I wonder  why not? 
>>    
>>
>
>Maybe, (just maybe, I did not try it myself)  the originate variables
>are passed using asterisk CVS-HEAD and variable names prefixed with
>underscore... Eg: Use variable _X instead of X in the originate
>command. Let me know if it works.
>
>Regards,
>
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20041115/f3f89273/attachment.htm


More information about the asterisk-users mailing list