[Asterisk-Users] Need help with Dial M option and destination context

Michael Collins mcollins at fcnetwork.com
Tue May 16 17:25:46 MST 2006


I would appreciate hearing from anyone who has figured this one out.
Here's the scenario:

I have a context wherein I give the called party the option to dial the
digit 9.  If he does so, he is transferred a la this extension entry:

exten => 9,1,Playback(pls-hold-while-try)

exten => 9,n,Noop(Attempting to bridge to ${agentext})

exten => 9,n,Dial(Zap/g9/${agentext}|60|gM(Connect_to_agent^${dnum}))

exten => 9,n,Noop(Done w/ x-fer to agent!)

exten => 9,n,Hangup

 

I simply play a "please hold message," execute a Noop, and then Dial
with g and M.  In this case, the variable agentext has already been
assigned a value ("2160"), and the Dial command executes properly, at
least AFAIK.  The call gets transferred and the agent's phone rings.
Now, here's the catch: I'm trying to pass along some information to the
agent before the call gets transferred.  Here's the dialplan context
"Macro-Connect_to_agent":

[macro-Connect_to_agent]

exten => s,1,DigitTimeout(180)

exten => s,n,Noop(Inside macro, ARG1 is '${ARG1}') ;ARG1 = dnum

exten => s,n,Set(AGENT_TRIES=1)

exten => s,n,Noop(Agent tries = ${AGENT_TRIES})

exten => s,n(repeat),WaitExten(.5)

exten => s,n,Background(your-account)

exten => s,n,Background(number)

exten => s,n,WaitExten(.5)

exten => s,n,SayDigits(${ARG1})

exten => s,n,WaitExten(1.5)

exten => s,n,Set(AGENT_TRIES=$[${AGENT_TRIES} + 1])

exten => s,n,GotoIf($[${AGENT_TRIES} > 40]?10:repeat)

exten => s,n,Noop(How did I get here?!)

exten => 1,1,Noop(Agent pressed ${EXTEN} - call being transferred)

exten => 1,n,ForkCDR()  ; start new CDR if call actually got xfer'd

exten => 1,n,Noop(All done here!)

exten => t,1,Noop(Agent timeout, dropping call anyway)

exten => h,1,Hangup

exten => i,1,Noop(Invalid entry, dropping call to agent)

exten => 10,1,Playback(vm-goodbye)

exten => 10,n,Noop(Agent did not pickup call...)

exten => 10,n,Hangup

 

The idea of this context is to voice a series of digits to the agent who
answers the call.  (The digits are passed in the variable "dnum.")  It
repeats over and over again, 40 times before giving up.  This part works
well.  After hearing the digits, the agent presses 1 (during the
WaitExten app) and the call is connected.  I see this at the CLI:

    -- Executing WaitExten("Zap/49-1", "1.5") in new stack

    -- Attempting native bridge of Zap/1-1 and Zap/49-1

 

Again, that works just fine.  The call is connect as soon as the agent
dials the digit 1 (or any digit, it would seem).  However, extension 1
never gets executed.  The call is connected properly, but my Noop's and
my ForkCDR never happen.  When the call is terminated then it returns to
the original context.  Here is the CLI for the whole process from the
point where I tell the called party to dial 9:

 

    -- Executing Playback("Zap/1-1", "pls-hold-while-try") in new stack

    -- Playing 'pls-hold-while-try' (language 'en')

    -- Executing NoOp("Zap/1-1", "Attempting to bridge to 2160") in new
stack

    -- Executing Dial("Zap/1-1",
"Zap/g9/2160|60|gM(Connect_to_agent^5012709)")

in new stack

    -- Called g9/2160

    -- Zap/49-1 answered Zap/1-1

    -- Executing DigitTimeout("Zap/49-1", "180") in new stack

    -- Executing NoOp("Zap/49-1", "Inside macro| ARG1 is 5012709") in
new stack

    -- Executing Set("Zap/49-1", "AGENT_TRIES=1") in new stack

    -- Executing NoOp("Zap/49-1", "Agent tries = 1") in new stack

    -- Executing WaitExten("Zap/49-1", ".5") in new stack

    -- Timeout on Zap/49-1, continuing...

    -- Executing BackGround("Zap/49-1", "your-account") in new stack

    -- Playing 'your-account' (language 'en')

    -- Executing BackGround("Zap/49-1", "number") in new stack

    -- Playing 'number' (language 'en')

    -- Executing WaitExten("Zap/49-1", ".5") in new stack

    -- Timeout on Zap/49-1, continuing...

    -- Executing SayDigits("Zap/49-1", "5012709") in new stack

    -- Playing 'digits/5' (language 'en')

    -- Playing 'digits/0' (language 'en')

    -- Playing 'digits/1' (language 'en')

    -- Playing 'digits/2' (language 'en')

    -- Playing 'digits/7' (language 'en')

    -- Playing 'digits/0' (language 'en')

    -- Playing 'digits/9' (language 'en')

    -- Executing WaitExten("Zap/49-1", "1.5") in new stack

    -- Attempting native bridge of Zap/1-1 and Zap/49-1

    -- Hungup 'Zap/49-1'

    -- Executing NoOp("Zap/1-1", "Done w/ x-fer to agent!") in new stack

    -- Executing Hangup("Zap/1-1", "") in new stack

  == Spawn extension (blasterisk_english_right_party, 9, 5) exited
non-zero on '

Zap/1-1'

    -- Hungup 'Zap/1-1'

 

 

As you can see, the call simply returns to the original context and
carries on, in this case executing the Noop that immediate follows the
Dial.  For kicks, I've tried without the 'g' option on the Dial but that
made no difference (other than not returning and continuing with the
priority following the Dial).

 

Is there any way to get the system to go to extension 1 when the agent
dials 1 so that I can do my ForkCDR?  

 

Thanks for your time and sorry for the long post!

 

-MC

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060516/714b2d43/attachment.htm


More information about the asterisk-users mailing list