Event socket bug fix and more docs (#6823)
* Add documentation to methods. Use is_resource for added type detection * Allow connect to specify timeout in microseconds with default 30,000 * Update calling mechanism for event sockets * Update project for new singleton event sockets * remove unused variable * catch errors on closing the socket
This commit is contained in:
parent
44567f7a05
commit
3a4c2f72e2
|
|
@ -118,10 +118,7 @@
|
|||
$cache->delete("configuration:acl.conf");
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
event_socket_request($fp, "api reloadacl");
|
||||
}
|
||||
event_socket::api("reloadacl");
|
||||
|
||||
//redirect the user
|
||||
header('Location: access_control_edit.php?id='.$id);
|
||||
|
|
@ -204,10 +201,7 @@
|
|||
$cache->delete("configuration:acl.conf");
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
event_socket_request($fp, "api reloadacl");
|
||||
}
|
||||
event_socket::async("reloadacl");
|
||||
|
||||
//redirect the user
|
||||
if (isset($action)) {
|
||||
|
|
|
|||
|
|
@ -40,18 +40,11 @@
|
|||
//set the variables
|
||||
$search = $_REQUEST['search'] ?? '';
|
||||
|
||||
//create event socket connection
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
//run the command
|
||||
$result = rtrim(event_socket_request($fp, 'api reloadacl'));
|
||||
//run the command
|
||||
$result = rtrim(event_socket::api('reloadacl'));
|
||||
|
||||
//add message
|
||||
message::add($result, 'alert');
|
||||
|
||||
//close the connection
|
||||
fclose($fp);
|
||||
}
|
||||
//add message
|
||||
message::add($result, 'alert');
|
||||
|
||||
//redirect
|
||||
$search = preg_replace('#[^a-zA-Z0-9_\-\.]# ', '', $search);
|
||||
|
|
|
|||
|
|
@ -157,12 +157,10 @@
|
|||
$cache->delete("configuration:sofia.conf:".gethostname());
|
||||
|
||||
//create the event socket connection
|
||||
if (!$fp) {
|
||||
$fp = event_socket_create();
|
||||
}
|
||||
$esl = event_socket::create();
|
||||
|
||||
//reload the acl
|
||||
event_socket_request($fp, "api reloadacl");
|
||||
event_socket::async("reloadacl");
|
||||
|
||||
//rescan each sip profile
|
||||
$sql = "select sip_profile_name from v_sip_profiles ";
|
||||
|
|
@ -171,10 +169,10 @@
|
|||
$sip_profiles = $database->select($sql, null, 'all');
|
||||
if (is_array($sip_profiles)) {
|
||||
foreach ($sip_profiles as $row) {
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
$command = "sofia profile '".$row['sip_profile_name']."' rescan";
|
||||
//echo $command."\n";
|
||||
$result = event_socket_request($fp, "api ".$command);
|
||||
$result = event_socket::api($command);
|
||||
//echo $result."\n";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,10 +87,7 @@ if (!class_exists('access_controls')) {
|
|||
$cache->delete("configuration:acl.conf");
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
event_socket_request($fp, "api reloadacl");
|
||||
}
|
||||
event_socket::async("reloadacl");
|
||||
|
||||
//set message
|
||||
message::add($text['message-delete']);
|
||||
|
|
@ -146,10 +143,7 @@ if (!class_exists('access_controls')) {
|
|||
$cache->delete("configuration:acl.conf");
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
event_socket_request($fp, "api reloadacl");
|
||||
}
|
||||
event_socket::async("reloadacl");
|
||||
|
||||
//set message
|
||||
message::add($text['message-delete']);
|
||||
|
|
@ -261,10 +255,7 @@ if (!class_exists('access_controls')) {
|
|||
$cache->delete("configuration:acl.conf");
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
event_socket_request($fp, "api reloadacl");
|
||||
}
|
||||
event_socket::async("reloadacl");
|
||||
|
||||
//set message
|
||||
message::add($text['message-copy']);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ if (count($_GET) > 0) {
|
|||
$direction = trim($_GET["direction"] ?? '');
|
||||
|
||||
//setup the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//allow specific commands
|
||||
if (!empty($switch_cmd)) {
|
||||
|
|
@ -99,7 +99,7 @@ if (count($_GET) > 0) {
|
|||
}
|
||||
|
||||
//run the command
|
||||
$switch_result = event_socket_request($fp, 'api '.$api_cmd);
|
||||
$switch_result = event_socket::api($api_cmd);
|
||||
|
||||
/*
|
||||
//record stop
|
||||
|
|
|
|||
|
|
@ -97,15 +97,15 @@
|
|||
|
||||
//update the user_status
|
||||
if (is_uuid($call_center_agent_uuid)) {
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
$switch_cmd .= "callcenter_config agent set status ".$call_center_agent_uuid." '".$user_status."'";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
|
||||
//update the user state
|
||||
if (is_uuid($call_center_agent_uuid)) {
|
||||
$cmd = "api callcenter_config agent set state ".$call_center_agent_uuid." Waiting";
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
|
||||
//update do not disturb
|
||||
|
|
|
|||
|
|
@ -86,10 +86,12 @@ if (!class_exists('basic_operator_panel')) {
|
|||
}
|
||||
|
||||
//send the command
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$switch_result = event_socket_request($fp, 'api show channels as json');
|
||||
$switch_result = event_socket::api('show channels as json');
|
||||
if ($switch_result !== false) {
|
||||
$fp = true;
|
||||
$json_array = json_decode($switch_result, true);
|
||||
} else {
|
||||
$fp = false;
|
||||
}
|
||||
|
||||
//build the response
|
||||
|
|
@ -205,8 +207,10 @@ if (!class_exists('basic_operator_panel')) {
|
|||
if ($fp) {
|
||||
if (is_uuid($field['uuid'])) {
|
||||
$switch_cmd = 'uuid_dump '.$field['uuid'].' json';
|
||||
$dump_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$dump_array = json_decode($dump_result, true);
|
||||
$dump_result = event_socket::api($switch_cmd);
|
||||
if ($dump_result !== false) {
|
||||
$dump_array = json_decode($dump_result, true);
|
||||
}
|
||||
if (is_array($dump_array)) {
|
||||
foreach ($dump_array as $dump_var_name => $dump_var_value) {
|
||||
$array[$x][$dump_var_name] = $dump_var_value;
|
||||
|
|
|
|||
|
|
@ -64,9 +64,8 @@ if (!empty($groups)) {
|
|||
}
|
||||
|
||||
//get the valet info
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$valet_info = event_socket_request($fp, 'api valet_info park@'.$_SESSION['domain_name']);
|
||||
$valet_info = event_socket::api('valet_info park@'.$_SESSION['domain_name']);
|
||||
if ($valet_info !== false) {
|
||||
|
||||
//get an array of the valet call uuid and park numbers
|
||||
if (isset($valet_info)) {
|
||||
|
|
@ -78,10 +77,10 @@ if ($fp) {
|
|||
//unset($_SESSION['valet']);
|
||||
foreach($valet_matches as $row) {
|
||||
if (!isset($_SESSION['valet']['uuid']['caller_id_name'])) {
|
||||
$_SESSION['valet'][$row[1]]['caller_id_name'] = event_socket_request($fp, 'api uuid_getvar '.$row[1].' caller_id_name');
|
||||
$_SESSION['valet'][$row[1]]['caller_id_name'] = event_socket::api('uuid_getvar '.$row[1].' caller_id_name');
|
||||
}
|
||||
if (!isset($_SESSION['valet']['uuid']['caller_id_number'])) {
|
||||
$_SESSION['valet'][$row[1]]['caller_id_number'] = event_socket_request($fp, 'api uuid_getvar '.$row[1].' caller_id_number');
|
||||
$_SESSION['valet'][$row[1]]['caller_id_number'] = event_socket::api('uuid_getvar '.$row[1].' caller_id_number');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@
|
|||
$broadcast_name = str_replace("'", "", $broadcast_name);
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$fp = event_socket::create();
|
||||
|
||||
//get information over event socket
|
||||
if (!$fp) {
|
||||
|
|
@ -196,11 +196,11 @@
|
|||
|
||||
//if the event socket connection is lost then re-connect
|
||||
if (!$fp) {
|
||||
$fp = event_socket_create();
|
||||
$fp = event_socket::create();
|
||||
}
|
||||
|
||||
//method 1
|
||||
$response = trim(event_socket_request($fp, 'api '.$cmd));
|
||||
$response = trim(event_socket::command($cmd));
|
||||
|
||||
//method 2
|
||||
//cmd_async($_SESSION['switch']['bin']['dir']."/fs_cli -x \"".$cmd."\";");
|
||||
|
|
@ -216,8 +216,7 @@
|
|||
$count++;
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
|
||||
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='50%'>\n";
|
||||
echo "<tr>\n";
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ else {
|
|||
if (is_uuid($uuid)) {
|
||||
//show the result
|
||||
if (count($_GET) > 0) {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$fp = event_socket::create();
|
||||
if ($fp !== false) {
|
||||
$cmd = "sched_del ".$uuid;
|
||||
$result = event_socket_request($fp, 'api '.$cmd);
|
||||
$result = event_socket::api($cmd);
|
||||
message::add(htmlentities($result));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,10 +90,10 @@
|
|||
}
|
||||
|
||||
//create an event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//get the call center queue, agent and tiers list
|
||||
if (!$fp) {
|
||||
if (!$esl->is_connected()) {
|
||||
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='40%'>\n";
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
//send the event socket command and get the response
|
||||
//callcenter_config queue list tiers [queue_name] |
|
||||
$switch_command = 'callcenter_config queue list tiers '.$queue_extension."@".$_SESSION["domain_name"];
|
||||
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_command));
|
||||
$event_socket_str = trim(event_socket::api($switch_command));
|
||||
$result = str_to_named_array($event_socket_str, '|');
|
||||
|
||||
//prepare the result for array_multisort
|
||||
|
|
@ -139,7 +139,7 @@
|
|||
//send the event socket command and get the response
|
||||
//callcenter_config queue list agents [queue_name] [status] |
|
||||
$switch_command = 'callcenter_config queue list agents '.$queue_extension."@".$_SESSION["domain_name"];
|
||||
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_command));
|
||||
$event_socket_str = trim(event_socket::api($switch_command));
|
||||
$agent_result = str_to_named_array($event_socket_str, '|');
|
||||
|
||||
//get the agents from the database
|
||||
|
|
@ -280,7 +280,7 @@
|
|||
//callcenter_config queue list members [queue_name]
|
||||
if (is_uuid($queue_uuid)) {
|
||||
$switch_command = 'callcenter_config queue list members '.$queue_extension."@".$_SESSION["domain_name"];
|
||||
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_command));
|
||||
$event_socket_str = trim(event_socket::api($switch_command));
|
||||
$result = str_to_named_array($event_socket_str, '|');
|
||||
if (!is_array($result)) { unset($result); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,8 +90,7 @@
|
|||
|
||||
//run the command
|
||||
if (isset($switch_command)) {
|
||||
$fp = event_socket_create();
|
||||
$response = event_socket_request($fp, 'api '.$switch_command);
|
||||
$response = event_socket::api($switch_command);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -134,14 +133,14 @@
|
|||
//fs cmd
|
||||
if (!empty($switch_cmd)) {
|
||||
//setup the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
//ensure the connection exists
|
||||
if ($fp) {
|
||||
if ($esl) {
|
||||
//send the command
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::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);
|
||||
$response = event_socket::command($cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,37 +238,37 @@
|
|||
|
||||
//add the agent
|
||||
//setup the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
//add the agent using event socket
|
||||
if ($fp) {
|
||||
if ($esl->connected()) {
|
||||
//add the agent
|
||||
$cmd = "api callcenter_config agent add ".$call_center_agent_uuid." ".$agent_type;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config agent add ".$call_center_agent_uuid." '".$agent_type."'";
|
||||
$response = event_socket::api($cmd);
|
||||
usleep(200);
|
||||
//agent set contact
|
||||
$cmd = "api callcenter_config agent set contact ".$call_center_agent_uuid." ".$agent_contact;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config agent set contact ".$call_center_agent_uuid." '".$agent_contact."'";
|
||||
$response = event_socket::api($cmd);
|
||||
usleep(200);
|
||||
//agent set status
|
||||
$cmd = "api callcenter_config agent set status ".$call_center_agent_uuid." '".$agent_status."'";
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config agent set status ".$call_center_agent_uuid." '".$agent_status."'";
|
||||
$response = event_socket::api($cmd);
|
||||
usleep(200);
|
||||
//agent set reject_delay_time
|
||||
$cmd = "api callcenter_config agent set reject_delay_time ".$call_center_agent_uuid." ".$agent_reject_delay_time;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = 'callcenter_config agent set reject_delay_time '.$call_center_agent_uuid.' '. $agent_reject_delay_time;
|
||||
$response = event_socket::api($cmd);
|
||||
usleep(200);
|
||||
//agent set busy_delay_time
|
||||
$cmd = "api callcenter_config agent set busy_delay_time ".$call_center_agent_uuid." ".$agent_busy_delay_time;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = 'callcenter_config agent set busy_delay_time '.$call_center_agent_uuid.' '.$agent_busy_delay_time;
|
||||
$response = event_socket::api($cmd);
|
||||
//agent set no_answer_delay_time
|
||||
$cmd = "api callcenter_config agent set no_answer_delay_time ".$call_center_agent_uuid." ".$agent_no_answer_delay_time;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = 'callcenter_config agent set no_answer_delay_time '.$call_center_agent_uuid.' '.$agent_no_answer_delay_time;
|
||||
$response = event_socket::api($cmd);
|
||||
//agent set max_no_answer
|
||||
$cmd = "api callcenter_config agent set max_no_answer ".$call_center_agent_uuid." ".$agent_max_no_answer;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = 'callcenter_config agent set max_no_answer '.$call_center_agent_uuid.' '.$agent_max_no_answer;
|
||||
$response = event_socket::api($cmd);
|
||||
//agent set wrap_up_time
|
||||
$cmd = "api callcenter_config agent set wrap_up_time ".$call_center_agent_uuid." ".$agent_wrap_up_time;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = 'callcenter_config agent set wrap_up_time '.$call_center_agent_uuid.' '.$agent_wrap_up_time;
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
unset($sql, $parameters);
|
||||
|
||||
//setup the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//get the agents from the database
|
||||
$sql = "select * from v_call_center_agents ";
|
||||
|
|
@ -70,12 +70,12 @@
|
|||
|
||||
//get the agent list from event socket
|
||||
$switch_cmd = 'callcenter_config agent list';
|
||||
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
$event_socket_str = trim(event_socket::api($switch_cmd));
|
||||
$agent_list = csv_to_named_array($event_socket_str, '|');
|
||||
|
||||
//get the agent list from event socket
|
||||
$switch_cmd = 'callcenter_config tier list';
|
||||
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
$event_socket_str = trim(event_socket::api($switch_cmd));
|
||||
$call_center_tiers = csv_to_named_array($event_socket_str, '|');
|
||||
|
||||
//get the call center queues from the database
|
||||
|
|
@ -100,7 +100,7 @@
|
|||
|
||||
//get the queue list from event socket
|
||||
$switch_cmd = "callcenter_config queue list agents ".$queue_id;
|
||||
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
$event_socket_str = trim(event_socket::api($switch_cmd));
|
||||
$queue_list = csv_to_named_array($event_socket_str, '|');
|
||||
$call_center_queues[$x]['queue_list'] = $queue_list;
|
||||
$x++;
|
||||
|
|
@ -165,7 +165,7 @@
|
|||
foreach($_POST['agents'] as $row) {
|
||||
if (!empty($row['agent_status'])) {
|
||||
//agent set status
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
//set the user_status
|
||||
if (!isset($row['queue_name'])) {
|
||||
$array['users'][0]['user_uuid'] = $row['user_uuid'] ?? null;
|
||||
|
|
@ -211,20 +211,20 @@
|
|||
|
||||
//set the call center status to Logged Out
|
||||
if (is_uuid($row['agent_uuid'])) {
|
||||
$command = "api callcenter_config agent set status ".$row['agent_uuid']." 'Logged Out' ";
|
||||
$response = event_socket_request($fp, $command);
|
||||
$command = "callcenter_config agent set status ".$row['agent_uuid']." 'Logged Out' ";
|
||||
$response = event_socket::api($command);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (is_uuid($row['agent_uuid'])) {
|
||||
//set the agent status
|
||||
$command = "api callcenter_config agent set status ".$row['agent_uuid']." '".$agent_status."'";
|
||||
$response = event_socket_request($fp, $command);
|
||||
$command = "callcenter_config agent set status ".$row['agent_uuid']." '".$agent_status."'";
|
||||
$response = event_socket::api($command);
|
||||
|
||||
//set the agent state
|
||||
if ($agent_status == 'Available' || $agent_status == 'Logged Out') {
|
||||
$command = "api callcenter_config agent set state ".$row['agent_uuid']." 'Waiting'";
|
||||
$response = event_socket_request($fp, $command);
|
||||
$command = "callcenter_config agent set state ".$row['agent_uuid']." 'Waiting'";
|
||||
$response = event_socket::api($command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -247,22 +247,21 @@
|
|||
if (isset($row['queue_uuid']) && $row['agent_status'] == 'Available') {
|
||||
//set the call center status
|
||||
//$command = "api callcenter_config agent set status ".$row['agent_name']."@".$_SESSION['domain_name']." '".$row['agent_status']."'";
|
||||
//$response = event_socket_request($fp, $command);
|
||||
//$response = event_socket::command($command);
|
||||
|
||||
//assign the agent to the queue
|
||||
if (is_uuid($row['queue_uuid']) && is_uuid($row['agent_uuid'])) {
|
||||
$command = "api callcenter_config tier add ".$queue_id." ".$row['agent_uuid']." 1 1";
|
||||
//echo $command."<br />\n";
|
||||
$response = event_socket_request($fp, $command);
|
||||
$command = "callcenter_config tier add ".$queue_id." ".$row['agent_uuid']." 1 1";
|
||||
$response = event_socket::api($command);
|
||||
}
|
||||
}
|
||||
|
||||
//un-assign the agent from the queue
|
||||
if (isset($row['queue_uuid']) && $row['agent_status'] == 'Logged Out') {
|
||||
if (is_uuid($row['queue_uuid']) && is_uuid($row['agent_uuid'])) {
|
||||
$command = "api callcenter_config tier del ".$queue_id." ".$row['agent_uuid'];
|
||||
$command = "callcenter_config tier del ".$queue_id." ".$row['agent_uuid'];
|
||||
//echo $command."<br />\n";
|
||||
$response = event_socket_request($fp, $command);
|
||||
$response = event_socket::api($command);
|
||||
}
|
||||
}
|
||||
usleep(200);
|
||||
|
|
|
|||
|
|
@ -160,13 +160,13 @@
|
|||
|
||||
//delete the agent from freeswitch
|
||||
//setup the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
//delete the agent over event socket
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
//callcenter_config tier del [queue_name] [agent_name]
|
||||
if (is_numeric($queue_extension) && is_uuid($call_center_agent_uuid)) {
|
||||
$cmd = "api callcenter_config tier del ".$queue_extension."@".$_SESSION['domain_name']." ".$call_center_agent_uuid;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config tier del ".$queue_extension."@".$_SESSION['domain_name']." ".$call_center_agent_uuid;
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -468,9 +468,9 @@
|
|||
|
||||
if (!empty($agent_name)) {
|
||||
//setup the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
//add the agent using event socket
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
/* syntax:
|
||||
callcenter_config tier add [queue_name] [agent_name] [level] [position]
|
||||
callcenter_config tier set state [queue_name] [agent_name] [state]
|
||||
|
|
@ -479,20 +479,20 @@
|
|||
*/
|
||||
//add the agent
|
||||
if (is_numeric($queue_extension) && is_uuid($call_center_agent_uuid) && is_numeric($tier_level) && is_numeric($tier_position)) {
|
||||
$cmd = "api callcenter_config tier add ".$queue_extension."@".$_SESSION["domain_name"]." ".$call_center_agent_uuid." ".$tier_level." ".$tier_position;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config tier add ".$queue_extension."@".$_SESSION["domain_name"]." ".$call_center_agent_uuid." ".$tier_level." ".$tier_position;
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
usleep(200);
|
||||
//agent set level
|
||||
if (is_numeric($queue_extension) && is_numeric($tier_level)) {
|
||||
$cmd = "api callcenter_config tier set level ".$queue_extension."@".$_SESSION["domain_name"]." ".$call_center_agent_uuid." ".$tier_level;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config tier set level ".$queue_extension."@".$_SESSION["domain_name"]." ".$call_center_agent_uuid." ".$tier_level;
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
usleep(200);
|
||||
//agent set position
|
||||
if (is_numeric($queue_extension) && is_numeric($tier_position)) {
|
||||
$cmd = "api callcenter_config tier set position ".$queue_extension."@".$_SESSION["domain_name"]." ".$tier_position;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config tier set position ".$queue_extension."@".$_SESSION["domain_name"]." ".$tier_position;
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
usleep(200);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,11 +70,10 @@
|
|||
|
||||
//connect to event socket
|
||||
if (isset($queue_extension) && isset($cmd)) {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$response = event_socket_request($fp, 'api reloadxml');
|
||||
$response = event_socket_request($fp, 'api callcenter_config queue '.$cmd. ' '.$queue_extension."@".$_SESSION["domain_name"]);
|
||||
fclose($fp);
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$response = event_socket::api('reloadxml');
|
||||
$response = event_socket::api('callcenter_config queue '.$cmd.' '.$queue_extension.'@'.$_SESSION['domain_name']);
|
||||
}
|
||||
else {
|
||||
$response = '';
|
||||
|
|
@ -85,4 +84,4 @@
|
|||
$_SESSION["message"] = $response;
|
||||
header("Location: call_center_queues.php?savemsg=".urlencode($response));
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -338,13 +338,13 @@
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//setup the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//delete the queue in the switch
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
foreach ($uuids as $uuid) {
|
||||
$cmd = "api callcenter_config queue unload ".$call_center_queues[$uuid]['queue_extension']."@".$_SESSION["domain_name"];
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config queue unload ".$call_center_queues[$uuid]['queue_extension']."@".$_SESSION['domain_name'];
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -436,13 +436,12 @@
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//setup the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//delete the agent in the switch
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
foreach ($uuids as $uuid) {
|
||||
$cmd = "api callcenter_config agent del ".$uuid;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
event_socket::async("callcenter_config agent del $uuid");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -627,4 +626,4 @@ $c->queue_cc_exit_keys = "";
|
|||
$c->dialplan();
|
||||
*/
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
}
|
||||
|
||||
//setup the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//get the http post values and set them as php variables
|
||||
if (!empty($_POST['agents'])) {
|
||||
|
|
@ -91,8 +91,8 @@
|
|||
$result = $database->save($array);
|
||||
|
||||
//send the agent status status to mod_call_center
|
||||
$cmd = "api callcenter_config agent set status ".$agent_uuid." '".$agent_status."'";
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config agent set status ".$agent_uuid." '".$agent_status."'";
|
||||
$response = event_socket::api($cmd);
|
||||
|
||||
//add or delete agents from the queue assigned by the tier
|
||||
foreach ($_POST['agents'] as $row) {
|
||||
|
|
@ -103,21 +103,21 @@
|
|||
//set the agent status to available and assign the agent to the queue with the tier
|
||||
if ($row['agent_status'] == 'Available') {
|
||||
//assign the agent to the queue
|
||||
$cmd = "api callcenter_config tier add ".$row['queue_extension']."@".$_SESSION['domain_name']." ".$row['id']." 1 1";
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config tier add ".$row['queue_extension']."@".$_SESSION['domain_name']." ".$row['id']." 1 1";
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
|
||||
//set the agent status to available and assign the agent to the queue with the tier
|
||||
if ($row['agent_status'] == 'On Break') {
|
||||
//assign the agent to the queue
|
||||
$cmd = "api callcenter_config tier add ".$row['queue_extension']."@".$_SESSION['domain_name']." ".$row['id']." 1 1";
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config tier add ".$row['queue_extension']."@".$_SESSION['domain_name']." ".$row['id']." 1 1";
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
|
||||
//un-assign the agent from the queue
|
||||
if ($row['agent_status'] == 'Logged Out') {
|
||||
$cmd = "api callcenter_config tier del ".$row['queue_extension']."@".$_SESSION['domain_name']." ".$row['id'];
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$cmd = "callcenter_config tier del ".$row['queue_extension']."@".$_SESSION['domain_name']." ".$row['id'];
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
|
||||
//small sleep
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
|
||||
//get the agent list from event socket
|
||||
$switch_cmd = 'callcenter_config tier list';
|
||||
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
$event_socket_str = trim(event_socket::api($switch_cmd));
|
||||
$call_center_tiers = csv_to_named_array($event_socket_str, '|');
|
||||
|
||||
//get the agents from the database
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@
|
|||
}
|
||||
|
||||
//connect to event socket
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//get the agent list from event socket
|
||||
$switch_cmd = 'callcenter_config agent list';
|
||||
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
$event_socket_str = trim(event_socket::api($switch_cmd));
|
||||
$agent_list = csv_to_named_array($event_socket_str, '|');
|
||||
|
||||
//get the agents from the database
|
||||
|
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
|
||||
//build the event
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
$event = "sendevent PRESENCE_IN\n";
|
||||
$event .= "proto: agent\n";
|
||||
$event .= "from: ".$row['agent_name']."@".$row['domain_name']."\n";
|
||||
|
|
@ -104,16 +104,13 @@
|
|||
}
|
||||
|
||||
//send the event
|
||||
$result = event_socket_request($fp, $event);
|
||||
$result = event_socket::command($event);
|
||||
if (isset($debug)) {
|
||||
print_r($result, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//close event socket connection
|
||||
fclose($fp);
|
||||
|
||||
/*
|
||||
* * * * * cd /var/www/fusionpbx && php /var/www/fusionpbx/app/call_centers/resources/jobs/call_center_agents.php
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -257,8 +257,8 @@
|
|||
|
||||
// Update subscribed endpoints
|
||||
if (!empty($call_flow_feature_code)) {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
//send the event
|
||||
$event = "sendevent PRESENCE_IN\n";
|
||||
$event .= "proto: flow\n";
|
||||
|
|
@ -274,8 +274,7 @@
|
|||
} else {
|
||||
$event .= "answer-state: terminated\n";
|
||||
}
|
||||
event_socket_request($fp, $event);
|
||||
fclose($fp);
|
||||
event_socket::command($event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -281,8 +281,7 @@ if (!class_exists('call_flows')) {
|
|||
}
|
||||
|
||||
//send the event
|
||||
$fp = event_socket_create();
|
||||
$switch_result = event_socket_request($fp, $cmd);
|
||||
$switch_result = event_socket::command($cmd);
|
||||
}
|
||||
}
|
||||
unset($call_flows);
|
||||
|
|
|
|||
|
|
@ -399,9 +399,7 @@
|
|||
$cmd .= "answer-state: confirmed\n";
|
||||
|
||||
//send the event
|
||||
$fp = event_socket_create();
|
||||
$switch_result = event_socket_request($fp, $cmd);
|
||||
unset($fp);
|
||||
$switch_result = event_socket::command($cmd);
|
||||
}
|
||||
else {
|
||||
$presence = new presence;
|
||||
|
|
@ -421,9 +419,7 @@
|
|||
$cmd .= "answer-state: terminated\n";
|
||||
|
||||
//send the event
|
||||
$fp = event_socket_create();
|
||||
$switch_result = event_socket_request($fp, $cmd);
|
||||
unset($fp);
|
||||
$switch_result = event_socket::command($cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@
|
|||
if ($this->enabled == "true") {
|
||||
//update the call center status
|
||||
$user_status = "Logged Out";
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$switch_cmd .= "callcenter_config agent set status ".$_SESSION['username']."@".$this->domain_name." '".$user_status."'";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
|
||||
//update the database user_status
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@
|
|||
|
||||
//feature_event method
|
||||
public function send_notify() {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
// Get the SIP profiles for the extension
|
||||
$command = "sofia_contact */{$this->extension}@{$this->domain_name}";
|
||||
$contact_string = event_socket_request($fp, "api ".$command);
|
||||
$contact_string = event_socket::api($command);
|
||||
// The first value in the array will be full matching text, the second one will be the array of profile matches
|
||||
preg_match_all('/sofia\/([^,]+)\/(?:[^,]+)/', $contact_string, $matches);
|
||||
if (sizeof($matches) != 2 || sizeof($matches[1]) < 1) {
|
||||
|
|
@ -72,12 +72,11 @@
|
|||
$event .= "forward_no_answer: " . $this->forward_no_answer_destination . "\n";
|
||||
$event .= "doNotDisturbOn: " . $this->do_not_disturb . "\n";
|
||||
$event .= "ringCount: " . $this->ring_count . "\n";
|
||||
event_socket_request($fp, $event);
|
||||
event_socket::command($event);
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
} //function
|
||||
|
||||
|
||||
} //class
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//check the permission
|
||||
if (defined('STDIN')) {
|
||||
//includes files
|
||||
require_once dirname(__DIR__, 4) . "/resources/require.php";
|
||||
require_once dirname(__DIR__, 4) . "/resources/require.php";
|
||||
}
|
||||
else {
|
||||
exit;
|
||||
|
|
@ -31,54 +31,63 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//connect to event socket
|
||||
$fp = event_socket_create();
|
||||
//use global conf created from require.php
|
||||
global $conf;
|
||||
|
||||
//get the list
|
||||
$sql = "select domain_name, extension, user_context, do_not_disturb, description ";
|
||||
$sql .= "from v_extensions as e, v_domains as d ";
|
||||
$sql .= "where do_not_disturb = 'true' ";
|
||||
$sql .= "and e.domain_uuid = d.domain_uuid ";
|
||||
$sql .= "and enabled = 'true' ";
|
||||
$database = new database;
|
||||
$results = $database->select($sql, $parameters, 'all');
|
||||
unset($parameters);
|
||||
//set the event socket connection settings
|
||||
$host = $conf['switch.event_socket.host'] ?? $conf['event_socket.ip_address'] ?? '127.0.0.1';
|
||||
$port = $conf['switch.event_socket.port'] ?? $conf['event_socket.port'] ?? '8021';
|
||||
$pass = $conf['switch.event_socket.password'] ?? $conf['event_socket.password'] ?? 'ClueCon';
|
||||
|
||||
//view_array($results);
|
||||
foreach($results as $row) {
|
||||
//connect to event socket using a lower timeout because we are on cli
|
||||
$esl = event_socket::create($host, $port, $pass, 10000);
|
||||
|
||||
//build the event
|
||||
$cmd = "sendevent PRESENCE_IN\n";
|
||||
$cmd .= "proto: sip\n";
|
||||
$cmd .= "login: ".$row['extension']."@".$row['domain_name']."\n";
|
||||
$cmd .= "from: ".$row['extension']."@".$row['domain_name']."\n";
|
||||
$cmd .= "status: Active (1 waiting)\n";
|
||||
$cmd .= "rpid: unknown\n";
|
||||
$cmd .= "event_type: presence\n";
|
||||
$cmd .= "alt_event_type: dialog\n";
|
||||
$cmd .= "event_count: 1\n";
|
||||
$cmd .= "unique-id: ".uuid()."\n";
|
||||
$cmd .= "Presence-Call-Direction: outbound\n";
|
||||
$cmd .= "answer-state: confirmed\n";
|
||||
//$cmd .= "answer-state: early\n";
|
||||
//$cmd .= "answer-state: terminated\n";
|
||||
//ensure we are connected
|
||||
if ($esl->is_connected()) {
|
||||
|
||||
//send message to the console
|
||||
if (isset($debug)) {
|
||||
echo "\n";
|
||||
echo "[presence] dnd ".$row['extension']."@".$row['domain_name']."\n";
|
||||
//get the list
|
||||
$sql = "select domain_name, extension, user_context, do_not_disturb, description ";
|
||||
$sql .= "from v_extensions as e, v_domains as d ";
|
||||
$sql .= "where do_not_disturb = 'true' ";
|
||||
$sql .= "and e.domain_uuid = d.domain_uuid ";
|
||||
$sql .= "and enabled = 'true' ";
|
||||
$database = new database;
|
||||
$results = $database->select($sql, $parameters, 'all');
|
||||
unset($parameters);
|
||||
foreach ($results as $row) {
|
||||
|
||||
//build the event
|
||||
$cmd = "sendevent PRESENCE_IN\n";
|
||||
$cmd .= "proto: sip\n";
|
||||
$cmd .= "login: " . $row['extension'] . "@" . $row['domain_name'] . "\n";
|
||||
$cmd .= "from: " . $row['extension'] . "@" . $row['domain_name'] . "\n";
|
||||
$cmd .= "status: Active (1 waiting)\n";
|
||||
$cmd .= "rpid: unknown\n";
|
||||
$cmd .= "event_type: presence\n";
|
||||
$cmd .= "alt_event_type: dialog\n";
|
||||
$cmd .= "event_count: 1\n";
|
||||
$cmd .= "unique-id: " . uuid() . "\n";
|
||||
$cmd .= "Presence-Call-Direction: outbound\n";
|
||||
$cmd .= "answer-state: confirmed\n";
|
||||
//$cmd .= "answer-state: early\n";
|
||||
//$cmd .= "answer-state: terminated\n";
|
||||
//send message to the console
|
||||
if (isset($debug)) {
|
||||
echo "\n";
|
||||
echo "[presence] dnd " . $row['extension'] . "@" . $row['domain_name'] . "\n";
|
||||
}
|
||||
|
||||
//send the event
|
||||
$result = event_socket::command($cmd);
|
||||
if (isset($debug)) {
|
||||
print_r($result, false);
|
||||
}
|
||||
}
|
||||
|
||||
//send the event
|
||||
$result = event_socket_request($fp, $cmd);
|
||||
if (isset($debug)) {
|
||||
print_r($result, false);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
trigger_error("Unable to connect to FreeSWITCH using $host, $port, $password", E_USER_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* * * * * cd /var/www/fusionpbx && php /var/www/fusionpbx/app/call_forward/resources/jobs/dnd.php
|
||||
*/
|
||||
|
||||
?>
|
||||
/*
|
||||
* * * * * cd /var/www/fusionpbx && php /var/www/fusionpbx/app/call_forward/resources/jobs/dnd.php
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@
|
|||
$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']);
|
||||
$esl = event_socket::create();
|
||||
|
||||
//send the event socket command and get the array
|
||||
if ($fp) {
|
||||
$json = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
if ($esl->is_connected()) {
|
||||
$json = trim(event_socket::api($switch_cmd));
|
||||
$results = json_decode($json, "true");
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +90,7 @@
|
|||
|
||||
|
||||
//if the connnection is available then run it and return the results
|
||||
if (!$fp) {
|
||||
if (!$esl) {
|
||||
|
||||
$msg = "<div align='center'>".$text['confirm-socket']."<br /></div>";
|
||||
echo "<div align='center'>\n";
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
$calls = [];
|
||||
//verify submitted call uuids
|
||||
if (is_array($_POST['calls']) && @sizeof($_POST['calls']) != 0) {
|
||||
foreach ($_POST['calls'] as $call) {
|
||||
|
|
@ -71,18 +72,18 @@
|
|||
}
|
||||
|
||||
//iterate through calls
|
||||
if (is_array($calls) && @sizeof($calls) != 0) {
|
||||
if (count($calls) > 0) {
|
||||
|
||||
//setup the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//execute hangup command
|
||||
foreach ($calls as $call_uuid) {
|
||||
$switch_result = event_socket_request($fp, 'api uuid_kill '.$call_uuid);
|
||||
if ($esl->is_connected()) foreach ($calls as $call_uuid) {
|
||||
event_socket::async("uuid_kill $call_uuid");
|
||||
}
|
||||
|
||||
//set message
|
||||
message::add($text['message-calls_ended'].': '.@sizeof($calls),'positive');
|
||||
message::add($text['message-calls_ended'].': '.count($calls),'positive');
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,124 +93,120 @@
|
|||
}
|
||||
|
||||
//create the even socket connection and send the event socket command
|
||||
$fp = event_socket_create();
|
||||
if (!$fp) {
|
||||
//error message
|
||||
echo "<div align='center'><strong>Connection to Event Socket failed.</strong></div>";
|
||||
}
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
|
||||
//set call uuid
|
||||
$origination_uuid = trim(event_socket_request($fp, "api create_uuid"));
|
||||
//set call uuid
|
||||
$origination_uuid = trim(event_socket::api("create_uuid"));
|
||||
|
||||
//add record path and name
|
||||
if ($rec == "true") {
|
||||
$record_path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d");
|
||||
if (isset($_SESSION['recordings']['extension']['text'])) {
|
||||
$record_extension = $_SESSION['recordings']['extension']['text'];
|
||||
}
|
||||
else {
|
||||
$record_extension = 'wav';
|
||||
}
|
||||
if (isset($_SESSION['recordings']['template']['text'])) {
|
||||
//${year}${month}${day}-${caller_id_number}-${caller_destination}-${uuid}.${record_extension}
|
||||
$record_name = $_SESSION['recordings']['template']['text'];
|
||||
$record_name = str_replace('${year}', date("Y"), $record_name);
|
||||
$record_name = str_replace('${month}', date("M"), $record_name);
|
||||
$record_name = str_replace('${day}', date("d"), $record_name);
|
||||
$record_name = str_replace('${source}', $src, $record_name);
|
||||
$record_name = str_replace('${caller_id_name}', $src_cid_name, $record_name);
|
||||
$record_name = str_replace('${caller_id_number}', $src_cid_number, $record_name);
|
||||
$record_name = str_replace('${caller_destination}', $dest, $record_name);
|
||||
$record_name = str_replace('${destination}', $dest, $record_name);
|
||||
$record_name = str_replace('${uuid}', $origination_uuid, $record_name);
|
||||
$record_name = str_replace('${record_extension}', $record_extension, $record_name);
|
||||
}
|
||||
else {
|
||||
$record_name = $origination_uuid.'.'.$record_extension;
|
||||
}
|
||||
}
|
||||
|
||||
//determine call direction
|
||||
$dir = (user_exists($dest)) ? 'local' : 'outbound';
|
||||
|
||||
//define a leg - set source to display the defined caller id name and number
|
||||
$source_common = "{";
|
||||
$source_common .= "click_to_call=true";
|
||||
$source_common .= ",origination_caller_id_name='".$src_cid_name."'";
|
||||
$source_common .= ",origination_caller_id_number=".$src_cid_number;
|
||||
$source_common .= ",instant_ringback=true";
|
||||
$source_common .= ",ringback=".$ringback_value;
|
||||
$source_common .= ",presence_id=".$src."@".$_SESSION['domains'][$domain_uuid]['domain_name'];
|
||||
$source_common .= ",call_direction=".$dir;
|
||||
if ($rec == "true") {
|
||||
$source_common .= ",record_path='".$record_path."'";
|
||||
$source_common .= ",record_name='".$record_name."'";
|
||||
}
|
||||
|
||||
if (user_exists($src)) {
|
||||
//source is a local extension
|
||||
$source = $source_common.$sip_auto_answer.
|
||||
",domain_uuid=".$domain_uuid.
|
||||
",domain_name=".$_SESSION['domains'][$domain_uuid]['domain_name']."}user/".$src."@".$_SESSION['domains'][$domain_uuid]['domain_name'];
|
||||
}
|
||||
else {
|
||||
//source is an external number
|
||||
$bridge_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $src);
|
||||
$source = $source_common."}".$bridge_array[0];
|
||||
}
|
||||
unset($source_common);
|
||||
|
||||
//define b leg - set destination to display the defined caller id name and number
|
||||
$destination_common = " &bridge({origination_caller_id_name='".$dest_cid_name."',origination_caller_id_number=".$dest_cid_number;
|
||||
if (user_exists($dest)) {
|
||||
//destination is a local extension
|
||||
if (strpbrk($dest, '@') != FALSE) { //sip-uri
|
||||
$switch_cmd = $destination_common.",call_direction=outbound}sofia/external/".$dest.")";
|
||||
}
|
||||
else { //not sip-uri
|
||||
$switch_cmd = " &transfer('".$dest." XML ".$context."')";
|
||||
}
|
||||
}
|
||||
else {
|
||||
//local extension (source) > external number (destination)
|
||||
if (user_exists($src) && empty($dest_cid_number)) {
|
||||
//retrieve outbound caller id from the (source) extension
|
||||
$sql = "select outbound_caller_id_name, outbound_caller_id_number from v_extensions where domain_uuid = :domain_uuid and extension = :src ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['src'] = $src;
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
foreach ($result as &$row) {
|
||||
$dest_cid_name = $row["outbound_caller_id_name"];
|
||||
$dest_cid_number = $row["outbound_caller_id_number"];
|
||||
break; //limit to 1 row
|
||||
//add record path and name
|
||||
if ($rec == "true") {
|
||||
$record_path = $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d");
|
||||
if (isset($_SESSION['recordings']['extension']['text'])) {
|
||||
$record_extension = $_SESSION['recordings']['extension']['text'];
|
||||
}
|
||||
else {
|
||||
$record_extension = 'wav';
|
||||
}
|
||||
if (isset($_SESSION['recordings']['template']['text'])) {
|
||||
//${year}${month}${day}-${caller_id_number}-${caller_destination}-${uuid}.${record_extension}
|
||||
$record_name = $_SESSION['recordings']['template']['text'];
|
||||
$record_name = str_replace('${year}', date("Y"), $record_name);
|
||||
$record_name = str_replace('${month}', date("M"), $record_name);
|
||||
$record_name = str_replace('${day}', date("d"), $record_name);
|
||||
$record_name = str_replace('${source}', $src, $record_name);
|
||||
$record_name = str_replace('${caller_id_name}', $src_cid_name, $record_name);
|
||||
$record_name = str_replace('${caller_id_number}', $src_cid_number, $record_name);
|
||||
$record_name = str_replace('${caller_destination}', $dest, $record_name);
|
||||
$record_name = str_replace('${destination}', $dest, $record_name);
|
||||
$record_name = str_replace('${uuid}', $origination_uuid, $record_name);
|
||||
$record_name = str_replace('${record_extension}', $record_extension, $record_name);
|
||||
}
|
||||
else {
|
||||
$record_name = $origination_uuid.'.'.$record_extension;
|
||||
}
|
||||
}
|
||||
if (permission_exists('click_to_call_call')) {
|
||||
|
||||
//determine call direction
|
||||
$dir = (user_exists($dest)) ? 'local' : 'outbound';
|
||||
|
||||
//define a leg - set source to display the defined caller id name and number
|
||||
$source_common = "{";
|
||||
$source_common .= "click_to_call=true";
|
||||
$source_common .= ",origination_caller_id_name='".$src_cid_name."'";
|
||||
$source_common .= ",origination_caller_id_number=".$src_cid_number;
|
||||
$source_common .= ",instant_ringback=true";
|
||||
$source_common .= ",ringback=".$ringback_value;
|
||||
$source_common .= ",presence_id=".$src."@".$_SESSION['domains'][$domain_uuid]['domain_name'];
|
||||
$source_common .= ",call_direction=".$dir;
|
||||
if ($rec == "true") {
|
||||
$source_common .= ",record_path='".$record_path."'";
|
||||
$source_common .= ",record_name='".$record_name."'";
|
||||
}
|
||||
|
||||
if (user_exists($src)) {
|
||||
//source is a local extension
|
||||
$source = $source_common.$sip_auto_answer.
|
||||
",domain_uuid=".$domain_uuid.
|
||||
",domain_name=".$_SESSION['domains'][$domain_uuid]['domain_name']."}user/".$src."@".$_SESSION['domains'][$domain_uuid]['domain_name'];
|
||||
}
|
||||
else {
|
||||
//source is an external number
|
||||
$bridge_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $src);
|
||||
$source = $source_common."}".$bridge_array[0];
|
||||
}
|
||||
unset($source_common);
|
||||
|
||||
//define b leg - set destination to display the defined caller id name and number
|
||||
$destination_common = " &bridge({origination_caller_id_name='".$dest_cid_name."',origination_caller_id_number=".$dest_cid_number;
|
||||
if (user_exists($dest)) {
|
||||
//destination is a local extension
|
||||
if (strpbrk($dest, '@') != FALSE) { //sip-uri
|
||||
$switch_cmd = $destination_common.",call_direction=outbound}sofia/external/".$dest.")";
|
||||
}
|
||||
else { //not sip-uri
|
||||
$bridge_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $dest);
|
||||
//$switch_cmd = $destination_common."}".$bridge_array[0].")"; // wouldn't set cdr destination correctly, so below used instead
|
||||
$switch_cmd = " &transfer('".$dest." XML ".$context."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($destination_common);
|
||||
|
||||
//create the even socket connection and send the event socket command
|
||||
$fp = event_socket_create();
|
||||
if (!$fp) {
|
||||
else {
|
||||
//local extension (source) > external number (destination)
|
||||
if (user_exists($src) && empty($dest_cid_number)) {
|
||||
//retrieve outbound caller id from the (source) extension
|
||||
$sql = "select outbound_caller_id_name, outbound_caller_id_number from v_extensions where domain_uuid = :domain_uuid and extension = :src ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['src'] = $src;
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
foreach ($result as &$row) {
|
||||
$dest_cid_name = $row["outbound_caller_id_name"];
|
||||
$dest_cid_number = $row["outbound_caller_id_number"];
|
||||
break; //limit to 1 row
|
||||
}
|
||||
}
|
||||
if (permission_exists('click_to_call_call')) {
|
||||
if (strpbrk($dest, '@') != FALSE) { //sip-uri
|
||||
$switch_cmd = $destination_common.",call_direction=outbound}sofia/external/".$dest.")";
|
||||
}
|
||||
else { //not sip-uri
|
||||
$bridge_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $dest);
|
||||
//$switch_cmd = $destination_common."}".$bridge_array[0].")"; // wouldn't set cdr destination correctly, so below used instead
|
||||
$switch_cmd = " &transfer('".$dest." XML ".$context."')";
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($destination_common);
|
||||
} else {
|
||||
//error message
|
||||
echo "<div align='center'><strong>Connection to Event Socket failed.</strong></div>";
|
||||
}
|
||||
else {
|
||||
|
||||
//ensure we are still connected and send the event socket command
|
||||
if ($esl->is_connected()) {
|
||||
//display the last command
|
||||
$switch_cmd = "api originate ".$source.$switch_cmd;
|
||||
$switch_cmd = "originate ".$source.$switch_cmd;
|
||||
echo "<div align='center'><strong>".escape($src)." has called ".escape($dest)."</strong></div>\n";
|
||||
//show the command result
|
||||
$result = trim(event_socket_request($fp, $switch_cmd));
|
||||
$result = trim(event_socket::api($switch_cmd));
|
||||
if (substr($result, 0,3) == "+OK") {
|
||||
//$uuid = substr($result, 4);
|
||||
if ($rec == "true") {
|
||||
|
|
@ -218,12 +214,15 @@
|
|||
date_default_timezone_set($_SESSION['time_zone']['system']);
|
||||
//create the api record command and send it over event socket
|
||||
if (is_uuid($origination_uuid) && file_exists($record_path)) {
|
||||
$switch_cmd = "api uuid_record ".$origination_uuid." start ".$record_path."/".$record_name;
|
||||
$switch_cmd = "uuid_record $origination_uuid start $record_path/$record_name";
|
||||
}
|
||||
$result2 = trim(event_socket_request($fp, $switch_cmd));
|
||||
$result2 = trim(event_socket::api($switch_cmd));
|
||||
}
|
||||
}
|
||||
echo "<div align='center'><br />".escape($result)."<br /><br /></div>\n";
|
||||
} else {
|
||||
//error message
|
||||
echo "<div align='center'><strong>Connection to Event Socket failed.</strong></div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -141,9 +141,9 @@
|
|||
$default_voice = 'callie';
|
||||
$switch_cmd = "conference ".$conference_room_uuid."@".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
||||
//connect to event socket
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,9 +98,9 @@
|
|||
$default_voice = 'callie';
|
||||
$switch_cmd = "conference ".$meeting_uuid."@".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
||||
//connect to event socket
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$esl = event_socket::create();
|
||||
if ($esl) {
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -137,12 +137,12 @@
|
|||
|
||||
//get conference array
|
||||
$switch_cmd = "conference xml_list";
|
||||
$fp = event_socket_create();
|
||||
if (!$fp) {
|
||||
//connection to even socket failed
|
||||
$esl = event_socket::create();
|
||||
if (!$esl->is_connected()) {
|
||||
trigger_error('Unable to connect to FreeSWITCH', E_USER_WARNING);
|
||||
}
|
||||
else {
|
||||
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
$xml_str = trim(event_socket::api($switch_cmd));
|
||||
try {
|
||||
$xml = new SimpleXMLElement($xml_str, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@
|
|||
//feature_event method
|
||||
public function send_call_center_notify() {
|
||||
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
//send the event
|
||||
$event = "sendevent PRESENCE_IN\n";
|
||||
$event .= "proto: agent\n";
|
||||
|
|
@ -50,9 +50,8 @@
|
|||
$event .= "login: agent+".$this->agent_name."@".$this->domain_name."\n";
|
||||
$event .= "unique-id: ".$this->agent_uuid."\n";
|
||||
$event .= "answer-state: ".$this->answer_state."\n";
|
||||
event_socket_request($fp, $event);
|
||||
event_socket::command($event);
|
||||
//echo $event."<br />";
|
||||
fclose($fp);
|
||||
}
|
||||
} //function
|
||||
|
||||
|
|
|
|||
|
|
@ -687,10 +687,10 @@ if (!class_exists('conference_centers')) {
|
|||
$switch_cmd_notice = "conference ".$meeting_uuid[$uuid]."@".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
|
||||
//execute api commands
|
||||
// if (!file_exists($recording_dir.'/'.$meeting_uuid[$uuid].'.wav')) {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
// $switch_result = event_socket_request($fp, 'api '.$switch_cmd_record);
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd_notice);
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
// $switch_result = event_socket::api($switch_cmd_record);
|
||||
$switch_result = event_socket::api($switch_cmd_notice);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,9 +147,9 @@
|
|||
}
|
||||
|
||||
//define an alternative kick all
|
||||
function conference_end($fp, $name) {
|
||||
function conference_end($name) {
|
||||
$switch_cmd = "conference '".$name."' xml_list";
|
||||
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
$xml_str = trim(event_socket::api($switch_cmd));
|
||||
try {
|
||||
$xml = new SimpleXMLElement($xml_str);
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@
|
|||
foreach ($xml->conference->members->member as $row) {
|
||||
$uuid = (string)$row->uuid;
|
||||
if (is_uuid($uuid)) {
|
||||
$switch_result = event_socket_request($fp, 'api uuid_kill '.$uuid);
|
||||
$switch_result = event_socket::api("uuid_kill $uuid");
|
||||
}
|
||||
if ($x < 1) {
|
||||
usleep(500000); //500000 = 0.5 seconds
|
||||
|
|
@ -188,66 +188,66 @@
|
|||
}
|
||||
|
||||
//connect to event socket
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
if ($data == "energy") {
|
||||
//conference 3001-example-domain.org energy 103
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$result_array = explode("=",$switch_result);
|
||||
$tmp_value = $result_array[1];
|
||||
if ($direction == "up") { $tmp_value = $tmp_value + 100; }
|
||||
if ($direction == "down") { $tmp_value = $tmp_value - 100; }
|
||||
//echo "energy $tmp_value<br />\n";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
|
||||
$switch_result = event_socket::api("$switch_cmd $tmp_value");
|
||||
}
|
||||
elseif ($data == "volume_in") {
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$result_array = explode("=",$switch_result);
|
||||
$tmp_value = $result_array[1];
|
||||
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
|
||||
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
|
||||
//echo "volume $tmp_value<br />\n";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
|
||||
$switch_result = event_socket::api($switch_cmd.' '.$tmp_value);
|
||||
}
|
||||
elseif ($data == "volume_out") {
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$result_array = explode("=",$switch_result);
|
||||
$tmp_value = $result_array[1];
|
||||
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
|
||||
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
|
||||
//echo "volume $tmp_value<br />\n";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
|
||||
$switch_result = event_socket::api($switch_cmd.' '.$tmp_value);
|
||||
}
|
||||
elseif ($data == "record") {
|
||||
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
|
||||
$switch_cmd .= $recording_dir."/".$uuid.".wav";
|
||||
if (!file_exists($recording_dir."/".$uuid.".wav")) {
|
||||
$switch_result = event_socket_request($fp, "api ".$switch_cmd);
|
||||
$switch_cmd .= $recording_dir."/{$uuid}.wav";
|
||||
if (!file_exists($switch_cmd)) {
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
}
|
||||
elseif ($data == "norecord") {
|
||||
//stop recording and rename the file
|
||||
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/'.$_SESSION['domain_name'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
|
||||
$switch_cmd .= $recording_dir."/".$uuid.".wav";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
elseif ($data == "kick") {
|
||||
$switch_result = event_socket_request($fp, 'api uuid_kill '.$uuid);
|
||||
$switch_result = event_socket::api("uuid_kill $uuid");
|
||||
}
|
||||
elseif ($data == "kick all") {
|
||||
//$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
conference_end($fp, $name);
|
||||
//$switch_result = event_socket::api($switch_cmd);
|
||||
conference_end($name);
|
||||
}
|
||||
elseif ($data == "mute" || $data == "unmute" || $data == "mute non_moderator" || $data == "unmute non_moderator") {
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$switch_cmd = "uuid_setvar ".$uuid. " hand_raised false";
|
||||
event_socket_request($fp, 'api '.$switch_cmd);
|
||||
event_socket::api($switch_cmd);
|
||||
}
|
||||
elseif ($data == "deaf" || $data == "undeaf" ) {
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
elseif ($data == "lock" || $data == "unlock" ) {
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
//echo "command: ".$switch_cmd." result: ".$switch_result."<br\n>";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@
|
|||
$switch_cmd = "conference '".$conference_name."' xml_list";
|
||||
|
||||
//connect to event socket, send the command and process the results
|
||||
$fp = event_socket_create();
|
||||
if (!$fp) {
|
||||
$esl = event_socket::create();
|
||||
if (!$esl->is_connected()) {
|
||||
$msg = "<div align='center'>".$text['message-connection']."<br /></div>";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='40%'>\n";
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
}
|
||||
else {
|
||||
//show the content
|
||||
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
$xml_str = trim(event_socket::api($switch_cmd));
|
||||
if (substr($xml_str, -9) == "not found") {
|
||||
$valid_xml = false;
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@
|
|||
$caller_id_name = urldecode($caller_id_name);
|
||||
$caller_id_number = $row->caller_id_number;
|
||||
$switch_cmd = "uuid_getvar ".$uuid. " hand_raised";
|
||||
$hand_raised = (trim(event_socket_request($fp, 'api '.$switch_cmd)) == "true") ? "true" : "false";
|
||||
$hand_raised = (trim(event_socket::api($switch_cmd)) == "true") ? "true" : "false";
|
||||
//format secondsfloor(floor($fifo_duration / 60) % 60)
|
||||
$join_time_formatted = sprintf('%02d:%02d:%02d', floor($join_time / 3600), floor(floor($join_time / 60) % 60), $join_time % 60);
|
||||
$last_talking_formatted = sprintf('%02d:%02d:%02d', floor($last_talking / 3600), floor(floor($last_talking / 60) % 60), $last_talking % 60);
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@
|
|||
$text = $language->get();
|
||||
|
||||
//show content
|
||||
$fp = event_socket_create();
|
||||
if (!$fp) {
|
||||
$fp = event_socket::create();
|
||||
if (!$fp->is_connected()) {
|
||||
$msg = "<div align='center'>".$text['message-connection']."<br /></div>";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='40%'>\n";
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
echo "</div>\n";
|
||||
}
|
||||
else {
|
||||
$xml_string = trim(event_socket_request($fp, 'api conference xml_list'));
|
||||
$xml_string = trim(event_socket::api('conference xml_list'));
|
||||
try {
|
||||
$xml = new SimpleXMLElement($xml_string);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@
|
|||
}
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
// Get the SIP profiles for the user
|
||||
$command = "sofia_contact */{$user}@{$domain_name}";
|
||||
$contact_string = event_socket_request($fp, "api ".$command);
|
||||
$contact_string = event_socket::api($command);
|
||||
|
||||
// The first value in the array will be full matching text, the second one will be the array of profile matches
|
||||
preg_match_all('/sofia\/([^,]+)\/(?:[^,]+)/', $contact_string, $matches);
|
||||
|
|
@ -93,8 +93,8 @@
|
|||
}
|
||||
|
||||
//send the command
|
||||
$response = event_socket_request($fp, "api {$command}");
|
||||
event_socket_request($fp, "api log notice {$command}");
|
||||
$response = event_socket::api("{$command}");
|
||||
event_socket::api("log notice {$command}");
|
||||
|
||||
//prepare the response
|
||||
$message = $text['message-command_sent'];
|
||||
|
|
@ -105,9 +105,6 @@
|
|||
//show the response
|
||||
message::add($text['label-event']." ".$message, 'positive', 3500);
|
||||
}
|
||||
|
||||
//close the connection
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
|
|
|
|||
|
|
@ -89,14 +89,14 @@
|
|||
|
||||
//get the list of applications
|
||||
if (empty($_SESSION['switch']['applications']) || !is_array($_SESSION['switch']['applications'])) {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$result = event_socket_request($fp, 'api show application');
|
||||
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$result = event_socket::api('show application');
|
||||
|
||||
$show_applications = explode("\n\n", $result);
|
||||
$raw_applications = explode("\n", $show_applications[0]);
|
||||
unset($result);
|
||||
unset($fp);
|
||||
unset($esl);
|
||||
|
||||
$previous_application = null;
|
||||
foreach($raw_applications as $row) {
|
||||
|
|
|
|||
|
|
@ -383,11 +383,11 @@
|
|||
$domain_name = $database->select($sql, $parameters, 'column');
|
||||
|
||||
//send the message waiting status
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
//$switch_cmd .= "luarun app.lua voicemail mwi ".$voicemail_id."@".$domain_name;
|
||||
$switch_cmd .= "luarun app/voicemail/resources/scripts/mwi_notify.lua ".$voicemail_id." ".$domain_name." 0 0";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_cmd .= "luarun app/voicemail/resources/scripts/mwi_notify.lua $voicemail_id $domain_name 0 0";
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
echo $switch_cmd."\n";
|
||||
}
|
||||
else {
|
||||
|
|
@ -517,7 +517,7 @@
|
|||
unset($mail);
|
||||
|
||||
//save output to
|
||||
//$fp = fopen(sys_get_temp_dir()."/mailer-app.log", "a");
|
||||
//$esl = fopen(sys_get_temp_dir()."/mailer-app.log", "a");
|
||||
|
||||
//prepare the output buffers
|
||||
//ob_end_clean();
|
||||
|
|
@ -532,7 +532,7 @@
|
|||
|
||||
//ob_end_clean(); //clean the buffer
|
||||
|
||||
//fwrite($fp, $content);
|
||||
//fclose($fp);
|
||||
//fwrite($esl, $content);
|
||||
//fclose($esl);
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -157,8 +157,8 @@ if (!class_exists('event_guard')) {
|
|||
$cmd = "sendevent CUSTOM\n";
|
||||
$cmd .= "Event-Name: CUSTOM\n";
|
||||
$cmd .= "Event-Subclass: event_guard:unblock\n";
|
||||
$fp = event_socket_create();
|
||||
$switch_result = event_socket_request($fp, $cmd);
|
||||
$esl = event_socket::create();
|
||||
$switch_result = event_socket::command($cmd);
|
||||
|
||||
//set message
|
||||
message::add($text['message-delete']);
|
||||
|
|
|
|||
|
|
@ -780,8 +780,8 @@
|
|||
|
||||
//reload acl if allowed
|
||||
if (permission_exists("extension_cidr")) {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) { event_socket_request($fp, "api reloadacl"); }
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) { event_socket::api("reloadacl"); }
|
||||
}
|
||||
|
||||
//check the permissions
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@
|
|||
$switch_cmd = 'show channels as json';
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//send the event socket command and get the array
|
||||
if ($fp) {
|
||||
$json = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
if ($esl->is_connected()) {
|
||||
$json = trim($esl->api($switch_cmd));
|
||||
$results = json_decode($json, "true");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -212,8 +212,8 @@
|
|||
if ($fax_status == 'waiting' || $fax_status == 'trying' || $fax_status == 'busy') {
|
||||
|
||||
//create event socket handle
|
||||
$fp = event_socket_create();
|
||||
if (!$fp) {
|
||||
$esl = event_socket::create();
|
||||
if (!$esl->is_connected()) {
|
||||
echo "Could not connect to event socket.\n";
|
||||
exit;
|
||||
}
|
||||
|
|
@ -297,7 +297,7 @@
|
|||
//send the fax and try another route if the fax fails
|
||||
foreach($route_array as $route) {
|
||||
$fax_command = "originate {" . $dial_string . ",fax_uri=".$route."}" . $route." &txfax('".$fax_file."')";
|
||||
$fax_response = event_socket_request($fp, "api " . $fax_command);
|
||||
$fax_response = event_socket::api($fax_command);
|
||||
$response = str_replace("\n", "", $fax_response);
|
||||
$response = trim(str_replace("+OK", "", $response));
|
||||
if (is_uuid($response)) {
|
||||
|
|
@ -311,8 +311,7 @@
|
|||
echo "response: ".$response."\n";
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
|
||||
|
||||
//set the fax file name without the extension
|
||||
$fax_instance_id = pathinfo($fax_file, PATHINFO_FILENAME);
|
||||
|
||||
|
|
|
|||
|
|
@ -51,38 +51,38 @@
|
|||
/*
|
||||
if ($action == "energy") {
|
||||
//conference 3001-example.dyndns.org energy 103
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$result_array = explode("=",$switch_result);
|
||||
$tmp_value = $result_array[1];
|
||||
if ($direction == "up") { $tmp_value = $tmp_value + 100; }
|
||||
if ($direction == "down") { $tmp_value = $tmp_value - 100; }
|
||||
//echo "energy $tmp_value<br />\n";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
|
||||
$switch_result = event_socket::api($switch_cmd.' '.$tmp_value);
|
||||
}
|
||||
if ($action == "volume_in") {
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$result_array = explode("=",$switch_result);
|
||||
$tmp_value = $result_array[1];
|
||||
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
|
||||
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
|
||||
//echo "volume $tmp_value<br />\n";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
|
||||
$switch_result = event_socket::api($switch_cmd.' '.$tmp_value);
|
||||
}
|
||||
if ($action == "volume_out") {
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$result_array = explode("=",$switch_result);
|
||||
$tmp_value = $result_array[1];
|
||||
if ($direction == "up") { $tmp_value = $tmp_value + 1; }
|
||||
if ($direction == "down") { $tmp_value = $tmp_value - 1; }
|
||||
//echo "volume $tmp_value<br />\n";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
|
||||
$switch_result = event_socket::api($switch_cmd.' '.$tmp_value);
|
||||
}
|
||||
*/
|
||||
//connect to the event socket
|
||||
//$fp = event_socket_create();
|
||||
//$esl = event_socket::create();
|
||||
//send the command over event socket
|
||||
//if ($fp) {
|
||||
// $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
//if ($esl->is_connected()) {
|
||||
// $switch_result = event_socket::api($switch_cmd);
|
||||
//}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@
|
|||
|
||||
$switch_cmd = 'fifo list_verbose '.$fifo_name.'';
|
||||
|
||||
$fp = event_socket_create();
|
||||
if (!$fp) {
|
||||
$esl = event_socket::create();
|
||||
if (!$esl->is_connected()) {
|
||||
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
|
||||
echo "<div align='center'>\n";
|
||||
echo "<table width='40%'>\n";
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
}
|
||||
else {
|
||||
//send the api command over event socket
|
||||
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
$xml_str = trim(event_socket::api($switch_cmd));
|
||||
|
||||
//parse the response as xml
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@
|
|||
|
||||
//show the list
|
||||
$switch_cmd = 'fifo list';
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$xml_str = trim(event_socket::api($switch_cmd));
|
||||
try {
|
||||
$xml = new SimpleXMLElement($xml_str);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,8 +143,8 @@
|
|||
save_gateway_xml();
|
||||
|
||||
//clear the cache
|
||||
$fp = event_socket_create();
|
||||
$hostname = trim(event_socket_request($fp, 'api switchname'));
|
||||
$esl = event_socket::create();
|
||||
$hostname = trim(event_socket::api('switchname'));
|
||||
$cache = new cache;
|
||||
$cache->delete("configuration:sofia.conf:".$hostname);
|
||||
|
||||
|
|
|
|||
|
|
@ -227,20 +227,16 @@
|
|||
save_gateway_xml();
|
||||
|
||||
//clear the cache
|
||||
$fp = event_socket_create();
|
||||
$hostname = trim(event_socket_request($fp, 'api switchname'));
|
||||
$esl = event_socket::create();
|
||||
$hostname = trim(event_socket::api('switchname'));
|
||||
$cache = new cache;
|
||||
$cache->delete("configuration:sofia.conf:".$hostname);
|
||||
|
||||
//rescan the external profile to look for new or stopped gateways
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$tmp_cmd = 'api sofia profile external rescan';
|
||||
$response = event_socket_request($fp, $tmp_cmd);
|
||||
unset($tmp_cmd);
|
||||
$esl = event_socket::create();
|
||||
$response = event_socket::api('sofia profile external rescan');
|
||||
usleep(1000);
|
||||
//close the connection
|
||||
fclose($fp);
|
||||
//clear the apply settings reminder
|
||||
$_SESSION["reload_xml"] = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -70,15 +70,15 @@
|
|||
$obj->delete($gateways);
|
||||
}
|
||||
case 'start':
|
||||
$fp = event_socket_create();
|
||||
if ($fp && permission_exists('gateway_edit')) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl && permission_exists('gateway_edit')) {
|
||||
$obj = new gateways;
|
||||
$obj->start($gateways);
|
||||
}
|
||||
break;
|
||||
case 'stop':
|
||||
$fp = event_socket_create();
|
||||
if ($fp && permission_exists('gateway_edit')) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl && permission_exists('gateway_edit')) {
|
||||
$obj = new gateways;
|
||||
$obj->stop($gateways);
|
||||
}
|
||||
|
|
@ -90,19 +90,19 @@
|
|||
}
|
||||
|
||||
//connect to event socket
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//gateway status function
|
||||
if (!function_exists('switch_gateway_status')) {
|
||||
function switch_gateway_status($gateway_uuid, $result_type = 'xml') {
|
||||
global $fp;
|
||||
if ($fp) {
|
||||
$fp = event_socket_create();
|
||||
$cmd = 'api sofia xmlstatus gateway '.$gateway_uuid;
|
||||
$response = trim(event_socket_request($fp, $cmd));
|
||||
global $esl;
|
||||
if ($esl->is_connected()) {
|
||||
$esl = event_socket::create();
|
||||
$cmd = 'sofia xmlstatus gateway '.$gateway_uuid;
|
||||
$response = trim(event_socket::api($cmd));
|
||||
if ($response == "Invalid Gateway!") {
|
||||
$cmd = 'api sofia xmlstatus gateway '.strtoupper($gateway_uuid);
|
||||
$response = trim(event_socket_request($fp, $cmd));
|
||||
$cmd = 'sofia xmlstatus gateway '.strtoupper($gateway_uuid);
|
||||
$response = trim(event_socket::api($cmd));
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
|
@ -267,7 +267,7 @@
|
|||
echo "<th class='hide-sm-dn'>".$text['label-proxy']."</th>\n";
|
||||
echo th_order_by('context', $text['label-context'], $order_by, $order);
|
||||
echo th_order_by('register', $text['label-register'], $order_by, $order);
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
echo "<th class='hide-sm-dn'>".$text['label-status']."</th>\n";
|
||||
if (permission_exists('gateway_edit')) {
|
||||
echo "<th class='center'>".$text['label-action']."</th>\n";
|
||||
|
|
@ -316,7 +316,7 @@
|
|||
echo " <td>".escape($row["proxy"])."</td>\n";
|
||||
echo " <td>".escape($row["context"])."</td>\n";
|
||||
echo " <td>".ucwords(escape($row["register"]))."</td>\n";
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
if ($row["enabled"] == "true") {
|
||||
$response = switch_gateway_status($row["gateway_uuid"]);
|
||||
if ($response == "Invalid Gateway!") {
|
||||
|
|
|
|||
|
|
@ -110,23 +110,23 @@ if (!class_exists('gateways')) {
|
|||
|
||||
if (!empty($gateways) && is_array($gateways) && @sizeof($gateways) != 0) {
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
//start gateways
|
||||
foreach ($gateways as $gateway_uuid => $gateway) {
|
||||
if ($gateway['enabled'] == 'true') {
|
||||
//start gateways
|
||||
foreach ($gateways as $gateway_uuid => $gateway) {
|
||||
if ($gateway['enabled'] == 'true') {
|
||||
$cmd = 'api sofia profile '.$gateway['profile'].' startgw '.$gateway_uuid;
|
||||
$cmd = 'sofia profile '.$gateway['profile'].' startgw '.$gateway_uuid;
|
||||
$responses[$gateway_uuid]['gateway'] = $gateway['name'];
|
||||
$responses[$gateway_uuid]['message'] = trim(event_socket_request($fp, $cmd));
|
||||
$responses[$gateway_uuid]['message'] = trim(event_socket::api($cmd));
|
||||
}
|
||||
}
|
||||
//old method used to start gateways
|
||||
//$cmd = 'api sofia profile '.$gateway['profile'].' rescan';
|
||||
//$cmd = 'sofia profile '.$gateway['profile'].' rescan';
|
||||
//$responses[$gateway_uuid]['gateway'] = $gateway['name'];
|
||||
//$responses[$gateway_uuid]['message'] = trim(event_socket_request($fp, $cmd));
|
||||
//$responses[$gateway_uuid]['message'] = trim(event_socket::api($cmd));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -198,14 +198,14 @@ if (!class_exists('gateways')) {
|
|||
|
||||
if (!empty($gateways) && is_array($gateways) && @sizeof($gateways) != 0) {
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
//stop gateways
|
||||
foreach ($gateways as $gateway_uuid => $gateway) {
|
||||
if ($gateway['enabled'] == 'true') {
|
||||
$cmd = 'api sofia profile '.$gateway['profile'].' killgw '.$gateway_uuid;
|
||||
$cmd = 'sofia profile '.$gateway['profile'].' killgw '.$gateway_uuid;
|
||||
$responses[$gateway_uuid]['gateway'] = $gateway['name'];
|
||||
$responses[$gateway_uuid]['message'] = trim(event_socket_request($fp, $cmd));
|
||||
$responses[$gateway_uuid]['message'] = trim(event_socket::api($cmd));
|
||||
}
|
||||
}
|
||||
//set message
|
||||
|
|
@ -274,9 +274,7 @@ if (!class_exists('gateways')) {
|
|||
}
|
||||
|
||||
//create the event socket connection
|
||||
if (!isset($fp)) {
|
||||
$fp = event_socket_create();
|
||||
}
|
||||
$esl = event_socket::create();
|
||||
|
||||
//loop through gateways
|
||||
$x = 0;
|
||||
|
|
@ -294,9 +292,9 @@ if (!class_exists('gateways')) {
|
|||
}
|
||||
|
||||
//send the api command to stop the gateway
|
||||
if ($fp) {
|
||||
$cmd = 'api sofia profile '.$gateway['profile'].' killgw '.$gateway_uuid;
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
if ($esl->is_connected()) {
|
||||
$cmd = 'sofia profile '.$gateway['profile'].' killgw '.$gateway_uuid;
|
||||
$response = event_socket::api($cmd);
|
||||
unset($cmd);
|
||||
}
|
||||
|
||||
|
|
@ -320,20 +318,16 @@ if (!class_exists('gateways')) {
|
|||
save_gateway_xml();
|
||||
|
||||
//clear the cache
|
||||
if (!$fp) {
|
||||
$fp = event_socket_create();
|
||||
}
|
||||
if ($fp) {
|
||||
$hostname = trim(event_socket_request($fp, 'api switchname'));
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$hostname = trim(event_socket::api('switchname'));
|
||||
$cache = new cache;
|
||||
$cache->delete("configuration:sofia.conf:".$hostname);
|
||||
}
|
||||
|
||||
//rescan the sip profile to look for new or stopped gateways
|
||||
if (!$fp) {
|
||||
$fp = event_socket_create();
|
||||
}
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
//get distinct profiles from gateways
|
||||
foreach ($gateways as $gateway) {
|
||||
$array[] = $gateway['profile'];
|
||||
|
|
@ -342,13 +336,8 @@ if (!class_exists('gateways')) {
|
|||
|
||||
//send the api command to rescan each profile
|
||||
foreach ($profiles as $profile) {
|
||||
$cmd = 'api sofia profile '.$profile.' rescan';
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$response = event_socket::api("sofia profile $profile rescan");
|
||||
}
|
||||
unset($cmd);
|
||||
|
||||
//close the connection
|
||||
fclose($fp);
|
||||
}
|
||||
usleep(1000);
|
||||
|
||||
|
|
@ -452,18 +441,16 @@ if (!class_exists('gateways')) {
|
|||
save_gateway_xml();
|
||||
|
||||
//clear the cache
|
||||
$fp = event_socket_create();
|
||||
$hostname = trim(event_socket_request($fp, 'api switchname'));
|
||||
$esl = event_socket::create();
|
||||
$hostname = trim(event_socket::api('switchname'));
|
||||
$cache = new cache;
|
||||
$cache->delete("configuration:sofia.conf:".$hostname);
|
||||
|
||||
//create the event socket connection
|
||||
if (!$fp) {
|
||||
$fp = event_socket_create();
|
||||
}
|
||||
$esl = event_socket::create();
|
||||
|
||||
//rescan the sip profile to look for new or stopped gateways
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
//get distinct profiles from gateways
|
||||
foreach ($gateways as $gateway) {
|
||||
$array[] = $gateway['profile'];
|
||||
|
|
@ -472,13 +459,8 @@ if (!class_exists('gateways')) {
|
|||
|
||||
//send the api command to rescan each profile
|
||||
foreach ($profiles as $profile) {
|
||||
$cmd = 'api sofia profile '.$profile.' rescan';
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
event_socket::api("sofia profile $profile rescan");
|
||||
}
|
||||
unset($cmd);
|
||||
|
||||
//close the connection
|
||||
fclose($fp);
|
||||
}
|
||||
usleep(1000);
|
||||
|
||||
|
|
@ -585,8 +567,8 @@ if (!class_exists('gateways')) {
|
|||
save_gateway_xml();
|
||||
|
||||
//clear the cache
|
||||
$fp = event_socket_create();
|
||||
$hostname = trim(event_socket_request($fp, 'api switchname'));
|
||||
$esl = event_socket::create();
|
||||
$hostname = trim(event_socket::api('switchname'));
|
||||
$cache = new cache;
|
||||
$cache->delete("configuration:sofia.conf:".$hostname);
|
||||
|
||||
|
|
|
|||
|
|
@ -92,17 +92,10 @@
|
|||
}
|
||||
|
||||
//connect to event socket
|
||||
$fp = event_socket_create();
|
||||
|
||||
//check connection status
|
||||
$esl_alive = false;
|
||||
if ($fp) {
|
||||
$esl_alive = true;
|
||||
fclose($fp);
|
||||
}
|
||||
$esl = event_socket::create();
|
||||
|
||||
//warn if switch not running
|
||||
if (!$fp) {
|
||||
if (!$esl->is_connected()) {
|
||||
message::add($text['error-event-socket'], 'negative', 5000);
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +126,7 @@
|
|||
echo "<div class='action_bar' id='action_bar'>\n";
|
||||
echo " <div class='heading'><b>".$text['header-modules']." (".$module_count.")</b></div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
if (permission_exists('module_edit') && $modules && $fp) {
|
||||
if (permission_exists('module_edit') && $modules && $esl->is_connected()) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-stop'],'icon'=>$_SESSION['theme']['button_icon_stop'],'onclick'=>"modal_open('modal-stop','btn_stop');"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-start'],'icon'=>$_SESSION['theme']['button_icon_start'],'onclick'=>"modal_open('modal-start','btn_start');"]);
|
||||
}
|
||||
|
|
@ -151,7 +144,7 @@
|
|||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
if (permission_exists('module_edit') && !empty($modules) && $fp) {
|
||||
if (permission_exists('module_edit') && !empty($modules) && $esl->is_connected()) {
|
||||
echo modal::create(['id'=>'modal-stop','type'=>'general','message'=>$text['confirm-stop_modules'],'actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_stop','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('stop'); list_form_submit('form_list');"])]);
|
||||
echo modal::create(['id'=>'modal-start','type'=>'general','message'=>$text['confirm-start_modules'],'actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_start','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('start'); list_form_submit('form_list');"])]);
|
||||
}
|
||||
|
|
@ -171,7 +164,7 @@
|
|||
|
||||
echo "<table class='list'>\n";
|
||||
function write_header($modifier) {
|
||||
global $fp, $text, $modules, $list_row_edit_button;
|
||||
global $text, $modules, $list_row_edit_button;
|
||||
$modifier = str_replace('/', '', $modifier);
|
||||
$modifier = str_replace(' ', ' ', $modifier);
|
||||
$modifier = str_replace(' ', '_', $modifier);
|
||||
|
|
@ -185,7 +178,8 @@
|
|||
}
|
||||
echo "<th>".$text['label-label']."</th>\n";
|
||||
echo "<th class='hide-xs'>".$text['label-status']."</th>\n";
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
echo "<th class='center'>".$text['label-action']."</th>\n";
|
||||
}
|
||||
echo "<th class='center'>".$text['label-enabled']."</th>\n";
|
||||
|
|
@ -229,7 +223,7 @@
|
|||
echo escape($row['module_label']);
|
||||
}
|
||||
echo " </td>\n";
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
if ($module->active($row["module_name"])) {
|
||||
echo " <td class='hide-xs'>".$text['label-running']."</td>\n";
|
||||
if (permission_exists('module_edit')) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ if (!class_exists('modules')) {
|
|||
* declare public variables
|
||||
*/
|
||||
public $dir;
|
||||
public $fp;
|
||||
public $esl;
|
||||
public $modules;
|
||||
public $msg;
|
||||
|
||||
|
|
@ -65,9 +65,8 @@ if (!class_exists('modules')) {
|
|||
$this->toggle_values = ['true','false'];
|
||||
|
||||
//get the list of active modules
|
||||
$this->fp = event_socket_create();
|
||||
$cmd = "api show modules as json";
|
||||
$json = event_socket_request($this->fp, $cmd);
|
||||
$this->esl = event_socket::create();
|
||||
$json = $this->esl->api("show modules as json");
|
||||
$this->active_modules = json_decode($json, true);
|
||||
}
|
||||
|
||||
|
|
@ -884,15 +883,14 @@ if (!class_exists('modules')) {
|
|||
|
||||
if (is_array($modules) && @sizeof($modules) != 0) {
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
//control modules
|
||||
foreach ($modules as $module_uuid => $module) {
|
||||
if ($module['enabled'] == 'true') {
|
||||
$cmd = 'api '.$action.' '.$module['name'];
|
||||
$responses[$module_uuid]['module'] = $module['name'];
|
||||
$responses[$module_uuid]['message'] = trim(event_socket_request($fp, $cmd));
|
||||
$responses[$module_uuid]['message'] = trim(event_socket::api($action.' '.$module['name']));
|
||||
}
|
||||
else {
|
||||
$responses[$module_uuid]['module'] = $module['name'];
|
||||
|
|
@ -970,15 +968,14 @@ if (!class_exists('modules')) {
|
|||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//stop modules
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
foreach ($modules as $module_uuid => $module) {
|
||||
if ($this->active($module['name'])) {
|
||||
$cmd = 'api unload '.$module['name'];
|
||||
$responses[$module_uuid]['module'] = $module['name'];
|
||||
$responses[$module_uuid]['message'] = trim(event_socket_request($fp, $cmd));
|
||||
$responses[$module_uuid]['message'] = trim(event_socket::api('unload '.$module['name']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1070,15 +1067,15 @@ if (!class_exists('modules')) {
|
|||
unset($array);
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//stop modules if active
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
foreach ($modules as $module_uuid => $module) {
|
||||
if ($this->active($module['name'])) {
|
||||
$cmd = 'api unload '.$module['name'];
|
||||
$cmd = 'unload '.$module['name'];
|
||||
$responses[$module_uuid]['module'] = $module['name'];
|
||||
$responses[$module_uuid]['message'] = trim(event_socket_request($fp, $cmd));
|
||||
$responses[$module_uuid]['message'] = trim(event_socket::api($cmd));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,15 +147,15 @@ if (!class_exists('switch_music_on_hold')) {
|
|||
|
||||
public function reload() {
|
||||
//if the handle does not exist create it
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
//if the handle still does not exist show an error message
|
||||
if (!$fp) {
|
||||
if (!$esl->is_connected()) {
|
||||
$msg = "<div align='center'>".$text['message-event-socket']."<br /></div>";
|
||||
}
|
||||
//send the api command to check if the module exists
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
$cmd = "reload mod_local_stream";
|
||||
$switch_result = event_socket_request($fp, 'api '.$cmd);
|
||||
$switch_result = event_socket::api($cmd);
|
||||
unset($cmd);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,22 +42,20 @@
|
|||
$rdr = $_GET['rdr'];
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
//reloadxml
|
||||
if ($cmd == "api reloadxml") {
|
||||
message::add(rtrim(event_socket_request($fp, $cmd)), 'alert');
|
||||
message::add(rtrim(event_socket::command($cmd)), 'alert');
|
||||
unset($cmd);
|
||||
}
|
||||
|
||||
//reload mod_translate
|
||||
if ($cmd == "api reload mod_translate") {
|
||||
message::add(rtrim(event_socket_request($fp, $cmd)), 'alert');
|
||||
message::add(rtrim(event_socket::command($cmd)), 'alert');
|
||||
unset($cmd);
|
||||
}
|
||||
|
||||
//close the connection
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
|
|
|
|||
|
|
@ -142,8 +142,8 @@ if ($domains_processed == 1) {
|
|||
//save_phrases_xml();
|
||||
|
||||
//delete the phrase from memcache
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
//get phrase languages
|
||||
$sql = "select distinct phrase_language from v_phrases order by phrase_language asc ";
|
||||
$database = new database;
|
||||
|
|
@ -158,7 +158,7 @@ if ($domains_processed == 1) {
|
|||
}
|
||||
unset($sql, $result, $row);
|
||||
}
|
||||
unset($fp);
|
||||
unset($esl);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ if (!class_exists('registrations')) {
|
|||
$id = 0;
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//get the default settings
|
||||
$sql = "select sip_profile_name from v_sip_profiles ";
|
||||
|
|
@ -77,7 +77,7 @@ if (!class_exists('registrations')) {
|
|||
|
||||
//get sofia status profile information including registrations
|
||||
$cmd = "api sofia xmlstatus profile '".$field['sip_profile_name']."' reg";
|
||||
$xml_response = trim(event_socket_request($fp, $cmd));
|
||||
$xml_response = trim(event_socket::command($cmd));
|
||||
|
||||
//show an error message
|
||||
if ($xml_response == "Invalid Profile!") {
|
||||
|
|
@ -269,10 +269,10 @@ if (!class_exists('registrations')) {
|
|||
unset($sql);
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//loop through registrations
|
||||
if ($fp) {
|
||||
if ($esl->is_connected()) {
|
||||
//check if registrations exist
|
||||
if (is_array($registrations)) {
|
||||
foreach ($registrations as $registration) {
|
||||
|
|
@ -332,9 +332,9 @@ if (!class_exists('registrations')) {
|
|||
}
|
||||
|
||||
//send the api command
|
||||
if (!empty($command) && $fp) {
|
||||
$response_api[$registration['user']]['command'] = event_socket_request($fp, "api ".$command);
|
||||
$response_api[$registration['user']]['log'] = event_socket_request($fp, "api log notice ".$command);
|
||||
if (!empty($command) && $esl->is_connected()) {
|
||||
$response_api[$registration['user']]['command'] = event_socket::api($command);
|
||||
$response_api[$registration['user']]['log'] = event_socket::api("log notice $command");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,9 +154,9 @@ if (!class_exists('sip_profiles')) {
|
|||
}
|
||||
}
|
||||
if ($empty_hostname) {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$hostnames[] = event_socket_request($fp, 'api switchname');
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$hostnames[] = event_socket::api('switchname');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -237,9 +237,9 @@ if (!class_exists('sip_profiles')) {
|
|||
|
||||
//get system hostname if necessary
|
||||
if (empty($sip_profile_hostname)) {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$sip_profile_hostname = event_socket_request($fp, 'api switchname');
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$sip_profile_hostname = event_socket::api('switchname');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -315,9 +315,9 @@ if (!class_exists('sip_profiles')) {
|
|||
|
||||
//get system hostname if necessary
|
||||
if (empty($sip_profile_hostname)) {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$sip_profile_hostname = event_socket_request($fp, 'api switchname');
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$sip_profile_hostname = event_socket::api('switchname');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -403,9 +403,9 @@ if (!class_exists('sip_profiles')) {
|
|||
}
|
||||
}
|
||||
if ($empty_hostname) {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$hostnames[] = event_socket_request($fp, 'api switchname');
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$hostnames[] = event_socket::api('switchname');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -247,9 +247,9 @@
|
|||
|
||||
//get the hostname
|
||||
if ($sip_profile_hostname == '') {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$sip_profile_hostname = event_socket_request($fp, 'api switchname');
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$sip_profile_hostname = event_socket::api('switchname');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,15 +91,15 @@
|
|||
}
|
||||
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
//if reloadxml then run reloadacl, reloadxml and rescan the external profile for new gateways
|
||||
if (isset($command)) {
|
||||
//clear the apply settings reminder
|
||||
$_SESSION["reload_xml"] = false;
|
||||
|
||||
//run the command
|
||||
$result = rtrim(event_socket_request($fp, 'api '.$command));
|
||||
$result = rtrim(event_socket::api($command));
|
||||
}
|
||||
|
||||
//sofia profile
|
||||
|
|
@ -109,9 +109,6 @@
|
|||
else if (!empty($result)) {
|
||||
message::add($result, 'alert');
|
||||
}
|
||||
|
||||
//close the connection
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
//redirect the user
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@
|
|||
$text = $language->get();
|
||||
|
||||
//create event socket
|
||||
$fp = event_socket_create();
|
||||
if (!$fp) {
|
||||
$esl = event_socket::create();
|
||||
if (!$esl->is_connected()) {
|
||||
message::add($text['error-event-socket'], 'negative', 5000);
|
||||
}
|
||||
|
||||
|
|
@ -57,8 +57,8 @@
|
|||
unset($sql);
|
||||
|
||||
//get the sip profiles
|
||||
if ($fp) {
|
||||
$hostname = trim(event_socket_request($fp, 'api switchname'));
|
||||
if ($esl->is_connected()) {
|
||||
$hostname = trim(event_socket::api('switchname'));
|
||||
}
|
||||
$sql = "select sip_profile_uuid, sip_profile_name from v_sip_profiles ";
|
||||
$sql .= "where sip_profile_enabled = 'true' ";
|
||||
|
|
@ -80,8 +80,8 @@
|
|||
|
||||
//get status
|
||||
try {
|
||||
$cmd = "api sofia xmlstatus";
|
||||
$xml_response = trim(event_socket_request($fp, $cmd));
|
||||
$cmd = "sofia xmlstatus";
|
||||
$xml_response = trim(event_socket::api($cmd));
|
||||
if ($xml_response) {
|
||||
$xml = new SimpleXMLElement($xml_response);
|
||||
}
|
||||
|
|
@ -91,8 +91,8 @@
|
|||
message::add($message, 'negative', 5000);
|
||||
}
|
||||
try {
|
||||
$cmd = "api sofia xmlstatus gateway";
|
||||
$xml_response = trim(event_socket_request($fp, $cmd));
|
||||
$cmd = "sofia xmlstatus gateway";
|
||||
$xml_response = trim(event_socket::api($cmd));
|
||||
if ($xml_response) {
|
||||
$xml_gateways = new SimpleXMLElement($xml_response);
|
||||
}
|
||||
|
|
@ -221,10 +221,9 @@
|
|||
}
|
||||
|
||||
//sofia status profile
|
||||
if ($fp && permission_exists('system_status_sofia_status_profile')) {
|
||||
if ($esl && permission_exists('system_status_sofia_status_profile')) {
|
||||
foreach ($sip_profiles as $sip_profile_name => $sip_profile_uuid) {
|
||||
$cmd = "api sofia xmlstatus profile ".$sip_profile_name."";
|
||||
$xml_response = trim(event_socket_request($fp, $cmd));
|
||||
$xml_response = trim(event_socket::api("sofia xmlstatus profile $sip_profile_name"));
|
||||
if ($xml_response == "Invalid Profile!") {
|
||||
$xml_response = "<error_msg>Invalid Profile!</error_msg>";
|
||||
$profile_state = 'stopped';
|
||||
|
|
@ -309,16 +308,14 @@
|
|||
}
|
||||
|
||||
//status
|
||||
if ($fp && permission_exists('sip_status_switch_status')) {
|
||||
$cmd = "api status";
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
if ($esl->is_connected() && permission_exists('sip_status_switch_status')) {
|
||||
$response = event_socket::api("status");
|
||||
echo "<b><a href='javascript:void(0);' onclick=\"$('#status').slideToggle();\">".$text['title-status']."</a></b>\n";
|
||||
echo "<div id='status' style='margin-top: 20px; font-size: 9pt;'>";
|
||||
echo "<pre>";
|
||||
echo trim(escape($response));
|
||||
echo "</pre>\n";
|
||||
echo "</div>";
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
//include the footer
|
||||
|
|
|
|||
|
|
@ -36,10 +36,7 @@ if (!class_exists('presence')) {
|
|||
* @var string $presence_id
|
||||
*/
|
||||
public function active($presence_id) {
|
||||
$fp = event_socket_create();
|
||||
$cmd = 'show calls as json';
|
||||
$json = event_socket_request($fp, 'api '.$cmd);
|
||||
unset($fp);
|
||||
$json = event_socket::api('show calls as json');
|
||||
$call_array = json_decode($json, true);
|
||||
if (isset($call_array['rows'])) {
|
||||
$x = 0;
|
||||
|
|
@ -65,10 +62,7 @@ if (!class_exists('presence')) {
|
|||
* show presence
|
||||
*/
|
||||
public function show() {
|
||||
$fp = event_socket_create();
|
||||
$cmd = 'show calls as json';
|
||||
$json = event_socket_request($fp, 'api '.$cmd);
|
||||
unset($fp);
|
||||
$json = event_socket::api('show calls as json');
|
||||
$call_array = json_decode($json, true);
|
||||
if (isset($call_array['rows'])) {
|
||||
$x = 0;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<configuration name="event_socket.conf" description="Socket Client">
|
||||
<settings>
|
||||
<param name="nat-map" value="false"/>
|
||||
<param name="listen-ip" value="127.0.0.1"/>
|
||||
<param name="listen-ip" value="0.0.0.0"/>
|
||||
<param name="listen-port" value="8021"/>
|
||||
<param name="password" value="ClueCon"/>
|
||||
<!--<param name="apply-inbound-acl" value="lan"/>-->
|
||||
|
|
|
|||
|
|
@ -26,19 +26,19 @@
|
|||
$row_style["1"] = "row_style1";
|
||||
|
||||
//connect to event socket
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
|
||||
//switch version
|
||||
if (permission_exists('switch_version') && $fp) {
|
||||
$switch_version = event_socket_request($fp, 'api version');
|
||||
if (permission_exists('switch_version') && $esl->is_connected()) {
|
||||
$switch_version = event_socket::api('version');
|
||||
preg_match("/FreeSWITCH Version (\d+\.\d+\.\d+(?:\.\d+)?).*\(.*?(\d+\w+)\s*\)/", $switch_version, $matches);
|
||||
$switch_version = $matches[1];
|
||||
$switch_bits = $matches[2];
|
||||
}
|
||||
|
||||
//switch uptime
|
||||
if (permission_exists('switch_uptime') && $fp) {
|
||||
$tmp = event_socket_request($fp, 'api status');
|
||||
if (permission_exists('switch_uptime') && $esl->is_connected()) {
|
||||
$tmp = event_socket::api('status');
|
||||
$tmp = explode("\n", $tmp);
|
||||
$tmp = $tmp[0];
|
||||
$tmp = explode(' ', $tmp);
|
||||
|
|
@ -55,8 +55,8 @@
|
|||
//channel count
|
||||
$channels = '';
|
||||
$tr_link_channels = '';
|
||||
if (permission_exists('switch_channels') && $fp) {
|
||||
$tmp = event_socket_request($fp, 'api status');
|
||||
if (permission_exists('switch_channels') && $esl->is_connected()) {
|
||||
$tmp = event_socket::api('status');
|
||||
$matches = Array();
|
||||
preg_match("/(\d+)\s+session\(s\)\s+\-\speak/", $tmp, $matches);
|
||||
$channels = $matches[1] ? $matches[1] : 0;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
$cpu_cores = trim($result);
|
||||
}
|
||||
if (stristr(PHP_OS, 'Linux')) {
|
||||
$result = trim(shell_exec("grep -P '^processor' /proc/cpuinfo"));
|
||||
$result = @trim(shell_exec("grep -P '^processor' /proc/cpuinfo"));
|
||||
$cpu_cores = count(explode("\n", $result));
|
||||
}
|
||||
if ($cpu_cores > 1) { $percent_cpu = $percent_cpu / $cpu_cores; }
|
||||
|
|
|
|||
|
|
@ -187,8 +187,9 @@
|
|||
}
|
||||
|
||||
//channel count
|
||||
if (isset($fp)) {
|
||||
$tmp = event_socket_request($fp, 'api status');
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$tmp = event_socket::api('status');
|
||||
$matches = Array();
|
||||
preg_match("/(\d+)\s+session\(s\)\s+\-\speak/", $tmp, $matches);
|
||||
$channels = !empty($matches[1]) ? $matches[1] : 0;
|
||||
|
|
@ -201,7 +202,7 @@
|
|||
}
|
||||
|
||||
//registration count
|
||||
if (isset($fp) && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/registrations/")) {
|
||||
if ($esl->is_connected() && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/registrations/")) {
|
||||
$registration = new registrations;
|
||||
$registrations = $registration->count();
|
||||
$tr_link = "href='".PROJECT_PATH."/app/registrations/registrations.php'";
|
||||
|
|
|
|||
|
|
@ -144,9 +144,9 @@
|
|||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$switch_version = event_socket_request($fp, 'api version');
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$switch_version = event_socket::api('version');
|
||||
preg_match("/FreeSWITCH Version (\d+\.\d+\.\d+(?:\.\d+)?).*\(.*?(\d+\w+)\s*\)/", $switch_version, $matches);
|
||||
$switch_version = $matches[1];
|
||||
$switch_bits = $matches[2];
|
||||
|
|
@ -544,10 +544,10 @@
|
|||
$memcache_fail = false;
|
||||
$mod = new modules;
|
||||
if ($mod -> active("mod_memcache")) {
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$switch_cmd = "memcache status verbose";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
$memcache_lines = preg_split('/\n/', $switch_result);
|
||||
foreach($memcache_lines as $memcache_line) {
|
||||
if (!empty(trim($memcache_line)) > 0 && substr_count($memcache_line, ': ')) {
|
||||
|
|
|
|||
|
|
@ -595,10 +595,10 @@
|
|||
|
||||
//send the message waiting status
|
||||
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$switch_cmd = "luarun app.lua voicemail mwi ".$this->voicemail_id."@".$_SESSION['domain_name'];
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -843,7 +843,7 @@
|
|||
* range download method (helps safari play audio sources)
|
||||
*/
|
||||
private function range_download($file) {
|
||||
$fp = @fopen($file, 'rb');
|
||||
$esl = @fopen($file, 'rb');
|
||||
|
||||
$size = filesize($file); // File size
|
||||
$length = $size; // Content length
|
||||
|
|
@ -909,7 +909,7 @@
|
|||
$start = $c_start;
|
||||
$end = $c_end;
|
||||
$length = $end - $start + 1; // Calculate new content length
|
||||
fseek($fp, $start);
|
||||
fseek($esl, $start);
|
||||
header('HTTP/1.1 206 Partial Content');
|
||||
}
|
||||
// Notify the client the byte range we'll be outputting
|
||||
|
|
@ -918,14 +918,14 @@
|
|||
|
||||
// Start buffered download
|
||||
$buffer = 1024 * 8;
|
||||
while(!feof($fp) && ($p = ftell($fp)) <= $end) {
|
||||
while(!feof($esl) && ($p = ftell($esl)) <= $end) {
|
||||
if ($p + $buffer > $end) {
|
||||
// In case we're only outputtin a chunk, make sure we don't
|
||||
// read past the length
|
||||
$buffer = $end - $p + 1;
|
||||
}
|
||||
set_time_limit(0); // Reset time limit for big files
|
||||
echo fread($fp, $buffer);
|
||||
echo fread($esl, $buffer);
|
||||
flush(); // Free up memory. Otherwise large files will trigger PHP's memory limit.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ Mark J Crane <markjcrane@fusionpbx.com>
|
|||
$web_server = $_SERVER['SERVER_SOFTWARE'];
|
||||
|
||||
// switch version
|
||||
$fp = event_socket_create();
|
||||
if ($fp) {
|
||||
$switch_result = event_socket_request($fp, 'api version');
|
||||
$esl = event_socket::create();
|
||||
if ($esl->is_connected()) {
|
||||
$switch_result = event_socket::api('version');
|
||||
}
|
||||
$switch_ver = trim($switch_result);
|
||||
|
||||
|
|
|
|||
|
|
@ -573,16 +573,16 @@
|
|||
|
||||
//update the user_status
|
||||
if (isset($call_center_agent_uuid) && is_uuid($call_center_agent_uuid) && !empty($user_status)) {
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
$switch_cmd = "callcenter_config agent set status ".$call_center_agent_uuid." '".$user_status."'";
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
}
|
||||
|
||||
//update the user state
|
||||
if (isset($call_center_agent_uuid) && is_uuid($call_center_agent_uuid)) {
|
||||
$fp = event_socket_create();
|
||||
$cmd = "api callcenter_config agent set state ".$call_center_agent_uuid." Waiting";
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$esl = event_socket::create();
|
||||
$cmd = "callcenter_config agent set state ".$call_center_agent_uuid." Waiting";
|
||||
$response = event_socket::api($cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,17 +30,15 @@ class cache {
|
|||
//save to memcache
|
||||
if ($_SESSION['cache']['method']['text'] == "memcache") {
|
||||
//connect to event socket
|
||||
$fp = event_socket_create();
|
||||
if ($fp === false) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//run the memcache
|
||||
$command = "memcache set ".$key." ".$value;
|
||||
$result = event_socket_request($fp, 'api '.$command);
|
||||
$result = event_socket::api($command);
|
||||
|
||||
//close event socket
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
//save to the file cache
|
||||
|
|
@ -64,8 +62,8 @@ class cache {
|
|||
//cache method memcache
|
||||
if ($_SESSION['cache']['method']['text'] == "memcache") {
|
||||
// connect to event socket
|
||||
$fp = event_socket_create();
|
||||
if ($fp === false) {
|
||||
$esl = event_socket::create();
|
||||
if (!$esl->is_connected()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -73,10 +71,8 @@ class cache {
|
|||
|
||||
//run the memcache
|
||||
$command = "memcache get ".$key;
|
||||
$result = event_socket_request($fp, 'api '.$command);
|
||||
$result = event_socket::api($command);
|
||||
|
||||
//close event socket
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
//get the file cache
|
||||
|
|
@ -106,8 +102,8 @@ class cache {
|
|||
//cache method memcache
|
||||
if (!empty($_SESSION['cache']['method']['text']) && $_SESSION['cache']['method']['text'] == "memcache") {
|
||||
//connect to event socket
|
||||
$fp = event_socket_create();
|
||||
if ($fp === false) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -117,14 +113,12 @@ class cache {
|
|||
$event .= "Event-Subclass: fusion::memcache\n";
|
||||
$event .= "API-Command: memcache\n";
|
||||
$event .= "API-Command-Argument: delete ".$key."\n";
|
||||
event_socket_request($fp, $event);
|
||||
event_socket::command($event);
|
||||
|
||||
//run the memcache
|
||||
$command = "memcache delete ".$key;
|
||||
$result = event_socket_request($fp, 'api '.$command);
|
||||
$result = event_socket::api($command);
|
||||
|
||||
//close event socket
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
//cache method file
|
||||
|
|
@ -133,8 +127,8 @@ class cache {
|
|||
$key = str_replace(":", ".", $key);
|
||||
|
||||
//connect to event socket
|
||||
$fp = event_socket_create();
|
||||
if ($fp === false) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -144,7 +138,7 @@ class cache {
|
|||
$event .= "Event-Subclass: fusion::file\n";
|
||||
$event .= "API-Command: cache\n";
|
||||
$event .= "API-Command-Argument: delete ".$key."\n";
|
||||
event_socket_request($fp, $event);
|
||||
event_socket::command($event);
|
||||
|
||||
//remove the local files
|
||||
foreach (glob($_SESSION['cache']['location']['text'] . "/" . $key) as $file) {
|
||||
|
|
@ -174,8 +168,8 @@ class cache {
|
|||
//cache method memcache
|
||||
if ($_SESSION['cache']['method']['text'] == "memcache") {
|
||||
// connect to event socket
|
||||
$fp = event_socket_create();
|
||||
if ($fp === false) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -185,21 +179,19 @@ class cache {
|
|||
$event .= "Event-Subclass: fusion::memcache\n";
|
||||
$event .= "API-Command: memcache\n";
|
||||
$event .= "API-Command-Argument: flush\n";
|
||||
event_socket_request($fp, $event);
|
||||
event_socket::command($event);
|
||||
|
||||
//run the memcache
|
||||
$command = "memcache flush";
|
||||
$result = event_socket_request($fp, 'api '.$command);
|
||||
$result = event_socket::api($command);
|
||||
|
||||
//close event socket
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
//cache method file
|
||||
if ($_SESSION['cache']['method']['text'] == "file") {
|
||||
// connect to event socket
|
||||
$fp = event_socket_create();
|
||||
if ($fp === false) {
|
||||
$esl = event_socket::create();
|
||||
if ($esl === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -209,7 +201,7 @@ class cache {
|
|||
$event .= "Event-Subclass: fusion::file\n";
|
||||
$event .= "API-Command: cache\n";
|
||||
$event .= "API-Command-Argument: flush\n";
|
||||
event_socket_request($fp, $event);
|
||||
event_socket::command($event);
|
||||
|
||||
//remove the cache
|
||||
recursive_delete($_SESSION['cache']['location']['text']);
|
||||
|
|
|
|||
|
|
@ -42,26 +42,43 @@ class buffer {
|
|||
//print($b->read_line());
|
||||
//print($b->read_line());
|
||||
|
||||
/**
|
||||
* Subscribes to the event socket of the FreeSWITCH (c) Event Socket Server
|
||||
* @depends buffer::class
|
||||
*/
|
||||
class event_socket {
|
||||
private $buffer;
|
||||
public $fp;
|
||||
|
||||
private static $socket = null;
|
||||
|
||||
/**
|
||||
* Create a new connection to the socket
|
||||
* @param resource|false $fp
|
||||
*/
|
||||
public function __construct($fp = false) {
|
||||
$this->buffer = new buffer;
|
||||
$this->fp = $fp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures a closed connection on destruction of object
|
||||
*/
|
||||
public function __destructor() {
|
||||
$this->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the event body from the socket
|
||||
* @return string|false Content body or false if not connected or empty message
|
||||
* @depends buffer::class
|
||||
*/
|
||||
public function read_event() {
|
||||
if (!$this->fp) {
|
||||
if (!$this->connected()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$b = $this->buffer;
|
||||
$content_length = 0;
|
||||
$content = array();
|
||||
|
||||
while (true) {
|
||||
|
|
@ -87,7 +104,7 @@ class event_socket {
|
|||
$str = $b->read_n($content['Content-Length']);
|
||||
if ($str === false) {
|
||||
while (true) {
|
||||
if (feof($this->fp)) {
|
||||
if (!$this->connected()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -107,69 +124,67 @@ class event_socket {
|
|||
return $content;
|
||||
}
|
||||
|
||||
public function connect($host = null, $port = null, $password = null) {
|
||||
/**
|
||||
* Connect to the FreeSWITCH (c) event socket server
|
||||
* <p>If the configuration is not loaded then the defaults of
|
||||
* host 127.0.0.1, port of 8021, and default password of ClueCon will be used</p>
|
||||
* @global array $conf Global configuration used in fusionpbx/config.conf
|
||||
* @param string $host Host or IP address of FreeSWITCH event socket server. Defaults to 127.0.0.1
|
||||
* @param string $port Port number of FreeSWITCH event socket server. Defaults to 8021
|
||||
* @param string $password Password of FreeSWITCH event socket server. Defaults to ClueCon
|
||||
* @param int $timeout_microseconds Number of microseconds before timeout is triggered on socket
|
||||
* @return bool Returns true on success or false if not connected
|
||||
*/
|
||||
public function connect($host = null, $port = null, $password = null, $timeout_microseconds = 30000) {
|
||||
|
||||
global $conf;
|
||||
|
||||
//get the database connection settings
|
||||
if (empty($host) && empty($conf['event_socket.ip_address'])) {
|
||||
$host = '127.0.0.1';
|
||||
}
|
||||
if (empty($port) && empty($conf['event_socket.port'])) {
|
||||
$port = '8021';
|
||||
}
|
||||
if (empty($password) && empty($conf['switch.event_socket.password'])) {
|
||||
$password = 'ClueCon';
|
||||
}
|
||||
|
||||
//set the event socket variables
|
||||
if (!empty($conf['switch.event_socket.host'])) {
|
||||
$host = $conf['switch.event_socket.host'];
|
||||
}
|
||||
if (!empty($conf['switch.event_socket.port'])) {
|
||||
$port = $conf['switch.event_socket.port'];
|
||||
}
|
||||
if (!empty($conf['switch.event_socket.password'])) {
|
||||
$password = $conf['switch.event_socket.password'];
|
||||
}
|
||||
//set the event socket variables in the order of
|
||||
//param passed to func, conf setting, old conf setting, default
|
||||
$host = $host ?? $conf['switch.event_socket.host'] ?? $conf['event_socket.ip_address'] ?? '127.0.0.1';
|
||||
$port = $port ?? $conf['switch.event_socket.port'] ?? $conf['event_socket.port'] ?? '8021';
|
||||
$password = $password ?? $conf['switch.event_socket.password'] ?? $conf['event_socket.password'] ?? 'ClueCon';
|
||||
|
||||
//open the socket connection
|
||||
$fp = @fsockopen($host, $port, $errno, $errdesc, 3);
|
||||
$this->fp = @fsockopen($host, $port, $errno, $errdesc, 3);
|
||||
|
||||
if (!$fp) {
|
||||
if (!$this->connected()) {
|
||||
return false;
|
||||
}
|
||||
socket_set_timeout($fp, 0, 30000);
|
||||
socket_set_blocking($fp, true);
|
||||
$this->fp = $fp;
|
||||
|
||||
socket_set_timeout($this->fp, 0, $timeout_microseconds);
|
||||
socket_set_blocking($this->fp, true);
|
||||
|
||||
//wait auth request and send response
|
||||
while (!feof($fp)) {
|
||||
$event = $this->read_event();
|
||||
if(@$event['Content-Type'] == 'auth/request'){
|
||||
fputs($fp, "auth $password\n\n");
|
||||
break;
|
||||
}
|
||||
while ($this->connected()) {
|
||||
$event = $this->read_event();
|
||||
if(($event['Content-Type'] ?? '') === 'auth/request'){
|
||||
fputs($this->fp, "auth $password\n\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//wait auth response
|
||||
while (!feof($fp)) {
|
||||
$event = $this->read_event();
|
||||
if (@$event['Content-Type'] == 'command/reply') {
|
||||
if (@$event['Reply-Text'] == '+OK accepted') {
|
||||
return $fp;
|
||||
}
|
||||
$this->fp = false;
|
||||
fclose($fp);
|
||||
return false;
|
||||
while ($this->connected()) {
|
||||
$event = $this->read_event();
|
||||
if (($event['Content-Type'] ?? '') === 'command/reply') {
|
||||
if (($event['Reply-Text'] ?? '') === '+OK accepted') {
|
||||
break;
|
||||
} else {
|
||||
$this->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return $this->connected();
|
||||
}
|
||||
|
||||
public function connected() {
|
||||
if (!$this->fp) {
|
||||
/**
|
||||
* Tests if connected to the FreeSWITCH Event Socket Server
|
||||
* @return bool Returns true when connected or false when not connected
|
||||
*/
|
||||
public function connected(): bool {
|
||||
if (!is_resource($this->fp)) {
|
||||
//not connected to the socket
|
||||
return false;
|
||||
}
|
||||
|
|
@ -177,14 +192,27 @@ class event_socket {
|
|||
//not connected to the socket
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
//connected to the socket
|
||||
return true;
|
||||
}
|
||||
//connected to the socket
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* alias of connected
|
||||
* @return bool
|
||||
*/
|
||||
public function is_connected(): bool {
|
||||
return $this->connected();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a command to the FreeSWITCH Event Socket Server
|
||||
* <p>Multi-line commands can be sent when separated by '\n'</p>
|
||||
* @param string $cmd Command to send through the socket
|
||||
* @return mixed Returns the response from FreeSWITCH or false if not connected
|
||||
* @depends read_event()
|
||||
*/
|
||||
public function request($cmd) {
|
||||
if (!$this->fp) {
|
||||
if (!$this->connected()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -202,42 +230,90 @@ class event_socket {
|
|||
return $event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current socket resource returning the old
|
||||
* @param resource|bool $fp Sets the current FreeSWITCH resource
|
||||
* @return mixed Returns the original resource
|
||||
* @deprecated since version 5.1
|
||||
*/
|
||||
public function reset_fp($fp = false){
|
||||
$tmp = $this->fp;
|
||||
$this->fp = $fp;
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the socket
|
||||
*/
|
||||
public function close() {
|
||||
if ($this->fp) {
|
||||
fclose($this->fp);
|
||||
$this->fp = false;
|
||||
//fp is public access so ensure it is a resource before closing it
|
||||
if (is_resource($this->fp)) {
|
||||
try {
|
||||
fclose($this->fp);
|
||||
} catch (\Exception $t) {
|
||||
//report it
|
||||
trigger_error("event_socket failed to close socket", E_USER_WARNING);
|
||||
}
|
||||
} else {
|
||||
//log an error if fp was set to something other than a resource
|
||||
if ($this->fp !== false) {
|
||||
trigger_error("event_socket not a resource", E_USER_ERROR);
|
||||
}
|
||||
}
|
||||
//force fp to be false
|
||||
$this->fp = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create uses a singleton design to return a connected socket to the FreeSWITCH Event Socket Layer
|
||||
* @global array $conf Global configuration used in config.conf
|
||||
* @param string $host Host or IP address of FreeSWITCH event socket server. Defaults to 127.0.0.1
|
||||
* @param string $port Port number of FreeSWITCH event socket server. Defaults to 8021
|
||||
* @param string $password Password of FreeSWITCH event socket server. Defaults to ClueCon
|
||||
* @param int $timeout_microseconds Number of microseconds before timeout is triggered on socket
|
||||
* @return self
|
||||
*/
|
||||
public static function create($host = null, $port = null, $password = null, $timeout_microseconds = 30000): self {
|
||||
//create the event socket object
|
||||
if (self::$socket === null) {
|
||||
self::$socket = new event_socket();
|
||||
}
|
||||
//attempt to connect it
|
||||
if(!self::$socket->connected()) {
|
||||
self::$socket->connect($host, $port, $password, $timeout_microseconds);
|
||||
}
|
||||
return self::$socket;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a command on the socket blocking for a response
|
||||
* @param string $cmd
|
||||
* @return string|false Response from server or false if failed
|
||||
*/
|
||||
public static function command(string $cmd) {
|
||||
return self::create()->request($cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an API command on the socket
|
||||
* @param string $api_cmd
|
||||
* @return string|false Response from server or false if failed
|
||||
*/
|
||||
public static function api(string $api_cmd) {
|
||||
return self::command('api '.$api_cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an API command to FreeSWITCH using asynchronous (non-blocking) mode
|
||||
* @param string $cmd API command to send
|
||||
* @returns string $job_id the Job ID for tracking completion status
|
||||
*/
|
||||
public static function async(string $cmd) {
|
||||
return self::command('bgapi '.$cmd);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
function event_socket_create($host, $port, $password) {
|
||||
$esl = new event_socket;
|
||||
if ($esl->connect($host, $port, $password)) {
|
||||
return $esl->reset_fp();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function event_socket_request($fp, $cmd) {
|
||||
$esl = new event_socket($fp);
|
||||
$result = $esl->request($cmd);
|
||||
$esl->reset_fp();
|
||||
return $result;
|
||||
}
|
||||
*/
|
||||
|
||||
// $esl = new event_socket;
|
||||
// $esl->connect('127.0.0.1', 8021, 'ClueCon');
|
||||
// $esl = event_socket::create('127.0.0.1', 8021, 'ClueCon');
|
||||
// print($esl->request('api sofia status'));
|
||||
|
||||
// $fp = event_socket_create('127.0.0.1', 8021, 'ClueCon');
|
||||
// print(event_socket_request($fp, 'api sofia status'));
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -51,9 +51,8 @@ if (!class_exists('switch_settings')) {
|
|||
}
|
||||
|
||||
//connect to event socket
|
||||
$esl = new event_socket;
|
||||
$esl->connect($this->event_socket_ip_address, $this->event_socket_port, $this->event_socket_password);
|
||||
|
||||
$esl = event_socket::create($this->event_socket_ip_address, $this->event_socket_port, $this->event_socket_password);
|
||||
|
||||
//run the api command
|
||||
$result = $esl->request('api global_getvar');
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -35,9 +35,9 @@
|
|||
}
|
||||
else {
|
||||
//create the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
//reload the access control list this also runs reloadxml
|
||||
$response = event_socket_request($fp, 'api reloadxml');
|
||||
$response = event_socket::api('reloadxml');
|
||||
$_SESSION["reload_xml"] = '';
|
||||
unset($_SESSION["reload_xml"]);
|
||||
usleep(500);
|
||||
|
|
|
|||
|
|
@ -29,29 +29,39 @@
|
|||
//includes files
|
||||
require_once __DIR__ . "/require.php";
|
||||
|
||||
/**
|
||||
* Returns an fp connector from an event socket.
|
||||
* This has been replaced with event_socket::create() method and using the
|
||||
* socket directly is preferred.
|
||||
* @param string $host
|
||||
* @param string $port
|
||||
* @param string $password
|
||||
* @return true Returns true if successful connection and false if there is a failure
|
||||
* @deprecated since version 5.1.11
|
||||
*/
|
||||
function event_socket_create($host = null, $port = null, $password = null) {
|
||||
$esl = new event_socket;
|
||||
if ($esl->connect($host, $port, $password)) {
|
||||
return $esl->reset_fp();
|
||||
}
|
||||
return false;
|
||||
$esl = event_socket::create($host = null, $port = null, $password = null);
|
||||
return ($esl !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request on the event socket
|
||||
* @param null $fp No longer used
|
||||
* @param string $cmd Command to use
|
||||
* @return string|false Response of the server or false if failed
|
||||
*/
|
||||
function event_socket_request($fp, $cmd) {
|
||||
$esl = new event_socket($fp);
|
||||
$result = $esl->request($cmd);
|
||||
$esl->reset_fp();
|
||||
return $result;
|
||||
return event_socket::command($cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request on the event socket
|
||||
* @param type $fp
|
||||
* @param type $cmd
|
||||
* @return type
|
||||
*/
|
||||
function event_socket_request_cmd($cmd) {
|
||||
$esl = new event_socket;
|
||||
if (!$esl->connect()) {
|
||||
return false;
|
||||
}
|
||||
$response = $esl->request($cmd);
|
||||
$esl->close();
|
||||
return $response;
|
||||
return event_socket::command($cmd);
|
||||
}
|
||||
|
||||
function remove_config_from_cache($name) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue