From 42e45e24f450a0630ab5826d3eb06351a70ff67a Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 23 Oct 2015 14:40:29 +0300 Subject: [PATCH 1/3] Change. Use `destination_caller_id_number` as call forward caller id. This is same value which uses by `Outbound CallerID Number` for extension. --- app/calls/call_edit.php | 12 ++++++++++-- app/calls/resources/classes/call_forward.php | 20 +++++++++++++++----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index 33934c39dd..dad61a64c3 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -536,7 +536,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (permission_exists('follow_me_cid_set')) { echo "   "; - $sql_forward = "select destination_uuid, destination_number, destination_description from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc "; + $sql_forward = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc "; $prep_statement_forward = $db->prepare(check_sql($sql_forward)); $prep_statement_forward->execute(); $result_forward = $prep_statement_forward->fetchAll(PDO::FETCH_ASSOC); @@ -546,7 +546,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; foreach ($result_forward as &$row_forward) { $selected = $row_forward["destination_uuid"] == $forward_caller_id_uuid ? "selected='selected' " : ''; - echo "\n"; + $caller_id_number = $row_forward['destination_caller_id_number']; + if(strlen($caller_id_number) == 0){ + $caller_id_number = $row_forward['destination_number']; + } + $caller_id_name = $row_forward['destination_caller_id_name']; + if(strlen($caller_id_name) == 0){ + $caller_id_name = $row_forward['destination_description']; + } + echo "\n"; } echo "\n"; } diff --git a/app/calls/resources/classes/call_forward.php b/app/calls/resources/classes/call_forward.php index 3825ec3304..2886856180 100644 --- a/app/calls/resources/classes/call_forward.php +++ b/app/calls/resources/classes/call_forward.php @@ -84,17 +84,27 @@ include "root.php"; } if (strlen($this->forward_caller_id_uuid) > 0){ - $sql_caller = "select destination_number, destination_description from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->forward_caller_id_uuid'"; + $sql_caller = "select destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->forward_caller_id_uuid'"; $prep_statement_caller = $db->prepare($sql_caller); if ($prep_statement_caller) { $prep_statement_caller->execute(); $row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC); - if (strlen($row_caller['destination_description']) > 0) { - $dial_string_caller_id_name = $row_caller['destination_description']; + + $caller_id_number = $row_caller['destination_caller_id_number']; + if(strlen($caller_id_number) == 0){ + $caller_id_number = $row_caller['destination_number']; + } + $caller_id_name = $row_caller['destination_caller_id_name']; + if(strlen($caller_id_name) == 0){ + $caller_id_name = $row_caller['destination_description']; + } + + if (strlen($caller_id_name) > 0) { + $dial_string_caller_id_name = $caller_id_name; $dial_string .= ",origination_caller_id_name=$dial_string_caller_id_name"; } - if (strlen($row_caller['destination_number']) > 0) { - $dial_string_caller_id_number = $row_caller['destination_number']; + if (strlen($caller_id_number) > 0) { + $dial_string_caller_id_number = $caller_id_number; $dial_string .= ",origination_caller_id_number=$dial_string_caller_id_number"; $dial_string .= ",outbound_caller_id_number=$dial_string_caller_id_number"; } From a56e1e94a3e9884ba185237d5ad70ec169e7f2a4 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 23 Oct 2015 14:55:48 +0300 Subject: [PATCH 2/3] Change. Use `destination_caller_id_number` as call follow_me caller id. --- app/calls/call_edit.php | 14 ++++++++++++-- app/calls/resources/classes/follow_me.php | 20 +++++++++++++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index dad61a64c3..8c92444b6e 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -611,7 +611,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { if (permission_exists('follow_me_cid_set')) { echo "   "; - $sql_follow_me = "select destination_uuid, destination_number, destination_description from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc "; + $sql_follow_me = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc "; $prep_statement_follow_me = $db->prepare(check_sql($sql_follow_me)); $prep_statement_follow_me->execute(); $result_follow_me = $prep_statement_follow_me->fetchAll(PDO::FETCH_ASSOC); @@ -621,7 +621,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; foreach ($result_follow_me as &$row_follow_me) { $selected = $row_follow_me["destination_uuid"] == $follow_me_caller_id_uuid ? "selected='selected'" : ''; - echo "\n"; + + $caller_id_number = $row_follow_me['destination_caller_id_number']; + if(strlen($caller_id_number) == 0){ + $caller_id_number = $row_follow_me['destination_number']; + } + $caller_id_name = $row_follow_me['destination_caller_id_name']; + if(strlen($caller_id_name) == 0){ + $caller_id_name = $row_follow_me['destination_description']; + } + + echo "\n"; } echo "\n"; } diff --git a/app/calls/resources/classes/follow_me.php b/app/calls/resources/classes/follow_me.php index 8aeb0f80cc..5cdf86d74e 100644 --- a/app/calls/resources/classes/follow_me.php +++ b/app/calls/resources/classes/follow_me.php @@ -299,16 +299,26 @@ include "root.php"; $dial_string_caller_id_number = "\${caller_id_number}"; if (strlen($this->follow_me_caller_id_uuid) > 0){ - $sql_caller = "select destination_number, destination_description from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->follow_me_caller_id_uuid'"; + $sql_caller = "select destination_number, destination_description, destination_caller_id_number, destination_caller_id_name from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->follow_me_caller_id_uuid'"; $prep_statement_caller = $db->prepare($sql_caller); if ($prep_statement_caller) { $prep_statement_caller->execute(); $row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC); - if (strlen($row_caller['destination_description']) > 0) { - $dial_string_caller_id_name = $row_caller['destination_description']; + + $caller_id_number = $row_caller['destination_caller_id_number']; + if(strlen($caller_id_number) == 0){ + $caller_id_number = $row_caller['destination_number']; } - if (strlen($row_caller['destination_number']) > 0) { - $dial_string_caller_id_number = $row_caller['destination_number']; + $caller_id_name = $row_caller['destination_caller_id_name']; + if(strlen($caller_id_name) == 0){ + $caller_id_name = $row_caller['destination_description']; + } + + if (strlen($caller_id_name) > 0) { + $dial_string_caller_id_name = $caller_id_name; + } + if (strlen($caller_id_number) > 0) { + $dial_string_caller_id_number = $caller_id_number; } } } From 6abb8a67832baceab198413c2322ea1e4174230a Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 23 Oct 2015 15:05:24 +0300 Subject: [PATCH 3/3] Change. Allow use destination number as Outbound CallerID number for extension. --- app/extensions/extension_edit.php | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index b156b79358..a5dcaab29b 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -1368,11 +1368,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; @@ -1401,11 +1407,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " \n";