[asterisk-users] Local channel usage

Steve Edwards asterisk.org at sedwards.com
Fri Jun 25 16:23:45 CDT 2010


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       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list