Add provider_uuid to destinations dialplan xml and XML CDR

This commit is contained in:
FusionPBX 2023-12-09 23:07:36 -07:00 committed by GitHub
parent d48f4a0b89
commit cea06a548e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 6 deletions

View File

@ -486,6 +486,9 @@
$dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"call_direction=inbound\" inline=\"true\"/>\n";
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"domain_uuid=".$_SESSION['domain_uuid']."\" inline=\"true\"/>\n";
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"domain_name=".$_SESSION['domain_name']."\" inline=\"true\"/>\n";
if (!empty($provider_uuid)) {
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"provider_uuid=".xml::sanitize($provider_uuid)."\" inline=\"true\"/>\n";
}
if (isset($row['condition_app']) && !empty($row['condition_app'])) {
if ($destination->valid($row['condition_app'].':'.$row['condition_data'])) {
$dialplan["dialplan_xml"] .= " <action application=\"".xml::sanitize($row['condition_app'])."\" data=\"".xml::sanitize($row['condition_data'])."\"/>\n";
@ -499,6 +502,9 @@
$dialplan["dialplan_xml"] .= " <action application=\"export\" data=\"call_direction=inbound\" inline=\"true\"/>\n";
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"domain_uuid=".$_SESSION['domain_uuid']."\" inline=\"true\"/>\n";
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"domain_name=".$_SESSION['domain_name']."\" inline=\"true\"/>\n";
if (!empty($provider_uuid)) {
$dialplan["dialplan_xml"] .= " <action application=\"set\" data=\"provider_uuid=".xml::sanitize($provider_uuid)."\" inline=\"true\"/>\n";
}
//add this only if using application bridge
if (!empty($destination_app) && $destination_app == 'bridge') {

View File

@ -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'] = "";
?>

View File

@ -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