aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/app_ices.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/apps/app_ices.c b/apps/app_ices.c
index b2a4e9b91..397bed8e2 100644
--- a/apps/app_ices.c
+++ b/apps/app_ices.c
@@ -44,8 +44,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
#include "asterisk/translate.h"
-#define ICES "/usr/bin/ices"
-#define LOCAL_ICES "/usr/local/bin/ices"
+#define path_BIN "/usr/bin/"
+#define path_LOCAL "/usr/local/bin/"
static char *app = "ICES";
@@ -54,7 +54,9 @@ static char *synopsis = "Encode and stream using 'ices'";
static char *descrip =
" ICES(config.xml) Streams to an icecast server using ices\n"
"(available separately). A configuration file must be supplied\n"
-"for ices (see examples/asterisk-ices.conf). \n";
+"for ices (see contrib/asterisk-ices.xml). \n"
+"\n"
+"- ICES version 2 cient and server required.\n";
static int icesencode(char *filename, int fd)
@@ -85,13 +87,23 @@ static int icesencode(char *filename, int fd)
if ((x != STDIN_FILENO) && (x != STDOUT_FILENO))
close(x);
}
- /* Most commonly installed in /usr/local/bin */
- execl(ICES, "ices", filename, (char *)NULL);
- /* But many places has it in /usr/bin */
- execl(LOCAL_ICES, "ices", filename, (char *)NULL);
- /* As a last-ditch effort, try to use PATH */
- execlp("ices", "ices", filename, (char *)NULL);
- ast_log(LOG_WARNING, "Execute of ices failed\n");
+
+ /* Most commonly installed in /usr/local/bin
+ * But many places has it in /usr/bin
+ * As a last-ditch effort, try to use PATH
+ */
+ execl(path_LOCAL "ices2", "ices", filename, NULL);
+ execl(path_BIN "ices2", "ices", filename, NULL);
+ execlp("ices2", "ices", filename, NULL);
+
+ ast_debug(1, "Couldn't find ices version 2, attempting to use ices version 1.");
+
+ execl(path_LOCAL "ices", "ices", filename, NULL);
+ execl(path_BIN "ices", "ices", filename, NULL);
+ execlp("ices", "ices", filename, NULL);
+
+ ast_log(LOG_WARNING, "Execute of ices failed, could not find command.\n");
+ close(fd);
_exit(0);
}
@@ -151,7 +163,6 @@ static int ices_exec(struct ast_channel *chan, void *data)
if (c)
*c = '\0';
res = icesencode(filename, fds[0]);
- close(fds[0]);
if (res >= 0) {
pid = res;
for (;;) {
@@ -182,6 +193,7 @@ static int ices_exec(struct ast_channel *chan, void *data)
ast_frfree(f);
}
}
+ close(fds[0]);
close(fds[1]);
if (pid > -1)