Alan Lord (News)
2009-Jul-16 12:08 UTC
[asterisk-users] Struggling with Macros and "s" Extension
Hi all, I'm sure this has been done before but I just can't figure it out. On my * box I have a simple IVR: [tolc_menu] ; Welcome and information to callers exten => s,1,Answer() exten => s,n,Wait(2) exten => s,n,Background(welcome-to-tolc) ; Say Hello exten => s,n,Wait(1) exten => s,n(tryagain),Background(enter-ext-of-person&or) ; Enter extension number if known, or exten => s,n,Background(pls-stay-on-line) ; Trying to connect... exten => s,n,WaitExten(5) exten => s,n,Macro(belllord,${ALANL}&${ALANB},303) exten => _10[1-5],1,Macro(call_extension,SIP/${EXTEN}) exten => _20[1-5],1,Macro(call_extension,IAX2/alanb/${EXTEN}) . . . Hopefully you'll see that the caller can either enter an extension number or wait. If they wait, we use macro-belllord: [macro-belllord] exten => s,1,Dial(${ARG1},20,t) exten => s,n,Goto(s-${DIALSTATUS},1) exten => s-NOANSWER,1,Voicemail(${ARG2}@business,u) ; business is the voicemail context, ${ARG2} is the mailbox number to dial exten => s-NOANSWER,n,Hangup() exten => s-BUSY,1,Voicemail(${ARG2}@business,b) exten => s-BUSY,n,Hangup() exten => _s-.,1,Goto(s-NOANSWER,1) The Vars ALANL and ALANB are: ALANL=SIP/101 ALANB=IAX2/alanb/202 If I call in, dial the extension (say 101) and connect, then the Link Event on the AMI port (and in CDRs) correctly displays *both* numbers of the connection. For that scenario we use macro-call_extention: [macro-call_extension] exten => s,1,Dial(${ARG1},20,t) ; Ring channel for up to 20s exten => s,n,Goto(s-${DIALSTATUS},1) ; Go to either no answer or busy. exten => s-NOANSWER,1,Voicemail(${MACRO_EXTEN}@garden_house,u) exten => s-BUSY,1,Voicemail(${MACRO_EXTEN}@garden_house,b) exten => _s-.,1,Goto(s-NOANSWER,1) If however I wait and let macro-belllord do it's stuff. I only ever see "s" as the called party's number. I really need to know what that extension number is. Could someone help me and show how I can rejig this? It was suggested to do something with ${MACRO_EXTEN} but I can't get it at all... Many thanks in advance. Alan