<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2716.2200" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=688473722-20032004>Hi
folks,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=688473722-20032004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=688473722-20032004>I need some help
from php/agi experts out there;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=688473722-20032004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=688473722-20032004>I am having
difficulties in extracting the callerid number from php. My script is given
below;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#!/usr/local/bin/php -<SPAN
class=688473722-20032004>q</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=688473722-20032004></SPAN><?php<BR>//environment dump</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2>ob_implicit_flush(true);<BR>set_time_limit(0);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>$err=fopen("php://stderr","w");<BR>$in =
fopen("php://stdin","r");<BR>while (!feof($in)) {<BR>$temp =
str_replace("\n","",fgets($in,4096));<BR></FONT><FONT face=Arial
size=2></FONT></DIV>
<DIV><FONT face=Arial size=2>echo "VERBOSE \"$temp\"\n";</FONT></DIV>
<DIV><FONT face=Arial size=2>if (($temp == "") || ($temp == "\n"))
{<BR>break;<BR>}<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2>?></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial size=2>And the Response
is:</FONT></SPAN></DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial size=2>getenv.agi:
agi_request: getenv.agi<BR>getenv.agi: agi_channel: SIP/-081524c0<BR>getenv.agi:
agi_language: en<BR>getenv.agi: agi_type: SIP<BR>getenv.agi: agi_uniqueid:
1079819757.97<BR>getenv.agi: agi_callerid: Sathya
<=====================<BR>getenv.agi: agi_dnid: unknown<BR>getenv.agi:
agi_rdnis: unknown<BR>getenv.agi: agi_context: default-in<BR>getenv.agi:
agi_extension: 91234<BR>getenv.agi: agi_priority: 1<BR>getenv.agi: agi_enhanced:
0.0<BR>getenv.agi: agi_accountcode:</FONT></SPAN></DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial size=2>Actual caller ID is
; "Sathya Weerasooriya"<1001>, but what I get from this PHP is only first
part.</FONT></SPAN></DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial size=2>When I run the
example test script in agi-bin directory, I get the correct
callerid.</FONT></SPAN></DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial size=2>I am using PHP
4.3.5CR xx.</FONT></SPAN></DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial size=2>Any help is
appreciated.</FONT></SPAN></DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=688473722-20032004><FONT face=Arial
size=2>Sathya</FONT></SPAN></DIV></BODY></HTML>