From 3e50f562a06c8088b6d8db80198ab598e9e7d223 Mon Sep 17 00:00:00 2001 From: Luis Daniel Lucio Quiroz Date: Fri, 26 May 2017 17:41:50 -0400 Subject: [PATCH] Fix the CID (#2588) * Fixes CID Although you already had somehow fixed the caller id here. you need to put origination and effective. For some reason, not all carriers get the CID from the same field in the SIP payload. origination_* and effective_* affects different parts of the SIP invite. * Fix the CID Although you already had somehow fixed the caller id here. you need to put origination and effective. For some reason, not all carriers get the CID from the same field in the SIP payload. origination_* and effective_* affects different parts of the SIP invite. * Update follow_me.php * Update call_forward.php --- app/calls/resources/classes/call_forward.php | 27 +++++++++++++------- app/calls/resources/classes/follow_me.php | 15 ++++++++--- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/app/calls/resources/classes/call_forward.php b/app/calls/resources/classes/call_forward.php index ad215361b2..63f958eb8f 100644 --- a/app/calls/resources/classes/call_forward.php +++ b/app/calls/resources/classes/call_forward.php @@ -126,16 +126,25 @@ include "root.php"; else { // setting here presence_id equal extension not dialed number allows work BLF and intercept. $presence_id = extension_presence_id($this->extension, $this->number_alias); + + if (strlen($caller_id_number) > 0) { + - //set the caller id if it is set + - if (strlen($caller_id_name) > 0) { + $dial_string .= ",origination_caller_id_name=".$caller_id_name; + $dial_string .= ",effective_caller_id_name=".$caller_id_name; + } + - $dial_string .= ",origination_caller_id_number=".$caller_id_number; + $dial_string .= ",effective_caller_id_number=".$caller_id_number; + - } + - else { + - //set the outbound caller id number if the caller id number is a user + $dial_string .='{origination_caller_id_number=${cond(${from_user_exists} == true ? ${outbound_caller_id_number} : ${origination_caller_id_number})}}'; + $dial_string .='{effective_caller_id_number=${cond(${from_user_exists} == true ? ${outbound_caller_id_number} : ${effective_caller_id_number})}}'; + $dial_string .='{origination_caller_id_name=${cond(${from_user_exists} == true ? ${outbound_caller_id_name} : ${origination_caller_id_name})}}'; + $dial_string .='{effective_caller_id_name=${cond(${from_user_exists} == true ? ${outbound_caller_id_name} : ${effective_caller_id_name})}}'; + + - } - if (strlen($caller_id_number) > 0) { - //set the caller id if it is set - if (strlen($caller_id_name) > 0) { $dial_string .= ",origination_caller_id_name=".$caller_id_name; } - $dial_string .= ",origination_caller_id_number=".$caller_id_number; - } - else { - //set the outbound caller id number if the caller id number is a user - $dial_string .= ",\${cond(\${user_exists id \${caller_id_number} \${domain_name}} == true ? origination_caller_id_name=\${outbound_caller_id_name},origination_caller_id_number=\${outbound_caller_id_number} : )}"; - } // $presence_id = $this->forward_all_destination; $dial_string .= ",presence_id=".$presence_id."@".$_SESSION['domain_name']; $dial_string .= "}"; diff --git a/app/calls/resources/classes/follow_me.php b/app/calls/resources/classes/follow_me.php index a8c921468b..39cb9daa10 100644 --- a/app/calls/resources/classes/follow_me.php +++ b/app/calls/resources/classes/follow_me.php @@ -378,26 +378,35 @@ include "root.php"; } else { $presence_id = extension_presence_id($this->extension, $this->number_alias); - $dial_string .= "["; + $dial_string .= "[anyvar="; //set the caller id if ($_SESSION['cdr']['follow_me_fix']['boolean'] == "true") { if (strlen($this->outbound_caller_id_name) > 0) { $dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix.$this->outbound_caller_id_name; + $dial_string .= ",effective_caller_id_name=".$this->cid_name_prefix.$this->outbound_caller_id_name; } if (strlen($this->outbound_caller_id_number) > 0) { $dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix.$this->outbound_caller_id_number; + $dial_string .= ",effective_caller_id_number=".$this->cid_number_prefix.$this->outbound_caller_id_number; } } else { if (strlen($caller_id_number) > 0) { //set the caller id if it is set - if (strlen($caller_id_name) > 0) { $dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix.$caller_id_name; } + if (strlen($caller_id_name) > 0) { + $dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix.$caller_id_name; + $dial_string .= ",effective_caller_id_name=".$this->cid_name_prefix.$caller_id_name; + } $dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix.$caller_id_number; + $dial_string .= ",effective_caller_id_number=".$this->cid_number_prefix.$caller_id_number; } else { //set the outbound caller id number if the caller id number is a user - $dial_string .= ",\${cond(\${user_exists id \${caller_id_number} \${domain_name}} == true ? origination_caller_id_name=".$this->cid_name_prefix."\${outbound_caller_id_name},origination_caller_id_number=".$this->cid_number_prefix."\${outbound_caller_id_number} : )}"; + $dial_string .=',origination_caller_id_number=${cond(${from_user_exists} == true ? ${outbound_caller_id_number} : ${origination_caller_id_number})}'; + $dial_string .=',effective_caller_id_number=${cond(${from_user_exists} == true ? ${outbound_caller_id_number} : ${effective_caller_id_number})}'; + $dial_string .=',origination_caller_id_name=${cond(${from_user_exists} == true ? ${outbound_caller_id_name} : ${origination_caller_id_name})}'; + $dial_string .=',effective_caller_id_name=${cond(${from_user_exists} == true ? ${outbound_caller_id_name} : ${effective_caller_id_name})}'; } }