mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Remove some redudant code for finding record_path and record_name
This commit is contained in:
@@ -683,7 +683,7 @@ if (!class_exists('xml_cdr')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get the recording details
|
//get the recording details
|
||||||
if (isset($xml->variables->record_path)) {
|
if (isset($xml->variables->record_path) && isset($xml->variables->record_name)) {
|
||||||
$record_path = urldecode($xml->variables->record_path);
|
$record_path = urldecode($xml->variables->record_path);
|
||||||
$record_name = urldecode($xml->variables->record_name);
|
$record_name = urldecode($xml->variables->record_name);
|
||||||
if (isset($xml->variables->record_seconds)) {
|
if (isset($xml->variables->record_seconds)) {
|
||||||
@@ -693,31 +693,21 @@ if (!class_exists('xml_cdr')) {
|
|||||||
$record_length = urldecode($xml->variables->duration);
|
$record_length = urldecode($xml->variables->duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif (isset($xml->variables->cc_record_filename)) {
|
||||||
|
$record_path = dirname(urldecode($xml->variables->cc_record_filename));
|
||||||
|
$record_name = basename(urldecode($xml->variables->cc_record_filename));
|
||||||
|
$record_length = urldecode($xml->variables->record_seconds);
|
||||||
|
}
|
||||||
elseif (!isset($record_path) && urldecode($xml->variables->last_app) == "record_session") {
|
elseif (!isset($record_path) && urldecode($xml->variables->last_app) == "record_session") {
|
||||||
$record_path = dirname(urldecode($xml->variables->last_arg));
|
$record_path = dirname(urldecode($xml->variables->last_arg));
|
||||||
$record_name = basename(urldecode($xml->variables->last_arg));
|
$record_name = basename(urldecode($xml->variables->last_arg));
|
||||||
$record_length = urldecode($xml->variables->record_seconds);
|
$record_length = urldecode($xml->variables->record_seconds);
|
||||||
}
|
}
|
||||||
elseif (isset($xml->variables->record_name)) {
|
|
||||||
if (isset($xml->variables->record_path)) {
|
|
||||||
$record_path = urldecode($xml->variables->record_path);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$record_path = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day;
|
|
||||||
}
|
|
||||||
$record_name = urldecode($xml->variables->record_name);
|
|
||||||
$record_length = urldecode($xml->variables->duration);
|
|
||||||
}
|
|
||||||
elseif (!empty($xml->variables->sofia_record_file)) {
|
elseif (!empty($xml->variables->sofia_record_file)) {
|
||||||
$record_path = dirname(urldecode($xml->variables->sofia_record_file));
|
$record_path = dirname(urldecode($xml->variables->sofia_record_file));
|
||||||
$record_name = basename(urldecode($xml->variables->sofia_record_file));
|
$record_name = basename(urldecode($xml->variables->sofia_record_file));
|
||||||
$record_length = urldecode($xml->variables->record_seconds);
|
$record_length = urldecode($xml->variables->record_seconds);
|
||||||
}
|
}
|
||||||
elseif (!empty($xml->variables->cc_record_filename)) {
|
|
||||||
$record_path = dirname(urldecode($xml->variables->cc_record_filename));
|
|
||||||
$record_name = basename(urldecode($xml->variables->cc_record_filename));
|
|
||||||
$record_length = urldecode($xml->variables->record_seconds);
|
|
||||||
}
|
|
||||||
elseif (!empty($xml->variables->api_on_answer)) {
|
elseif (!empty($xml->variables->api_on_answer)) {
|
||||||
$command = str_replace("\n", " ", urldecode($xml->variables->api_on_answer));
|
$command = str_replace("\n", " ", urldecode($xml->variables->api_on_answer));
|
||||||
$parts = explode(" ", $command);
|
$parts = explode(" ", $command);
|
||||||
@@ -751,19 +741,8 @@ if (!class_exists('xml_cdr')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($record_name)) {
|
|
||||||
$bridge_uuid = urldecode($xml->variables->bridge_uuid) ?: $last_bridge;
|
//check to see if file exists with the default file name and path
|
||||||
$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 (empty($record_name)) {
|
if (empty($record_name)) {
|
||||||
$path = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day;
|
$path = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day;
|
||||||
if (file_exists($path.'/'.$uuid.'.wav')) {
|
if (file_exists($path.'/'.$uuid.'.wav')) {
|
||||||
@@ -777,9 +756,9 @@ if (!class_exists('xml_cdr')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//last check
|
//last check - check to see if file exists with the bridge_uuid for the file name and path
|
||||||
if (empty($record_name)) {
|
if (empty($record_name)) {
|
||||||
$bridge_uuid = urldecode($xml->variables->bridge_uuid) ?: $last_bridge ;
|
$bridge_uuid = urldecode($xml->variables->bridge_uuid) ?: $last_bridge;
|
||||||
$path = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day;
|
$path = $_SESSION['switch']['recordings']['dir'].'/'.$domain_name.'/archive/'.$start_year.'/'.$start_month.'/'.$start_day;
|
||||||
if (file_exists($path.'/'.$bridge_uuid.'.wav')) {
|
if (file_exists($path.'/'.$bridge_uuid.'.wav')) {
|
||||||
$record_path = $path;
|
$record_path = $path;
|
||||||
@@ -789,14 +768,6 @@ if (!class_exists('xml_cdr')) {
|
|||||||
$record_path = $path;
|
$record_path = $path;
|
||||||
$record_name = $bridge_uuid.'.mp3';
|
$record_name = $bridge_uuid.'.mp3';
|
||||||
$record_length = urldecode($xml->variables->duration);
|
$record_length = urldecode($xml->variables->duration);
|
||||||
} elseif (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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user