0) { $switch_cmd = trim($_GET["cmd"]); $action = trim(check_str($_GET["action"])); $data = trim(check_str($_GET["data"])); $username = trim(check_str($_GET["username"])); } //authorized commands if (stristr($switch_cmd, 'user_status') == true) { //authorized; } elseif (stristr($switch_cmd, 'callcenter_config') == true) { //authorized; } elseif (stristr($switch_cmd, 'eavesdrop') == true) { //authorized; } elseif (stristr($switch_cmd, 'bridge') == true) { //authorized; } elseif (stristr($switch_cmd, 'uuid_transfer') == true) { //authorized; } else { //not found. this command is not authorized echo "access denied"; exit; } //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 ($action == "user_status") { $user_status = $data; $sql = "update v_users set "; $sql .= "user_status = '".trim($user_status, "'")."' "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and username = '".$username."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); } //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); } } } ?>