[asterisk-dev] Re: Devloping an end of call hook or trap

Beau Hargis beauh at bluefrogmobile.com
Thu Feb 16 11:49:48 MST 2006

the h extension exists in a context, so an h extension would have to be
setup for each context, and I have found that sometimes the channel
variables exist and sometimes they dont.

What I am looking for is a way to hook into the process of the hangup
itself whether the call terminates abnormally, the plan errors out and
hangs up the channel, or the hangup function is called. 

I need to know the point that the channel is hung up but the state of
the call is still intact so I could do a post-mortem if there was a bug,
or the switch screwed up or someone unplugged the T-1 out of the
machine, or the caller hungup for some reason, or their carrier
disconnected their call. There is information in the channel that has
been captured or changed and that state is useful for logging to the
database or updating customer records, or for debugging.

I am developing some complex applications supporting hundreds of
simultaneous calls and I need to be able to hook into various parts of
the call to make sure certain things are done, or to debug certain
things, or check for quality of service.

>From a development stand point, a hundred contexts could exist in the
application, so what I am looking for is something like a hangup context
that all apps running on the box go to, or set per channel, or per call.
There seem to be weird interactions with the hangup extension when
things happen inside macros or with GoSub.

Other systems I have been developing on have two important hooks that we
use: a start of call hook and an end of call hook. These are very
important for doing sanity checks at the beginning of the call and for
doing various other logging and customer tracking and update at the end
of call that exist outside the CDR. Start of call is easy on asterisk
because I can define an incoming context for each channel driver where I
can do some routing and sanity checks, but I have no 'outgoing' context
do various things that need to be done before the channel is destroyed
and before the CDR is written because I might want to adjust certain
things that get written to the CDR.

On Thu, 2006-02-16 at 09:37 +0000, Tony Mountifield wrote:
> In article <1140052785.14478.19.camel at serproxy.blueforgmobile.com>,
> Beau Hargis <beauh at bluefrogmobile.com> wrote:
> > 
> > It doesn't even have to be a C function that gets called. Would others
> > be interested in something like a hangup context to which every call is
> > dumped on hangup where all the state of the call, including the channel
> > variables is available.
> Isn't that what the 'h' extension is for? While 'h' is being processed,
> the channel still exists and so do all the channel variables. You can
> even call an AGI function from 'h' so long as you do so with DeadAGI().
> Or have I completely misunderstood what you're looking for?
> Cheers
> Tony

More information about the asterisk-dev mailing list