From 815dd7ec872c3c31ed3a5f69f28831f754050449 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Tue, 4 Sep 2012 16:34:34 +0000 Subject: [PATCH] Fix outbound_route_to_bridge so that it uses the correct domain_uuid in every situation. Everyone using multi-tenant is should update svn to apply this fix. --- app/call_broadcast/v_call_broadcast_send.php | 2 +- app/click_to_call/click_to_call.php | 4 ++-- app/fax/fax_view.php | 2 +- app/virtual_tables/v_virtual_tables_edit.php | 2 +- includes/lib_switch.php | 10 +++++----- secure/fax_to_email.php | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/call_broadcast/v_call_broadcast_send.php b/app/call_broadcast/v_call_broadcast_send.php index 803fd112d6..7a4fd25144 100644 --- a/app/call_broadcast/v_call_broadcast_send.php +++ b/app/call_broadcast/v_call_broadcast_send.php @@ -148,7 +148,7 @@ function cmd_async($cmd) { $phone1 = str_replace(".", "", $phone1); //get the correct gateway - $bridge_array = outbound_route_to_bridge ($phone1); + $bridge_array = outbound_route_to_bridge ($_SESSION['domain_uuid'], $phone1); //prepare the string $channel_variables = "ignore_early_media=true,origination_number=$phone1,origination_caller_id_name='$broadcast_caller_id_name',origination_caller_id_number=$broadcast_caller_id_number"; diff --git a/app/click_to_call/click_to_call.php b/app/click_to_call/click_to_call.php index a7a41330b1..3b96cac20b 100644 --- a/app/click_to_call/click_to_call.php +++ b/app/click_to_call/click_to_call.php @@ -93,7 +93,7 @@ if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest']) $source = "{".$sip_auto_answer."origination_caller_id_name='$src_cid_name',origination_caller_id_number=$src_cid_number,instant_ringback=true,ringback=$ringback_value,presence_id=$src@".$_SESSION['domains'][$domain_uuid]['domain_name'].",call_direction=outbound}sofia/internal/$src%".$_SESSION['domains'][$domain_uuid]['domain_name']; } else { - $bridge_array = outbound_route_to_bridge ($src); + $bridge_array = outbound_route_to_bridge ($_SESSION['domain_uuid'], $src); $source = "{origination_caller_id_name='$src_cid_name',origination_caller_id_number=$src_cid_number,instant_ringback=true,ringback=$ringback_value,presence_id=$src@".$_SESSION['domains'][$domain_uuid]['domain_name'].",call_direction=outbound}".$bridge_array[0]; } @@ -120,7 +120,7 @@ if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest']) unset ($prep_statement); } } - $bridge_array = outbound_route_to_bridge ($dest); + $bridge_array = outbound_route_to_bridge ($_SESSION['domain_uuid'], $dest); $destination = "{origination_caller_id_name='$dest_cid_name',origination_caller_id_number=$dest_cid_number}".$bridge_array[0]; if (permission_exists('click_to_call_call')) { $switch_cmd = "api originate $source &bridge($destination)"; diff --git a/app/fax/fax_view.php b/app/fax/fax_view.php index 412a574c7f..a615984cb6 100644 --- a/app/fax/fax_view.php +++ b/app/fax/fax_view.php @@ -254,7 +254,7 @@ else { $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if ($fp) { //prepare the fax originate command - $route_array = outbound_route_to_bridge($fax_number); + $route_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $fax_number); $fax_file = $dir_fax_temp."/".$fax_name.".tif"; if (count($route_array) == 0) { //send the internal call to the registered extension diff --git a/app/virtual_tables/v_virtual_tables_edit.php b/app/virtual_tables/v_virtual_tables_edit.php index 5eb2a73874..cbd34b0b1b 100644 --- a/app/virtual_tables/v_virtual_tables_edit.php +++ b/app/virtual_tables/v_virtual_tables_edit.php @@ -47,7 +47,7 @@ else { if (count($_POST)>0) { $virtual_table_category = check_str($_POST["virtual_table_category"]); $virtual_table_category_other = check_str($_POST["virtual_table_category_other"]); - if (strlen($virtual_table_category_other) == 0) { $virtual_table_category = $virtual_table_category_other; } + if (strlen($virtual_table_category_other) > 0) { $virtual_table_category = $virtual_table_category_other; } $virtual_table_label = check_str($_POST["virtual_table_label"]); $virtual_table_name = check_str($_POST["virtual_table_name"]); $virtual_table_auth = check_str($_POST["virtual_table_auth"]); diff --git a/includes/lib_switch.php b/includes/lib_switch.php index bd109a2929..d3bb0ac4f5 100644 --- a/includes/lib_switch.php +++ b/includes/lib_switch.php @@ -2150,7 +2150,7 @@ function save_var_xml() { //unset($cmd); } -function outbound_route_to_bridge ($destination_number) { +function outbound_route_to_bridge ($domain_uuid, $destination_number) { global $db; $destination_number = trim($destination_number); @@ -2164,7 +2164,7 @@ function outbound_route_to_bridge ($destination_number) { } $sql = "select * from v_dialplans "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "and app_uuid = '8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3' "; $sql .= "and dialplan_enabled = 'true' "; $sql .= "order by dialplan_order asc "; @@ -2182,7 +2182,7 @@ function outbound_route_to_bridge ($destination_number) { //get the extension number using the dialplan_uuid $sql = "select * "; $sql .= "from v_dialplan_details "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "and dialplan_uuid = '$dialplan_uuid' "; $sql .= "order by dialplan_detail_order asc "; $sub_result = $db->query($sql)->fetchAll(PDO::FETCH_ASSOC); @@ -2230,7 +2230,7 @@ function outbound_route_to_bridge ($destination_number) { unset ($prep_statement); } //$destination_number = '1231234'; -//$bridge_array = outbound_route_to_bridge ($destination_number); +//$bridge_array = outbound_route_to_bridge ($domain_uuid, $destination_number); //foreach ($bridge_array as &$bridge) { // echo "bridge: ".$bridge."
"; //} @@ -2682,7 +2682,7 @@ function save_hunt_group_xml() { $tmp_sub_array["application"] = "bridge"; $tmp_sub_array["type"] = "sip uri"; //$destination_data = "{user=foo}loopback/".$ent['destination_data']."/default/XML"; - $bridge_array = outbound_route_to_bridge ($ent['destination_data']); + $bridge_array = outbound_route_to_bridge ($domain_uuid, $ent['destination_data']); $destination_data = $bridge_array[0]; $tmp_sub_array["application"] = "bridge"; $tmp_sub_array["data"] = "\"[leg_timeout=$destination_timeout,origination_caller_id_name=\"..caller_id_name..\",origination_caller_id_number=\"..caller_id_number..\"]".$destination_data."\""; diff --git a/secure/fax_to_email.php b/secure/fax_to_email.php index 341d6190fd..52da27f7c5 100644 --- a/secure/fax_to_email.php +++ b/secure/fax_to_email.php @@ -181,7 +181,7 @@ if (defined('STDIN')) { //send the command with event socket if ($fp) { //prepare the fax originate command - $route_array = outbound_route_to_bridge($fax_forward_number); + $route_array = outbound_route_to_bridge($_SESSION['domain_uuid'], $fax_forward_number); $fax_file = $dir_fax."/".$fax_name.".tif"; if (count($route_array) == 0) { //send the internal call to the registered extension