Skip to content

Commit

Permalink
Update xml_cdr.php
Browse files Browse the repository at this point in the history
  • Loading branch information
markjcrane authored Feb 18, 2019
1 parent 3f088a5 commit 4972776
Showing 1 changed file with 34 additions and 19 deletions.
53 changes: 34 additions & 19 deletions app/xml_cdr/resources/classes/xml_cdr.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,21 +430,21 @@ function ($matches) {
}

//get the recording details
if (strlen($xml->variables->record_name) > 0) {
if (strlen($xml->variables->record_session) > 0) {
$record_path = urldecode($xml->variables->record_path);
$record_name = urldecode($xml->variables->record_name);
$record_length = urldecode($xml->variables->billsec);
}
elseif (urldecode($xml->variables->current_application) == 'record_session') {
$record_path = dirname(urldecode($xml->variables->current_application_data));
$record_name = basename(urldecode($xml->variables->current_application_data));
$record_length = urldecode($xml->variables->record_seconds);
}
elseif (strlen($xml->variables->record_session) > 0) {
$record_path = dirname(urldecode($xml->variables->record_session));
$record_name = basename(urldecode($xml->variables->record_session));
elseif (!isset($record_path) && urldecode($xml->variables->last_app) == "record_session") {
$record_path = dirname(urldecode($xml->variables->last_arg));
$record_name = basename(urldecode($xml->variables->last_arg));
$record_length = urldecode($xml->variables->record_seconds);
}
elseif (strlen($xml->variables->record_name) > 0) {
$record_path = urldecode($xml->variables->record_path);
$record_name = urldecode($xml->variables->record_name);
$record_length = urldecode($xml->variables->duration);
}
elseif (strlen($xml->variables->sofia_record_file) > 0) {
$record_path = dirname(urldecode($xml->variables->sofia_record_file));
$record_name = basename(urldecode($xml->variables->sofia_record_file));
Expand All @@ -465,16 +465,6 @@ function ($matches) {
$record_length = urldecode($xml->variables->duration);
}
}
elseif (strlen($xml->variables->{'nolocal:api_on_answer'}) > 0) {
$command = str_replace("\n", " ", urldecode($xml->variables->{'nolocal:api_on_answer'}));
$parts = explode(" ", $command);
if ($parts[0] == "uuid_record") {
$recording = $parts[3];
$record_path = dirname($recording);
$record_name = basename($recording);
$record_length = urldecode($xml->variables->duration);
}
}
elseif (strlen($xml->variables->current_application_data) > 0) {
$commands = explode(",", urldecode($xml->variables->current_application_data));
foreach ($commands as $command) {
Expand All @@ -492,6 +482,31 @@ function ($matches) {
}
}
}
if (!isset($record_name)) {
$bridge_uuid = urldecode($xml->variables->bridge_uuid);
$path = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day;
if (file_exists($path.'/'.$bridge_uuid.'.wav')) {
$record_path = $path;
$record_name = $bridge_uuid.'.wav';
$record_length = urldecode($xml->variables->duration);
} elseif (file_exists($path.'/'.$bridge_uuid.'.mp3')) {
$record_path = $path;
$record_name = $bridge_uuid.'.mp3';
$record_length = urldecode($xml->variables->duration);
}
}
if (!isset($record_name)) {
$path = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day;
if (file_exists($path.'/'.$uuid.'.wav')) {
$record_path = $path;
$record_name = $uuid.'.wav';
$record_length = urldecode($xml->variables->duration);
} elseif (file_exists($path.'/'.$uuid.'.mp3')) {
$record_path = $path;
$record_name = $uuid.'.mp3';
$record_length = urldecode($xml->variables->duration);
}
}

//add the call recording
if (isset($record_path) && isset($record_name) && file_exists($record_path.'/'.$record_name) && $record_length > 0) {
Expand Down

0 comments on commit 4972776

Please sign in to comment.