Thomas Winter
2010-Feb-10 22:37 UTC
[asterisk-users] How to avoid AGI script is canceled if caller HangUp
Hi, 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.. Some thing can happend with an Macro if caller hang up exactly when call is answered. An Macro called byi the DIAL command will be stoped and data mismatch can occur.. best regards Thomas
Danny Nicholas
2010-Feb-10 22:44 UTC
[asterisk-users] How to avoid AGI script is canceled if callerHangUp
According to the CLI doc, you can do it this way - exten => 100,1,Set(AGISIGHUP=no) - exten => 100,n,AGI(youragi.agi) YMMV -- Danny Nicholas -- -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Thomas Winter Sent: Wednesday, February 10, 2010 4:38 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: [asterisk-users] How to avoid AGI script is canceled if callerHangUp Hi, 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.. Some thing can happend with an Macro if caller hang up exactly when call is answered. An Macro called byi the DIAL command will be stoped and data mismatch can occur.. best regards Thomas -- _____________________________________________________________________ -- 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
Steve Edwards
2010-Feb-10 23:13 UTC
[asterisk-users] How to avoid AGI script is canceled if callerHangUp
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
Tilghman Lesher
2010-Feb-10 23:51 UTC
[asterisk-users] How to avoid AGI script is canceled if callerHangUp
On Wednesday 10 February 2010 17:13:09 Steve Edwards wrote:> 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.One thing that you cannot do in 1.4 is continue to interact with the AGI interface, however. You can handle the signal, but once it is sent, you can no longer interact with Asterisk. This deficiency is fixed in the 1.6 series. -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com & www.asterisk.org