Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Need some PHP/AMI guidance please


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
drdialtone at optonlin...
Guest





PostPosted: Fri Mar 28, 2014 1:49 pm    Post subject: [asterisk-users] Need some PHP/AMI guidance please Reply with quote

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...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services