Browse Source

Normalize numbers to disregard the plus

Using this right now when the number comes to inbound and outbound one number has the plus and the other doesn't they are seen as different numbers. May re-add it in the future.
FusionPBX 11 months ago
parent
commit
bd3f39770d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      messages_contacts.php

+ 2 - 2
messages_contacts.php

@@ -94,7 +94,7 @@
 	$sql .= "from (\n";
 	$sql .= "	select number from \n";
 	$sql .= "	(\n";
-	$sql .= "		select distinct(message_from) as number from v_messages \n";
+	$sql .= "		select distinct(REPLACE(message_from, '+', '')) as number from v_messages \n";
 	$sql .= "		where domain_uuid = :domain_uuid \n";
 	$sql .= "		and message_direction = 'inbound' and message_from is not null \n";
 	//$sql .= "		and user_uuid = :user_uuid \n";
@@ -109,7 +109,7 @@
 	$sql .= "		)\n";
 	$sql .= "		and message_from ~'^\+?([0-9]+\.?[0-9]*|\.[0-9]+)$' \n";
 	$sql .= "		union \n";
-	$sql .= "		select distinct(message_to) as number from v_messages \n";
+	$sql .= "		select distinct(REPLACE(message_to, '+', '')) as number from v_messages \n";
 	$sql .= "		where domain_uuid = :domain_uuid \n";
 	$sql .= "		and message_direction = 'outbound' and message_from is not null \n";
 	//$sql .= "		and user_uuid = :user_uuid ";