[asterisk-users] Macro Usage

Lee Jenkins lee at datatrakpos.com
Wed Feb 14 18:14:16 MST 2007


Jason Wolfe wrote:
> Hello,
> 
> I have the following simple application...
> 
> 
> 1. Call is answered, and Dial() function is used with a macro to dial 
> out to a number.
> 2. 'Called' party answers the phone, and hears a message (this is a 
> function of the macro)
> 
> At this point I'd like for the 'Called' Party to be able to make a 
> decision and press 1 or 2 to hear some additional information before 
> accepting the call.
> 
> The problem is that any key pressed causes the call to be bridged.
> 
> Is this the only behavior, or can someone help me with an example of a 
> script that will allow the 'Called' party to do some things before the 
> call is bridged.
> 
> I have included my macro code below
> **************************************************************
> 
> [macro-acceptcall]
> exten => s,1,Answer()
> exten => s,2,Wait(1)
> exten => s,3,Background(makechoice)  ;make a choice, press 1 or 2
> exten => s,4,WaitExten(3)
> exten => s,5,Goto(s,3)
> 
> 
> exten => 1,1,Background(youchose1)
> 
> exten => 2,1,Background(youchose2)
> 
> ***************************************************************
> 
> This is what I want to happen, but it just bridges the call immediately 
> without playing the respective messages. Thanks for the help.
> 

[macro-acceptcall]
exten=>s,1,Answer()
exten=>s,2,Wait(1)
exten=>s,3,Read(NameOfVarToSaveValueIn,makechoice)
exten=>s,4,GotoIf($["${NameOfVarToSaveValueIn}" = "1"?5:6)
exten=>s,5,Playback(youchose1)
exten=>s,6,Playback(youchose2)

I've not played with WaitExten().  Read() command could work though.

-- 

Warm Regards,

Lee



More information about the asterisk-users mailing list