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
This commit is contained in:
Anthony Minessale 2007-12-11 22:37:33 +00:00
parent 70c65fc3c2
commit 294b6c6b81
1 changed files with 19 additions and 0 deletions

View File

@ -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,