[asterisk-users] How to avoid AGI script is canceled if callerHangUp
Steve Edwards
asterisk.org at sedwards.com
Wed Feb 10 17:13:09 CST 2010
Un-top-posting...
> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Thomas
> Winter
>
> is there any way to avoid cancel the AGI script if caller is hanging up.
> That gives me sometimes data mismatch and it is deffcault to clean up in
> the h extension.
>
> I would like that the PHP script called by AGI will run to end..
On Wed, 10 Feb 2010, Danny Nicholas wrote:
> According to the CLI doc, you can do it this way
> - exten => 100,1,Set(AGISIGHUP=no)
> - exten => 100,n,AGI(youragi.agi)
Who knew? Hey TP, I learned something new today!
Another approach, is to establish a signal handler -- so you can handle
the signal :)
I write my AGIs in C (because you can execute xxx AGIs written in C in the
time it takes to load PHP and parse your script) so it looks like this:
// trap SIGHUP -- caller hung up
signal(SIGHUP, (void (*)(int))(int)hangup);
When the caller hangs up, Asterisk delivers a SIGHUP to the process
created by the agi() application. Execution of your AGI will then continue
with your signal handler where you can clean up temporary files, roll back
database cruft, etc.
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list