Update switch.php (#4922)

* Update switch.php

* Update switch.php
This commit is contained in:
agree 2019-12-03 17:05:08 -05:00 committed by FusionPBX
parent 0b35eb3064
commit 347e5f0934
1 changed files with 15 additions and 7 deletions

View File

@ -424,7 +424,7 @@ function save_var_xml() {
}
}
function outbound_route_to_bridge($domain_uuid, $destination_number) {
function outbound_route_to_bridge($domain_uuid, $destination_number, array $channel_variables=null) {
$destination_number = trim($destination_number);
preg_match('/^[\*\+0-9]*$/', $destination_number, $matches, PREG_OFFSET_CAPTURE);
@ -470,7 +470,7 @@ function outbound_route_to_bridge($domain_uuid, $destination_number) {
$sub_result = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
$regex_match = false;
$condition_match = false;
if (is_array($sub_result) && @sizeof($sub_result) != 0) {
foreach ($sub_result as &$sub_row) {
if ($sub_row['dialplan_detail_tag'] == "condition") {
@ -478,22 +478,31 @@ function outbound_route_to_bridge($domain_uuid, $destination_number) {
$pattern = '/'.$sub_row['dialplan_detail_data'].'/';
preg_match($pattern, $destination_number, $matches, PREG_OFFSET_CAPTURE);
if (count($matches) == 0) {
$regex_match = false;
$condition_match[] = 'false';
}
else {
$regex_match = true;
$condition_match[] = 'true';
$regex_match_1 = $matches[1][0];
$regex_match_2 = $matches[2][0];
$regex_match_3 = $matches[3][0];
$regex_match_4 = $matches[4][0];
$regex_match_5 = $matches[5][0];
}
}
elseif ($sub_row['dialplan_detail_type'] == "\${toll_allow}") {
$pattern = '/'.$sub_row['dialplan_detail_data'].'/';
preg_match($pattern, $channel_variables['toll_allow'], $matches, PREG_OFFSET_CAPTURE);
if (count($matches) == 0) {
$condition_match[] = 'false';
}
else {
$condition_match[] = 'true';
}
}
}
}
}
if ($regex_match) {
if (!in_array('false', $condition_match)) {
$x = 0;
foreach ($sub_result as &$sub_row) {
$dialplan_detail_data = $sub_row['dialplan_detail_data'];
@ -514,7 +523,6 @@ function outbound_route_to_bridge($domain_uuid, $destination_number) {
}
}
unset($result, $row);
return $bridge_array;
}
//$destination_number = '1231234';