Hello all,
I've got some PHP code that opens an AMI socket and does a ConfBridgeList
for a specific bridge (8888).
This all works just fine but I need to filter the information displayed to
only CallerIDName so I can see a complete list of names of participants.
After days of googling and playing with it, I'm no closer than I was when I
started.
I'm not at all married to a table. A simple list of names is fine...
Any help is much appreciated!
Pertinent code:
<?php
$ami = fsockopen("127.0.0.1", 5038, $errno, $errstr);
if (!$ami) {
echo "ERROR: $errno - $errstr<br />\n";
} else {
fwrite($ami, "Action: Login\r\nUsername: someuser\r\nSecret:
somesecret\r\nEvents: off\r\n\r\n");
fwrite($ami, "Action: ConfbridgeList\r\nConference: 8888\r\n\r\n");
sleep(1);
$record = fread($ami,1024);
$record = explode("\r\n", $record);
echo "<META HTTP-EQUIV=Refresh CONTENT=\"20\">";
echo "<table border=\"1\" style='color: black;'>";
foreach($record as $value){
if(!strlen(stristr($value,'Asterisk'))>0
&& !strlen(stristr($value,'Response'))>0
&& !strlen(stristr($value,'Message'))>0
&& !strlen(stristr($value,'Event'))>0
&& strlen(strpos($value,' '))>0)
php_table($value);;
}
echo "</table>";
fclose($ami);
}
function php_table($value){
$row1 = true;
$value = explode(" ", $value);
foreach($value as $field){
if($row1){
echo "<tr><td>".$field."</td>";
$row1 = false;
}
else{
echo "<td>".$field."</td></tr>";
$row1 = true;
}
}
}
?>
I think the "explode" is where I should be looking but I'm very new to PHP
Thank you!
Pat...
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users