From cea06a548ef83a108f7d7d3ddd1e4335203da1cb Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 9 Dec 2023 23:07:36 -0700 Subject: [PATCH] Add provider_uuid to destinations dialplan xml and XML CDR --- app/destinations/destination_edit.php | 6 ++++++ app/xml_cdr/app_config.php | 10 ++++++++++ app/xml_cdr/resources/classes/xml_cdr.php | 18 ++++++++++++------ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index 8a201a3958..89ab7a59d8 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -486,6 +486,9 @@ $dialplan["dialplan_xml"] .= " \n"; $dialplan["dialplan_xml"] .= " \n"; $dialplan["dialplan_xml"] .= " \n"; + if (!empty($provider_uuid)) { + $dialplan["dialplan_xml"] .= " \n"; + } if (isset($row['condition_app']) && !empty($row['condition_app'])) { if ($destination->valid($row['condition_app'].':'.$row['condition_data'])) { $dialplan["dialplan_xml"] .= " \n"; @@ -499,6 +502,9 @@ $dialplan["dialplan_xml"] .= " \n"; $dialplan["dialplan_xml"] .= " \n"; $dialplan["dialplan_xml"] .= " \n"; + if (!empty($provider_uuid)) { + $dialplan["dialplan_xml"] .= " \n"; + } //add this only if using application bridge if (!empty($destination_app) && $destination_app == 'bridge') { diff --git a/app/xml_cdr/app_config.php b/app/xml_cdr/app_config.php index 7a55d74cd7..63328b910b 100644 --- a/app/xml_cdr/app_config.php +++ b/app/xml_cdr/app_config.php @@ -461,6 +461,15 @@ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "provider_uuid"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_providers"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "provider_uuid"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "extension_uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; @@ -829,3 +838,4 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; ?> + diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index a1dc2269c8..35cc835bd7 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -135,6 +135,7 @@ if (!class_exists('xml_cdr')) { $this->fields[] = "xml_cdr_uuid"; $this->fields[] = "domain_uuid"; + $this->fields[] = "provider_uuid"; $this->fields[] = "extension_uuid"; $this->fields[] = "sip_call_id"; $this->fields[] = "domain_name"; @@ -579,6 +580,11 @@ if (!class_exists('xml_cdr')) { $status = 'failed'; } + //set the provider id + if (isset($xml->variables->provider_uuid)) { + $this->array[$key]['provider_uuid'] = urldecode($xml->variables->provider_uuid); + } + //misc $key = 0; $uuid = urldecode($xml->variables->uuid); @@ -1043,10 +1049,10 @@ if (!class_exists('xml_cdr')) { $destination = new destinations; $destination_array = $destination->get('dialplan'); - //add new rows when callee_id_number exists + //add new rows when callee_id_number exists $new_rows = 0; foreach ($call_flow_array as $key => $row) { - if (!empty($row["caller_profile"]["destination_number"]) + if (!empty($row["caller_profile"]["destination_number"]) and !empty($row["caller_profile"]["callee_id_number"]) and $row["caller_profile"]["destination_number"] !== $row["caller_profile"]["callee_id_number"]) { //build the base of the new_row array @@ -1174,9 +1180,9 @@ if (!class_exists('xml_cdr')) { } //valet park - if (!empty($row["caller_profile"]["destination_number"]) + if (!empty($row["caller_profile"]["destination_number"]) and (substr($row["caller_profile"]["destination_number"], 0, 4) == 'park' - or (substr($row["caller_profile"]["destination_number"], 0, 3) == '*59' + or (substr($row["caller_profile"]["destination_number"], 0, 3) == '*59' and strlen($row["caller_profile"]["destination_number"]) == 5))) { //add items to the app array $app['application'] = 'dialplans'; @@ -1209,7 +1215,7 @@ if (!class_exists('xml_cdr')) { } //debug - add the callee_id_number to the end of the status - if (isset($_REQUEST['debug']) && $_REQUEST['debug'] == 'true' && !empty($row["caller_profile"]["destination_number"]) + if (isset($_REQUEST['debug']) && $_REQUEST['debug'] == 'true' && !empty($row["caller_profile"]["destination_number"]) and !empty($row["caller_profile"]["callee_id_number"]) and $row["caller_profile"]["destination_number"] !== $row["caller_profile"]["callee_id_number"]) { $app['status'] .= ' ('.$row["caller_profile"]["callee_id_number"].')'; @@ -1301,7 +1307,7 @@ if (!class_exists('xml_cdr')) { if ($application == 'destinations') { if ('+'.$value['destination_prefix'].$value['destination_number'] == $detail_action or $value['destination_prefix'].$value['destination_number'] == $detail_action - or $value['destination_number'] == $detail_action + or $value['destination_number'] == $detail_action or $value['destination_trunk_prefix'].$value['destination_number'] == $detail_action or '+'.$value['destination_prefix'].$value['destination_area_code'].$value['destination_number'] == $detail_action or $value['destination_prefix'].$value['destination_area_code'].$value['destination_number'] == $detail_action