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

Gareth Blades list-asterisk at skycomuk.com
Wed Apr 28 10:50:08 CDT 2010


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



More information about the asterisk-users mailing list