Status -> Active Calls now uses JSON

This commit is contained in:
Mark Crane 2014-08-16 01:06:09 +00:00
parent 224fc644af
commit b9ffc8855b
1 changed files with 7 additions and 6 deletions

View File

@ -41,9 +41,11 @@ else {
} }
//set the command //set the command
$switch_cmd = 'show channels'; $switch_cmd = 'show channels as json';
//create the event socket connection //create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//if the connnection is available then run it and return the results //if the connnection is available then run it and return the results
if (!$fp) { if (!$fp) {
$msg = "<div align='center'>".$text['confirm-socket']."<br /></div>"; $msg = "<div align='center'>".$text['confirm-socket']."<br /></div>";
@ -60,11 +62,10 @@ else {
} }
else { else {
//send the event socket command //send the event socket command
$csv = trim(event_socket_request($fp, 'api '.$switch_cmd)); $json = trim(event_socket_request($fp, 'api '.$switch_cmd));
//prepare the string //set the array
$result_array = explode("\n\n",$csv); $result_array = json_decode($json, "true");
//get the named array $result_array = $result_array["rows"];
$result_array = csv_to_named_array($result_array[0], ",");
//set the alternating color for each row //set the alternating color for each row
$c = 0; $c = 0;