diff --git a/app/dialplan_outbound/dialplan_outbound_add.php b/app/dialplan_outbound/dialplan_outbound_add.php index 295442888a..d31336e6f9 100644 --- a/app/dialplan_outbound/dialplan_outbound_add.php +++ b/app/dialplan_outbound/dialplan_outbound_add.php @@ -72,20 +72,23 @@ $gateway_type = 'gateway'; $gateway_2_type = 'gateway'; $gateway_3_type = 'gateway'; - - //set the gateway type to enum - if (strtolower(substr($gateway, 0, 7)) == "enum") { + //set the gateway type to bridge + if (strtolower(substr($gateway, 0, 6)) == "bridge") { + $gateway_type = 'bridge'; + } + //set the type to enum + if (strtolower(substr($gateway, 0, 4)) == "enum") { $gateway_type = 'enum'; } - //set the gateway type to freetdm + //set the type to freetdm if (strtolower(substr($gateway, 0, 7)) == "freetdm") { $gateway_type = 'freetdm'; } - //set the gateway type to transfer + //set the type to transfer if (strtolower(substr($gateway, 0, 8)) == "transfer") { $gateway_type = 'transfer'; } - //set the gateway type to dingaling + //set the type to dingaling if (strtolower(substr($gateway, 0, 4)) == "xmpp") { $gateway_type = 'xmpp'; } @@ -102,15 +105,23 @@ //set the gateway_2 variable $gateway_2 = check_str($_POST["gateway_2"]); - //set the gateway type to enum + //set the type to bridge + if (strtolower(substr($gateway_2, 0, 6)) == "bridge") { + $gateway_2_type = 'bridge'; + } + //set type to enum if (strtolower(substr($gateway_2, 0, 4)) == "enum") { $gateway_2_type = 'enum'; } - //set the gateway type to freetdm + //set the type to freetdm if (strtolower(substr($gateway_2, 0, 7)) == "freetdm") { $gateway_2_type = 'freetdm'; } - //set the gateway type to dingaling + //set the type to transfer + if (strtolower(substr($gateway_2, 0, 8)) == "transfer") { + $gateway_type = 'transfer'; + } + //set the type to dingaling if (strtolower(substr($gateway_2, 0, 4)) == "xmpp") { $gateway_2_type = 'xmpp'; } @@ -127,18 +138,26 @@ //set the gateway_3 variable $gateway_3 = check_str($_POST["gateway_3"]); - //set the gateway type to enum + //set the type to bridge + if (strtolower(substr($gateway_3, 0, 6)) == "bridge") { + $gateway_3_type = 'bridge'; + } + //set the type to enum if (strtolower(substr($gateway_3, 0, 4)) == "enum") { $gateway_3_type = 'enum'; } - //set the gateway type to freetdm + //set the type to freetdm if (strtolower(substr($gateway_3, 0, 7)) == "freetdm") { $gateway_3_type = 'freetdm'; } - //set the gateway type to dingaling + //set the type to dingaling if (strtolower(substr($gateway_3, 0, 4)) == "xmpp") { $gateway_3_type = 'xmpp'; } + //set the type to transfer + if (strtolower(substr($gateway_3, 0, 8)) == "transfer") { + $gateway_type = 'transfer'; + } //set the gateway_3_id and gateway_3_name if ($gateway_3_type == "gateway" && strlen($_POST["gateway_3"]) > 0) { $gateway_3_array = explode(":",$gateway_3); @@ -284,7 +303,7 @@ if ($gateway_type == "gateway") { $dialplan_name = $gateway_name.".".$abbrv; - $action_data = "sofia/gateway/".$gateway_uuid."/".$prefix_number."\$1"; + $bridge_data = "sofia/gateway/".$gateway_uuid."/".$prefix_number."\$1"; } if (strlen($gateway_2_name) > 0 && $gateway_2_type == "gateway") { $extension_2_name = $gateway_2_id.".".$abbrv; @@ -296,7 +315,7 @@ } if ($gateway_type == "freetdm") { $dialplan_name = "freetdm.".$abbrv; - $action_data = $gateway."/1/a/".$prefix_number."\$1"; + $bridge_data = $gateway."/1/a/".$prefix_number."\$1"; } if ($gateway_2_type == "freetdm") { $extension_2_name = "freetdm.".$abbrv; @@ -308,7 +327,7 @@ } if ($gateway_type == "xmpp") { $dialplan_name = "xmpp.".$abbrv; - $action_data = "dingaling/gtalk/+".$prefix_number."\$1@voice.google.com"; + $bridge_data = "dingaling/gtalk/+".$prefix_number."\$1@voice.google.com"; } if ($gateway_2_type == "xmpp") { $extension_2_name = "xmpp.".$abbrv; @@ -318,6 +337,23 @@ $extension_3_name = "xmpp.".$abbrv; $bridge_3_data .= "dingaling/gtalk/+".$prefix_number."\$1@voice.google.com"; } + + if ($gateway_type == "bridge") { + $dialplan_name = "bridge.".$abbrv; + $gateway_array = explode(":",$gateway); + $bridge_data = $gateway_array[1]; + } + if ($gateway_2_type == "bridge") { + $dialplan_name = "bridge.".$abbrv; + $gateway_array = explode(":",$gateway_2); + $bridge_2_data = $gateway_array[1]; + } + if ($gateway_3_type == "bridge") { + $dialplan_name = "bridge.".$abbrv; + $gateway_array = explode(":",$gateway_3); + $bridge_3_data = $gateway_array[1]; + } + if ($gateway_type == "enum") { if (strlen($bridge_2_data) == 0) { $dialplan_name = "enum.".$abbrv; @@ -325,7 +361,7 @@ else { $dialplan_name = $extension_2_name; } - $action_data = "\${enum_auto_route}"; + $bridge_data = "\${enum_auto_route}"; } if ($gateway_2_type == "enum") { $bridge_2_data .= "\${enum_auto_route}"; @@ -333,10 +369,11 @@ if ($gateway_3_type == "enum") { $bridge_3_data .= "\${enum_auto_route}"; } + if ($gateway_type == "transfer") { $dialplan_name = "transfer.".$abbrv; $gateway_array = explode(":",$gateway); - $action_data = $gateway_array[1]; + $bridge_data = $gateway_array[1]; } if ($gateway_2_type == "transfer") { $gateway_array = explode(":",$gateway_2); @@ -346,6 +383,7 @@ $gateway_array = explode(":",$gateway_3); $bridge_3_data = $gateway_array[1]; } + if (strlen($dialplan_order) == 0) { $dialplan_order ='333'; } @@ -600,7 +638,7 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_uuid'] = $dialplan_uuid; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_tag'] = 'action'; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_type'] = $dialplan_detail_type; - $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $action_data; + $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_data'] = $bridge_data; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_order'] = $y * 10; $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; @@ -628,12 +666,13 @@ $array['dialplans'][$x]['dialplan_details'][$y]['dialplan_detail_group'] = '0'; } + + unset($bridge_data); unset($bridge_2_data); unset($bridge_3_data); unset($label); unset($abbrv); unset($dialplan_expression); - unset($action_data); } //if strlen $x++; } //end foreach @@ -665,6 +704,40 @@ header("Location: ".PROJECT_PATH."/app/dialplans/dialplans.php?app_uuid=8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3"); return; } //end if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) + +//get the domains + $sql = "select * from v_domains "; + $sql .= "where domain_enabled = 'true' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $domains = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset ($prep_statement, $sql); + +//get the gateways + $sql = "select * from v_gateways "; + $sql .= "where enabled = 'true' "; + if (permission_exists('outbound_route_any_gateway')) { + $sql .= "order by domain_uuid "; + } + else { + $sql .= "and domain_uuid = '$domain_uuid' "; + } + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $gateways = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset ($prep_statement, $sql); + +//get the bridges + if (permission_exists('bridge_view')) { + $sql = "select * from v_bridges "; + $sql .= "where bridge_enabled = 'true' "; + $sql .= "and domain_uuid = '$domain_uuid' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $bridges = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset ($prep_statement, $sql); + } + ?>