本文整理汇总了PHP中save_dialplan_xml函数的典型用法代码示例。如果您正苦于以下问题:PHP save_dialplan_xml函数的具体用法?PHP save_dialplan_xml怎么用?PHP save_dialplan_xml使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_dialplan_xml函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dialplan
//.........这里部分代码省略.........
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "fax_uuid=" . $this->fax_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "api_hangup_hook=lua app/fax/resources/scripts/hangup_rx.lua";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
foreach ($_SESSION['fax']['variable'] as $data) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (substr($data, 0, 8) == "inbound:") {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($data, 8, strlen($data));
} elseif (substr($data, 0, 9) == "outbound:") {
} else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $data;
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
if (strlen($_SESSION['fax']['last_fax']['text']) > 0) {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=" . $_SESSION['fax']['last_fax']['text'];
} else {
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "last_fax=\${caller_id_number}-\${strftime(%Y-%m-%d-%H-%M-%S)}";
}
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "playback";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "silence_stream://2000";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "rxfax";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $_SESSION['switch']['storage']['dir'] . '/fax/' . $_SESSION['domain_name'] . '/' . $this->fax_extension . '/inbox/' . $this->forward_prefix . '${last_fax}.tif';
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
//add the dialplan permission
$p = new permissions();
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//save the dialplan
$orm = new orm();
$orm->name('dialplans');
$orm->save($dialplan);
$dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
$sql = "update v_fax ";
$sql .= "set dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "where fax_uuid = '" . $this->fax_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache();
$cache->delete("dialplan:" . $_SESSION['context']);
//return the dialplan_uuid
return $dialplan_response;
}
示例2: check_str
//update dialplan detail action
$dialplan_detail_tag = 'action';
//condition, action, antiaction
$dialplan_detail_type = 'set';
$dialplan_detail_data = "api_hangup_hook=lua app/fax/resources/scripts/hangup_rx.lua";
$sql = "update v_dialplan_details set ";
$sql .= "dialplan_detail_data = '" . check_str($dialplan_detail_data) . "' ";
$sql .= "where domain_uuid = '" . $_SESSION['domain_uuid'] . "' ";
$sql .= "and dialplan_detail_tag = 'action' ";
$sql .= "and dialplan_detail_type = 'set' ";
$sql .= "and dialplan_uuid = '{$dialplan_uuid}' ";
$sql .= "and dialplan_detail_data like 'api_hangup_hook=%' ";
$db->query(check_sql($sql));
}
//save the xml
save_dialplan_xml();
//apply settings reminder
$_SESSION["reload_xml"] = true;
//clear the cache
$cache = new cache();
$cache->delete("dialplan:" . $_SESSION["context"]);
//redirect the browser
if ($action == "update" && permission_exists('fax_extension_edit')) {
$_SESSION["message"] = $text['confirm-update'];
}
if ($action == "add" && permission_exists('fax_extension_add')) {
$_SESSION["message"] = $text['confirm-add'];
}
header("Location: fax.php");
return;
}
示例3: save_switch_xml
function save_switch_xml()
{
if (is_readable($_SESSION['switch']['dialplan']['dir'])) {
save_dialplan_xml();
}
if (is_readable($_SESSION['switch']['extensions']['dir'])) {
if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/app/extensions/resources/classes/extension.php")) {
require_once $_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "app/extensions/resources/classes/extension.php";
$extension = new extension();
$extension->xml();
}
}
if (is_readable($_SESSION['switch']['conf']['dir'])) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/settings/app_config.php")) {
save_setting_xml();
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/modules/app_config.php")) {
save_module_xml();
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/vars/app_config.php")) {
save_var_xml();
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/call_center/app_config.php")) {
save_call_center_xml();
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/gateways/app_config.php")) {
save_gateway_xml();
}
//if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ivr_menu/app_config.php")) {
// save_ivr_menu_xml();
//}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . PROJECT_PATH . "/app/sip_profiles/app_config.php")) {
save_sip_profile_xml();
}
}
}
示例4: upgrade
//.........这里部分代码省略.........
unset($prep_statement);
//get the domain_settings
$sql = "select * from v_domain_settings ";
$sql .= "where domain_setting_enabled = 'true' ";
$prep_statement = $this->db->prepare($sql);
$prep_statement->execute();
$domain_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($prep_statement);
//get the default settings
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_enabled = 'true' ";
$prep_statement = $this->db->prepare($sql);
$prep_statement->execute();
$database_default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset($prep_statement);
//get the domain_uuid
foreach ($domains as $row) {
if (count($domains) == 1) {
$_SESSION["domain_uuid"] = $row["domain_uuid"];
$_SESSION["domain_name"] = $row['domain_name'];
} else {
if (lower_case($row['domain_name']) == lower_case($domain_array[0]) || lower_case($row['domain_name']) == lower_case('www.' . $domain_array[0])) {
$_SESSION["domain_uuid"] = $row["domain_uuid"];
$_SESSION["domain_name"] = $row['domain_name'];
}
$_SESSION['domains'][$row['domain_uuid']]['domain_uuid'] = $row['domain_uuid'];
$_SESSION['domains'][$row['domain_uuid']]['domain_name'] = $row['domain_name'];
}
}
//loop through all domains
$domain_count = count($domains);
$domains_processed = 1;
foreach ($domains as &$row) {
//get the values from database and set them as php variables
$domain_uuid = $row["domain_uuid"];
$domain_name = $row["domain_name"];
//get the context
$context = $domain_name;
//show the domain when display_type is set to text
if ($display_type == "text") {
echo "\n";
echo $domain_name;
echo "\n";
}
//get the default settings - this needs to be done to reset the session values back to the defaults for each domain in the loop
foreach ($database_default_settings as $row) {
$name = $row['default_setting_name'];
$category = $row['default_setting_category'];
$subcategory = $row['default_setting_subcategory'];
if (strlen($subcategory) == 0) {
if ($name == "array") {
$_SESSION[$category][] = $row['default_setting_value'];
} else {
$_SESSION[$category][$name] = $row['default_setting_value'];
}
} else {
if ($name == "array") {
$_SESSION[$category][$subcategory][] = $row['default_setting_value'];
} else {
$_SESSION[$category][$subcategory]['uuid'] = $row['default_setting_uuid'];
$_SESSION[$category][$subcategory][$name] = $row['default_setting_value'];
}
}
}
//get the domains settings for the current domain
foreach ($domain_settings as $row) {
if ($row['domain_uuid'] == $domain_uuid) {
$name = $row['domain_setting_name'];
$category = $row['domain_setting_category'];
$subcategory = $row['domain_setting_subcategory'];
if (strlen($subcategory) == 0) {
//$$category[$name] = $row['domain_setting_value'];
$_SESSION[$category][$name] = $row['domain_setting_value'];
} else {
//$$category[$subcategory][$name] = $row['domain_setting_value'];
$_SESSION[$category][$subcategory][$name] = $row['domain_setting_value'];
}
}
}
//get the list of installed apps from the core and mod directories and execute the php code in app_defaults.php
$default_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_defaults.php");
foreach ($default_list as &$default_path) {
include $default_path;
}
//track of the number of domains processed
$domains_processed++;
}
//synchronize the dialplan
if (function_exists('save_dialplan_xml')) {
save_dialplan_xml();
}
//update config.lua
if (file_exists($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . '/app/scripts/resources/classes/scripts.php')) {
$obj = new scripts();
$obj->write_config();
}
//clear the session variables
unset($_SESSION['domain']);
unset($_SESSION['switch']);
}
示例5: dialplan
//.........这里部分代码省略.........
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^([^#]+#)(.*)\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "never";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "caller_id_name=\$2";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "1";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "condition";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "destination_number";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "^" . $this->destination_number . "\$";
$dialplan["dialplan_details"][$y]["dialplan_detail_break"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "answer";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "hangup_after_bridge=true";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_cid_prefix) > 0) {
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "set";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "effective_caller_id_name=" . $this->queue_cid_prefix . "#\${caller_id_name}";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "callcenter";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = $this->queue_name . '@' . $_SESSION["domain_name"];
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
if (strlen($this->queue_timeout_action) > 0) {
$action_array = explode(":", $this->queue_timeout_action);
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $action_array[0];
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = substr($this->queue_timeout_action, strlen($action_array[0]) + 1, strlen($this->queue_timeout_action));
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
$y++;
}
$dialplan["dialplan_details"][$y]["domain_uuid"] = $this->domain_uuid;
$dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action";
$dialplan["dialplan_details"][$y]["dialplan_detail_type"] = "hangup";
$dialplan["dialplan_details"][$y]["dialplan_detail_data"] = "";
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
//add the dialplan permission
$p = new permissions();
$p->add("dialplan_add", 'temp');
$p->add("dialplan_detail_add", 'temp');
$p->add("dialplan_edit", 'temp');
$p->add("dialplan_detail_edit", 'temp');
//save the dialplan
$orm = new orm();
$orm->name('dialplans');
$orm->save($dialplan);
$dialplan_response = $orm->message;
$this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
$sql = "update v_call_center_queues ";
$sql .= "set dialplan_uuid = '" . $this->dialplan_uuid . "' ";
$sql .= "where call_center_queue_uuid = '" . $this->call_center_queue_uuid . "' ";
$sql .= "and domain_uuid = '" . $this->domain_uuid . "' ";
$this->db->exec($sql);
unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
$p->delete("dialplan_detail_add", 'temp');
$p->delete("dialplan_edit", 'temp');
$p->delete("dialplan_detail_edit", 'temp');
//synchronize the xml config
save_dialplan_xml();
//clear the cache
$cache = new cache();
$cache->delete("dialplan:" . $_SESSION['context']);
//return the dialplan_uuid
return $dialplan_response;
}
示例6: save_ivr_menu_xml
//.........这里部分代码省略.........
$ivr_menu_exit_sound = $row["ivr_menu_exit_sound"];
$ivr_menu_confirm_macro = $row["ivr_menu_confirm_macro"];
$ivr_menu_confirm_key = $row["ivr_menu_confirm_key"];
$ivr_menu_tts_engine = $row["ivr_menu_tts_engine"];
$ivr_menu_tts_voice = $row["ivr_menu_tts_voice"];
$ivr_menu_confirm_attempts = $row["ivr_menu_confirm_attempts"];
$ivr_menu_timeout = $row["ivr_menu_timeout"];
$ivr_menu_exit_app = $row["ivr_menu_exit_app"];
$ivr_menu_exit_data = $row["ivr_menu_exit_data"];
$ivr_menu_inter_digit_timeout = $row["ivr_menu_inter_digit_timeout"];
$ivr_menu_max_failures = $row["ivr_menu_max_failures"];
$ivr_menu_max_timeouts = $row["ivr_menu_max_timeouts"];
$ivr_menu_digit_len = $row["ivr_menu_digit_len"];
$ivr_menu_direct_dial = $row["ivr_menu_direct_dial"];
$ivr_menu_enabled = $row["ivr_menu_enabled"];
$ivr_menu_description = check_str($row["ivr_menu_description"]);
//replace space with an underscore
$ivr_menu_name = str_replace(" ", "_", $ivr_menu_name);
//add each IVR menu to the XML config
$tmp = "<include>\n";
if (strlen($ivr_menu_description) > 0) {
$tmp .= "\t<!-- {$ivr_menu_description} -->\n";
}
if (count($_SESSION["domains"]) > 1) {
$tmp .= "\t<menu name=\"" . $_SESSION['domains'][$domain_uuid]['domain_name'] . "-" . $ivr_menu_name . "\"\n";
} else {
$tmp .= "\t<menu name=\"{$ivr_menu_name}\"\n";
}
if (stripos($ivr_menu_greet_long, 'mp3') !== false || stripos($ivr_menu_greet_long, 'wav') !== false) {
//found wav or mp3
$tmp .= "\t\tgreet-long=\"" . $ivr_menu_greet_long . "\"\n";
} else {
//not found
$tmp .= "\t\tgreet-long=\"" . $ivr_menu_greet_long . "\"\n";
}
if (stripos($ivr_menu_greet_short, 'mp3') !== false || stripos($ivr_menu_greet_short, 'wav') !== false) {
if (strlen($ivr_menu_greet_short) > 0) {
$tmp .= "\t\tgreet-short=\"" . $ivr_menu_greet_short . "\"\n";
}
} else {
//not found
if (strlen($ivr_menu_greet_short) > 0) {
$tmp .= "\t\tgreet-short=\"" . $ivr_menu_greet_short . "\"\n";
}
}
$tmp .= "\t\tinvalid-sound=\"{$ivr_menu_invalid_sound}\"\n";
$tmp .= "\t\texit-sound=\"{$ivr_menu_exit_sound}\"\n";
$tmp .= "\t\tconfirm-macro=\"{$ivr_menu_confirm_macro}\"\n";
$tmp .= "\t\tconfirm-key=\"{$ivr_menu_confirm_key}\"\n";
$tmp .= "\t\ttts-engine=\"{$ivr_menu_tts_engine}\"\n";
$tmp .= "\t\ttts-voice=\"{$ivr_menu_tts_voice}\"\n";
$tmp .= "\t\tconfirm-attempts=\"{$ivr_menu_confirm_attempts}\"\n";
$tmp .= "\t\ttimeout=\"{$ivr_menu_timeout}\"\n";
$tmp .= "\t\tinter-digit-timeout=\"{$ivr_menu_inter_digit_timeout}\"\n";
$tmp .= "\t\tmax-failures=\"{$ivr_menu_max_failures}\"\n";
$tmp .= "\t\tmax-timeouts=\"{$ivr_menu_max_timeouts}\"\n";
$tmp .= "\t\tdigit-len=\"{$ivr_menu_digit_len}\">\n";
$sub_sql = "select * from v_ivr_menu_options ";
$sub_sql .= "where ivr_menu_uuid = '{$ivr_menu_uuid}' ";
$sub_sql .= "and domain_uuid = '{$domain_uuid}' ";
$sub_sql .= "order by ivr_menu_option_order asc ";
$sub_prep_statement = $db->prepare(check_sql($sub_sql));
$sub_prep_statement->execute();
$sub_result = $sub_prep_statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($sub_result as &$sub_row) {
//$ivr_menu_uuid = $sub_row["ivr_menu_uuid"];
$ivr_menu_option_digits = $sub_row["ivr_menu_option_digits"];
$ivr_menu_option_action = $sub_row["ivr_menu_option_action"];
$ivr_menu_option_param = $sub_row["ivr_menu_option_param"];
$ivr_menu_option_description = $sub_row["ivr_menu_option_description"];
$tmp .= "\t\t<entry action=\"{$ivr_menu_option_action}\" digits=\"{$ivr_menu_option_digits}\" param=\"{$ivr_menu_option_param}\"/>";
if (strlen($ivr_menu_option_description) == 0) {
$tmp .= "\n";
} else {
$tmp .= "\t<!-- {$ivr_menu_option_description} -->\n";
}
}
unset($sub_prep_statement, $sub_row);
if ($ivr_menu_direct_dial == "true") {
$tmp .= "\t\t<entry action=\"menu-exec-app\" digits=\"/(^\\d{3,6}\$)/\" param=\"transfer \$1 XML " . $_SESSION["context"] . "\"/>\n";
}
$tmp .= "\t</menu>\n";
$tmp .= "</include>\n";
//remove invalid characters from the file names
$ivr_menu_name = str_replace(" ", "_", $ivr_menu_name);
$ivr_menu_name = preg_replace("/[\\*\\:\\/\\<\\>\\|\\'\"\\?]/", "", $ivr_menu_name);
//write the file
if (count($_SESSION["domains"]) > 1) {
$fout = fopen($_SESSION['switch']['conf']['dir'] . "/ivr_menus/v_" . $_SESSION['domains'][$row['domain_uuid']]['domain_name'] . "_" . $ivr_menu_name . ".xml", "w");
} else {
$fout = fopen($_SESSION['switch']['conf']['dir'] . "/ivr_menus/v_" . $ivr_menu_name . ".xml", "w");
}
fwrite($fout, $tmp);
fclose($fout);
}
}
save_dialplan_xml();
//apply settings
$_SESSION["reload_xml"] = true;
}
示例7: dialplan
//.........这里部分代码省略.........
$details[$x]['dialplan_detail_data'] = 'ringback=${hold_music}';
} else {
$details[$x]['dialplan_detail_data'] = 'ringback=' . $field['ivr_menu_ringback'];
}
$details[$x]['dialplan_detail_order'] = '025';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = 'set';
if ($field['ivr_menu_ringback'] == "music" || $field['ivr_menu_ringback'] == "") {
$details[$x]['dialplan_detail_data'] = 'transfer_ringback=${hold_music}';
} else {
$details[$x]['dialplan_detail_data'] = 'transfer_ringback=' . $field['ivr_menu_ringback'];
}
$details[$x]['dialplan_detail_order'] = '030';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = 'set';
$details[$x]['dialplan_detail_data'] = 'ivr_menu_uuid=' . $this->ivr_menu_uuid;
$details[$x]['dialplan_detail_order'] = '035';
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
if ($_SESSION['ivr menu']['application']['text'] == "lua") {
$details[$x]['dialplan_detail_type'] = 'lua';
$details[$x]['dialplan_detail_data'] = 'ivr_menu.lua';
} else {
$details[$x]['dialplan_detail_type'] = 'ivr';
$details[$x]['dialplan_detail_data'] = $this->ivr_menu_uuid;
}
$details[$x]['dialplan_detail_order'] = '040';
if (strlen($field['ivr_menu_exit_app']) > 0) {
$x++;
$details[$x]['dialplan_detail_tag'] = 'action';
//condition, action, antiaction
$details[$x]['dialplan_detail_type'] = $field['ivr_menu_exit_app'];
$details[$x]['dialplan_detail_data'] = $field['ivr_menu_exit_data'];
$details[$x]['dialplan_detail_order'] = '045';
$x++;
}
//build the array
$array['domain_uuid'] = $field['domain_uuid'];
$array['dialplan_uuid'] = $field['dialplan_uuid'];
$array['dialplan_name'] = $field['ivr_menu_name'];
$array['dialplan_order'] = '333';
$array['dialplan_context'] = $_SESSION['context'];
$array['dialplan_enabled'] = $field['ivr_menu_enabled'];
$array['dialplan_description'] = $field['ivr_menu_description'];
$array['app_uuid'] = $this->app_uuid;
$x = 0;
foreach ($details as $row) {
//find the matching uuid
/*
foreach ($dialplan_details as $database) {
if ($database['dialplan_detail_tag'] == $row['dialplan_detail_tag']
&& $database['dialplan_detail_type'] == $row['dialplan_detail_type']
&& $database['dialplan_detail_data'] == $row['dialplan_detail_data']) {
$array['dialplan_details'][$x]['dialplan_detail_uuid'] = $database['dialplan_detail_uuid'];
}
}
*/
//add to the array
$array['dialplan_details'][$x]['domain_uuid'] = $field['domain_uuid'];
$array['dialplan_details'][$x]['dialplan_uuid'] = $field['dialplan_uuid'];
$array['dialplan_details'][$x]['dialplan_detail_tag'] = $row['dialplan_detail_tag'];
$array['dialplan_details'][$x]['dialplan_detail_type'] = $row['dialplan_detail_type'];
$array['dialplan_details'][$x]['dialplan_detail_data'] = $row['dialplan_detail_data'];
$array['dialplan_details'][$x]['dialplan_detail_order'] = $row['dialplan_detail_order'];
//increment the row
$x++;
}
//debug
//echo "<pre>\n";
//print_r($dialplan_details);
//print_r($array);
//echo "</pre>\n";
//exit;
//save the dialplan
$orm = new orm();
$orm->name('dialplans');
$orm->save($array);
$response = $orm->message;
if (strlen($response['uuid']) > 0) {
$this->dialplan_uuid = $response['uuid'];
}
//debug
//echo "<pre>\n";
//print_r($response);
//echo "</pre>\n";
//exit;
//synchronize the xml config
save_dialplan_xml();
//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);
//}
}
示例8: upgrade
//.........这里部分代码省略.........
}
$_SESSION['domains'][$row['domain_uuid']]['domain_uuid'] = $row['domain_uuid'];
$_SESSION['domains'][$row['domain_uuid']]['domain_name'] = $row['domain_name'];
}
}
unset($result, $prep_statement);
//get the default settings
$sql = "select * from v_default_settings ";
$sql .= "where default_setting_enabled = 'true' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$result_default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
//get the default recordings directory
foreach ($result_default_settings as $row) {
$name = $row['default_setting_name'];
$category = $row['default_setting_category'];
$subcategory = $row['default_setting_subcategory'];
if ($category == 'switch' && $subcategory == 'recordings' && $name == 'dir') {
$switch_recordings_dir = $row['default_setting_value'];
}
}
//loop through all domains
$sql = "select * from v_domains ";
$v_prep_statement = $db->prepare(check_sql($sql));
$v_prep_statement->execute();
$main_result = $v_prep_statement->fetchAll(PDO::FETCH_ASSOC);
$domain_count = count($main_result);
$domains_processed = 1;
foreach ($main_result as &$row) {
//get the values from database and set them as php variables
$domain_uuid = $row["domain_uuid"];
$domain_name = $row["domain_name"];
//get the context
$context = $domain_name;
//show the domain when display_type is set to text
if ($display_type == "text") {
echo "\n";
echo $domain_name;
echo "\n";
}
//get the default settings - this needs to be done to reset the session values back to the defaults for each domain in the loop
foreach ($result_defaults_settings as $row) {
$name = $row['default_setting_name'];
$category = $row['default_setting_category'];
$subcategory = $row['default_setting_subcategory'];
if (strlen($subcategory) == 0) {
if ($name == "array") {
$_SESSION[$category][] = $row['default_setting_value'];
} else {
$_SESSION[$category][$name] = $row['default_setting_value'];
}
} else {
if ($name == "array") {
$_SESSION[$category][$subcategory][] = $row['default_setting_value'];
} else {
$_SESSION[$category][$subcategory]['uuid'] = $row['default_setting_uuid'];
$_SESSION[$category][$subcategory][$name] = $row['default_setting_value'];
}
}
}
//get the domains settings
$sql = "select * from v_domain_settings ";
$sql .= "where domain_uuid = '" . $domain_uuid . "' ";
$sql .= "and domain_setting_enabled = 'true' ";
$prep_statement = $db->prepare($sql);
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as $row) {
$name = $row['domain_setting_name'];
$category = $row['domain_setting_category'];
$subcategory = $row['domain_setting_subcategory'];
if (strlen($subcategory) == 0) {
//$$category[$name] = $row['domain_setting_value'];
$_SESSION[$category][$name] = $row['domain_setting_value'];
} else {
//$$category[$subcategory][$name] = $row['domain_setting_value'];
$_SESSION[$category][$subcategory][$name] = $row['domain_setting_value'];
}
}
//set the recordings directory
if (strlen($switch_recordings_dir) > 1 && count($_SESSION["domains"]) > 1) {
$_SESSION['switch']['recordings']['dir'] = $switch_recordings_dir . "/" . $domain_name;
}
//get the list of installed apps from the core and mod directories and execute the php code in app_defaults.php
$default_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_defaults.php");
foreach ($default_list as &$default_path) {
include $default_path;
}
//track of the number of domains processed
$domains_processed++;
}
unset($v_prep_statement);
//synchronize the dialplan
if (function_exists('save_dialplan_xml')) {
save_dialplan_xml();
}
//clear the session variables
unset($_SESSION['domain']);
unset($_SESSION['switch']);
}
示例9: save_hunt_group
//.........这里部分代码省略.........
if ($tmp_row["application"] == "voicemail") {
$tmpdata = "*99" . $tmpdata;
} else {
if ($tmp_row["type"] == "extension") {
$tmp .= "if (extension_registered(domain_name, sip_profile, '" . $tmp_row["extension"] . "')) then\n";
$tmp .= "\t";
}
if ($row['hunt_group_caller_announce'] == "true") {
$tmp .= "result = originate (domain_name, session, " . $tmpdata . ", extension, caller_id_name, caller_id_number, caller_announce);\n";
} else {
$tmp .= "result = originate (domain_name, session, " . $tmpdata . ", extension, caller_id_name, caller_id_number);\n";
}
if ($tmp_row["type"] == "extension") {
$tmp .= "end\n";
}
}
}
}
} else {
foreach ($tmp_array as $tmp_row) {
if (strlen($tmp_row["data"]) > 0) {
$tmp .= "\tsession:execute(\"" . $tmp_application . "\", " . $tmp_row["data"] . ");\n";
}
}
}
unset($tmp_row);
}
break;
}
unset($tmp_switch, $tmp_buffer, $tmp_array);
//set the timeout destination
$hunt_group_timeout_destination = $row['hunt_group_timeout_destination'];
if ($row['hunt_group_timeout_type'] == "extension") {
$hunt_group_timeout_type = "transfer";
}
if ($row['hunt_group_timeout_type'] == "voicemail") {
$hunt_group_timeout_type = "transfer";
$hunt_group_timeout_destination = "*99" . $hunt_group_timeout_destination . " XML " . $_SESSION["context"];
}
if ($row['hunt_group_timeout_type'] == "sip uri") {
$hunt_group_timeout_type = "bridge";
}
$tmp .= "\n";
if ($row['hunt_group_caller_announce'] == "true" || $row['hunt_group_call_prompt'] == "true") {
//do nothing
} else {
$tmp .= "\t--timeout\n";
if ($row['hunt_group_type'] != 'dnd') {
$tmp .= "\toriginate_disposition = session:getVariable(\"originate_disposition\");\n";
$tmp .= "\tif originate_disposition ~= \"SUCCESS\" then\n";
}
if ($row['hunt_group_timeout_type'] == "voicemail") {
$tmp .= "\t\t\tsession:answer();\n";
}
$tmp .= "\t\t\tsession:execute(\"" . $hunt_group_timeout_type . "\", \"" . $hunt_group_timeout_destination . "\");\n";
if ($row['hunt_group_type'] != 'dnd') {
$tmp .= "\tend\n";
}
}
if ($row['hunt_group_caller_announce'] == "true" || $row['hunt_group_call_prompt'] == "true") {
//do nothing
} else {
$tmp .= "end --end if session:ready\n";
}
$tmp .= "\n";
//pin number requested from caller if provided
if (strlen($row['hunt_group_pin']) > 0) {
$tmp .= "else \n";
$tmp .= "\tsession:streamFile(sounds_dir..\"/\"..default_language..\"/\"..default_dialect..\"/\"..default_voice..\"/custom/your_pin_number_is_incorect_goodbye.wav\");\n";
$tmp .= "\tsession:hangup();\n";
$tmp .= "end\n";
$tmp .= "\n";
}
//unset variables
$tmp .= "\n";
$tmp .= "--clear variables\n";
$tmp .= "dialed_extension = \"\";\n";
$tmp .= "new_extension = \"\";\n";
$tmp .= "domain_name = \"\";\n";
$tmp .= "\n";
//remove invalid characters from the file names
$huntgroup_extension = $row['hunt_group_extension'];
$huntgroup_extension = str_replace(" ", "_", $huntgroup_extension);
$huntgroup_extension = preg_replace("/[\\*\\:\\/\\<\\>\\|\\'\"\\?]/", "", $huntgroup_extension);
//write the hungroup lua script
if (strlen($row['hunt_group_extension']) > 0) {
if ($row['hunt_group_enabled'] != "false") {
$hunt_group_filename = "v_huntgroup_" . $_SESSION['domains'][$domain_uuid]['domain_name'] . "_" . $huntgroup_extension . ".lua";
//echo "location".$_SESSION['switch']['scripts']['dir']."/".$hunt_group_filename;
$fout = fopen($_SESSION['switch']['scripts']['dir'] . "/" . $hunt_group_filename, "w");
fwrite($fout, $tmp);
unset($hunt_group_filename);
fclose($fout);
}
}
}
//end while
//save the dialplan xml files
save_dialplan_xml();
}