Iam facing some problems here regarding AGI. we are running (freepbx 2.8) asterisk 11.6 and php [login to view URL] we have to check the caller id in dial plan with caller id stored in external CRM by using AGI. For testing purpose we made a rough scenario having script in agi-bin, and calling it from and back to dial plan
DIALPLAN:
exten => 5678,1,NoOp(*** agi testing***)
same => n,AGI([login to view URL],${CALLERID(num)})
same => n,NoOp(*** the result from script is ${result} *** )
PHPAGI SCRIPT:
#!/usr/bin/php -q
<?php
set_time_limit(30);
require('[login to view URL]');
error_reporting(E_ALL);
$agi = new AGI();
ob_implicit_flush(true);
$agi->answer();
$mob=$avgv[1];
$agi->set_variable('result',$mob);
CLI OUTPUT:
-- Launched AGI Script /var/lib/asterisk/agi-bin/[login to view URL]
<SIP/1000-00000012>AGI Tx >> agi_request: [login to view URL]
<SIP/1000-00000012>AGI Tx >> agi_channel: SIP/1000-00000012
<SIP/1000-00000012>AGI Tx >> agi_language: en
<SIP/1000-00000012>AGI Tx >> agi_type: SIP
<SIP/1000-00000012>AGI Tx >> agi_uniqueid: 1386330214.18
<SIP/1000-00000012>AGI Tx >> agi_version: 11.6.0
<SIP/1000-00000012>AGI Tx >> agi_callerid: 1000
<SIP/1000-00000012>AGI Tx >> agi_calleridname: 1000
<SIP/1000-00000012>AGI Tx >> agi_callingpres: 0
<SIP/1000-00000012>AGI Tx >> agi_callingani2: 0
<SIP/1000-00000012>AGI Tx >> agi_callington: 0
<SIP/1000-00000012>AGI Tx >> agi_callingtns: 0
<SIP/1000-00000012>AGI Tx >> agi_dnid: 5678
<SIP/1000-00000012>AGI Tx >> agi_rdnis: unknown
<SIP/1000-00000012>AGI Tx >> agi_context: newagitest
<SIP/1000-00000012>AGI Tx >> agi_extension: 5678
<SIP/1000-00000012>AGI Tx >> agi_priority: 3
<SIP/1000-00000012>AGI Tx >> agi_enhanced: 0.0
<SIP/1000-00000012>AGI Tx >> agi_accountcode:
<SIP/1000-00000012>AGI Tx >> agi_threadid: -1259586704
<SIP/1000-00000012>AGI Tx >> agi_arg_1: 1000
<SIP/1000-00000012>AGI Tx >>
-- <SIP/1000-00000012>AGI Script [login to view URL] completed, returning 0
-- Auto fallthrough, channel 'SIP/1000-00000012' status is 'UNKNOWN'
we are not getting variable (${result}) back to dialplan.
we need exact php script and Dialplan for getting the variable back to dialplan.
Hope you can help me out of this.