[Asterisk-Users] AbsoluteTimeout Inside A Macro

Mike Coakley mcoakley at ioumail.com
Tue Aug 10 20:32:47 MST 2004


Chris,

Actually it is a documented feature of Macro. Macro only executes 
extension "s" there are no other extensions in the macro context. I ran 
into this while working through building our dial plan. It was driving 
me nutz. (But the WIKI rescued me.) What I had to do is use the Macro 
to setup the call as needed and then Goto a context that had all the 
extensions I needed.

For a complete example:

I wanted to be able to call an station and if that station didn't 
answer I wanted to present the user with a menu that they could press 
#1 to leave a voicemail, #2 to try again, #4 to go to the main menu, #8 
to call the group/department the station belongs to, #9 to go to the 
group/department directory or #0 to go to operator. Here is what I had 
to do BECAUSE Macro can only execute the "s" extension.

[macro-stationcall]
exten => s,1,SetVar(STATION_EXT=${ARG1})
exten => s,2,SetVar(STATION_MAILBOX=${ARG2})
exten => s,3,SetVar(STATION_GROUP=${ARG3})
exten => s,4,SetVar(STATION_MENU=${ARG4})
exten => s,5,SetVar(STATION_DIRECTORY=${ARG5})
exten => s,6,Goto(stationcall_menu,s,1)

[stationcall_menu]
exten => s,1,Answer
exten => s,2,Wait(1)
exten => s,3,DigitTimeout(5)
exten => s,4,ResponseTimeout(5)
exten => s,5,AbsoluteTimeout(30)
exten => s,6,Dial(${STATION_EXT})
exten => s,7,Background(${STATION_MENU})
exten => 1,1,Voicemail(u${STATION_MAILBOX})
exten => 2,1,Goto(s,6)
exten => 4,1,Goto(main_menu,s,1)
exten => 8,1,Macro(groupcall,${STATION_GROU})
exten => 9,1,Directory(${STATION_DIRECTORY})
exten => 0,1,Goto(operator,s,1)
exten => i,1,Playback(invalid)
exten => i,2,Goto(s,7)
exten => t,1,Goto(s,7)
exten => T,1,Hangup

I simplified this example (trust me) but I hope you get the idea. Also 
realize that SetVar puts a variable in the scope of the current call.

Hope this helps.

Mike

On Aug 10, 2004, at 5:59 PM, Christopher L. Wade wrote:

> Okay, time for an update.
>
> I posted this as a bug.  Very quickly got informed that it is not a 
> bug, but instead, an undocumented 'feature'.
>
> AbsoluteTimeout is treated as an *exception* (ie it looks like a 
> hangup) by most applications, including Macro, which makes most 
> applications exit.
>
> This being said, this is why a 'T' extension in the calling context 
> would run, but not a 'T' extension inside the macro.  Once macro 
> exists, the macro context no longer exists, and the 'T' extension 
> inside the macro becomes 'inaccessible'.
>
> Oh well, I guess I'll have to implement my logic without macros. 
> Hopefully variables aren't screwed up by AbsoluteTimeout.
>
> Thanks,
> Chris
>
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>




More information about the asterisk-users mailing list