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
//environment dump
ob_implicit_flush(true);
set_time_limit(0);
set_time_limit(0);
$err=fopen("php://stderr","w");
$in = fopen("php://stdin","r");
while (!feof($in)) {
$temp = str_replace("\n","",fgets($in,4096));
$in = fopen("php://stdin","r");
while (!feof($in)) {
$temp = str_replace("\n","",fgets($in,4096));
echo "VERBOSE \"$temp\"\n";
if (($temp == "") || ($temp == "\n"))
{
break;
}
}
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:
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