ситуация следующая есть два скрипта:
Код: Выделить всё
#!/usr/bin/php
<?php
date_default_timezone_set('Europe/Moscow');
$stdin = fopen('php://stdin', 'r');
$stdout = fopen('php://stdout', 'w');
while (!feof($stdin)) {
$temp = fgets($stdin);
$temp = str_replace("\n","",$temp);
$s = explode(":",$temp);
$agivar[$s[0]] = trim($s[1]);
if (($temp == "") || ($temp == "\n")) {
break;
}
}
$debug=2;
if ($debug){
$logfile = fopen('/php-agi/call_stat.log', 'a');
}
if ($debug){
logg(sprintf("\n[%s]\nCaller: %s\n",date("d.m.Y H:i:s",time()),$agivar['agi_callerid']));
logg("AGI ARGV Dump:\n");
foreach ($argv as $k=>$v) {
logg(" -- $k = $v\n");
}
if ($debug>1){
logg("AGI Environment Dump:\n");
foreach ($agivar as $k=>$v) {
logg(" -- $k = $v\n");
}
}
fclose($logfile);
}
function logg($res){
global $logfile;
if (is_resource($logfile)){
fputs($logfile, $res);
}
}
?>
Код: Выделить всё
#!/usr/bin/php
<?php
date_default_timezone_set('Europe/Moscow');
$TEMP = 9999990;
if(!class_exists('AGI'))
{
require_once('/var/lib/asterisk/agi-bin/phpagi.php');
}
$agi = new AGI();
$agi->set_variable(OUT,${TEMP});
?>
Код: Выделить всё
exten => s,n,AGI(/php-agi/sc1.php,${AMPUSER},${OUTNUM},${OUT_${DIAL_TRUNK}},${CHANNEL})
exten => s,n,AGI(/php-agi/sc2.php)
Код: Выделить всё
<SIP/107-000001d0>AGI Tx >> agi_request: /php-agi/chek-bablo.php
<SIP/107-000001d0>AGI Tx >> agi_channel: SIP/107-000001d0
<SIP/107-000001d0>AGI Tx >> agi_language: ru2
<SIP/107-000001d0>AGI Tx >> agi_type: SIP
<SIP/107-000001d0>AGI Tx >> agi_uniqueid: 1359303726.474
<SIP/107-000001d0>AGI Tx >> agi_version: 1.8.13.0
<SIP/107-000001d0>AGI Tx >> agi_callerid: 7916862
<SIP/107-000001d0>AGI Tx >> agi_calleridname: unknown
<SIP/107-000001d0>AGI Tx >> agi_callingpres: 0
<SIP/107-000001d0>AGI Tx >> agi_callingani2: 0
<SIP/107-000001d0>AGI Tx >> agi_callington: 0
<SIP/107-000001d0>AGI Tx >> agi_callingtns: 0
<SIP/107-000001d0>AGI Tx >> agi_dnid: 9100
<SIP/107-000001d0>AGI Tx >> agi_rdnis: unknown
<SIP/107-000001d0>AGI Tx >> agi_context: macro-dialout-trunk
<SIP/107-000001d0>AGI Tx >> agi_extension: s
<SIP/107-000001d0>AGI Tx >> agi_priority: 24
<SIP/107-000001d0>AGI Tx >> agi_enhanced: 0.0
<SIP/107-000001d0>AGI Tx >> agi_accountcode:
<SIP/107-000001d0>AGI Tx >> agi_threadid: 18979728
<SIP/107-000001d0>AGI Tx >> agi_arg_1: 107
<SIP/107-000001d0>AGI Tx >> agi_arg_2: 100
<SIP/107-000001d0>AGI Tx >> agi_arg_3: SIP/862
<SIP/107-000001d0>AGI Tx >> agi_arg_4: SIP/107-000001d0
<SIP/107-000001d0>AGI Tx >>
<SIP/107-000001d0>AGI Rx <<
<SIP/107-000001d0>AGI Tx >> 510 Invalid or unknown command
<SIP/107-000001d0>AGI Rx << Notice: Undefined offset: 2 in /php-agi/sc1.php on line 31
<SIP/107-000001d0>AGI Tx >> 510 Invalid or unknown command
<SIP/107-000001d0>AGI Rx <<
<SIP/107-000001d0>AGI Tx >> 510 Invalid or unknown command
<SIP/107-000001d0>AGI Rx << Notice: Undefined offset: 3 in /php-agi/sc1.php on line 32
<SIP/107-000001d0>AGI Tx >> 510 Invalid or unknown command
[2013-01-27 20:22:10] ERROR[26002]: utils.c:1164 ast_carefulwrite: write() returned error: Broken pipe
-- <SIP/107-000001d0>AGI Script /php-agi/sc1.php completed, returning 4
соответственно
Код: Выделить всё
31.$agi = new AGI();
32.$agi->set_variable(OUT,0);
http://phpagi.sourceforge.net/- тут был
зарание спасибо