From 4db3c727ece5c36f561e9119e2dceb4d27a9f53f Mon Sep 17 00:00:00 2001 From: reliberate Date: Mon, 29 Feb 2016 21:46:13 -0700 Subject: [PATCH 1/3] Outbound Route: Set effective_caller_id_name to use Emergency CID Name when creating 911 route. --- app/dialplan_outbound/dialplan_outbound_add.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 34261db7c3..bba0e20b56 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -420,7 +420,12 @@ else { $dialplan_detail_tag = 'action'; //condition, action, antiaction $dialplan_detail_type = 'set'; - $dialplan_detail_data = 'effective_caller_id_name=${outbound_caller_id_name}'; + if ($dialplan_expression == '^(911)$') { + $dialplan_detail_data = 'effective_caller_id_name=${emergency_caller_id_name}'; + } + else { + $dialplan_detail_data = 'effective_caller_id_name=${outbound_caller_id_name}'; + } $dialplan_detail_order = '030'; $dialplan_detail_group = '0'; dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data); From 877c1e805d9c4db7b4bded0bdc43010e1c04e6db Mon Sep 17 00:00:00 2001 From: reliberate Date: Mon, 29 Feb 2016 22:54:24 -0700 Subject: [PATCH 2/3] Call Center Agent: Prevent duplicate sip_invite_domain key/value insertion on Agent edit. --- app/call_centers/call_center_agent_edit.php | 34 ++++++--------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/app/call_centers/call_center_agent_edit.php b/app/call_centers/call_center_agent_edit.php index 34002e36ac..102797d5ea 100644 --- a/app/call_centers/call_center_agent_edit.php +++ b/app/call_centers/call_center_agent_edit.php @@ -140,37 +140,21 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //add the call_timeout and confirm $agent_contact = $first.',call_timeout='.$agent_call_timeout.$last; $agent_contact = "{".$confirm.",call_timeout=".$agent_call_timeout.",sip_invite_domain=".$_SESSION['domain_name']."}".$agent_contact; - echo "\n\n".$agent_contact."\n\n"; } } else { - //found + $position = strrpos($agent_contact, "}"); + $first = substr($agent_contact, 0, $position); + $last = substr($agent_contact, $position); + //add call_timeout and sip_invite_domain, only if missing + $call_timeout = (stristr($agent_contact, 'call_timeout') === FALSE) ? ',call_timeout='.$agent_call_timeout : null; + $sip_invite_domain = (stristr($agent_contact, 'sip_invite_domain') === FALSE) ? ',sip_invite_domain='.$_SESSION['domain_name'] : null; + //compose if(stristr($agent_contact, 'sofia/gateway') === FALSE) { - //not found - $position = strrpos($agent_contact, "}"); - $first = substr($agent_contact, 0, $position); - $last = substr($agent_contact, $position); - if(stristr($agent_contact, 'call_timeout') === FALSE) { - $call_timeout = ',call_timeout='.$agent_call_timeout; - } - else { - $call_timeout = ''; - } - $agent_contact = $first.',sip_invite_domain='.$_SESSION['domain_name'].$call_timeout.$last; + $agent_contact = $first.$sip_invite_domain.$call_timeout.$last; } else { - //found - $position = strrpos($agent_contact, "}"); - $first = substr($agent_contact, 0, $position); - $last = substr($agent_contact, $position); - if(stristr($agent_contact, 'call_timeout') === FALSE) { - //add the call_timeout and confirm - $agent_contact = $first.','.$confirm.',sip_invite_domain='.$_SESSION['domain_name'].'call_timeout='.$agent_call_timeout.$last; - } - else { - //add confirm - $agent_contact = $first.',sip_invite_domain='.$_SESSION['domain_name'].','.$confirm.$last; - } + $agent_contact = $first.','.$confirm.$sip_invite_domain.$call_timeout.$last; } } From 2230a6710dd6c0475b1acdc4d948fe3f76507af9 Mon Sep 17 00:00:00 2001 From: reliberate Date: Thu, 3 Mar 2016 11:28:35 -0700 Subject: [PATCH 3/3] User Settings: Fix delete setting, move bulk delete function to user_setting_delete.php. --- core/users/user_setting_delete.php | 33 ++++++++++--------- core/users/user_settings.php | 52 ++++++------------------------ 2 files changed, 28 insertions(+), 57 deletions(-) diff --git a/core/users/user_setting_delete.php b/core/users/user_setting_delete.php index 641cae46d3..52a021d600 100644 --- a/core/users/user_setting_delete.php +++ b/core/users/user_setting_delete.php @@ -38,26 +38,29 @@ else { $language = new text; $text = $language->get(); -//get the variables - if (count($_GET)>0) { - $id = check_str($_GET["id"]); - $user_uuid = check_str($_GET["user_uuid"]); - } +//delete user settings + $user_setting_uuids = $_REQUEST["id"]; + $user_uuid = check_str($_REQUEST["user_uuid"]); -//delete the record - if (strlen($id) > 0) { - //delete user_setting + if (sizeof($user_setting_uuids) > 0) { + foreach ($user_setting_uuids as $user_setting_uuid) { $sql = "delete from v_user_settings "; - $sql .= "where user_uuid = '$user_uuid' "; - $sql .= "and user_setting_uuid = '$id' "; + $sql .= "where user_uuid = '".$user_uuid."' "; + $sql .= "and user_setting_uuid = '".$user_setting_uuid."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); - unset($sql); + unset ($prep_statement, $sql); + } + // set message + $_SESSION["message"] = $text['message-delete'].": ".sizeof($user_setting_uuids); + } + else { + // set message + $_SESSION["message"] = $text['message-delete_failed']; + $_SESSION["message_mood"] = "negative"; } -//redirect the user - $_SESSION["message"] = $text['message-delete']; - header("Location: usersupdate.php?id=".$user_uuid); - return; + header("Location: usersupdate.php?id=".check_str($_REQUEST["user_uuid"])); + exit; ?> \ No newline at end of file diff --git a/core/users/user_settings.php b/core/users/user_settings.php index ce255112fb..a47f0cde5d 100644 --- a/core/users/user_settings.php +++ b/core/users/user_settings.php @@ -34,15 +34,12 @@ else { exit; } +//toggle setting enabled + if (sizeof($_REQUEST) > 1) { + $user_uuid = check_str($_REQUEST["user_id"]); + $user_setting_uuids = $_REQUEST["id"]; + $enabled = check_str($_REQUEST['enabled']); -if (sizeof($_REQUEST) > 1) { - - $action = check_str($_REQUEST["action"]); - $user_uuid = check_str($_REQUEST["user_id"]); - $user_setting_uuids = $_REQUEST["id"]; - $enabled = check_str($_REQUEST['enabled']); - - //change enabled value if ($user_uuid != '' && sizeof($user_setting_uuids) == 1 && $enabled != '') { $sql = "update v_user_settings set "; $sql .= "user_setting_enabled = '".$enabled."' "; @@ -56,35 +53,7 @@ if (sizeof($_REQUEST) > 1) { header("Location: usersupdate.php?id=".$user_uuid); exit; } - - //delete user settings - if ($action == 'delete' && permission_exists('user_setting_delete')) { - //add multi-lingual support - $language = new text; - $text = $language->get(); - - if (sizeof($user_setting_uuids) > 0) { - foreach ($user_setting_uuids as $user_setting_uuid) { - $sql = "delete from v_user_settings "; - $sql .= "where user_setting_uuid = '".$user_setting_uuid."' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset ($prep_statement, $sql); - } - // set message - $_SESSION["message"] = $text['message-delete'].": ".sizeof($user_setting_uuids); - } - else { - // set message - $_SESSION["message"] = $text['message-delete_failed']; - $_SESSION["message_mood"] = "negative"; - } - - header("Location: usersupdate.php?id=".check_str($_REQUEST["user_uuid"])); - exit; - } - -} //REQUEST + } //include the paging require_once "resources/paging.php"; @@ -94,8 +63,7 @@ if (sizeof($_REQUEST) > 1) { $order = check_str($_GET["order"]); //show the content - echo "
"; - echo ""; + echo ""; echo ""; //prepare to page the results @@ -187,7 +155,7 @@ if (sizeof($_REQUEST) > 1) { echo "".$v_link_label_add.""; } if (permission_exists('user_setting_delete')) { - echo "".$v_link_label_delete.""; + echo "".$v_link_label_delete.""; } echo "\n"; echo "\n"; @@ -246,7 +214,7 @@ if (sizeof($_REQUEST) > 1) { echo "$v_link_label_edit"; } if (permission_exists('user_setting_delete')) { - echo "$v_link_label_delete"; + echo "$v_link_label_delete"; } echo " \n"; echo "\n"; @@ -267,7 +235,7 @@ if (sizeof($_REQUEST) > 1) { echo "$v_link_label_add"; } if (permission_exists('user_setting_delete') && $result_count > 0) { - echo "".$v_link_label_delete.""; + echo "".$v_link_label_delete.""; } echo " \n"; echo " \n";