From 0fd70808bc0cb83c8586661414df64583b5d464f Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 24 Feb 2022 17:55:46 -0700 Subject: [PATCH] Add the country code for call block --- app/call_block/resources/classes/call_block.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/call_block/resources/classes/call_block.php b/app/call_block/resources/classes/call_block.php index 947f123f65..4f163420ef 100644 --- a/app/call_block/resources/classes/call_block.php +++ b/app/call_block/resources/classes/call_block.php @@ -328,8 +328,14 @@ if (!class_exists('call_block')) { $array['call_block'][$x]['extension_uuid'] = $this->extension_uuid; } if ($this->call_block_direction == 'inbound') { + //remove e.164 and country code + $call_block_number = str_replace("+".trim($_SESSION['domain']['country_code']['numeric']), "", trim($row["caller_id_number"])); + + //build the array + $array['call_block'][$x]['call_block_country_code'] = trim($_SESSION['domain']['country_code']['numeric']); $array['call_block'][$x]['call_block_name'] = trim($row["caller_id_name"]); - $array['call_block'][$x]['call_block_number'] = trim($row["caller_id_number"]); + $array['call_block'][$x]['call_block_number'] = $call_block_number; + $array['call_block'][$x]['call_block_description'] = trim($row["caller_id_name"]); } if ($this->call_block_direction == 'outbound') { $array['call_block'][$x]['call_block_number'] = trim($row["caller_destination"]); @@ -350,8 +356,13 @@ if (!class_exists('call_block')) { $array['call_block'][$x]['call_block_direction'] = $this->call_block_direction; $array['call_block'][$x]['extension_uuid'] = $field['extension_uuid']; if ($this->call_block_direction == 'inbound') { + //remove e.164 and country code + $call_block_number = str_replace("+".trim($_SESSION['domain']['country_code']['numeric']), "", trim($row["caller_id_number"])); + + //build the array $array['call_block'][$x]['call_block_name'] = trim($row["caller_id_name"]); - $array['call_block'][$x]['call_block_number'] = trim($row["caller_id_number"]); + $array['call_block'][$x]['call_block_number'] = $call_block_number; + $array['call_block'][$x]['call_block_description'] = trim($row["caller_id_name"]); } if ($this->call_block_direction == 'outbound') { $array['call_block'][$x]['call_block_number'] = trim($row["caller_destination"]); @@ -417,4 +428,4 @@ if (!class_exists('call_block')) { } //class } -?> \ No newline at end of file +?>