Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; include "app_languages.php"; if (permission_exists('call_active_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support foreach($text as $key => $value) { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } //set the command $switch_cmd = 'show channels as json'; //create the event socket connection $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 (!$fp) { $msg = "
".$text['confirm-socket']."
"; echo "
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
".$text['label-message']."
$msg
\n"; echo "
\n"; } else { //send the event socket command $json = trim(event_socket_request($fp, 'api '.$switch_cmd)); //set the array $results = json_decode($json, "true"); //set the alternating color for each row $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; //show the results echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; //echo "\n"; //echo "\n"; //echo "\n"; echo "\n"; echo "\n"; //echo "\n"; //echo "\n"; echo "\n"; //echo "\n"; echo "\n"; echo "\n"; //echo "\n"; echo "\n"; echo "\n"; //echo "\n"; //echo "\n"; echo "\n"; //echo "\n"; //echo "\n"; //echo "\n"; echo "\n"; echo "\n"; echo "\n"; foreach ($results["rows"] as $row) { //set the php variables foreach ($row as $key => $value) { $$key = $value; } //get the sip profile $name_array = explode("/", $name); $sip_profile = $name_array[1]; $sip_uri = $name_array[2]; //get the number $temp_array = explode("@", $sip_uri); $tmp_number = $temp_array[0]; $tmp_number = str_replace("sip:", "", $tmp_number); //remove the '+' because it breaks the call recording $cid_num = str_replace("+", "", $cid_num); echo "\n"; //echo "\n"; //echo "\n"; //echo "\n"; echo "\n"; echo "\n"; //echo "\n"; //echo "\n"; echo "\n"; //echo "\n"; echo "\n"; echo "\n"; //echo "\n"; echo "\n"; if (strlen($application) > 0) { echo "\n"; } else { echo "\n"; } //echo "\n"; //echo "\n"; echo "\n"; //echo "\n"; //echo "\n"; //echo "\n"; echo "\n"; echo "\n"; echo "\n"; if ($c==0) { $c=1; } else { $c=0; } } echo "\n"; echo "\n"; echo "
IDUUIDDir".$text['label-profile']."".$text['label-created']."Created EpochName".$text['label-number']."State".$text['label-cid-name']."".$text['label-cid-number']."IP Addr".$text['label-destination']."".$text['label-app']."DialplanContext".$text['label-codec']."Read RateWrite CodecWrite Rate".$text['label-secure']."".$text['label-opt']."
$id  $uuid  $direction  $sip_profile  $created  $created_epoch  $name  ".$tmp_number." $state  $cid_name  $cid_num  $ip_addr  $dest  ".$application.":".$application_data."   $dialplan  $context  $read_codec:$read_rate / $write_codec:$write_rate  $read_rate  $write_codec  $write_rate  $secure  \n"; //transfer echo " ".$text['label-transfer']."';\" onclick=\"send_cmd('calls_exec.php?cmd='+get_transfer_cmd(escape('$uuid')));\">".$text['label-transfer']." \n"; //park echo " ".$text['label-park']." \n"; //hangup echo " ".$text['label-hangup']." \n"; //record start/stop $tmp_dir = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d"); mkdir($tmp_dir, 0777, true); $tmp_file = $tmp_dir."/".$uuid.".wav"; if (file_exists($tmp_file)) { //stop echo " ".$text['label-stop']." \n"; } else { //start echo " ".$text['label-start']." \n"; } echo "  "; echo "
\n"; } ?>