Remove the country code if not e.164 (#6367)

This commit is contained in:
Jesse Gruver 2022-05-09 15:40:44 -07:00 committed by GitHub
parent 28c0d704df
commit 56b53b5f2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -329,8 +329,13 @@ if (!class_exists('call_block')) {
}
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"]));
if (trim($row["caller_id_number"])[0] == "+") {
//format e.164
$call_block_number = str_replace("+".trim($_SESSION['domain']['country_code']['numeric']), "", trim($row["caller_id_number"]));
} else {
//remove the country code if its the first in the string
$call_block_number = ltrim(trim($row["caller_id_number"]),$_SESSION['domain']['country_code']['numeric']);
}
//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"]);