In article <[EMAIL PROTECTED]>,
Artifex Maximus <[EMAIL PROTECTED]> wrote:
> On Nov 12, 2007 2:04 PM, Tony Mountifield <[EMAIL PROTECTED]> wrote:
> > In article <[EMAIL PROTECTED]>,
> >
> > Artifex Maximus <[EMAIL PROTECTED]> wrote:
> > > Hello!
> > >
> > > I would like to store ISDNCAUSE on automatic call-out campaign
> > > (possibly gives more detail on failed call). How is it possible?
> > >
> > > I have tried 'failed' and 'h' extension. No luck. Extension 'failed'
> > > does not know anything about ISDNCAUSE and 'h' extension is not called
> > > at all. Any idea?
> > >
> > > I am using Asterisk 1.2.14 on FC4 if it counts.
> >
> > I think you will find the 'h' extension is only called at the end of
> > a successful call.
> Extension 'h' is executed on every hangup event from both side.

But your experience as described directly contradicts that assertion.

My statement that 'h' is only called at the end of a successful call was
not accurate. It depends how the dialplan is written. The actual condition
is this:

When a channel is hung up, IF and ONLY IF that channel is executing in
the dial plan, the 'h' extension is called in whatever context that
channel is in currently.

> > 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.

You might find it useful to use a Local channel. Instead of doing this:

Channel: Zap/g1/123456789
Context: mycontext
Extension: s
Priority: 1

Try doing this:

Channel: Local/[EMAIL PROTECTED]
Context: mycontext
Extension: s
Priority: 1

(replace "mycontext" and "s" with whatever you are using currently)

And in extensions.conf:

[outgoing]
exten => _X.,1,Dial(Zap/g1/${EXTEN})
exten => 
_X.,n,NoOp(${EXTEN}:DIALSTATUS=${DIALSTATUS};HANGUPCAUSE=${HANGUPCAUSE})

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.

(Replace "Zap/g1" with whatever channel technology you are using)

Cheers
Tony

-- 
Tony Mountifield
Work: [EMAIL PROTECTED] - http://www.softins.co.uk
Play: [EMAIL PROTECTED] - http://tony.mountifield.org

_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to