[asterisk-dev] Dial 'd' option improvement

Tilghman Lesher tlesher at digium.com
Wed Jul 14 22:19:33 CDT 2010


On Wednesday 14 July 2010 15:48:26 Steve Edwards wrote:
> > On Wed, Jul 14, 2010 at 12:23 PM, Mark Murawski <markm at intellasoft.net>
> >
> > wrote:
> >> When using Dial from AGI, ${EXITCONTEXT} only is used for digit
> >> matching, and control returns to the agi script... so having any extens
> >> defined in the exit context is pretty useless in this case.  What I'm
> >> proposing is moving EXITCONTEXT to an option parameter such as
> >> d[([digits][@context])].
>
> On Wed, 14 Jul 2010, Tim Ringenbach wrote:
> > I don't have a strong opinion on your proposed change, but I wanted to
> > point out one thing:
> >
> > I don't think that's completely true. I haven't tested this case, but
> > most things that do a Goto while you're in an AGI do set a new context,
> > extension and priority, it's just that you're in the agi still so you
> > don't execute them until the AGI completes. It's effectively the same as
> > using the agi commands "set extension", "set context" and "set
> > priority". And you can see that this has happened by asking for the
> > EXTEN variable and notices that it's changed.
>
> According to http://www.voip-info.org/wiki/view/Asterisk+AGI, "If the AGI
> application dials outward by executing Dial, control over the call returns
> to the dialplan and the script loses contact with the Asterisk server."
>
> Is this correct, outdated or just plain wrong.

I'm pretty sure it's just plain wrong, or at the very least, misinformed about
what is actually occurring.

AGI in 1.4 and prior did not allow you to transition from a live, active call
to control after the call had been hungup.  And Dial, when it returns,
typically causes a hangup (unless the call was not answered or the 'g' flag
was used).  So what was actually happening was that Dial hungup and exited,
control returned to AGI, where, because the call was hungup, the script was
terminated (with SIGHUP), and control returned to whatever spawned the AGI.
Someone might have THOUGHT that they lost control, but they did not.

If they had used the 'g' flag to Dial, then control would have returned to the
AGI immediately upon Dial exiting, assuming it was the destination channel
which hungup and not the source channel.  If it was the source channel, then
then a hangup cannot be avoided, as the hangup is generated by the device
to which the channel belongs, rather than being passed from the remote end.

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list