[Asterisk-Users] Re: exten statement execution order

David L. West nntp at deskoptional.com
Wed May 10 08:01:51 MST 2006


Thanks, Wes, G was just what I needed.  Here's where I am:

[macro-stdexten]
exten => s,1,Set(cname=${CALLERID(number)}@pbx.deskoptional.com)
exten => s,n,Set(CALLERID(number)=${cname})
exten => s,n,Dial(${ARG2},20,gtTwWG(OnAnswer,1,1))
exten => s,n,Set(savestatus=${DIALSTATUS})
exten => s,n,Goto(s-${savestatus},1);ANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER
exten => s-CHANUNAVAIL,1,VoiceMail(u${ARG1})
exten => s-CONGESTION,1,VoiceMail(u${ARG1})
exten => s-NOANSWER,1,Voicemail(u${ARG1})
exten => s-BUSY,1,Voicemail(b${ARG1})
exten => h,1,Macro(OnHangup)

[OnAnswer]
exten => 1,1,NoOp(IN POSTDIAL 1)
exten => 1,2,NoOp(IN POSTDIAL 2)
exten => h,1,Macro(OnHangup)

[macro-OnHangup]
exten => s,1,NoOp(IN ONHANGUP)

Unanswered calls stay in macro-stdexten and so get handled as desired.  When a call is answered, I do see that control has passed to OnAnswer. >From the available evidence in the CLI, I'm guessing that having grabbed control from Dial() with the G switch, it is incumbent on me to do whatever it is Asterisk would have done if I hadn't grabbed the wheel.  I do notice that OnHangup gets called for both, which is good.  Here's the CLI log for "dave" calling "andrea", showing how both channels hit OnAnswer and time out.  I just need to figure out what to do there in order for the two to talk.

    -- SIP/dave-06e2 is ringing
    -- SIP/dave-06e2 answered SIP/Andrea-7837
  == Channel 'SIP/Andrea-7837' jumping out of macro 'stdexten'
    -- Executing NoOp("SIP/Andrea-7837", "IN POSTDIAL 1") in new stack
     -- Executing NoOp("SIP/Andrea-7837", "IN POSTDIAL 2") in new stack
    -- Executing NoOp("SIP/dave-06e2", "IN POSTDIAL 2") in new stack
May 10 08:50:37 WARNING[8722]: pbx.c:2412 __ast_pbx_run:  Timeout, but no rule 't' in context 'OnAnswer'
     -- Executing Macro("SIP/Andrea-7837", "OnHangup") in new stack
     -- Executing NoOp("SIP/Andrea-7837", "IN ONHANGUP") in new stack
May 10 08:50:37 WARNING[8725]: pbx.c:2412 __ast_pbx_run:  Timeout, but no rule 't' in context 'OnAnswer'
    -- Executing Macro("SIP/dave-06e2", "OnHangup") in new stack
    -- Executing NoOp("SIP/dave-06e2", "IN ONHANGUP") in new stack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060510/4c4b5f66/attachment.htm


More information about the asterisk-users mailing list