diff --git a/app/xml_cdr/resources/classes/xml_cdr.php b/app/xml_cdr/resources/classes/xml_cdr.php index 17d19e5970..1df5281da4 100644 --- a/app/xml_cdr/resources/classes/xml_cdr.php +++ b/app/xml_cdr/resources/classes/xml_cdr.php @@ -430,21 +430,21 @@ if (!class_exists('xml_cdr')) { } //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)); @@ -465,16 +465,6 @@ if (!class_exists('xml_cdr')) { $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) { @@ -492,6 +482,31 @@ if (!class_exists('xml_cdr')) { } } } + 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) {