0) { $command = trim($_GET["command"]); $uuid = trim($_GET["uuid"]); $extension = trim($_GET["extension"]); $caller_id_name = trim($_GET["extension"]); $caller_id_number = trim($_GET["extension"]); } //validate the extension if (!is_numeric($extension)) { $extension = null; } //validate the uuid if (!is_uuid($uuid)) { $uuid = null; } //validate the caller_id_name if (isset($caller_id_name) && strlen($caller_id_name)) { $caller_id_name = substr($caller_id_name, 0, 10); } //validate the caller_id_number if (!is_numeric($caller_id_number)) { $caller_id_number = null; } //validate the command switch ($command) { case "eavesdrop": $switch_command = "originate {origination_caller_id_name=eavesdrop,origination_caller_id_number=".$extension."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." &eavesdrop(".$uuid.")"; break; case "uuid_transfer": $switch_command = "uuid_transfer ".$uuid." -bleg ".$_SESSION['user']['extension'][0]['user']." XML ".$_SESSION['domain_name']; break; case "bridge": $switch_command = "originate {origination_caller_id_name=".$caller_id_name.",origination_caller_id_number=".$caller_id_number."}user/".$_SESSION['user']['extension'][0]['user']."@".$_SESSION['domain_name']." bridge(user/".$extension."@".$_SESSION['domain_name'].")"; break; default: echo "access denied"; exit; } //run the command if (isset($switch_command)) { $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $response = event_socket_request($fp, 'api '.$switch_command); } /* //set the username if (if_group("admin") || if_group("superadmin")) { //use the username that was provided } else { $username = $_SESSION['username']; } //get to php variables if (count($_GET) > 0) { if ($_GET['action'] == "user_status") { //validate the user status $user_status = $_GET['data']; switch ($user_status) { case "Available": case "Available (On Demand)": case "On Break": case "Do Not Disturb": case "Logged Out": break; default: $user_status = null; } $user_status = $data; $sql = "update v_users set "; $sql .= "user_status = :user_status "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and username = '".$username."' "; $parameters['user_status'] = trim($user_status, "'"); $database = new database; $database->execute($sql, $parameters); unset($sql, $parameters); } //fs cmd if (strlen($switch_cmd) > 0) { //setup the event socket connection $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); //ensure the connection exists if ($fp) { //send the command $switch_result = event_socket_request($fp, 'api '.$switch_cmd); //set the user state $cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting"; $response = event_socket_request($fp, $cmd); } } } */ ?>