Asterisk Manager Originate Action Problem

I am originating a call to a Local channel using an Originate Action:

Action: Originate
Channel: Local/dial@outdial
Context: outdial
Exten: answer
Priority: 1
Timeout: 45000
ActionID: some_id
Variable: DIAL_STRING=DAHDI/4/1234567890|DIAL_TIMEOUT=45000

In my dialplan, I have this:

exten => dial,1,Dial(${DIAL_STRING}, ${DIAL_TIMEOUT})
exten => dial,n,NoOp(Dial Status = ${DIALSTATUS})
exten => dial,n,Agi(agi://localhost/Outdial.agi, ${DIAL_STRING})
exten => dial,n,Hangup()

exten => answer,1,NoOp(Dial Status = ${DIALSTATUS})
exten => answer,n,Playback(${GREETING_NAME})
exten => answer,n,WaitForSilence(2000)
exten => answer,n,Agi(agi://localhost/Outdial.agi)
exten => answer,n,Hangup()

Everything seems to work fine so long as the Dial command executes successfully. For example, if someone picks up the other end after the Dial command completes, processing jumps to the “answer” extension as expected. If no one ever answers and the Dial command times out, processing continues on with the next priority of the “dial” extension, again as expected.

However, if someone sets a bad DIAL_STRING (such as using a channel that doesn’t exist), things start to behave oddly. It continues on in the next priority of the “dial” extension (as I would expect). However, as soon as it executes the call to the AGI script, it also starts processing the “answer” extension at the same time. As a result, I end up with two calls into my AGI script. Unfortunately, I don’t know what I’m doing wrong here.


Deric Page