Not setting variable and getting back in dialplan

hello everyone,
how to set and get variable using php agi script.I’m using asterisk 11.I’m getting the agi debug execution output as

– Launched AGI Script /var/lib/asterisk/agi-bin/agi2.php
<SIP/1000-00000029>AGI Tx >> agi_request: agi2.php
<SIP/1000-00000029>AGI Tx >> agi_channel: SIP/1000-00000029
<SIP/1000-00000029>AGI Tx >> agi_language: en
<SIP/1000-00000029>AGI Tx >> agi_type: SIP
<SIP/1000-00000029>AGI Tx >> agi_uniqueid: 1386313677.41
<SIP/1000-00000029>AGI Tx >> agi_version: 11.6.0
<SIP/1000-00000029>AGI Tx >> agi_callerid: 1000
<SIP/1000-00000029>AGI Tx >> agi_calleridname: 1000
<SIP/1000-00000029>AGI Tx >> agi_callingpres: 0
<SIP/1000-00000029>AGI Tx >> agi_callingani2: 0
<SIP/1000-00000029>AGI Tx >> agi_callington: 0
<SIP/1000-00000029>AGI Tx >> agi_callingtns: 0
<SIP/1000-00000029>AGI Tx >> agi_dnid: 5678
<SIP/1000-00000029>AGI Tx >> agi_rdnis: unknown
<SIP/1000-00000029>AGI Tx >> agi_context: newagitest
<SIP/1000-00000029>AGI Tx >> agi_extension: 5678
<SIP/1000-00000029>AGI Tx >> agi_priority: 2
<SIP/1000-00000029>AGI Tx >> agi_enhanced: 0.0
<SIP/1000-00000029>AGI Tx >> agi_accountcode:
<SIP/1000-00000029>AGI Tx >> agi_threadid: -1255556240
<SIP/1000-00000029>AGI Tx >> agi_arg_1: 1000
<SIP/1000-00000029>AGI Tx >>
– <SIP/1000-00000029>AGI Script agi2.php completed, returning 0

permissions,script location,user…everything is fine…finally landed in that, variable is not setting in script and not getting tht variable back to dialplan.

can any body help me please… :confused:
thanks in advance,god bless

The script isn’t sending anything to Asterisk. You haven’t provided any information that would allow us to work out why that is.

thanks for the reply

my dial plan…

[agitest]

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

my phpagi script …

#!/usr/bin/php -q

<?php set_time_limit(30); require('/var/lib/asterisk/agi-bin/phpagi.php'); $agi = new AGI(); $agi->answer(); $result = $agi->get_variable($agi_callerid); agi->noop(****${result}********); $mob=$agi->set_variable('result', $result); ?>

output of cli with agi debug on is like this…

-- Executing [4567@agitest:1] NoOp("SIP/4000-0000000a", "*** for agi testing                                              ***") in new stack
-- Executing [4567@agitest:2] AGI("SIP/4000-0000000a", "ccc.php,4000") in ne                                             w stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/ccc.php

<SIP/4000-0000000a>AGI Tx >> agi_request: ccc.php
<SIP/4000-0000000a>AGI Tx >> agi_channel: SIP/4000-0000000a
<SIP/4000-0000000a>AGI Tx >> agi_language: en
<SIP/4000-0000000a>AGI Tx >> agi_type: SIP
<SIP/4000-0000000a>AGI Tx >> agi_uniqueid: 1386323532.10
<SIP/4000-0000000a>AGI Tx >> agi_version: 11.6.0
<SIP/4000-0000000a>AGI Tx >> agi_callerid: 4000
<SIP/4000-0000000a>AGI Tx >> agi_calleridname: antony
<SIP/4000-0000000a>AGI Tx >> agi_callingpres: 0
<SIP/4000-0000000a>AGI Tx >> agi_callingani2: 0
<SIP/4000-0000000a>AGI Tx >> agi_callington: 0
<SIP/4000-0000000a>AGI Tx >> agi_callingtns: 0
<SIP/4000-0000000a>AGI Tx >> agi_dnid: 4567
<SIP/4000-0000000a>AGI Tx >> agi_rdnis: unknown
<SIP/4000-0000000a>AGI Tx >> agi_context: agitest
<SIP/4000-0000000a>AGI Tx >> agi_extension: 4567
<SIP/4000-0000000a>AGI Tx >> agi_priority: 2
<SIP/4000-0000000a>AGI Tx >> agi_enhanced: 0.0
<SIP/4000-0000000a>AGI Tx >> agi_accountcode:
<SIP/4000-0000000a>AGI Tx >> agi_threadid: -1255933072
<SIP/4000-0000000a>AGI Tx >> agi_arg_1: 4000
<SIP/4000-0000000a>AGI Tx >>
– <SIP/4000-0000000a>AGI Script ccc.php completed, returning 0
– Executing [4567@agitest:3] NoOp(“SIP/4000-0000000a”, "*** result from db is **") in new stack
– Auto fallthrough, channel ‘SIP/4000-0000000a’ status is 'UNKNOWN’
localhost
CLI>

please help me to find a way out of this…
thanks in advance :unamused:

Bad usage of get_variable.

SOLVED…

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

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

thanks buddy