From 294b6c6b81d2c6670c50766c7621f01031b0643f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 11 Dec 2007 22:37:33 +0000 Subject: [PATCH] allow .loc files in local_stream dirs to contain urls git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6678 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../mod_local_stream/mod_local_stream.c | 19 +++++++++++++++++++ 1 file changed, 19 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 45a25f8c6d..efd17c6faa 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -102,6 +102,25 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void uint8_t *abuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; snprintf(path_buf, sizeof(path_buf), "%s%s%s", source->location, SWITCH_PATH_SEPARATOR, fname); + if (switch_stristr(".loc", path_buf)) { + int fd; + ssize_t bytes; + char *p; + + if ((fd = open(path_buf, O_RDONLY)) < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open %s\n", fname); + switch_yield(1000000); + continue; + } + + bytes = read(fd, path_buf, sizeof(path_buf)); + if ((p = strchr(path_buf, '\r')) || + (p = strchr(path_buf, '\n'))) { + *p = '\0'; + } + close(fd); + } + fname = path_buf; if (switch_core_file_open(&fh, (char *)fname,