Gareth Blades
2010-Apr-28 08:50 UTC
[asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI script
I have upgraded Asterisk from 1.4.22 to 1.4.30 and I have noticed I am getting a lot of errors like this on the console :- ERROR[23912]: utils.c:968 ast_carefulwrite: write() returned error: Broken pipe I have tracked it down to a perl AGI script which performs our own CDR recording. It is called before the start of the call, once answered and again when the call is hungup. It works fine when called before dialing and the AGI debugging shows asterisk sending the STDIN to the script very fast. When called after answering and at the end of the call asterisk is much slower sending the STDIN and I can see the debug scrolling up the screen and this is what is causing the error as the AGI script finished and exits before all the STDIN is sent. Even if I add a pause at the end of the script for 1 second it only gets half way through sending the STDIN. Why is asterisk so slow in sending the call info via STDIn in these cases? Is there any way this can be fixed? Thanks
Danny Nicholas
2010-Apr-28 13:23 UTC
[asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI script
Two suggestions - 1. Make sure your AGI has the proper syntax/handling - just because it "works" doesn't mean that it will be happy in the more "restrictive" environment of a dialplan call. 2. If you are 100% certain that #1 has been addressed, change utils.c line 968 from ast_log(LOG_ERROR, "write() returned error: %s\n", strerror(errno)); to ast_log(LOG_WARNING, "write() returned error: %s\n", strerror(errno)); and do a new make;make install. -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Gareth Blades Sent: Wednesday, April 28, 2010 3:51 AM To: Asterisk Mailing List Subject: [asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI script I have upgraded Asterisk from 1.4.22 to 1.4.30 and I have noticed I am getting a lot of errors like this on the console :- ERROR[23912]: utils.c:968 ast_carefulwrite: write() returned error: Broken pipe I have tracked it down to a perl AGI script which performs our own CDR recording. It is called before the start of the call, once answered and again when the call is hungup. It works fine when called before dialing and the AGI debugging shows asterisk sending the STDIN to the script very fast. When called after answering and at the end of the call asterisk is much slower sending the STDIN and I can see the debug scrolling up the screen and this is what is causing the error as the AGI script finished and exits before all the STDIN is sent. Even if I add a pause at the end of the script for 1 second it only gets half way through sending the STDIN. Why is asterisk so slow in sending the call info via STDIn in these cases? Is there any way this can be fixed? Thanks -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Danny Nicholas
2010-Apr-28 13:29 UTC
[asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI script
Check out this snippet from "Tilghman Lesher" (one of the true Asterisk Guru's) http://www.mail-archive.com/asterisk-users at lists.digium.com/msg220482.html It's a "NAG" (my term) introduced in the jump from 1.4.22 to 1.4.23 and carried out through the rest of the 1.4 tree. -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Gareth Blades Sent: Wednesday, April 28, 2010 3:51 AM To: Asterisk Mailing List Subject: [asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI script I have upgraded Asterisk from 1.4.22 to 1.4.30 and I have noticed I am getting a lot of errors like this on the console :- ERROR[23912]: utils.c:968 ast_carefulwrite: write() returned error: Broken pipe I have tracked it down to a perl AGI script which performs our own CDR recording. It is called before the start of the call, once answered and again when the call is hungup. It works fine when called before dialing and the AGI debugging shows asterisk sending the STDIN to the script very fast. When called after answering and at the end of the call asterisk is much slower sending the STDIN and I can see the debug scrolling up the screen and this is what is causing the error as the AGI script finished and exits before all the STDIN is sent. Even if I add a pause at the end of the script for 1 second it only gets half way through sending the STDIN. Why is asterisk so slow in sending the call info via STDIn in these cases? Is there any way this can be fixed? Thanks -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Philipp von Klitzing
2010-Apr-28 13:32 UTC
[asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI script
Hi!> Why is asterisk so slow in sending the call info via STDIn in these cases? > Is there any way this can be fixed?Your AGI script is faulty: In at least one place you have missed to READ the output right after you have issued a command. So go check your script ("agi debug" might help a little with this). Others would say: Your script violates the AGI protocol. Philipp
Gareth Blades
2010-Apr-28 13:59 UTC
[asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI script
Philipp von Klitzing wrote:> Hi! > >> Why is asterisk so slow in sending the call info via STDIn in these cases? >> Is there any way this can be fixed? > > Your AGI script is faulty: In at least one place you have missed to READ > the output right after you have issued a command. So go check your script > ("agi debug" might help a little with this). > > Others would say: Your script violates the AGI protocol.The script performs call logging to a database. Similar to the built in CDR but it updates at the start and answering of a call aswell so the database can be used to show current call status. The script does not issue any commands. The same script is called at all 3 stages but with different parameters on the command line to indicate the call status. Works fine before the call is answered but during and at the end of the call it quits before asterisk has finished sending the information about the current call via STDIN.
Danny Nicholas
2010-Apr-28 14:24 UTC
[asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI script
Can you post the script? -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Gareth Blades Sent: Wednesday, April 28, 2010 9:00 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI script Philipp von Klitzing wrote:> Hi! > >> Why is asterisk so slow in sending the call info via STDIn in thesecases?>> Is there any way this can be fixed? > > Your AGI script is faulty: In at least one place you have missed to READ > the output right after you have issued a command. So go check your script > ("agi debug" might help a little with this). > > Others would say: Your script violates the AGI protocol.The script performs call logging to a database. Similar to the built in CDR but it updates at the start and answering of a call aswell so the database can be used to show current call status. The script does not issue any commands. The same script is called at all 3 stages but with different parameters on the command line to indicate the call status. Works fine before the call is answered but during and at the end of the call it quits before asterisk has finished sending the information about the current call via STDIN. -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Steve Edwards
2010-Apr-28 16:34 UTC
[asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI script
On Wed, 28 Apr 2010, Ryan Bullock wrote:> Looking at the Asterisk::AGI docs, maybe try calling ReadParse() early > in the script to read in anything from stdin? > > (From the docs) > # pull AGI variables into %input > %input = $AGI->ReadParse();"early" == "before (any interaction with Asterisk || exit)" -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000