[asterisk-users] 'h' extension on call-out

Tony Mountifield tony at softins.clara.co.uk
Mon Nov 12 17:28:33 CST 2007


In article <9cbf3f070711121414v25502911tbba304034fa7669c at mail.gmail.com>,
Artifex Maximus <artifexor at gmail.com> wrote:
> > > > If the call is unsuccessful, the Dial command will return, and you can
> > > > then check ${ISDNCAUSE} on the next line of your dialplan.
> > > There is no dial command because I only wrote a call file to
> > > /var/spool/asterisk/outgoing and actually dial has been made by
> > > pbx_spool module. There is a 'failed' extension but no HANGUPCAUSE
> > > there.
> > That is why you are not executing the 'h' extension. You are placing
> > the call directly to a channel. That channel does not start executing
> > the dial plan until it is answered. In that respect, my original
> > statement was correct. Because it only starts the dialplan when the
> > call is successfully answered, there is no context in which to execute
> > an 'h' extension on a failed call.
> I see. Thanks for clarifying! In short there is no 'extra' extension
> for 'hangup' like 'failed'.
> 
> > Channel: Local/123456789 at outgoing
> > Context: mycontext
> > Extension: s
> > Priority: 1
> Thank you! I will try this! Is local redirection have any
> performance/resource hit on calls?

No, the Local channel is just used to set up the call, and once it is
answered, the extra channels are optimised out so that you end up with
the same channel as if you had called it directly.

> > [outgoing]
> > exten => _X.,1,Dial(Zap/g1/${EXTEN})
> I see. Therefore Dial is executed within my context and I have
> extension 'h' for it. Tricky.

Yes, but this is a different context from the one you want the answered
call to execute. In my example, "outgoing" and "mycontext" must be different,
unless there will be no confusion between possible extensions. I always
keep them different to avoid confusion.

> > exten => _X.,n,NoOp(${EXTEN}:DIALSTATUS=${DIALSTATUS};HANGUPCAUSE=${HANGUPCAUSE})
> Do I really need this? Because extension 'h' is executed on hangup so
> this is redundancy I think.
> 
> > exten => h,n,NoOp(${EXTEN}:DIALSTATUS=${DIALSTATUS};HANGUPCAUSE=${HANGUPCAUSE})
> >
> > In that case you should find the 'h' in [outgoing] gets executed on both successful
> > and failed calls.
> So I don't need NoOp for _X.. Right?

The NoOps were just so you could see which conditions caused each to be
called. You would replace or follow the NoOp with some conditional statements
that act on the status values.

It doesn't hurt to have the NoOps in both places. At least until you are sure
'h' catches all the conditions you are interested in. For example you might
want _X. to go on and try again or try a different operation that you couldn't
do within 'h'.

> Many thanks for your informations!

Glad to help. Hope you get it working the way you want!

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list