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

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Wed Feb 15 15:23:58 MST 2006


On Wednesday 15 February 2006 15:20, Beau Hargis wrote:
> I made a custom cdr module to log what we need at the end of call for
> the CDRs that we have in our databases, but I am looking for a clean
> way to hook into the hangup of a channel to do some end of call data
> gathering and logging. I can do this in my custom cdr loging
> function, but on SIP channels all the channel variables are destroyed
> at that point. On local, they are there, but I have yet to try it on
> a zap channel.

You should not count on the channel variables being there.  That is
precisely why CDR variables exist.

> Is there a point during the hangup of a channel where most everything
> is done, but the channel variables still exist so the state of the
> call at the point of hangup can be captured? So far, I have been
> using the CDR() dial plan function to store the information so it is
> accessible to the custom cdr logging, but it has to be explicitly
> set.

That is how you should be doing it.

-- 
Tilghman



More information about the asterisk-dev mailing list