aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_playback.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-11-21 21:15:14 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-11-21 21:15:14 +0000
commit6c73936f4842f0d989fdfb9a7a73f95bdff23e7c (patch)
tree5c6327c056e0a09477f85c975d49727f51c415c6 /apps/app_playback.c
parent4c63f091a4767fbd5c0cefed92446a1a184065d0 (diff)
Version 0.1.0 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@66 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_playback.c')
-rwxr-xr-xapps/app_playback.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/apps/app_playback.c b/apps/app_playback.c
new file mode 100755
index 000000000..ef1b85c33
--- /dev/null
+++ b/apps/app_playback.c
@@ -0,0 +1,71 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * Trivial application to playback a sound file
+ *
+ * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ *
+ * Mark Spencer <markster@linux-support.net>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+
+#include <asterisk/file.h>
+#include <asterisk/logger.h>
+#include <asterisk/channel.h>
+#include <asterisk/pbx.h>
+#include <asterisk/module.h>
+#include <asterisk/translate.h>
+#include <string.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+static char *tdesc = "Trivial Playback Application";
+
+static char *app = "Playback";
+
+STANDARD_LOCAL_USER;
+
+LOCAL_USER_DECL;
+
+static int playback_exec(struct ast_channel *chan, void *data)
+{
+ int res;
+ struct localuser *u;
+ if (!data) {
+ ast_log(LOG_WARNING, "Playback requires an argument (filename)\n");
+ return -1;
+ }
+ LOCAL_USER_ADD(u);
+ ast_stopstream(chan);
+ res = ast_streamfile(chan, (char *)data);
+ if (!res)
+ res = ast_waitstream(chan, "");
+ ast_stopstream(chan);
+ LOCAL_USER_REMOVE(u);
+ return res;
+}
+
+int unload_module(void)
+{
+ STANDARD_HANGUP_LOCALUSERS;
+ return ast_unregister_application(app);
+}
+
+int load_module(void)
+{
+ return ast_register_application(app, playback_exec);
+}
+
+char *description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
+ int res;
+ STANDARD_USECOUNT(res);
+ return res;
+}