hi,
I am really having a hard time for AGI I have been trying to run the basic agi script but have no success so far. I am wonder what to do now?
here a file I am calling
[color=green]#!/usr/bin/php -q
<?php ob_implicit_flush(false); set_time_limit(6); $stdin = fopen('php://stdin', 'r'); $stdlog = fopen('my_agi.log', 'w'); $debug = false; /* Read input from Asterisk and output via $astOutput */ function astRead() { global $stdin, $debug, $stdlog; $astOutput = str_replace("\n", "", fgets($stdin, 4096)); if ($debug) fputs($stdlog, "read: $input\n"); return $astOutput ; } /* Write AGI command to Asterisk */ function astWrite($agiCommand) { global $debug, $stdlog; if ($debug) fputs($stdlog, "write: $agiCommand\n"); echo $agiCommand."\n"; } /* Handling execution input from Asterisk */ $agivar = array(); while (!feof($stdin)) { $temp = fgets($stdin); echo "\n"; print_r($temp); $temp = str_replace("\n","",$temp); $s = explode(":",$temp); $agivar[$s[0]] = trim($s[1]); if ($temp == "") { break; } } /* Playback the demo-congrats.gsm file from the directory /var/lib/asterisk/sounds/ */ astWrite("STREAM FILE demo-congrats #"); astRead(); /* Say the number 123456 */ astWrite("SAY NUMBER 123456 #"); astRead(); /* Finalization of AGI script and clean-ups */ fclose ($stdin); fclose ($stdlog); exit(0); ?>[/color][color=red]extensions.conf
exten => s,1,Answer()
exten => s,n,Wait(0.5)
exten => s,n,AGI(hello_world.php)
exten => s,n,Playback(vm-goodbye)[/color]
[color=brown]-- Executing [s@from-zaptel:2] Wait(“Zap/1-1”, “0.5”) in new stack
– Executing [s@from-zaptel:3] AGI(“Zap/1-1”, “hello_world.php”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/hello_world.php
AGI Tx >> agi_request: hello_world.php
AGI Tx >> agi_channel: Zap/1-1
AGI Tx >> agi_language: en
AGI Tx >> agi_type: Zap
AGI Tx >> agi_uniqueid: 1245325539.6
AGI Tx >> agi_callerid: 2279968
AGI Tx >> agi_calleridname: unknown
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: unknown
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: from-zaptel
AGI Tx >> agi_extension: s
AGI Tx >> agi_priority: 3
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << Usage: php [options] [-f] [–] [args…]
AGI Tx >> 510 Invalid or unknown command
AGI Rx << php [options] -r [–] [args…]
AGI Tx >> 510 Invalid or unknown command
AGI Rx << php [options] [-B <begin_code>] -R [-E <end_code>] [–] [args…]
AGI Tx >> 510 Invalid or unknown command
AGI Tx >> 510 Invalid or unknown command
AGI Script hello_world.php completed, returning 0[/color]
Please help me in this regard
I will highly appreciate