From c66dc3de190f597785b45653c65edf528a7b1838 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 29 Apr 2009 03:05:35 +0000 Subject: [PATCH] fail over to default if desired stream is not found git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13184 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/formats/mod_local_stream/mod_local_stream.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index 673c8744ad..b78f1d5d08 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -301,6 +301,8 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons return SWITCH_STATUS_FALSE; } + top: + alt_path = switch_mprintf("%s/%d", path, handle->samplerate); switch_mutex_lock(globals.mutex); @@ -313,6 +315,13 @@ static switch_status_t local_stream_file_open(switch_file_handle_t *handle, cons if (switch_thread_rwlock_tryrdlock(source->rwlock) != SWITCH_STATUS_SUCCESS) { source = NULL; } + } else { + if (!switch_stristr("default", alt_path) && !switch_stristr("default", path)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown source %s, trying 'default'\n", path); + free(alt_path); + path = "default"; + goto top; + } } switch_mutex_unlock(globals.mutex);