On Tue, 22 Jun 2010, Philipp von Klitzing wrote:

> Here's an example for "Voicemail live" that uses such a technique: 
> http://www.voip-info.org/wiki/view/Asterisk+tips+voicemail+live

A great example. If I ever get around to setting up a home Asterisk 
server, I'm sure this will help with the WAF.

It looks like you may have a couple of bugs in your AGIs:

        //read the standard agi variables
         while (!feof($in)) {
                $temp = str_replace("\n","",fgets($in,4096));
                $s = split(":",$temp);
                $agi[str_replace("agi_","",$s[0])] = trim($s[1]);
                if (($temp == "") || ($temp == "\n")) {
                        break;
                }
         }

The tests for $temp being empty should be before the split. If you execute 
the script from the command line, the PHP interpreter will complain about 
$s[1].

Also in your __read__() and __write__() functions:

        function __write__($line) {
           global $debug;
           if ($debug) echo "VERBOSE \"write: $line\"\n";
           print $line."\n";
        }

If $debug is set, you issue the agi VERBOSE request but you do not read 
the response. This violates the AGI protocol and leaves the response 
hanging in STDIN where it is subsequently read by the GET VARIABLE 
request.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwa...@sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to