Your script is receiving the data correctly, as you will see if you actually dump that data to a file rather than back to the asterisk console.

The problem is actually in your VERBOSE statement. You are passing back this string:

VERBOSE ""Sathya Weerasooriya" <1001>"

Naturally asterisk is confused by this quote nesting. Try this line instead:

echo "VERBOSE \"".str_replace("\"", "\\\"", $temp)."\"\n";

David

Sathya wrote:

Hi folks,
I need some help from php/agi experts out there;
I am having difficulties in extracting the callerid number from php. My script is given below;
#!/usr/local/bin/php -q
<?php
//environment dump
ob_implicit_flush(true);
set_time_limit(0);
$err=fopen("php://stderr","w");
$in = fopen("php://stdin","r");
while (!feof($in)) {
$temp = str_replace("\n","",fgets($in,4096));
echo "VERBOSE \"$temp\"\n";
if (($temp == "") || ($temp == "\n")) {
break;
}
}
?>
And the Response is:
getenv.agi: agi_request: getenv.agi
getenv.agi: agi_channel: SIP/-081524c0
getenv.agi: agi_language: en
getenv.agi: agi_type: SIP
getenv.agi: agi_uniqueid: 1079819757.97
getenv.agi: agi_callerid: Sathya <=====================
getenv.agi: agi_dnid: unknown
getenv.agi: agi_rdnis: unknown
getenv.agi: agi_context: default-in
getenv.agi: agi_extension: 91234
getenv.agi: agi_priority: 1
getenv.agi: agi_enhanced: 0.0
getenv.agi: agi_accountcode:
Actual caller ID is ; "Sathya Weerasooriya"<1001>, but what I get from this PHP is only first part.
When I run the example test script in agi-bin directory, I get the correct callerid.
I am using PHP 4.3.5CR xx.
Any help is appreciated.
Sathya
_______________________________________________
Asterisk-Users mailing list
[EMAIL PROTECTED]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to