From d233fd5d12da7f73c6d67bbe309e088b578dd70a Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Fri, 12 Jul 2002 09:03:50 +0000 Subject: Version 0.2.0 from FTP git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@484 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- apps/app_datetime.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ apps/app_milliwatt.c | 3 +- apps/app_playback.c | 6 ++-- apps/app_qcall.c | 4 +-- apps/app_record.c | 2 +- apps/app_zapateller.c | 2 +- apps/app_zapras.c | 4 +-- 7 files changed, 95 insertions(+), 10 deletions(-) create mode 100755 apps/app_datetime.c (limited to 'apps') 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 + * + * This program is free software, distributed under the terms of + * the GNU General Public License + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +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 -- cgit v1.2.3