aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2002-07-12 09:03:50 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2002-07-12 09:03:50 +0000
commit0ac7711a22bfc433c394d87fa58d2c553ba52b9f (patch)
treee2cb193cae19783f6b766de76726004c70d07d97 /apps
parent12fd7ca3bbc8df1293b20a615646e35b5033cb72 (diff)
Version 0.2.0 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@484 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_datetime.c84
-rwxr-xr-xapps/app_milliwatt.c3
-rwxr-xr-xapps/app_playback.c6
-rwxr-xr-xapps/app_qcall.c4
-rwxr-xr-xapps/app_record.c2
-rwxr-xr-xapps/app_zapateller.c2
-rwxr-xr-xapps/app_zapras.c4
7 files changed, 95 insertions, 10 deletions
diff --git a/apps/app_datetime.c b/apps/app_datetime.c
new file mode 100755
index 000000000..97c1088f8
--- /dev/null
+++ b/apps/app_datetime.c
@@ -0,0 +1,84 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * Time of day - Report the time of day
+ *
+ * Copyright (C) 1999, Mark Spencer
+ *
+ * Mark Spencer <markster@linux-support.net>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+
+#include <asterisk/lock.h>
+#include <asterisk/file.h>
+#include <asterisk/logger.h>
+#include <asterisk/channel.h>
+#include <asterisk/pbx.h>
+#include <asterisk/module.h>
+#include <asterisk/say.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <pthread.h>
+
+
+static char *tdesc = "Date and Time";
+
+static char *app = "DateTime";
+
+static char *synopsis = "Say the date and time";
+
+static char *descrip =
+" DateTime(): Says the current date and time. Returns -1 on hangup or 0\n"
+"otherwise.\n";
+
+STANDARD_LOCAL_USER;
+
+LOCAL_USER_DECL;
+
+static int datetime_exec(struct ast_channel *chan, void *data)
+{
+ int res=0;
+ time_t t;
+ struct localuser *u;
+ LOCAL_USER_ADD(u);
+ time(&t);
+ if (chan->_state != AST_STATE_UP)
+ res = ast_answer(chan);
+ if (!res)
+ res = ast_say_datetime(chan, t, "", chan->language);
+ 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, datetime_exec, synopsis, descrip);
+}
+
+char *description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
+ int res;
+ STANDARD_USECOUNT(res);
+ return res;
+}
+
+char *key()
+{
+ return ASTERISK_GPL_KEY;
+}
diff --git a/apps/app_milliwatt.c b/apps/app_milliwatt.c
index 2f162f242..b117441df 100755
--- a/apps/app_milliwatt.c
+++ b/apps/app_milliwatt.c
@@ -100,11 +100,10 @@ static int milliwatt_exec(struct ast_channel *chan, void *data)
{
struct localuser *u;
- struct ast_frame *f;
LOCAL_USER_ADD(u);
ast_set_write_format(chan, AST_FORMAT_ULAW);
ast_set_read_format(chan, AST_FORMAT_ULAW);
- if (chan->state != AST_STATE_UP)
+ if (chan->_state != AST_STATE_UP)
{
ast_answer(chan);
}
diff --git a/apps/app_playback.c b/apps/app_playback.c
index 5ca262660..346617377 100755
--- a/apps/app_playback.c
+++ b/apps/app_playback.c
@@ -63,7 +63,7 @@ static int playback_exec(struct ast_channel *chan, void *data)
if (options && !strcasecmp(options, "noanswer"))
option_noanswer = 1;
LOCAL_USER_ADD(u);
- if (chan->state != AST_STATE_UP) {
+ if (chan->_state != AST_STATE_UP) {
if (option_skip) {
/* At the user's option, skip if the line is not up */
LOCAL_USER_REMOVE(u);
@@ -77,8 +77,10 @@ static int playback_exec(struct ast_channel *chan, void *data)
res = ast_streamfile(chan, tmp, chan->language);
if (!res)
res = ast_waitstream(chan, "");
- else
+ else {
ast_log(LOG_WARNING, "ast_streamfile failed on %s for %s\n", chan->name, (char *)data);
+ res = 0;
+ }
ast_stopstream(chan);
}
LOCAL_USER_REMOVE(u);
diff --git a/apps/app_qcall.c b/apps/app_qcall.c
index 1a7887bb3..5a1df9726 100755
--- a/apps/app_qcall.c
+++ b/apps/app_qcall.c
@@ -247,7 +247,7 @@ time_t t;
if (channel->ani) free(channel->ani);
channel->ani = NULL;
}
- if (channel->state == AST_STATE_UP)
+ if (channel->_state == AST_STATE_UP)
if (debug) printf("@@@@ Autodial:Line is Up\n");
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Qcall waiting for answer on %s\n",
@@ -274,7 +274,7 @@ time_t t;
if (f->subclass == AST_CONTROL_ANSWER)
{
if (debug) printf("@@@@ qcall_do:Phone Answered\n");
- if (channel->state == AST_STATE_UP)
+ if (channel->_state == AST_STATE_UP)
{
unlink(fname);
if (option_verbose > 2)
diff --git a/apps/app_record.c b/apps/app_record.c
index 4ad4a15fd..1e54276b8 100755
--- a/apps/app_record.c
+++ b/apps/app_record.c
@@ -95,7 +95,7 @@ static int record_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
- if (chan->state != AST_STATE_UP) {
+ if (chan->_state != AST_STATE_UP) {
res = ast_answer(chan); /* Shouldn't need this, but checking to see if channel is already answered
* Theoretically asterisk should already have answered before running the app */
}
diff --git a/apps/app_zapateller.c b/apps/app_zapateller.c
index 658fde540..c9e5fdc34 100755
--- a/apps/app_zapateller.c
+++ b/apps/app_zapateller.c
@@ -45,7 +45,7 @@ static int zapateller_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
ast_stopstream(chan);
- if (chan->state != AST_STATE_UP) {
+ if (chan->_state != AST_STATE_UP) {
if (data && !strcasecmp(data, "answer"))
res = ast_answer(chan);
if (!res) {
diff --git a/apps/app_zapras.c b/apps/app_zapras.c
index 82614f120..7d2b0b83a 100755
--- a/apps/app_zapras.c
+++ b/apps/app_zapras.c
@@ -125,7 +125,7 @@ static void run_ras(struct ast_channel *chan, char *args)
res = wait4(pid, &status, WNOHANG, NULL);
if (!res) {
/* Check for hangup */
- if (chan->softhangup && !signalled) {
+ if (chan->_softhangup && !signalled) {
ast_log(LOG_DEBUG, "Channel '%s' hungup. Signalling RAS at %d to die...\n", chan->name, pid);
kill(pid, SIGTERM);
signalled=1;
@@ -182,7 +182,7 @@ static int zapras_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
strncpy(args, data, sizeof(args) - 1);
/* Answer the channel if it's not up */
- if (chan->state != AST_STATE_UP)
+ if (chan->_state != AST_STATE_UP)
ast_answer(chan);
if (strcasecmp(chan->type, "Zap")) {
/* If it's not a zap channel, we're done. Wait a couple of