[Freeswitch-svn] [commit] r6678 - freeswitch/trunk/src/mod/formats/mod_local_stream

Freeswitch SVN anthm at freeswitch.org
Tue Dec 11 17:37:34 EST 2007


Author: anthm
Date: Tue Dec 11 17:37:33 2007
New Revision: 6678

Modified:
   freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c

Log:
allow .loc files in local_stream dirs to contain urls

Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	Tue Dec 11 17:37:33 2007
@@ -102,6 +102,25 @@
 			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,



More information about the Freeswitch-svn mailing list