Getting variable back to dialplan from AGI script

hi
I’m having the simple AGI script,

#!/usr/bin/php -q

<?php set_time_limit(30); require('/var/lib/asterisk/agi-bin/phpagi.php'); $agi = new AGI(); $agi->answer(); $agi->set variable('vivek', '7979797979'); $agi->noop("Vivek testing"); ?>

calling this script from dialplan:

[agitest]

exten => 4567,1,NoOp(*** for agi testing )
same => n,AGI(welcome.php,${CALLERID(num)})
same => n,NoOp(
result from db is ${vivek} ***)

when executed the output in asterisk cli (agi set debug is on) is

– Executing [4567@agitest:1] NoOp(“SIP/4000-00000104”, “*** for agi testing ") in new stack
– Executing [4567@agitest:2] AGI(“SIP/4000-00000104”, “welcome.php,4000”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/welcome.php
<SIP/4000-00000104>AGI Tx >> agi_request: welcome.php
<SIP/4000-00000104>AGI Tx >> agi_channel: SIP/4000-00000104
<SIP/4000-00000104>AGI Tx >> agi_language: en
<SIP/4000-00000104>AGI Tx >> agi_type: SIP
<SIP/4000-00000104>AGI Tx >> agi_uniqueid: 1386152808.260
<SIP/4000-00000104>AGI Tx >> agi_version: 11.6.0
<SIP/4000-00000104>AGI Tx >> agi_callerid: 4000
<SIP/4000-00000104>AGI Tx >> agi_calleridname: 4000
<SIP/4000-00000104>AGI Tx >> agi_callingpres: 0
<SIP/4000-00000104>AGI Tx >> agi_callingani2: 0
<SIP/4000-00000104>AGI Tx >> agi_callington: 0
<SIP/4000-00000104>AGI Tx >> agi_callingtns: 0
<SIP/4000-00000104>AGI Tx >> agi_dnid: 4567
<SIP/4000-00000104>AGI Tx >> agi_rdnis: unknown
<SIP/4000-00000104>AGI Tx >> agi_context: agitest
<SIP/4000-00000104>AGI Tx >> agi_extension: 4567
<SIP/4000-00000104>AGI Tx >> agi_priority: 2
<SIP/4000-00000104>AGI Tx >> agi_enhanced: 0.0
<SIP/4000-00000104>AGI Tx >> agi_accountcode:
<SIP/4000-00000104>AGI Tx >> agi_threadid: -1266926736
<SIP/4000-00000104>AGI Tx >> agi_arg_1: 4000
<SIP/4000-00000104>AGI Tx >>
– <SIP/4000-00000104>AGI Script welcome.php completed, returning 0
– Executing [4567@agitest:3] NoOp(“SIP/4000-00000104”, "
result from db is ***”) in new stack
– Auto fallthrough, channel ‘SIP/4000-00000104’ status is ‘UNKNOWN’

here in *** result from db is *** I want that variable ${vivek}.

please please help me anybody…thanks in advance :frowning:

Is set_variable with the underscore.

i tried with underscore also its not working like this set_variable…in asterisk 11.6

Check your PHP file in the Linux shell by running # php youragi.agi and see if exist errors.

hi, thanks for reply, i ran in shell its getting …
PHP Notice: Undefined index: PATH in /var/lib/asterisk/agi-bin/phpagi.php on line 1693
pls help

Show us the real agi script and the complete output of the cli when you invoke it.

Hi, thanks for reply ,what i want exactly is to pass a variable from dial plan to agi script and take the result variable from the script and pass it back to dial plan ,i used this code for testing not sure about how to declare variable and stuff.if any code for the same will be very helpful…

[newagitest]

exten => 5678,1,NoOp(*** for agi testing )
same => n,AGI(sss.php,${CALLERID(num)})
same => n,NoOp(
callerid is ${CALLERID(num)} )
same => n,NoOp(
* result from db${dialstatus}********)

my sss.php looks…

#!/usr/bin/php -q

<?php error_reporting (E_ALL ^ E_NOTICE); include_once ("phpagi.php"); ini_set('display_errors','false'); include_once ("phpagi-2.20/phpagi-asmanager.php"); $agi = new AGI(); $mob=$argv[1]; $dialstatus=$agi->set_variable('dailstatus' $mob); $agi->noop("status" $dialstatus); ?>

my cli o/p…

– Executing [5678@newagitest:1] NoOp(“SIP/1000-0000002b”, “*** for agi test ing ") in new stack
– Executing [5678@newagitest:2] AGI(“SIP/1000-0000002b”, “agi2.php,1000”) i n new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/agi2.php
<SIP/1000-0000002b>AGI Tx >> agi_request: agi2.php
<SIP/1000-0000002b>AGI Tx >> agi_channel: SIP/1000-0000002b
<SIP/1000-0000002b>AGI Tx >> agi_language: en
<SIP/1000-0000002b>AGI Tx >> agi_type: SIP
<SIP/1000-0000002b>AGI Tx >> agi_uniqueid: 1386315522.43
<SIP/1000-0000002b>AGI Tx >> agi_version: 11.6.0
<SIP/1000-0000002b>AGI Tx >> agi_callerid: 1000
<SIP/1000-0000002b>AGI Tx >> agi_calleridname: 1000
<SIP/1000-0000002b>AGI Tx >> agi_callingpres: 0
<SIP/1000-0000002b>AGI Tx >> agi_callingani2: 0
<SIP/1000-0000002b>AGI Tx >> agi_callington: 0
<SIP/1000-0000002b>AGI Tx >> agi_callingtns: 0
<SIP/1000-0000002b>AGI Tx >> agi_dnid: 5678
<SIP/1000-0000002b>AGI Tx >> agi_rdnis: unknown
<SIP/1000-0000002b>AGI Tx >> agi_context: newagitest
<SIP/1000-0000002b>AGI Tx >> agi_extension: 5678
<SIP/1000-0000002b>AGI Tx >> agi_priority: 2
<SIP/1000-0000002b>AGI Tx >> agi_enhanced: 0.0
<SIP/1000-0000002b>AGI Tx >> agi_accountcode:
<SIP/1000-0000002b>AGI Tx >> agi_threadid: -1255556240
<SIP/1000-0000002b>AGI Tx >> agi_arg_1: 1000
<SIP/1000-0000002b>AGI Tx >>
– <SIP/1000-0000002b>AGI Script agi2.php completed, returning 0
– Executing [5678@newagitest:3] NoOp(“SIP/1000-0000002b”, "
callerid is 1000 ") in new stack
– Executing [5678@newagitest:4] NoOp(“SIP/1000-0000002b”, "
* result from db********”) in new stack
– Auto fallthrough, channel ‘SIP/1000-0000002b’ status is ‘UNKNOWN’

pls help me …

Refer to the phpagi documentation you’re missing the coma for set_variable and noop, also notice that you should use Verbose instead noop. Check your script first in the shell to locate syntax errors.

hi,i changed script and ran it in shell, it shows no errors pls look at this…

#!/usr/bin/php -q

<?php error_reporting (E_ALL ^ E_NOTICE); set_time_limit(30); include_once("phpagi.php"); ini_set('display_errors','false'); $agi = new AGI(); $ani = $argv[1]; $mob = $ani; $ani = $agi-> get_variable($agi_arg_1); $agi-> set_variable("mob",$ani); $agi-> verbose("****$ani*****"); exit(); ?>

my shell o/p…

[root@localhost agi-bin]# php -q wagi.php

GET VARIABLE

SET VARIABLE mob “”

VERBOSE “Array*” 1

[root@localhost agi-bin]#

but when i run this using asterisk agi …debug o/p is like…

my extension_custom.conf is…

exten => 5678,1,NoOp(*** for agi testing )
same => n,AGI(wagi.php,${CALLERID(num)})
same => n,NoOp(++++++mobile value is ${mobile})
same => n,NoOp(
callerid is ${CALLERID(num)} )
same => n,NoOp(
* result from db:${ani}********)

my agi debug o/p…

-- Executing [5678@newagitest:1] NoOp("SIP/1000-00000004", "*** for agi testing ***") in new stack
-- Executing [5678@newagitest:2] Set("SIP/1000-00000004", "GLOBAL(mobile)=1000") in new stack

== Setting global variable ‘mobile’ to ‘1000’
– Executing [5678@newagitest:3] AGI(“SIP/1000-00000004”, “wagi.php,mobile”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/wagi.php
<SIP/1000-00000004>AGI Tx >> agi_request: wagi.php
<SIP/1000-00000004>AGI Tx >> agi_channel: SIP/1000-00000004
<SIP/1000-00000004>AGI Tx >> agi_language: en
<SIP/1000-00000004>AGI Tx >> agi_type: SIP
<SIP/1000-00000004>AGI Tx >> agi_uniqueid: 1386395151.4
<SIP/1000-00000004>AGI Tx >> agi_version: 11.6.0
<SIP/1000-00000004>AGI Tx >> agi_callerid: 1000
<SIP/1000-00000004>AGI Tx >> agi_calleridname: 1000
<SIP/1000-00000004>AGI Tx >> agi_callingpres: 0
<SIP/1000-00000004>AGI Tx >> agi_callingani2: 0
<SIP/1000-00000004>AGI Tx >> agi_callington: 0
<SIP/1000-00000004>AGI Tx >> agi_callingtns: 0
<SIP/1000-00000004>AGI Tx >> agi_dnid: 5678
<SIP/1000-00000004>AGI Tx >> agi_rdnis: unknown
<SIP/1000-00000004>AGI Tx >> agi_context: newagitest
<SIP/1000-00000004>AGI Tx >> agi_extension: 5678
<SIP/1000-00000004>AGI Tx >> agi_priority: 3
<SIP/1000-00000004>AGI Tx >> agi_enhanced: 0.0
<SIP/1000-00000004>AGI Tx >> agi_accountcode:
<SIP/1000-00000004>AGI Tx >> agi_threadid: -1256195216
<SIP/1000-00000004>AGI Tx >> agi_arg_1: mobile
<SIP/1000-00000004>AGI Tx >>
– <SIP/1000-00000004>AGI Script wagi.php completed, returning 0
– Executing [5678@newagitest:4] NoOp(“SIP/1000-00000004”, “++++++mobile value is 1000”) in new stack
– Executing [5678@newagitest:5] NoOp(“SIP/1000-00000004”, “*** callerid is 1000 ") in new stack
– Executing [5678@newagitest:6] NoOp(“SIP/1000-00000004”, "
* result from db:********”) in new stack
– Auto fallthrough, channel ‘SIP/1000-00000004’ status is ‘UNKNOWN’

i not sure this agi is executing script correctly or not .i am using php 5.3 and asterisk 11.6

i just want variable $ani back to dial plan…pls help …thankyou…

Seriously refer to the phpagi documentation, you are using the get_variable in the wrong way. And also notice that it returns an array not a single value.

hi
pls send me syntax,because what ever i use its not getting value from dialplan…tq

[code]#!/usr/bin/php -q

<?php error_reporting (E_ALL ^ E_NOTICE); set_time_limit(30); include_once("phpagi.php"); ini_set('display_errors','false'); $agi = new AGI(); $ani = $argv[1]; $mob = $ani; $agi-> set_variable("mob",$ani); $agi-> verbose("****$ani*****"); exit(); ?>

[/code]

exten => 5678,1,NoOp(*** for agi testing ***) same => n,AGI(wagi.php,${CALLERID(num)}) same => n,NoOp(++++++mobile value is ${mob})

Hi,
thanks for reply ,but nothing works result is same agi is returning 0 pls look at cli o/p

 -- Executing [5678@newagitest:1] NoOp("SIP/1000-00000001", "*** for agi testing ***") in new stack
-- Executing [5678@newagitest:2] AGI("SIP/1000-00000001", "wagi.php,1000") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/wagi.php

<SIP/1000-00000001>AGI Tx >> agi_request: wagi.php
<SIP/1000-00000001>AGI Tx >> agi_channel: SIP/1000-00000001
<SIP/1000-00000001>AGI Tx >> agi_language: en
<SIP/1000-00000001>AGI Tx >> agi_type: SIP
<SIP/1000-00000001>AGI Tx >> agi_uniqueid: 1386565127.1
<SIP/1000-00000001>AGI Tx >> agi_version: 11.6.0
<SIP/1000-00000001>AGI Tx >> agi_callerid: 1000
<SIP/1000-00000001>AGI Tx >> agi_calleridname: 1000
<SIP/1000-00000001>AGI Tx >> agi_callingpres: 0
<SIP/1000-00000001>AGI Tx >> agi_callingani2: 0
<SIP/1000-00000001>AGI Tx >> agi_callington: 0
<SIP/1000-00000001>AGI Tx >> agi_callingtns: 0
<SIP/1000-00000001>AGI Tx >> agi_dnid: 5678
<SIP/1000-00000001>AGI Tx >> agi_rdnis: unknown
<SIP/1000-00000001>AGI Tx >> agi_context: newagitest
<SIP/1000-00000001>AGI Tx >> agi_extension: 5678
<SIP/1000-00000001>AGI Tx >> agi_priority: 2
<SIP/1000-00000001>AGI Tx >> agi_enhanced: 0.0
<SIP/1000-00000001>AGI Tx >> agi_accountcode:
<SIP/1000-00000001>AGI Tx >> agi_threadid: -1256440976
<SIP/1000-00000001>AGI Tx >> agi_arg_1: 1000
<SIP/1000-00000001>AGI Tx >>
– <SIP/1000-00000001>AGI Script wagi.php completed, returning 0
– Executing [5678@newagitest:3] NoOp(“SIP/1000-00000001”, “*****mobile value is *****”) in new stack
– Auto fallthrough, channel ‘SIP/1000-00000001’ status is ‘UNKNOWN’

unable to understand what the problem is …pls help me

AGI:

[code]#!/usr/bin/php -q

<?php error_reporting (E_ALL ^ E_NOTICE); set_time_limit(30); include_once("phpagi.php"); ini_set('display_errors','false'); $agi = new AGI(); $mob = $argv[1]; $agi->set_variable("mob",$mob); $agi->verbose("****$mob*****"); exit(); ?>

[/code]

Dialplan:

exten => 5678,1,NoOp(*** for agi testing ***) same => n,AGI(tt.agi,${CALLERID(num)}) same => n,NoOp(++++++mobile value is ${mob})

Cli output:

*CLI> -- Executing [5678@phones:1] NoOp("PJSIP/5000-00000001", "*** for agi testing ***") in new stack -- Executing [5678@phones:2] AGI("PJSIP/5000-00000001", "tt.agi,5000") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/tt.agi <PJSIP/5000-00000001>AGI Tx >> agi_request: tt.agi <PJSIP/5000-00000001>AGI Tx >> agi_channel: PJSIP/5000-00000001 <PJSIP/5000-00000001>AGI Tx >> agi_language: es <PJSIP/5000-00000001>AGI Tx >> agi_type: PJSIP <PJSIP/5000-00000001>AGI Tx >> agi_uniqueid: 1386606899.1 <PJSIP/5000-00000001>AGI Tx >> agi_version: SVN-branch-12-r403304 <PJSIP/5000-00000001>AGI Tx >> agi_callerid: 5000 <PJSIP/5000-00000001>AGI Tx >> agi_calleridname: Max <PJSIP/5000-00000001>AGI Tx >> agi_callingpres: 0 <PJSIP/5000-00000001>AGI Tx >> agi_callingani2: 0 <PJSIP/5000-00000001>AGI Tx >> agi_callington: 0 <PJSIP/5000-00000001>AGI Tx >> agi_callingtns: 0 <PJSIP/5000-00000001>AGI Tx >> agi_dnid: unknown <PJSIP/5000-00000001>AGI Tx >> agi_rdnis: unknown <PJSIP/5000-00000001>AGI Tx >> agi_context: phones <PJSIP/5000-00000001>AGI Tx >> agi_extension: 5678 <PJSIP/5000-00000001>AGI Tx >> agi_priority: 2 <PJSIP/5000-00000001>AGI Tx >> agi_enhanced: 0.0 <PJSIP/5000-00000001>AGI Tx >> agi_accountcode: <PJSIP/5000-00000001>AGI Tx >> agi_threadid: 140712346896128 <PJSIP/5000-00000001>AGI Tx >> agi_arg_1: 5000 <PJSIP/5000-00000001>AGI Tx >> <PJSIP/5000-00000001>AGI Rx << SET VARIABLE mob "5000" <PJSIP/5000-00000001>AGI Tx >> 200 result=1 <PJSIP/5000-00000001>AGI Rx << VERBOSE "****5000*****" 1 tt.agi,5000: ****5000***** <PJSIP/5000-00000001>AGI Tx >> 200 result=1 -- <PJSIP/5000-00000001>AGI Script tt.agi completed, returning 0 -- Executing [5678@phones:3] NoOp("PJSIP/5000-00000001", "++++++mobile value is 5000") in new stack

Hi,thanks for reply
it wont made any changes for me , i tested with your dial plan and script .i am getting the same result
i think there is some issues with my asterisk php and agi versions.is there any possibility to re install agi and its dependency .I seen your agi version is SVN-branch-12-r403304 pls let me know how can i get this version of agi.

my configuration is

freepbx 2.8
asterisk 11.6
asterisk agi 11.6
php 5.3

will you please tell me your configuration you have been done this…thank you

The above was using Asterisk 12.

This is the output from Asterisk 11.6.0 same code:

== Using SIP RTP CoS mark 5 -- Executing [5678@phones:1] NoOp("SIP/5000-00000011", "*** for agi testing ***") in new stack -- Executing [5678@phones:2] AGI("SIP/5000-00000011", "tt.agi,5000") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/tt.agi <SIP/5000-00000011>AGI Tx >> agi_request: tt.agi <SIP/5000-00000011>AGI Tx >> agi_channel: SIP/5000-00000011 <SIP/5000-00000011>AGI Tx >> agi_language: es <SIP/5000-00000011>AGI Tx >> agi_type: SIP <SIP/5000-00000011>AGI Tx >> agi_uniqueid: 1386688026.17 <SIP/5000-00000011>AGI Tx >> agi_version: 11.6.0 <SIP/5000-00000011>AGI Tx >> agi_callerid: 5000 <SIP/5000-00000011>AGI Tx >> agi_calleridname: Max Reyes <SIP/5000-00000011>AGI Tx >> agi_callingpres: 0 <SIP/5000-00000011>AGI Tx >> agi_callingani2: 0 <SIP/5000-00000011>AGI Tx >> agi_callington: 0 <SIP/5000-00000011>AGI Tx >> agi_callingtns: 0 <SIP/5000-00000011>AGI Tx >> agi_dnid: 5678 <SIP/5000-00000011>AGI Tx >> agi_rdnis: unknown <SIP/5000-00000011>AGI Tx >> agi_context: phones <SIP/5000-00000011>AGI Tx >> agi_extension: 5678 <SIP/5000-00000011>AGI Tx >> agi_priority: 2 <SIP/5000-00000011>AGI Tx >> agi_enhanced: 0.0 <SIP/5000-00000011>AGI Tx >> agi_accountcode: DM <SIP/5000-00000011>AGI Tx >> agi_threadid: 1119290352 <SIP/5000-00000011>AGI Tx >> agi_arg_1: 5000 <SIP/5000-00000011>AGI Tx >> <SIP/5000-00000011>AGI Rx << SET VARIABLE mob "5000" <SIP/5000-00000011>AGI Tx >> 200 result=1 <SIP/5000-00000011>AGI Rx << VERBOSE "****5000*****" 1 tt.agi,5000: ****5000***** <SIP/5000-00000011>AGI Tx >> 200 result=1 -- <SIP/5000-00000011>AGI Script tt.agi completed, returning 0 -- Executing [5678@phones:3] NoOp("SIP/5000-00000011", "++++++mobile value is 5000") in new stack

Versions:
Asterisk:

FCRaspi*CLI> core show version Asterisk 11.6.0 built by root @ FCRaspi on a armv6l running Linux on 2013-12-08 17:48:47 UTC

PHP

# php -v PHP 5.4.17 (cli) (built: Jul 12 2013 16:18:12) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

hi,
i tried everything but its not working for me ,when i tried to update php it was not updating properly .pls let me know how to update php safely with out making any impact on my asterisk and webgui .i am using php 5.3 ,do u think it wont support agi do i need to update php?

thankyou

Hi, i am getting following errors for the same script above ,pls help me to solve it .Thank you

[code] == Using SIP RTP CoS mark 5 -- Executing [999@newagitest:1] NoOp("SIP/1000-00000003", "*** for agi testing ***") in new stack -- Executing [999@newagitest:2] AGI("SIP/1000-00000003", "tt.php,1000") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/tt.php [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe [2013-12-16 13:22:20] ERROR[3085][C-00000003]: utils.c:1321 ast_carefulwrite: write() returned error: Broken pipe -- <SIP/1000-00000003>AGI Script tt.php completed, returning 0 -- Executing [999@newagitest:3] NoOp("SIP/1000-00000003", "*****executed *****") in new stack -- Auto fallthrough, channel 'SIP/1000-00000003' status is 'UNKNOWN'[/code]

SOLVED…

I convert my php file after editing in windows machine to unix format had solved broken pipe error…

#dos2unix pin.php
#dos2unix: converting file pin.php to UNIX format …

my cli o/p

-- Launched AGI Script /var/lib/asterisk/agi-bin/tt.php <SIP/4000-0000001c>AGI Tx >> agi_request: tt.php <SIP/4000-0000001c>AGI Tx >> agi_channel: SIP/4000-0000001c <SIP/4000-0000001c>AGI Tx >> agi_language: en <SIP/4000-0000001c>AGI Tx >> agi_type: SIP <SIP/4000-0000001c>AGI Tx >> agi_uniqueid: 1387192225.28 <SIP/4000-0000001c>AGI Tx >> agi_version: 11.6.0 <SIP/4000-0000001c>AGI Tx >> agi_callerid: 4000 <SIP/4000-0000001c>AGI Tx >> agi_calleridname: 4000 <SIP/4000-0000001c>AGI Tx >> agi_callingpres: 0 <SIP/4000-0000001c>AGI Tx >> agi_callingani2: 0 <SIP/4000-0000001c>AGI Tx >> agi_callington: 0 <SIP/4000-0000001c>AGI Tx >> agi_callingtns: 0 <SIP/4000-0000001c>AGI Tx >> agi_dnid: 8907 <SIP/4000-0000001c>AGI Tx >> agi_rdnis: unknown <SIP/4000-0000001c>AGI Tx >> agi_context: eng-exist <SIP/4000-0000001c>AGI Tx >> agi_extension: 200 <SIP/4000-0000001c>AGI Tx >> agi_priority: 3 <SIP/4000-0000001c>AGI Tx >> agi_enhanced: 0.0 <SIP/4000-0000001c>AGI Tx >> agi_accountcode: <SIP/4000-0000001c>AGI Tx >> agi_threadid: -1255621776 <SIP/4000-0000001c>AGI Tx >> agi_arg_1: 4000 <SIP/4000-0000001c>AGI Tx >> <SIP/4000-0000001c>AGI Rx << SET VARIABLE mob "2000" <SIP/4000-0000001c>AGI Tx >> 200 result=1 <SIP/4000-0000001c>AGI Rx << VERBOSE "****2000*****" 1 tt.php,4000: ****2000***** <SIP/4000-0000001c>AGI Tx >> 200 result=1
Thanks …