[asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI script

Danny Nicholas danny at debsinc.com
Wed Apr 28 11:07:01 CDT 2010


FWIW, I would take your STDERR references and give them another handle,
since you're not really trying to produce a CLI/Console output.

The symptoms you have described in this thread are 100% compliant with "AGI
protocol violation (their term not mine)" - the last suggest I would give
you is to do an implicit AGI usage like this:
my $agi;
my %input;
$agi = new Asterisk::AGI;
%input = $agi->ReadParse();

-----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 10:50 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Asterisk 1.4.30 is slow sending STDIN to AGI
script

Danny Nicholas wrote:
> Darn, that should have worked.  The "improvement" from 1.4.22 to 1.4.23+
> basically requires that every "print STDOUT" line be followed by a <STDIN>
> to make util.c not choke when doing commands/setting variables.  I wonder
> how this "rewrite" would work?
> sub set_variable
>    {
>      my ($self, %vars) = @_;
>      while (my($var,$val) = each %vars)
>        {
>          if (!defined($val))
>            { warn "AGI->set_variable: not setting '$var' because value 
> was undef\n"; next; }
>          print STDOUT "SET VARIABLE $var \"$val\" \r\n";
>          <STDIN>;
>        }
>    }
> 

I dont think that routine is the issue. Its only called when setting the 
  variables and that is only done before the call is dialed and in that 
case the script generates no errors :-

     -- Executing [08454632504 at service_nts_nextgen_v2:1] AGI("Zap/5-1", 
"service_nts_nextgen|mode=start|") in new stack
     -- Launched AGI Script /var/lib/asterisk/agi-bin/service_nts_nextgen
AGI Tx >> agi_request: service_nts_nextgen
AGI Tx >> agi_channel: Zap/5-1
AGI Tx >> agi_language: en
AGI Tx >> agi_type: Zap
AGI Tx >> agi_uniqueid: 1272469456.5
AGI Tx >> agi_callerid: 1276459900
AGI Tx >> agi_calleridname: unknown
AGI Tx >> agi_callingpres: 1
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 33
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 08454632504
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: service_nts_nextgen_v2
AGI Tx >> agi_extension: 08454632504
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >> >
AGI Rx << SET VARIABLE __item_count "0"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __custid "13361"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __dniascli "0"
AGI Tx >> 200 result=1
AGI Rx << GET VARIABLE __cliorig
AGI Tx >> 200 result=0
AGI Rx << VERBOSE "Route To Number: 447584255419" 1
   service_nts_nextgen|mode=start|: Route To Number: 447584255419
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __destination_number_1 "07584255419"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __destination_type_1 "number"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __destination_type_id_1 "1"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __destination_channel_1 "Zap/g1"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __numcarriers_1 "2"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __destination_carrier_1_2 "PSTN:DEFAULT"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __destination_number_1_2 "07584255419"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __destination_channel_1_2 "Zap/g1"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __destination_carrier_1_1 "SIP:MAGRATHEA"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __destination_number_1_1 "07584255419 at magrathea"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __destination_channel_1_1 "SIP"
AGI Tx >> 200 result=1
AGI Rx << SET VARIABLE __item_count "1"
AGI Tx >> 200 result=1
     -- AGI Script service_nts_nextgen completed, returning 0

The problem is with where the mode is answered or completed when I get 
errors like this :-

     -- Executing [s at macro-service-nts-nextgenv2-register-answer:3] 
AGI("SIP/magrathea-00000002", 
"service_nts_nextgen|mode=answered|1272469456.5|1272469457.6|07584255419|1||
SIP:MAGRATHEA|params=") 
in new stack
     -- Launched AGI Script /var/lib/asterisk/agi-bin/service_nts_nextgen
AGI Tx >> agi_request: service_nts_nextgen
AGI Tx >> agi_channel: SIP/magrathea-00000002
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1272469457.6
AGI Tx >> agi_callerid: 08454632504
AGI Tx >> agi_calleridname: unknown
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 33
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: unknown
[Apr 28 16:44:34] ERROR[23465]: utils.c:968 ast_carefulwrite: write() 
returned error: Broken pipe
AGI Tx >> agi_rdnis: unknown
[Apr 28 16:44:34] ERROR[23465]: utils.c:968 ast_carefulwrite: write() 
returned error: Broken pipe
AGI Tx >> agi_context: macro-service-nts-nextgenv2-register-answer
[Apr 28 16:44:34] ERROR[23465]: utils.c:968 ast_carefulwrite: write() 
returned error: Broken pipe
AGI Tx >> agi_extension: s
[Apr 28 16:44:34] ERROR[23465]: utils.c:968 ast_carefulwrite: write() 
returned error: Broken pipe
AGI Tx >> agi_priority: 3
[Apr 28 16:44:34] ERROR[23465]: utils.c:968 ast_carefulwrite: write() 
returned error: Broken pipe
AGI Tx >> agi_enhanced: 0.0
[Apr 28 16:44:34] ERROR[23465]: utils.c:968 ast_carefulwrite: write() 
returned error: Broken pipe
AGI Tx >> agi_accountcode:
[Apr 28 16:44:34] ERROR[23465]: utils.c:968 ast_carefulwrite: write() 
returned error: Broken pipe
AGI Tx >>
[Apr 28 16:44:34] ERROR[23465]: utils.c:968 ast_carefulwrite: write() 
returned error: Broken pipe
     -- AGI Script service_nts_nextgen completed, returning 0

-- 
_____________________________________________________________________
-- 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




More information about the asterisk-users mailing list