本文整理汇总了PHP中event_socket_create函数的典型用法代码示例。如果您正苦于以下问题:PHP event_socket_create函数的具体用法?PHP event_socket_create怎么用?PHP event_socket_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了event_socket_create函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: switch_dingaling_status
function switch_dingaling_status($fp, $profile_username, $result_type = 'xml')
{
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$cmd = 'api dingaling status';
$response = trim(event_socket_request($fp, $cmd));
$response = explode("\n", $response);
$x = 0;
foreach ($response as $row) {
if ($x > 1) {
$dingaling = explode("|", $row);
if ($profile_username == trim($dingaling[0])) {
return trim($dingaling[1]);
}
}
$x++;
}
}
开发者ID:architek360,项目名称:fusionpbx-apps,代码行数:17,代码来源:xmpp.php
示例2: switch_gateway_status
function switch_gateway_status($gateway_uuid, $result_type = 'xml')
{
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
$cmd = 'api sofia xmlstatus gateway ' . $gateway_uuid;
$response = trim(event_socket_request($fp, $cmd));
if ($response == "Invalid Gateway!") {
$cmd = 'api sofia xmlstatus gateway ' . strtoupper($gateway_uuid);
$response = trim(event_socket_request($fp, $cmd));
}
return $response;
}
开发者ID:kevinlovesing,项目名称:fusionpbx,代码行数:11,代码来源:gateways.php
示例3: user_status
public function user_status()
{
//set the global variable
global $db;
//update the status
if ($this->enabled == "true") {
//update the call center status
$user_status = "Logged Out";
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd .= "callcenter_config agent set status " . $_SESSION['username'] . "@" . $this->domain_name . " '" . $user_status . "'";
$switch_result = event_socket_request($fp, 'api ' . $switch_cmd);
}
//update the database user_status
$user_status = "Do Not Disturb";
$sql = "update v_users set ";
$sql .= "user_status = '{$user_status}' ";
$sql .= "where domain_uuid = '" . $this->domain_uuid . "' ";
$sql .= "and username = '" . $_SESSION['username'] . "' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
}
}
开发者ID:kevinlovesing,项目名称:fusionpbx,代码行数:23,代码来源:do_not_disturb.php
示例4: switch_module_is_running
function switch_module_is_running($fp, $mod)
{
if (!$fp) {
//if the handle does not exist create it
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//if the handle still does not exist show an error message
if (!$fp) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
}
}
if ($fp) {
//send the api command to check if the module exists
$switchcmd = "module_exists {$mod}";
$switch_result = event_socket_request($fp, 'api ' . $switchcmd);
unset($switchcmd);
if (trim($switch_result) == "true") {
return true;
} else {
return false;
}
} else {
return false;
}
}
开发者ID:xyj70,项目名称:fusionpbx,代码行数:24,代码来源:functions.php
示例5: message_download
public function message_download()
{
//check the message waiting status
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd .= "luarun app.lua voicemail mwi " . $this->voicemail_id . "@" . $_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api ' . $switch_cmd);
}
//change the message status
$this->message_saved();
//clear the cache
session_cache_limiter('public');
//set source folder path
$path = $_SESSION['switch']['voicemail']['dir'] . '/default/' . $_SESSION['domain_name'] . '/' . $this->voicemail_id;
//prepare base64 content from db, if enabled
if ($_SESSION['voicemail']['storage_type']['text'] == 'base64') {
$sql = "select message_base64 from ";
$sql .= "v_voicemail_messages as m, ";
$sql .= "v_voicemails as v ";
$sql .= "where ";
$sql .= "m.voicemail_uuid = v.voicemail_uuid ";
$sql .= "and v.voicemail_id = '" . $this->voicemail_id . "' ";
$sql .= "and m.voicemail_uuid = '" . $this->voicemail_uuid . "' ";
$sql .= "and m.domain_uuid = '" . $this->domain_uuid . "' ";
$sql .= "and m.voicemail_message_uuid = '" . $this->voicemail_message_uuid . "' ";
$prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
if (count($result) > 0) {
foreach ($result as &$row) {
if ($row['message_base64'] != '') {
$message_decoded = base64_decode($row['message_base64']);
file_put_contents($path . '/msg_' . $this->voicemail_message_uuid . '.ext', $message_decoded);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
//determine mime type (requires PHP >= 5.3.0, must be manually enabled on Windows)
$file_mime = finfo_file($finfo, $path . '/msg_' . $this->voicemail_message_uuid . '.ext');
finfo_close($finfo);
switch ($file_mime) {
case 'audio/x-wav':
case 'audio/wav':
$file_ext = 'wav';
break;
case 'audio/mpeg':
case 'audio/mp3':
$file_ext = 'mp3';
break;
}
rename($path . '/msg_' . $this->voicemail_message_uuid . '.ext', $path . '/msg_' . $this->voicemail_message_uuid . '.' . $file_ext);
}
break;
}
}
unset($sql, $prep_statement, $result, $message_decoded);
}
//prepare and stream the file
if (file_exists($path . '/msg_' . $this->voicemail_message_uuid . '.wav')) {
$file_path = $path . '/msg_' . $this->voicemail_message_uuid . '.wav';
}
if (file_exists($path . '/msg_' . $this->voicemail_message_uuid . '.mp3')) {
$file_path = $path . '/msg_' . $this->voicemail_message_uuid . '.mp3';
}
if ($file_path != '') {
$fd = fopen($file_path, "rb");
if ($_GET['t'] == "bin") {
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
$file_ext = substr($file_path, -3);
if ($file_ext == "wav") {
header('Content-Disposition: attachment; filename="msg_' . $this->voicemail_message_uuid . '.wav"');
}
if ($file_ext == "mp3") {
header('Content-Disposition: attachment; filename="msg_' . $this->voicemail_message_uuid . '.mp3"');
}
} else {
$file_ext = substr($file_path, -3);
if ($file_ext == "wav") {
header("Content-Type: audio/wav");
}
if ($file_ext == "mp3") {
header("Content-Type: audio/mpeg");
}
}
header("Cache-Control: no-cache, must-revalidate");
// HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// date in the past
header("Content-Length: " . filesize($file_path));
ob_end_clean();
fpassthru($fd);
}
//if base64, remove temp file
if ($_SESSION['voicemail']['storage_type']['text'] == 'base64') {
@unlink($path . '/msg_' . $this->voicemail_message_uuid . '.' . $file_ext);
}
}
开发者ID:kevinlovesing,项目名称:fusionpbx,代码行数:97,代码来源:voicemail.php
示例6: reload
public function reload()
{
//if the handle does not exist create it
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//if the handle still does not exist show an error message
if (!$fp) {
$msg = "<div align='center'>" . $text['message-event-socket'] . "<br /></div>";
}
//send the api command to check if the module exists
if ($fp) {
$cmd = "reload mod_local_stream";
$switch_result = event_socket_request($fp, 'api ' . $cmd);
unset($cmd);
}
}
开发者ID:kpabijanskas,项目名称:fusionpbx,代码行数:15,代码来源:switch_music_on_hold.php
示例7: dialplan
//.........这里部分代码省略.........
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'answer';
$database->fields['dialplan_detail_data'] = '';
$database->fields['dialplan_detail_order'] = '010';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'sleep';
$database->fields['dialplan_detail_data'] = '1000';
$database->fields['dialplan_detail_order'] = '015';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = 'hangup_after_bridge=true';
$database->fields['dialplan_detail_order'] = '020';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
if ($this->ivr_menu_ringback == "music" || $this->ivr_menu_ringback == "") {
$database->fields['dialplan_detail_data'] = 'ringback=${hold_music}';
} else {
$database->fields['dialplan_detail_data'] = 'ringback=' . $this->ivr_menu_ringback;
}
$database->fields['dialplan_detail_order'] = '025';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
if ($this->ivr_menu_ringback == "music" || $this->ivr_menu_ringback == "") {
$database->fields['dialplan_detail_data'] = 'transfer_ringback=${hold_music}';
} else {
$database->fields['dialplan_detail_data'] = 'transfer_ringback=' . $this->ivr_menu_ringback;
}
$database->fields['dialplan_detail_order'] = '030';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'set';
$database->fields['dialplan_detail_data'] = 'ivr_menu_uuid=' . $this->ivr_menu_uuid;
$database->fields['dialplan_detail_order'] = '035';
$database->add();
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
if ($_SESSION['ivr menu']['application']['text'] == "lua") {
$database->fields['dialplan_detail_type'] = 'lua';
$database->fields['dialplan_detail_data'] = 'ivr_menu.lua';
} else {
$database->fields['dialplan_detail_type'] = 'ivr';
$database->fields['dialplan_detail_data'] = $this->ivr_menu_uuid;
}
$database->fields['dialplan_detail_order'] = '040';
$database->add();
if (strlen($this->ivr_menu_exit_app) > 0) {
$database->table = "v_dialplan_details";
$database->fields['domain_uuid'] = $this->domain_uuid;
$database->fields['dialplan_uuid'] = $this->dialplan_uuid;
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$database->fields['dialplan_detail_type'] = $this->ivr_menu_exit_app;
$database->fields['dialplan_detail_data'] = $this->ivr_menu_exit_data;
$database->fields['dialplan_detail_order'] = '045';
$database->add();
}
//delete the dialplan context from memcache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd .= "memcache delete dialplan:" . $_SESSION["context"] . "@" . $_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api ' . $switch_cmd);
}
}
开发者ID:kpabijanskas,项目名称:fusionpbx,代码行数:101,代码来源:ivr_menu.php
示例8: foreach
$sql = "";
$sql .= "select * from v_settings ";
$sql .= "where v_id = '{$v_id}' ";
$prepstatement = $db->prepare(check_sql($sql));
$prepstatement->execute();
$result = $prepstatement->fetchAll();
foreach ($result as &$row) {
//$v_id = $row["v_id"];
$event_socket_ip_address = $row["event_socket_ip_address"];
$event_socket_port = $row["event_socket_port"];
$event_socket_password = $row["event_socket_password"];
break;
//limit to 1 row
}
echo "<b>switch command:</b>\n";
echo "<pre>\n";
$fp = event_socket_create($event_socket_ip_address, $event_socket_port, $event_socket_password);
$switch_result = event_socket_request($fp, 'api ' . $switchcmd);
//$switch_result = eval($switchcmd);
echo htmlentities($switch_result);
echo "</pre>\n";
}
echo "\t\t</td>\n";
echo "\t</tr>";
}
echo "\t</td>";
echo "\t</tr>";
echo "</table>";
echo "</div>";
echo "</form>";
require_once "includes/footer.php";
开发者ID:petekelly,项目名称:fusionpbx,代码行数:31,代码来源:v_exec.php
示例9: get_call_activity
function get_call_activity()
{
global $db;
global $ext_user_status;
//get the extensions and their user status
$sql = "select ";
$sql .= "e.extension, ";
$sql .= "e.number_alias, ";
$sql .= "e.effective_caller_id_name, ";
$sql .= "e.effective_caller_id_number, ";
$sql .= "e.call_group, ";
$sql .= "e.description, ";
$sql .= "u.user_uuid, ";
$sql .= "u.user_status ";
$sql .= "from ";
$sql .= "v_extensions as e ";
$sql .= "left outer join v_extension_users as eu on ( eu.extension_uuid = e.extension_uuid and eu.domain_uuid = '" . $_SESSION['domain_uuid'] . "' ) ";
$sql .= "left outer join v_users as u on ( u.user_uuid = eu.user_uuid and u.domain_uuid = '" . $_SESSION['domain_uuid'] . "' ) ";
$sql .= "where ";
$sql .= "e.domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
$sql .= "order by ";
$sql .= "e.extension asc ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$extensions = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($prep_statement, $sql);
//store extension status by user uuid
foreach ($extensions as &$row) {
if ($row['user_uuid'] != '') {
$ext_user_status[$row['user_uuid']] = $row['user_status'];
unset($row['user_status']);
}
}
//send the command
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd = 'show channels as json';
$switch_result = event_socket_request($fp, 'api ' . $switch_cmd);
$json_array = json_decode($switch_result, true);
}
//build the response
$x = 0;
foreach ($extensions as &$row) {
$user = $row['extension'];
if (strlen($row['number_alias']) > 0) {
$user = $row['number_alias'];
}
//add the extension details
$array[$x] = $row;
//set the call detail defaults
$array[$x]["uuid"] = null;
$array[$x]["direction"] = null;
$array[$x]["created"] = null;
$array[$x]["created_epoch"] = null;
$array[$x]["name"] = null;
$array[$x]["state"] = null;
$array[$x]["cid_name"] = null;
$array[$x]["cid_num"] = null;
$array[$x]["ip_addr"] = null;
$array[$x]["dest"] = null;
$array[$x]["application"] = null;
$array[$x]["application_data"] = null;
$array[$x]["dialplan"] = null;
$array[$x]["context"] = null;
$array[$x]["read_codec"] = null;
$array[$x]["read_rate"] = null;
$array[$x]["read_bit_rate"] = null;
$array[$x]["write_codec"] = null;
$array[$x]["write_rate"] = null;
$array[$x]["write_bit_rate"] = null;
$array[$x]["secure"] = null;
$array[$x]["hostname"] = null;
$array[$x]["presence_id"] = null;
$array[$x]["presence_data"] = null;
$array[$x]["callstate"] = null;
$array[$x]["callee_name"] = null;
$array[$x]["callee_num"] = null;
$array[$x]["callee_direction"] = null;
$array[$x]["call_uuid"] = null;
$array[$x]["sent_callee_name"] = null;
$array[$x]["sent_callee_num"] = null;
$array[$x]["destination"] = null;
//add the active call details
$found = false;
foreach ($json_array['rows'] as &$field) {
$presence_id = $field['presence_id'];
$presence = explode("@", $presence_id);
$presence_id = $presence[0];
$presence_domain = $presence[1];
if ($user == $presence_id) {
if ($presence_domain == $_SESSION['domain_name']) {
$found = true;
break;
}
}
}
//normalize the array
if ($found) {
$array[$x]["uuid"] = $field['uuid'];
$array[$x]["direction"] = $field['direction'];
//.........这里部分代码省略.........
开发者ID:bitplus,项目名称:fusionpbx,代码行数:101,代码来源:get_call_activity.php
示例10: set
public function set()
{
//set the global variable
global $db;
//determine whether to update the dial string
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '" . $this->domain_uuid . "' ";
$sql .= "and extension_uuid = '" . $this->extension_uuid . "' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) > 0) {
foreach ($result as &$row) {
$this->extension = $row["extension"];
$this->accountcode = $row["accountcode"];
$this->outbound_caller_id_name = $row["outbound_caller_id_name"];
$this->outbound_caller_id_number = $row["outbound_caller_id_number"];
}
}
unset($prep_statement);
//set the dial string
if ($this->forward_all_enabled == "true") {
$dial_string = "{presence_id=" . $this->forward_all_destination . "@" . $_SESSION['domain_name'];
$dial_string .= ",instant_ringback=true";
$dial_string .= ",domain_uuid=" . $_SESSION['domain_uuid'];
$dial_string .= ",sip_invite_domain=" . $_SESSION['domain_name'];
$dial_string .= ",domain_name=" . $_SESSION['domain_name'];
$dial_string .= ",domain=" . $_SESSION['domain_name'];
$dial_string .= ",extension_uuid=" . $this->extension_uuid;
if (strlen($this->accountcode) > 0) {
$dial_string .= ",sip_h_X-accountcode=" . $this->accountcode;
$dial_string .= ",accountcode=" . $this->accountcode;
}
if (strlen($this->forward_caller_id_uuid) > 0) {
$sql_caller = "select destination_number, destination_description from v_destinations where domain_uuid = '{$this->domain_uuid}' and destination_type = 'inbound' and destination_uuid = '{$this->forward_caller_id_uuid}'";
$prep_statement_caller = $db->prepare($sql_caller);
if ($prep_statement_caller) {
$prep_statement_caller->execute();
$row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC);
if (strlen($row_caller['destination_description']) > 0) {
$dial_string_caller_id_name = $row_caller['destination_description'];
$dial_string .= ",origination_caller_id_name={$dial_string_caller_id_name}";
}
if (strlen($row_caller['destination_number']) > 0) {
$dial_string_caller_id_number = $row_caller['destination_number'];
$dial_string .= ",origination_caller_id_number={$dial_string_caller_id_number}";
$dial_string .= ",outbound_caller_id_number={$dial_string_caller_id_number}";
}
}
} else {
if ($_SESSION['cdr']['call_forward_fix']['boolean'] == "true") {
$dial_string .= ",outbound_caller_id_name=" . $this->outbound_caller_id_name;
$dial_string .= ",outbound_caller_id_number=" . $this->outbound_caller_id_number;
$dial_string .= ",origination_caller_id_name=" . $this->outbound_caller_id_name;
$dial_string .= ",origination_caller_id_number=" . $this->outbound_caller_id_number;
}
}
$dial_string .= "}";
if (extension_exists($this->forward_all_destination)) {
$dial_string .= "user/" . $this->forward_all_destination . "@" . $_SESSION['domain_name'];
} else {
if ($_SESSION['domain']['bridge']['text'] == "outbound" || $_SESSION['domain']['bridge']['text'] == "bridge") {
$bridge = outbound_route_to_bridge($_SESSION['domain_uuid'], $this->forward_all_destination);
$dial_string .= $bridge[0];
} elseif ($_SESSION['domain']['bridge']['text'] == "lcr") {
$dial_string .= "lcr/" . $_SESSION['lcr']['profile']['text'] . "/" . $_SESSION['domain_name'] . "/" . $this->forward_all_destination;
} elseif ($_SESSION['domain']['bridge']['text'] === "loopback") {
$dial_string .= "loopback/" . $this->forward_all_destination;
} else {
$dial_string .= "loopback/" . $this->forward_all_destination;
}
}
$this->dial_string = $dial_string;
} else {
$this->dial_string = '';
}
//update the extension
$sql = "update v_extensions set ";
if (strlen($this->forward_all_destination) == 0 || $this->forward_all_enabled == "false") {
if (strlen($this->forward_all_destination) == 0) {
$sql .= "forward_all_destination = null, ";
}
$sql .= "dial_string = null, ";
$sql .= "forward_all_enabled = 'false' ";
} else {
$sql .= "forward_all_destination = '{$this->forward_all_destination}', ";
$sql .= "dial_string = '" . $this->dial_string . "', ";
$sql .= "forward_all_enabled = 'true' ";
}
$sql .= "where domain_uuid = '{$this->domain_uuid}' ";
$sql .= "and extension_uuid = '{$this->extension_uuid}' ";
if ($this->debug) {
echo $sql;
}
$db->exec(check_sql($sql));
unset($sql);
//delete extension from memcache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd = "memcache delete directory:" . $this->extension . "@" . $this->domain_name;
//.........这里部分代码省略.........
开发者ID:reliberate,项目名称:fusionpbx,代码行数:101,代码来源:call_forward.php
示例11: active
public function active($name)
{
if (!$this->fp) {
$this->fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
}
if ($this->fp) {
$cmd = "api module_exists " . $name;
$response = trim(event_socket_request($this->fp, $cmd));
if ($response == "true") {
return true;
} else {
return false;
}
} else {
return false;
}
}
开发者ID:kpabijanskas,项目名称:fusionpbx,代码行数:17,代码来源:modules.php
示例12: event_socket_request_cmd
function event_socket_request_cmd($cmd)
{
global $db, $domain_uuid, $host;
if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/settings/app_config.php")) {
$sql = "select * from v_settings ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as &$row) {
$event_socket_ip_address = $row["event_socket_ip_address"];
$event_socket_port = $row["event_socket_port"];
$event_socket_password = $row["event_socket_password"];
break;
//limit to 1 row
}
unset($prep_statement);
}
$fp = event_socket_create($event_socket_ip_address, $event_socket_port, $event_socket_password);
$response = event_socket_request($fp, $cmd);
fclose($fp);
}
开发者ID:ringmor,项目名称:fusionpbx,代码行数:21,代码来源:switch.php
示例13: flush
/**
* Delete the entire cache
*/
public function flush()
{
//send a custom event
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$event = "sendevent CUSTOM\n";
$event .= "Event-Name: MEMCACHE\n";
$event .= "Event-Subclass: flush\n";
$event .= "API-Command: memcache\n";
$event .= "API-Command-Argument: flush\n";
echo event_socket_request($fp, $event);
}
//run the memcache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$command = "memcache flush";
return event_socket_request($fp, 'api ' . $command);
} else {
return false;
}
}
开发者ID:kevinlovesing,项目名称:fusionpbx,代码行数:24,代码来源:cache.php
示例14: switch_module_exists
function switch_module_exists($mod)
{
global $db, $v_id;
$sql = "";
$sql .= "select * from v_settings ";
$sql .= "where v_id = '{$v_id}' ";
$prepstatement = $db->prepare(check_sql($sql));
$prepstatement->execute();
$result = $prepstatement->fetchAll();
foreach ($result as &$row) {
$event_socket_ip_address = $row["event_socket_ip_address"];
$event_socket_port = $row["event_socket_port"];
$event_socket_password = $row["event_socket_password"];
break;
//limit to 1 row
}
$switchcmd = "module_exists {$mod}";
$fp = event_socket_create($event_socket_ip_address, $event_socket_port, $event_socket_password);
$switch_result = event_socket_request($fp, 'api ' . $switchcmd);
//$switch_result = eval($switchcmd);
if (trim($switch_result) == "true") {
//echo "yes";
return true;
} else {
//echo "no";
return false;
}
unset($switchcmd);
}
开发者ID:petekelly,项目名称:fusionpbx,代码行数:29,代码来源:lib_functions.php
示例15: delete
function delete()
{
//create the database object
$database = new database();
if ($this->db) {
$database->db = $this->db;
}
//start the transaction
//$count = $database->db->exec("BEGIN;");
//delete the ivr menu option
if (strlen($this->ivr_menu_option_uuid) > 0) {
$database->table = "v_ivr_menu_options";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_option_uuid';
$database->where[1]['value'] = $this->ivr_menu_option_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
unset($this->ivr_menu_option_uuid);
}
//delete the ivr menu
if (strlen($this->ivr_menu_option_uuid) == 0) {
//select the dialplan entries
$database->table = "v_ivr_menus";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$result = $database->find();
foreach ($result as $row) {
$this->dialplan_uuid = $row['dialplan_uuid'];
//delete the child dialplan information
$database->table = "v_dialplan_details";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete the dialplan information
$database->table = "v_dialplans";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
}
//delete child data
$database->table = "v_ivr_menu_options";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete parent data
$database->table = "v_ivr_menus";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'ivr_menu_uuid';
$database->where[1]['value'] = $this->ivr_menu_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete the dialplan context from memcache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd = "memcache delete dialplan:" . $_SESSION["context"];
$switch_result = event_socket_request($fp, 'api ' . $switch_cmd);
}
//commit the transaction
//$count = $database->db->exec("COMMIT;");
}
}
开发者ID:reliberate,项目名称:fusionpbx,代码行数:81,代码来源:ivr_menu.php
示例16: flush
/**
* Delete the entire cache
*/
public function flush()
{
// connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp === false) {
return false;
}
//send a custom event
$event = "sendevent CUSTOM\n";
$event .= "Event-Name: MEMCACHE\n";
$event .= "Event-Subclass: flush\n";
$event .= "API-Command: memcache\n";
$event .= "API-Command-Argument: flush\n";
event_socket_request($fp, $event);
//run the memcache
$command = "memcache flush";
$result = event_socket_request($fp, 'api ' . $command);
//close event socket
fclose($fp);
// return result
return $result;
}
开发者ID:bitplus,项目名称:fusionpbx,代码行数:25,代码来源:cache.php
示例17: event_socket_mkdir
function event_socket_mkdir($dir)
{
//connect to fs
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if (!$fp) {
return false;
}
//send the mkdir command to freeswitch
if ($fp) {
//build and send the mkdir command to freeswitch
$switch_cmd = "lua mkdir.lua '{$dir}'";
$switch_result = event_socket_request($fp, 'api ' . $switch_cmd);
fclose($fp);
//check result
if (trim($switch_result) == "-ERR no reply") {
return true;
}
}
//can not create directory
return false;
}
开发者ID:rdissauer,项目名称:fusionpbx,代码行数:21,代码来源:functions.php
示例18: message_waiting
public function message_waiting()
{
//send the message waiting status
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$switch_cmd .= "luarun app.lua voicemail mwi " . $this->voicemail_id . "@" . $_SESSION['domain_name'];
$switch_result = event_socket_request($fp, 'api ' . $switch_cmd);
}
}
开发者ID:powerpbx,项目名称:fusionpbx,代码行数:9,代码来源:voicemail.php
示例19: htmlentities
case 'shell':
if (permission_exists('exec_command')) {
$result = htmlentities(shell_exec($cmd));
}
break;
case 'php':
if (permission_exists('exec_php')) {
ob_start();
eval($cmd);
$result = ob_get_contents();
ob_end_clean();
}
break;
case 'switch':
if (permission_exists('exec_switch')) {
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$result = htmlentities(event_socket_request($fp, 'api ' . $cmd));
}
}
break;
}
if ($result != '') {
echo "<span id='response'>";
echo "<b>" . $text['label-response'] . "</b>\n";
echo "<br /><br />\n";
echo $handler == 'switch' ? "<textarea style='width: 100%; height: 450px; font-family: monospace; padding: 15px;' wrap='off'>" . $result . "</textarea>\n" : "<pre>" . $result . "</pre>";
echo "</span>";
}
}
}
开发者ID:kpabijanskas,项目名称:fusio |
请发表评论