[Asterisk-Users] Passing varibles *out* of macros

Joe Presto asterisk at desktopguerrillas.com
Sat Apr 2 10:38:51 MST 2005


Hi, I have a dialplan that has a called party indicate whether they want to
accept a call by pressing "1". I'm using a feature found in CVS head.

It works great, except that if the call is connected, and the called party
hangs up first, the caller goes into voicemail.

I tried to work around this by passing a variable out of the macro, but that
doesn't appear to work.  Here's my dialplan - what's the best way to
accomplish this?

[dg-extensions]
exten => 1,1,Playback(dg-connect-to-sales)
exten => 1,2,SetVar(CALLFILENAME=${EXTEN:1}-${TIMESTAMP}) 
exten => 1,3,Monitor(wav,${CALLFILENAME},m) 
exten => 1,4,SetMusicOnHold,sales
exten => 1,5,Dial(SIP/sales|30|gmM(screen))
exten => 1,6,GotoIf($[${screenresult} = accept ] ?8:7)
exten => 1,7,VoiceMail,su1
exten => 1,8,Wait(0)
exten => 1,107,VoiceMail,su1

[macro-screen]
exten => s,1,Wait(0.2)
exten => s,2,Read(ACCEPT|all-your-base|1)
exten => s,3,GotoIf($[${ACCEPT} = 1 ] ?7:4)  ;5:4
exten => s,4,SetVar(MACRO_RESULT=CONTINUE) ;do not connect call
exten => s,5,SetVar(screenresult=deny)
exten => s,6,Goto(s,8) 
exten => s,7,SetVar(screenresult=accept)  ;connect call
exten => s,8,Wait(0)

Thanks in advance - Joe




More information about the asterisk-users mailing list