const char *p;
//char *title = "", *copyright = "", *software = "", *artist = "", *comment = "", *date = "";
char *ext;
+ char *backup_file = NULL;
+ const char *backup_ext;
const char *prefix;
const char *timer_name;
const char *prebuf;
if ((ext = strrchr(file, '.'))) {
ext++;
} else {
+
+ if (!(backup_ext = switch_channel_get_variable(channel, "native_backup_extension"))) {
+ backup_ext = "wav";
+ }
+
ext = read_impl.iananame;
+ backup_file = switch_core_session_sprintf(session, "%s.%s", file, backup_ext);
file = switch_core_session_sprintf(session, "%s.%s", file, ext);
}
}
//switch_channel_set_flag_recursive(channel, CF_VIDEO_DECODED_READ);
}
- if (switch_core_file_open(fh,
- file,
- read_impl.number_of_channels,
- read_impl.actual_samples_per_second, flags, NULL) != SWITCH_STATUS_SUCCESS) {
+
+ for(;;) {
+ if (switch_core_file_open(fh,
+ file,
+ read_impl.number_of_channels,
+ read_impl.actual_samples_per_second, flags, NULL) == SWITCH_STATUS_SUCCESS) {
+ break;
+ }
+
+ if (backup_file) {
+ file = backup_file;
+ backup_file = NULL;
+ } else {
+ break;
+ }
+ }
+
+ if (!switch_test_flag(fh, SWITCH_FILE_OPEN)) {
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE);
status = SWITCH_STATUS_NOTFOUND;
continue;