connect("localhost","phpagi","phpagi"); # Check current list $res = $as->command('show parkedcalls'); $line = split("\n", $res['data']); $index=0; $count=0; foreach ($line as $myline) { if((!strstr($myline,"Privilege")) && (!strstr($myline,"Extension")) && (!strstr($myline,"parked")) && ($myline!="")) { $linevalue= preg_split("/ /", $myline,-1,PREG_SPLIT_NO_EMPTY); if($linevalue[0]!="") { $park[$count][0]=$linevalue[0]; $res_i = $as->Command('show channel '.$linevalue[1]); $line_i= @split("\n", $res_i['data']); foreach ($line_i as $myline_i) { if (strstr($myline_i,"Caller ID Name")) $park[$count][1]=substr(substr(strrchr($myline_i,":"),1),1); else if (strstr($myline_i,"Caller ID")) $park[$count][1]=substr(substr(strrchr($myline_i,":"),1),1); } $count++; } } $index++; } # Disconnect properly $as->disconnect(); header("Content-type: text/xml"); header("Connection: close"); header("Expires: -1"); echo " Parked Calls"; # Update display if($count==0) { echo "No Parked Calls"; } else { for ($index=0;$index<$count;$index++) echo "{$park[$index][0]} {$park[$index][1]}"; } echo " Extention List "; exit; ?>