AGI headers wont give CallerID completely


im using a PHP script found in , its suppose to get the Asterisk environment input thrown to AGI when its loaded, at first i had my sip.conf’s callerid to ‘testing’ <>, the script reads the name as ‘testing’ and [color=red]null[/color] for the number (since i didnt put any), the problem is when i place a callerid number the name doesnt show up, what is left is the callerid number, ive been googling for quite awhile but still no luck, anyone?

while (!feof($stdin))
$temp = fgets($stdin);
$temp = str_replace("\n","",$temp);
$s = explode(":",$temp);
$agivar[$s[0]] = trim($s[1]);

if (($temp == "") || ($temp == "\n")) 


finally found the solution, dang, took me this long before i realized it (was depending too much on the infos i found on that site), the headers was actually there all along…

what i did is log each $temp so i could see what Asterisk environment inputs are thrown to AGI, and there it was, a seperate agi header for the callerid name (agi_calleridname), so i took off the parsing for callerid and used both callerid name and number for comparison