[asterisk-users] PHP AGI script

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri Dec 7 08:31:36 CST 2007


On Friday 07 December 2007 04:42:34 Andreas Brodmann wrote:
> Nicholas Blasgen wrote:
> > I've got a very nice PHP AGI script but I want to be able to do some
> > database cleanup when the user hangs up the phone.  I wish everyone would
> > hang up when they were suposed to, but some people don't.  So what does
> > Asterisk send to an AGI file when the line has been disconnected?
> >
> > If I
> > remember reading somewhere correctly, I don't need to use
>
> DeadAGI.  Instead
>
> > I'm able to use normal AGI but I just need to catch a SIGTERM or
> > something like that and process it.
>
> Nicholas,
>
> I solved that using the following extension:
>
> exten => h,1,DeadAGI(log_exit.php)
>
> If you catch any signals you're 'cheating' asterisk.
> Using the 'h' extension and DeadAGI should be fine.

I don't see how that's cheating.  In fact, if you need to cleanup connections,
catching the signal is EXACTLY what you ought to do.  Just bear in mind that
as soon as you get a signal, the current version of AGI will stop interacting
with your script.

This has been changed for the next release cycle, so AGI will transparently
switch over to what is now DeadAGI behavior (after sending a HUP) and continue
to interact with the script until the script dies (which is what most people
wanted anyway).

-- 
Tilghman



More information about the asterisk-users mailing list