Set bridge statements variables

This commit is contained in:
FusionPBX 2023-08-25 16:05:33 -06:00 committed by GitHub
parent bc2e64af28
commit 85f6793a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 4 deletions

View File

@ -353,6 +353,16 @@ if (!class_exists('xml_cdr')) {
unset($sql, $parameters);
}
//set the call_direction
if (isset($xml->variables->call_direction)) {
$call_direction = urldecode($xml->variables->call_direction);
}
//set the accountcode
if (isset($xml->variables->accountcode)) {
$accountcode = urldecode($xml->variables->accountcode);
}
//process data if the call detail record is not a duplicate
if ($duplicate_uuid == false && is_uuid($uuid)) {
@ -399,7 +409,7 @@ if (!class_exists('xml_cdr')) {
$caller_id_number = urldecode($xml->variables->origination_caller_id_number);
}
if (urldecode($xml->variables->call_direction) == 'outbound' && isset($xml->variables->effective_caller_id_number)) {
if (urldecode($call_direction) == 'outbound' && isset($xml->variables->effective_caller_id_number)) {
$caller_id_number = urldecode($xml->variables->effective_caller_id_number);
}
@ -489,6 +499,28 @@ if (!class_exists('xml_cdr')) {
$missed_call = 'true';
}
//read the bridge statement variables
if (isset($xml->variables->last_app)) {
if (urldecode($xml->variables->last_app) == 'bridge') {
//get the variables from inside the { and } brackets
preg_match('/^\{([^}]+)\}/', urldecode($xml->variables->last_arg), $matches);
//create a variables array from the comma delimitted string
$bridge_variables = explode(",", $matches[1]);
//set bridge variables as variables
$x = 0;
if (!empty($bridge_variables)) {
foreach($bridge_variables as $variable) {
$pairs = explode("=", $variable);
$name = $pairs[0];
$$name = $pairs[1];
$x++;
}
}
}
}
//get the last bridge_uuid from the call to preserve previous behavior
foreach ($xml->variables->bridge_uuids as $bridge) {
$last_bridge = urldecode($bridge);
@ -507,7 +539,7 @@ if (!class_exists('xml_cdr')) {
$this->array[$key]['caller_id_name'] = $caller_id_name;
$this->array[$key]['caller_id_number'] = $caller_id_number;
$this->array[$key]['caller_destination'] = $caller_destination;
$this->array[$key]['accountcode'] = urldecode($xml->variables->accountcode);
$this->array[$key]['accountcode'] = urldecode($accountcode);
$this->array[$key]['default_language'] = urldecode($xml->variables->default_language);
$this->array[$key]['bridge_uuid'] = urldecode($xml->variables->bridge_uuid) ?: $last_bridge;
//$this->array[$key]['digits_dialed'] = urldecode($xml->variables->digits_dialed);
@ -539,7 +571,7 @@ if (!class_exists('xml_cdr')) {
$this->array[$key]['hangup_cause_q850'] = urldecode($xml->variables->hangup_cause_q850);
//store the call direction
$this->array[$key]['direction'] = urldecode($xml->variables->call_direction);
$this->array[$key]['direction'] = urldecode($call_direction);
//call center
if ($xml->variables->cc_member_uuid == '_undef_') { $xml->variables->cc_member_uuid = ''; }
@ -801,7 +833,7 @@ if (!class_exists('xml_cdr')) {
$array['call_recordings'][$x]['call_recording_path'] = $record_path;
$array['call_recordings'][$x]['call_recording_length'] = $record_length;
$array['call_recordings'][$x]['call_recording_date'] = date('c', $start_epoch);
$array['call_recordings'][$x]['call_direction'] = urldecode($xml->variables->call_direction);
$array['call_recordings'][$x]['call_direction'] = urldecode($call_direction);
//$array['call_recordings'][$x]['call_recording_description']= $row['zzz'];
//$array['call_recordings'][$x]['call_recording_base64']= $row['zzz'];