[asterisk-users] asterisk 1.6 agi problem with PHP

Zarko Zivanovic outlaw011 at gmail.com
Sat Jul 16 09:19:39 CDT 2011


Hello everyone,

I am sure that someone can help with this. We decided to do a fresh install
of asterisk 1.6.2.19

And after we did that, the problem that we have is this - We cant run a
single Php file!

 

Here's the output:

 

    -- Executing [8212 at from-pstn:1] Answer("DAHDI/23-1", "") in new stack

    -- Executing [8212 at from-pstn:2] AGI("DAHDI/23-1", "testera.agi") in new
stack

    -- Launched AGI Script /var/lib/asterisk/agi-bin/testera.agi

<DAHDI/23-1>AGI Tx >> agi_request: testera.agi

<DAHDI/23-1>AGI Tx >> agi_channel: DAHDI/23-1

<DAHDI/23-1>AGI Tx >> agi_language: en

<DAHDI/23-1>AGI Tx >> agi_type: DAHDI

<DAHDI/23-1>AGI Tx >> agi_uniqueid: 1310825293.10

<DAHDI/23-1>AGI Tx >> agi_version: 1.6.2.19

<DAHDI/23-1>AGI Tx >> agi_callerid: 112686649

<DAHDI/23-1>AGI Tx >> agi_calleridname: unknown

<DAHDI/23-1>AGI Tx >> agi_callingpres: 3

<DAHDI/23-1>AGI Tx >> agi_callingani2: 0

<DAHDI/23-1>AGI Tx >> agi_callington: 33

<DAHDI/23-1>AGI Tx >> agi_callingtns: 0

<DAHDI/23-1>AGI Tx >> agi_dnid: 8212

<DAHDI/23-1>AGI Tx >> agi_rdnis: unknown

<DAHDI/23-1>AGI Tx >> agi_context: from-pstn

<DAHDI/23-1>AGI Tx >> agi_extension: 8212

<DAHDI/23-1>AGI Tx >> agi_priority: 2

<DAHDI/23-1>AGI Tx >> agi_enhanced: 0.0

<DAHDI/23-1>AGI Tx >> agi_accountcode:

<DAHDI/23-1>AGI Tx >> agi_threadid: -1223132272

<DAHDI/23-1>AGI Tx >>

<DAHDI/23-1>AGI Rx << verbose "Failed to execute
'/var/lib/asterisk/agi-bin/testera.agi': No such file or directory" 1

testera.agi: Failed to execute '/var/lib/asterisk/agi-bin/testera.agi': No
such file or directory

<DAHDI/23-1>AGI Tx >> 200 result=1

 

 

VERIFIED EVERYTHING:

 

[root at localhost agi-bin]# ls -l

total 48

-rwxr-xr-x 1 asterisk asterisk  1742 Jul  1 18:57 agi-test.agi

-rwxr-xr-x 1 asterisk asterisk  9909 Jul  1 18:57 eagi-sphinx-test

-rwxr-xr-x 1 asterisk asterisk  8724 Jul  1 18:57 eagi-test

-rwxr-xr-x 1 asterisk asterisk 14530 Jul  1 18:57 jukebox.agi

-rwxr-xr-x 1 asterisk asterisk  1508 Jul 16 16:04 testera.agi

 

[root at localhost agi-bin]# which php

/usr/bin/php

 

 

 

 

 

 

 

Here's the agi - simple  test that we picked from the net.:

 

#!/usr/bin/php

<?

  ob_implicit_flush(false);

  set_time_limit(6);

  $stdin = fopen('php://stdin', 'r');

  $stdlog = fopen('my_agi.log', 'w');

   $debug = true;

   /* 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);

            $temp = str_replace("\n","",$temp);

            $s = explode(":",$temp);

            $agivar[$s[0]] = trim($s[1]);

            if ($temp == "")

       {

         break;

            }

   }

          /* Operational Code starts here */

          /* Playback the demo-congrats.gsm file from the

 

    * directory /var/lib/asterisk/sounds/

    */

          astWrite("STREAM FILE /var/lib/asterisk/sounds/en/tt-monkeys #");

          astRead();

          /* Say the number 123456

          astWrite("SAY NUMBER 123456 #");

          astRead();*/

          /* Finalization of AGI script and clean-ups */

          fclose ($stdin);

          fclose ($stdlog);

          exit(0);

?>

 

 

All help is appreciated.

 

Thanks,

Z. Zivanovic

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110716/5b30b5ef/attachment.htm>


More information about the asterisk-users mailing list