From d17ff1ea42571817d74962062410ca54a06b2053 Mon Sep 17 00:00:00 2001 From: file Date: Mon, 16 Jul 2007 14:39:29 +0000 Subject: Applications no longer need to call ast_module_user_add and ast_module_user_remove. This is now taken care of in the pbx_exec function outside of the application. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@75200 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_adsiprog.c | 7 +--- apps/app_alarmreceiver.c | 15 +------- apps/app_amd.c | 4 -- apps/app_authenticate.c | 10 +---- apps/app_cdr.c | 9 +---- apps/app_chanisavail.c | 5 --- apps/app_channelredirect.c | 4 -- apps/app_chanspy.c | 12 ------ apps/app_controlplayback.c | 6 --- apps/app_db.c | 12 ------ apps/app_dial.c | 11 +----- apps/app_dictate.c | 5 --- apps/app_directed_pickup.c | 5 --- apps/app_directory.c | 5 --- apps/app_disa.c | 10 ----- apps/app_dumpchan.c | 5 --- apps/app_echo.c | 4 -- apps/app_exec.c | 19 +--------- apps/app_externalivr.c | 6 --- apps/app_festival.c | 9 ----- apps/app_flash.c | 5 --- apps/app_followme.c | 5 --- apps/app_forkcdr.c | 4 -- apps/app_getcpeid.c | 5 +-- apps/app_ices.c | 10 +---- apps/app_image.c | 8 +--- apps/app_ivrdemo.c | 5 --- apps/app_macro.c | 19 +--------- apps/app_meetme.c | 28 +------------- apps/app_milliwatt.c | 6 --- apps/app_minivm.c | 54 ++------------------------- apps/app_mixmonitor.c | 13 ------- apps/app_morsecode.c | 5 --- apps/app_mp3.c | 7 ---- apps/app_nbscat.c | 7 ---- apps/app_osplookup.c | 26 ------------- apps/app_page.c | 6 --- apps/app_parkandannounce.c | 11 ------ apps/app_playback.c | 4 -- apps/app_privacy.c | 10 +---- apps/app_queue.c | 61 +----------------------------- apps/app_read.c | 7 +--- apps/app_readfile.c | 6 +-- apps/app_record.c | 9 ----- apps/app_rpt.c | 3 -- apps/app_sayunixtime.c | 5 --- apps/app_senddtmf.c | 5 --- apps/app_sendtext.c | 6 --- apps/app_setcallerid.c | 5 --- apps/app_skel.c | 5 --- apps/app_sms.c | 3 -- apps/app_softhangup.c | 5 --- apps/app_speech_utils.c | 93 ++++++---------------------------------------- apps/app_stack.c | 13 ------- apps/app_system.c | 7 +--- apps/app_talkdetect.c | 4 -- apps/app_test.c | 7 ---- apps/app_transfer.c | 8 ---- apps/app_url.c | 6 --- apps/app_userevent.c | 5 --- apps/app_verbose.c | 13 +------ apps/app_voicemail.c | 35 +++-------------- apps/app_waitforring.c | 4 -- apps/app_while.c | 16 ++------ apps/app_zapateller.c | 8 +--- apps/app_zapbarge.c | 5 --- apps/app_zapras.c | 4 -- apps/app_zapscan.c | 6 +-- 68 files changed, 46 insertions(+), 709 deletions(-) (limited to 'apps') diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c index 4729bcd99..eee3b3302 100644 --- a/apps/app_adsiprog.c +++ b/apps/app_adsiprog.c @@ -1548,10 +1548,7 @@ static int adsi_prog(struct ast_channel *chan, char *script) static int adsi_exec(struct ast_channel *chan, void *data) { - int res=0; - struct ast_module_user *u; - - u = ast_module_user_add(chan); + int res = 0; if (ast_strlen_zero(data)) data = "asterisk.adsi"; @@ -1564,8 +1561,6 @@ static int adsi_exec(struct ast_channel *chan, void *data) ast_verbose(VERBOSE_PREFIX_3 "ADSI Available on CPE. Attempting Upload.\n"); res = adsi_prog(chan, data); } - - ast_module_user_remove(u); return res; } diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c index 0b695eb16..1c759cd42 100644 --- a/apps/app_alarmreceiver.c +++ b/apps/app_alarmreceiver.c @@ -628,14 +628,11 @@ static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int static int alarmreceiver_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; event_node_t *elp, *efree; char signalling_type[64] = ""; event_node_t *event_head = NULL; - u = ast_module_user_add(chan); - /* Set write and read formats to ULAW */ if(option_verbose >= 4) @@ -643,13 +640,11 @@ static int alarmreceiver_exec(struct ast_channel *chan, void *data) if (ast_set_write_format(chan,AST_FORMAT_ULAW)){ ast_log(LOG_WARNING, "AlarmReceiver: Unable to set write format to Mu-law on %s\n",chan->name); - ast_module_user_remove(u); return -1; } if (ast_set_read_format(chan,AST_FORMAT_ULAW)){ ast_log(LOG_WARNING, "AlarmReceiver: Unable to set read format to Mu-law on %s\n",chan->name); - ast_module_user_remove(u); return -1; } @@ -664,13 +659,8 @@ static int alarmreceiver_exec(struct ast_channel *chan, void *data) ast_verbose(VERBOSE_PREFIX_4 "AlarmReceiver: Answering channel\n"); if (chan->_state != AST_STATE_UP) { - - res = ast_answer(chan); - - if (res) { - ast_module_user_remove(u); + if ((res = ast_answer(chan))) return -1; - } } /* Wait for the connection to settle post-answer */ @@ -722,9 +712,6 @@ static int alarmreceiver_exec(struct ast_channel *chan, void *data) ast_free(efree); } - - ast_module_user_remove(u); - return 0; } diff --git a/apps/app_amd.c b/apps/app_amd.c index 6c753783d..9a32f9032 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -318,11 +318,7 @@ static void isAnsweringMachine(struct ast_channel *chan, void *data) static int amd_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u = NULL; - - u = ast_module_user_add(chan); isAnsweringMachine(chan, data); - ast_module_user_remove(u); return 0; } diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c index 4cd85ce4f..1d260cda4 100644 --- a/apps/app_authenticate.c +++ b/apps/app_authenticate.c @@ -90,7 +90,6 @@ static int auth_exec(struct ast_channel *chan, void *data) { int res=0; int retries; - struct ast_module_user *u; char passwd[256]; char *prompt; int maxdigits; @@ -107,15 +106,10 @@ static int auth_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "Authenticate requires an argument(password)\n"); return -1; } - - u = ast_module_user_add(chan); if (chan->_state != AST_STATE_UP) { - res = ast_answer(chan); - if (res) { - ast_module_user_remove(u); + if ((res = ast_answer(chan))) return -1; - } } argcopy = ast_strdupa(data); @@ -217,7 +211,7 @@ static int auth_exec(struct ast_channel *chan, void *data) res = ast_waitstream(chan, ""); res = -1; } - ast_module_user_remove(u); + return res; } diff --git a/apps/app_cdr.c b/apps/app_cdr.c index 23044de80..8497405a6 100644 --- a/apps/app_cdr.c +++ b/apps/app_cdr.c @@ -46,15 +46,8 @@ static char *nocdr_synopsis = "Tell Asterisk to not maintain a CDR for the curre static int nocdr_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; - - u = ast_module_user_add(chan); - - if (chan->cdr) { + if (chan->cdr) ast_set_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED); - } - - ast_module_user_remove(u); return 0; } diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c index dbcc9b4d9..b1768e7e5 100644 --- a/apps/app_chanisavail.c +++ b/apps/app_chanisavail.c @@ -69,7 +69,6 @@ static int chanavail_exec(struct ast_channel *chan, void *data) { int res=-1, inuse=-1, option_state=0, string_compare=0; int status; - struct ast_module_user *u; char *info, tmp[512], trychan[512], *peers, *tech, *number, *rest, *cur; struct ast_channel *tempchan; AST_DECLARE_APP_ARGS(args, @@ -82,8 +81,6 @@ static int chanavail_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - info = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, info); @@ -108,7 +105,6 @@ static int chanavail_exec(struct ast_channel *chan, void *data) number = strchr(tech, '/'); if (!number) { ast_log(LOG_WARNING, "ChanIsAvail argument takes format ([technology]/[device])\n"); - ast_module_user_remove(u); return -1; } *number = '\0'; @@ -151,7 +147,6 @@ static int chanavail_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", ""); } - ast_module_user_remove(u); return 0; } diff --git a/apps/app_channelredirect.c b/apps/app_channelredirect.c index a67918aad..2164521a4 100644 --- a/apps/app_channelredirect.c +++ b/apps/app_channelredirect.c @@ -52,7 +52,6 @@ static char *descrip = static int asyncgoto_exec(struct ast_channel *chan, void *data) { int res = -1; - struct ast_module_user *u; char *info, *context, *exten, *priority; int prio = 1; struct ast_channel *chan2 = NULL; @@ -67,8 +66,6 @@ static int asyncgoto_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - info = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, info); @@ -115,7 +112,6 @@ static int asyncgoto_exec(struct ast_channel *chan, void *data) chanquit: ast_mutex_unlock(&chan2->lock); quit: - ast_module_user_remove(u); return res; } diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index fc3f4b920..80f3c530c 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -626,7 +626,6 @@ exit: static int chanspy_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; char *options = NULL; char *spec = NULL; char *argv[2]; @@ -641,8 +640,6 @@ static int chanspy_exec(struct ast_channel *chan, void *data) data = ast_strdupa(data); - u = ast_module_user_add(chan); - if ((argc = ast_app_separate_args(data, '|', argv, sizeof(argv) / sizeof(argv[0])))) { spec = argv[0]; if (argc > 1) @@ -680,7 +677,6 @@ static int chanspy_exec(struct ast_channel *chan, void *data) oldwf = chan->writeformat; if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) { ast_log(LOG_ERROR, "Could Not Set Write Format.\n"); - ast_module_user_remove(u); return -1; } @@ -702,14 +698,11 @@ static int chanspy_exec(struct ast_channel *chan, void *data) if (oldwf && ast_set_write_format(chan, oldwf) < 0) ast_log(LOG_ERROR, "Could Not Set Write Format.\n"); - ast_module_user_remove(u); - return res; } static int extenspy_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; char *options = NULL; char *exten = NULL; char *context = NULL; @@ -725,8 +718,6 @@ static int extenspy_exec(struct ast_channel *chan, void *data) data = ast_strdupa(data); - u = ast_module_user_add(chan); - if ((argc = ast_app_separate_args(data, '|', argv, sizeof(argv) / sizeof(argv[0])))) { context = argv[0]; if (!ast_strlen_zero(argv[0])) @@ -765,7 +756,6 @@ static int extenspy_exec(struct ast_channel *chan, void *data) oldwf = chan->writeformat; if (ast_set_write_format(chan, AST_FORMAT_SLINEAR) < 0) { ast_log(LOG_ERROR, "Could Not Set Write Format.\n"); - ast_module_user_remove(u); return -1; } @@ -787,8 +777,6 @@ static int extenspy_exec(struct ast_channel *chan, void *data) if (oldwf && ast_set_write_format(chan, oldwf) < 0) ast_log(LOG_ERROR, "Could Not Set Write Format.\n"); - ast_module_user_remove(u); - return res; } diff --git a/apps/app_controlplayback.c b/apps/app_controlplayback.c index 360f9b165..8f7a7fd61 100644 --- a/apps/app_controlplayback.c +++ b/apps/app_controlplayback.c @@ -93,7 +93,6 @@ static int controlplayback_exec(struct ast_channel *chan, void *data) int skipms = 0; long offsetms = 0; char offsetbuf[20]; - struct ast_module_user *u; char *tmp; int argc; char *argv[8] = { NULL, }; @@ -114,8 +113,6 @@ static int controlplayback_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "ControlPlayback requires an argument (filename)\n"); return -1; } - - u = ast_module_user_add(chan); tmp = ast_strdupa(data); @@ -123,7 +120,6 @@ static int controlplayback_exec(struct ast_channel *chan, void *data) if (argc < 1) { ast_log(LOG_WARNING, "ControlPlayback requires an argument (filename)\n"); - ast_module_user_remove(u); return -1; } @@ -165,8 +161,6 @@ static int controlplayback_exec(struct ast_channel *chan, void *data) snprintf(offsetbuf, sizeof(offsetbuf), "%ld", offsetms); pbx_builtin_setvar_helper(chan, "CPLAYBACKOFFSET", offsetbuf); - ast_module_user_remove(u); - return res; } diff --git a/apps/app_db.c b/apps/app_db.c index 01e440856..b6cead568 100644 --- a/apps/app_db.c +++ b/apps/app_db.c @@ -68,9 +68,6 @@ static char *dt_synopsis = "Delete a family or keytree from the database"; static int deltree_exec(struct ast_channel *chan, void *data) { char *argv, *family, *keytree; - struct ast_module_user *u; - - u = ast_module_user_add(chan); argv = ast_strdupa(data); @@ -79,7 +76,6 @@ static int deltree_exec(struct ast_channel *chan, void *data) keytree = strsep(&argv, "\0"); if (!family || !keytree) { ast_debug(1, "Ignoring; Syntax error in argument\n"); - ast_module_user_remove(u); return 0; } if (ast_strlen_zero(keytree)) @@ -101,19 +97,14 @@ static int deltree_exec(struct ast_channel *chan, void *data) ast_verbose(VERBOSE_PREFIX_3 "DBdeltree: Error deleting key from database.\n"); } - ast_module_user_remove(u); - return 0; } static int del_exec(struct ast_channel *chan, void *data) { char *argv, *family, *key; - struct ast_module_user *u; static int deprecation_warning = 0; - u = ast_module_user_add(chan); - if (!deprecation_warning) { deprecation_warning = 1; ast_log(LOG_WARNING, "The DBdel application has been deprecated in favor of the DB_DELETE dialplan function!\n"); @@ -126,7 +117,6 @@ static int del_exec(struct ast_channel *chan, void *data) key = strsep(&argv, "\0"); if (!family || !key) { ast_debug(1, "Ignoring; Syntax error in argument\n"); - ast_module_user_remove(u); return 0; } if (option_verbose > 2) @@ -138,8 +128,6 @@ static int del_exec(struct ast_channel *chan, void *data) } else { ast_debug(1, "Ignoring, no parameters\n"); } - - ast_module_user_remove(u); return 0; } diff --git a/apps/app_dial.c b/apps/app_dial.c index 7ee3e3272..4438daa8a 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1195,7 +1195,6 @@ static int setup_privacy_args(struct privacy_args *pa, static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags *peerflags, int *continue_exec) { int res = -1; /* default: error */ - struct ast_module_user *u; char *rest, *cur; /* scan the list of destinations */ struct chanlist *outgoing = NULL; /* list of destinations */ struct ast_channel *peer; @@ -1234,8 +1233,6 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags return -1; } - u = ast_module_user_add(chan); /* XXX is this the right place ? */ - parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); @@ -1820,7 +1817,6 @@ out: } done: - ast_module_user_remove(u); /* XXX probably not the right place for this. */ return res; } @@ -1838,7 +1834,6 @@ static int retrydial_exec(struct ast_channel *chan, void *data) char *announce = NULL, *dialdata = NULL; const char *context = NULL; int sleep = 0, loops = 0, res = -1; - struct ast_module_user *u; struct ast_flags peerflags; if (ast_strlen_zero(data)) { @@ -1846,8 +1841,6 @@ static int retrydial_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - announce = ast_strdupa(data); memset(&peerflags, 0, sizeof(peerflags)); @@ -1934,7 +1927,6 @@ static int retrydial_exec(struct ast_channel *chan, void *data) if (ast_test_flag(chan, AST_FLAG_MOH)) ast_moh_stop(chan); done: - ast_module_user_remove(u); return res; } @@ -1946,9 +1938,8 @@ static int unload_module(void) res = ast_unregister_application(app); res |= ast_unregister_application(rapp); - if ((con = ast_context_find("app_dial_gosub_virtual_context"))) { + if ((con = ast_context_find("app_dial_gosub_virtual_context"))) ast_context_remove_extension2(con, "s", 1, NULL); - } return res; } diff --git a/apps/app_dictate.c b/apps/app_dictate.c index 61252433d..566ff0f52 100644 --- a/apps/app_dictate.c +++ b/apps/app_dictate.c @@ -89,7 +89,6 @@ static int dictate_exec(struct ast_channel *chan, void *data) struct ast_flags flags = {0}; struct ast_filestream *fs; struct ast_frame *f = NULL; - struct ast_module_user *u; int ffactor = 320 * 80, res = 0, done = 0, @@ -101,8 +100,6 @@ static int dictate_exec(struct ast_channel *chan, void *data) len = 0, maxlen = 0, mode = 0; - - u = ast_module_user_add(chan); snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR); if (!ast_strlen_zero(data)) { @@ -122,7 +119,6 @@ static int dictate_exec(struct ast_channel *chan, void *data) oldr = chan->readformat; if ((res = ast_set_read_format(chan, AST_FORMAT_SLINEAR)) < 0) { ast_log(LOG_WARNING, "Unable to set to linear mode.\n"); - ast_module_user_remove(u); return -1; } @@ -330,7 +326,6 @@ static int dictate_exec(struct ast_channel *chan, void *data) if (oldr) { ast_set_read_format(chan, oldr); } - ast_module_user_remove(u); return 0; } diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c index 9d84f6985..99b252793 100644 --- a/apps/app_directed_pickup.c +++ b/apps/app_directed_pickup.c @@ -133,7 +133,6 @@ static int pickup_by_mark(struct ast_channel *chan, const char *mark) static int pickup_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u = NULL; char *tmp = ast_strdupa(data); char *exten = NULL, *context = NULL; @@ -141,8 +140,6 @@ static int pickup_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "Pickup requires an argument (extension)!\n"); return -1; } - - u = ast_module_user_add(chan); /* Parse extension (and context if there) */ while (!ast_strlen_zero(tmp) && (exten = strsep(&tmp, "&"))) { @@ -158,8 +155,6 @@ static int pickup_exec(struct ast_channel *chan, void *data) ast_log(LOG_NOTICE, "No target channel found for %s.\n", exten); } - ast_module_user_remove(u); - return res; } diff --git a/apps/app_directory.c b/apps/app_directory.c index 7746502c7..72f777763 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -566,7 +566,6 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, struct static int directory_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; struct ast_config *cfg, *ucfg; int last = 1; int readext = 0; @@ -584,8 +583,6 @@ static int directory_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); @@ -605,7 +602,6 @@ static int directory_exec(struct ast_channel *chan, void *data) cfg = realtime_directory(args.vmcontext); if (!cfg) { ast_log(LOG_ERROR, "Unable to read the configuration data!\n"); - ast_module_user_remove(u); return -1; } @@ -640,7 +636,6 @@ static int directory_exec(struct ast_channel *chan, void *data) if (ucfg) ast_config_destroy(ucfg); ast_config_destroy(cfg); - ast_module_user_remove(u); return res; } diff --git a/apps/app_disa.c b/apps/app_disa.c index 99d4f97eb..dadfdcc4a 100644 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -123,7 +123,6 @@ static int disa_exec(struct ast_channel *chan, void *data) int i,j,k,x,did_ignore,special_noanswer; int firstdigittimeout = 20000; int digittimeout = 10000; - struct ast_module_user *u; struct ast_flags flags; char *tmp, exten[AST_MAX_EXTENSION],acctcode[20]=""; char pwline[256]; @@ -145,8 +144,6 @@ static int disa_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "DISA requires an argument (passcode/passcode file)\n"); return -1; } - - u = ast_module_user_add(chan); if (chan->pbx) { firstdigittimeout = chan->pbx->rtimeout*1000; @@ -155,12 +152,10 @@ static int disa_exec(struct ast_channel *chan, void *data) if (ast_set_write_format(chan,AST_FORMAT_ULAW)) { ast_log(LOG_WARNING, "Unable to set write format to Mu-law on %s\n", chan->name); - ast_module_user_remove(u); return -1; } if (ast_set_read_format(chan,AST_FORMAT_ULAW)) { ast_log(LOG_WARNING, "Unable to set read format to Mu-law on %s\n", chan->name); - ast_module_user_remove(u); return -1; } @@ -218,13 +213,11 @@ static int disa_exec(struct ast_channel *chan, void *data) f = ast_read(chan); if (f == NULL) { - ast_module_user_remove(u); return -1; } if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) { ast_frfree(f); - ast_module_user_remove(u); return -1; } if (f->frametype == AST_FRAME_VOICE) { @@ -254,7 +247,6 @@ static int disa_exec(struct ast_channel *chan, void *data) fp = fopen(args.passcode,"r"); if (!fp) { ast_log(LOG_WARNING,"DISA password file %s not found on chan %s\n",args.passcode,chan->name); - ast_module_user_remove(u); return -1; } pwline[0] = 0; @@ -361,7 +353,6 @@ static int disa_exec(struct ast_channel *chan, void *data) if (special_noanswer) flags.flags = 0; ast_cdr_reset(chan->cdr, &flags); ast_explicit_goto(chan, args.context, exten, 1); - ast_module_user_remove(u); return 0; } } @@ -382,7 +373,6 @@ reorder: ast_frfree(f); } ast_playtones_stop(chan); - ast_module_user_remove(u); return -1; } diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c index 29ad21a59..ecffe488e 100644 --- a/apps/app_dumpchan.c +++ b/apps/app_dumpchan.c @@ -142,14 +142,11 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) static int dumpchan_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; struct ast_str *vars = ast_str_alloca(BUFSIZ * 4); /* XXX very large! */ char info[1024]; int level = 0; static char *line = "================================================================================"; - u = ast_module_user_add(chan); - if (!ast_strlen_zero(data)) level = atoi(data); @@ -157,8 +154,6 @@ static int dumpchan_exec(struct ast_channel *chan, void *data) serialize_showchan(chan, info, sizeof(info)); if (option_verbose >= level) ast_verbose("\nDumping Info For Channel: %s:\n%s\nInfo:\n%s\nVariables:\n%s%s\n", chan->name, line, info, vars->str, line); - - ast_module_user_remove(u); return 0; } diff --git a/apps/app_echo.c b/apps/app_echo.c index 6110f5369..1420131df 100644 --- a/apps/app_echo.c +++ b/apps/app_echo.c @@ -55,9 +55,6 @@ static int echo_exec(struct ast_channel *chan, void *data) { int res = -1; int format; - struct ast_module_user *u; - - u = ast_module_user_add(chan); format = ast_best_codec(chan->nativeformats); ast_set_write_format(chan, format); @@ -81,7 +78,6 @@ static int echo_exec(struct ast_channel *chan, void *data) ast_frfree(f); } end: - ast_module_user_remove(u); return res; } diff --git a/apps/app_exec.c b/apps/app_exec.c index 32298d03c..b953e8129 100644 --- a/apps/app_exec.c +++ b/apps/app_exec.c @@ -90,15 +90,12 @@ static char *execif_descrip = static int exec_exec(struct ast_channel *chan, void *data) { - int res=0; - struct ast_module_user *u; + int res = 0; char *s, *appname, *endargs, args[MAXRESULT] = ""; struct ast_app *app; if (ast_strlen_zero(data)) return 0; - - u = ast_module_user_add(chan); s = ast_strdupa(data); appname = strsep(&s, "("); @@ -118,23 +115,18 @@ static int exec_exec(struct ast_channel *chan, void *data) } } - ast_module_user_remove(u); - return res; } static int tryexec_exec(struct ast_channel *chan, void *data) { - int res=0; - struct ast_module_user *u; + int res = 0; char *s, *appname, *endargs, args[MAXRESULT] = ""; struct ast_app *app; if (ast_strlen_zero(data)) return 0; - u = ast_module_user_add(chan); - s = ast_strdupa(data); appname = strsep(&s, "("); if (s) { @@ -154,22 +146,17 @@ static int tryexec_exec(struct ast_channel *chan, void *data) } } - ast_module_user_remove(u); - return 0; } static int execif_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; char *myapp = NULL; char *mydata = NULL; char *expr = NULL; struct ast_app *app = NULL; - u = ast_module_user_add(chan); - expr = ast_strdupa(data); if ((myapp = strchr(expr,'|'))) { @@ -193,8 +180,6 @@ static int execif_exec(struct ast_channel *chan, void *data) ast_log(LOG_ERROR,"Invalid Syntax.\n"); res = -1; } - - ast_module_user_remove(u); return res; } diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c index e5778edba..63c182337 100644 --- a/apps/app_externalivr.c +++ b/apps/app_externalivr.c @@ -243,7 +243,6 @@ static struct playlist_entry *make_entry(const char *filename) static int app_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *lu; struct playlist_entry *entry; const char *args = data; int child_stdin[2] = { 0,0 }; @@ -265,8 +264,6 @@ static int app_exec(struct ast_channel *chan, void *data) struct ivr_localuser *u = &foo; sigset_t fullset, oldset; - lu = ast_module_user_add(chan); - sigfillset(&fullset); pthread_sigmask(SIG_BLOCK, &fullset, &oldset); @@ -275,7 +272,6 @@ static int app_exec(struct ast_channel *chan, void *data) if (ast_strlen_zero(args)) { ast_log(LOG_WARNING, "ExternalIVR requires a command to execute\n"); - ast_module_user_remove(lu); return -1; } @@ -571,8 +567,6 @@ static int app_exec(struct ast_channel *chan, void *data) while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) ast_free(entry); - ast_module_user_remove(lu); - return res; } diff --git a/apps/app_festival.c b/apps/app_festival.c index d43c3aa16..058477054 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -284,7 +284,6 @@ static int festival_exec(struct ast_channel *chan, void *vdata) { int usecache; int res=0; - struct ast_module_user *u; struct sockaddr_in serv_addr; struct hostent *serverhost; struct ast_hostent ahp; @@ -323,12 +322,9 @@ static int festival_exec(struct ast_channel *chan, void *vdata) return -1; } - u = ast_module_user_add(chan); - cfg = ast_config_load(FESTIVAL_CONFIG); if (!cfg) { ast_log(LOG_WARNING, "No such configuration file %s\n", FESTIVAL_CONFIG); - ast_module_user_remove(u); return -1; } if (!(host = ast_variable_retrieve(cfg, "general", "host"))) { @@ -385,7 +381,6 @@ static int festival_exec(struct ast_channel *chan, void *vdata) if (fd < 0) { ast_log(LOG_WARNING,"festival_client: can't get socket\n"); ast_config_destroy(cfg); - ast_module_user_remove(u); return -1; } @@ -398,7 +393,6 @@ static int festival_exec(struct ast_channel *chan, void *vdata) if (serverhost == (struct hostent *)0) { ast_log(LOG_WARNING,"festival_client: gethostbyname failed\n"); ast_config_destroy(cfg); - ast_module_user_remove(u); return -1; } memmove(&serv_addr.sin_addr,serverhost->h_addr, serverhost->h_length); @@ -410,7 +404,6 @@ static int festival_exec(struct ast_channel *chan, void *vdata) if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0) { ast_log(LOG_WARNING,"festival_client: connect to server failed\n"); ast_config_destroy(cfg); - ast_module_user_remove(u); return -1; } @@ -502,7 +495,6 @@ static int festival_exec(struct ast_channel *chan, void *vdata) ast_log(LOG_WARNING,"Unable to read from cache/festival fd\n"); close(fd); ast_config_destroy(cfg); - ast_module_user_remove(u); return -1; } n += read_data; @@ -529,7 +521,6 @@ static int festival_exec(struct ast_channel *chan, void *vdata) } while (strcmp(ack,"OK\n") != 0); close(fd); ast_config_destroy(cfg); - ast_module_user_remove(u); return res; } diff --git a/apps/app_flash.c b/apps/app_flash.c index 2497419a2..d35988fd5 100644 --- a/apps/app_flash.c +++ b/apps/app_flash.c @@ -73,15 +73,12 @@ static int flash_exec(struct ast_channel *chan, void *data) { int res = -1; int x; - struct ast_module_user *u; struct zt_params ztp; if (strcasecmp(chan->tech->type, "Zap")) { ast_log(LOG_WARNING, "%s is not a Zap channel\n", chan->name); return -1; } - - u = ast_module_user_add(chan); memset(&ztp, 0, sizeof(ztp)); res = ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp); @@ -104,8 +101,6 @@ static int flash_exec(struct ast_channel *chan, void *data) } else ast_log(LOG_WARNING, "Unable to get parameters of %s: %s\n", chan->name, strerror(errno)); - ast_module_user_remove(u); - return res; } diff --git a/apps/app_followme.c b/apps/app_followme.c index a97f40212..b2b03e31f 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -899,7 +899,6 @@ static int app_exec(struct ast_channel *chan, void *data) struct call_followme *f; struct number *nm, *newnm; int res = 0; - struct ast_module_user *u; char *argstr; char namerecloc[255]; int duration = 0; @@ -922,8 +921,6 @@ static int app_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - AST_STANDARD_APP_ARGS(args, argstr); if (!ast_strlen_zero(args.followmeid)) @@ -1043,8 +1040,6 @@ static int app_exec(struct ast_channel *chan, void *data) } outrun: - ast_module_user_remove(u); - return res; } diff --git a/apps/app_forkcdr.c b/apps/app_forkcdr.c index a58ca9a83..72c26bd8a 100644 --- a/apps/app_forkcdr.c +++ b/apps/app_forkcdr.c @@ -77,21 +77,17 @@ static void ast_cdr_fork(struct ast_channel *chan) static int forkcdr_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; if (!chan->cdr) { ast_log(LOG_WARNING, "Channel does not have a CDR\n"); return 0; } - u = ast_module_user_add(chan); - if (!ast_strlen_zero(data)) ast_set2_flag(chan->cdr, strchr(data, 'v'), AST_CDR_FLAG_KEEP_VARS); ast_cdr_fork(chan); - ast_module_user_remove(u); return res; } diff --git a/apps/app_getcpeid.c b/apps/app_getcpeid.c index fd19e4a31..9342a58ed 100644 --- a/apps/app_getcpeid.c +++ b/apps/app_getcpeid.c @@ -66,7 +66,6 @@ static int cpeid_setstatus(struct ast_channel *chan, char *stuff[], int voice) static int cpeid_exec(struct ast_channel *chan, void *idata) { int res=0; - struct ast_module_user *u; unsigned char cpeid[4]; int gotgeometry = 0; int gotcpeid = 0; @@ -74,8 +73,6 @@ static int cpeid_exec(struct ast_channel *chan, void *idata) char *data[4]; unsigned int x; - u = ast_module_user_add(chan); - for (x = 0; x < 4; x++) data[x] = alloca(80); @@ -125,7 +122,7 @@ static int cpeid_exec(struct ast_channel *chan, void *idata) ast_adsi_unload_session(chan); } } - ast_module_user_remove(u); + return res; } diff --git a/apps/app_ices.c b/apps/app_ices.c index 233ac6b13..fe900ef4a 100644 --- a/apps/app_ices.c +++ b/apps/app_ices.c @@ -103,8 +103,7 @@ static int icesencode(char *filename, int fd) static int ices_exec(struct ast_channel *chan, void *data) { - int res=0; - struct ast_module_user *u; + int res = 0; int fds[2]; int ms = -1; int pid = -1; @@ -119,14 +118,11 @@ static int ices_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "ICES requires an argument (configfile.xml)\n"); return -1; } - - u = ast_module_user_add(chan); last = ast_tv(0, 0); if (pipe(fds)) { ast_log(LOG_WARNING, "Unable to create pipe\n"); - ast_module_user_remove(u); return -1; } flags = fcntl(fds[1], F_GETFL); @@ -141,7 +137,6 @@ static int ices_exec(struct ast_channel *chan, void *data) close(fds[0]); close(fds[1]); ast_log(LOG_WARNING, "Answer failed!\n"); - ast_module_user_remove(u); return -1; } @@ -151,7 +146,6 @@ static int ices_exec(struct ast_channel *chan, void *data) close(fds[0]); close(fds[1]); ast_log(LOG_WARNING, "Unable to set write format to signed linear\n"); - ast_module_user_remove(u); return -1; } if (((char *)data)[0] == '/') @@ -201,8 +195,6 @@ static int ices_exec(struct ast_channel *chan, void *data) if (!res && oreadformat) ast_set_read_format(chan, oreadformat); - ast_module_user_remove(u); - return res; } diff --git a/apps/app_image.c b/apps/app_image.c index 6f35ea110..655bbcfa0 100644 --- a/apps/app_image.c +++ b/apps/app_image.c @@ -61,15 +61,12 @@ static char *descrip = static int sendimage_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; char *parse; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(filename); AST_APP_ARG(options); ); - u = ast_module_user_add(chan); - parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); @@ -85,15 +82,12 @@ static int sendimage_exec(struct ast_channel *chan, void *data) if (!ast_supports_images(chan)) { /* Does not support transport */ pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "NOSUPPORT"); - ast_module_user_remove(u); return 0; } if (!(res = ast_send_image(chan, args.filename))) pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "OK"); - - ast_module_user_remove(u); - + return res; } diff --git a/apps/app_ivrdemo.c b/apps/app_ivrdemo.c index e28e94d2c..3ac80cbb4 100644 --- a/apps/app_ivrdemo.c +++ b/apps/app_ivrdemo.c @@ -92,15 +92,12 @@ AST_IVR_DECLARE_MENU(ivr_demo, "IVR Demo Main Menu", 0, static int skel_exec(struct ast_channel *chan, void *data) { int res=0; - struct ast_module_user *u; if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "skel requires an argument (filename)\n"); return -1; } - u = ast_module_user_add(chan); - /* Do our thing here */ if (chan->_state != AST_STATE_UP) @@ -108,8 +105,6 @@ static int skel_exec(struct ast_channel *chan, void *data) if (!res) res = ast_ivr_menu_run(chan, &ivr_demo, data); - ast_module_user_remove(u); - return res; } diff --git a/apps/app_macro.c b/apps/app_macro.c index 01556d3a7..5f71bcd7f 100644 --- a/apps/app_macro.c +++ b/apps/app_macro.c @@ -166,15 +166,12 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) char *save_macro_context; char *save_macro_priority; char *save_macro_offset; - struct ast_module_user *u; if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "Macro() requires arguments. See \"show application macro\" for help.\n"); return -1; } - u = ast_module_user_add(chan); - /* does the user want a deeper rabbit hole? */ s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION"); if (s) @@ -193,7 +190,6 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) if (depth >= maxdepth) { ast_log(LOG_ERROR, "Macro(): possible infinite loop detected. Returning early.\n"); - ast_module_user_remove(u); return 0; } snprintf(depthc, sizeof(depthc), "%d", depth + 1); @@ -204,7 +200,6 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) macro = strsep(&rest, "|"); if (ast_strlen_zero(macro)) { ast_log(LOG_WARNING, "Invalid macro name specified\n"); - ast_module_user_remove(u); return 0; } @@ -214,7 +209,6 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) ast_log(LOG_WARNING, "No such context '%s' for macro '%s'\n", fullmacro, macro); else ast_log(LOG_WARNING, "Context '%s' for macro '%s' lacks 's' extension, priority 1\n", fullmacro, macro); - ast_module_user_remove(u); return 0; } @@ -225,8 +219,6 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) if (ast_context_lockmacro(fullmacro)) { ast_log(LOG_WARNING, "Failed to lock macro '%s' as in-use\n", fullmacro); ast_autoservice_stop(chan); - ast_module_user_remove(u); - return 0; } ast_autoservice_stop(chan); @@ -474,8 +466,6 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) res = 0; } } - - ast_module_user_remove(u); return res; } @@ -494,14 +484,9 @@ static int macroif_exec(struct ast_channel *chan, void *data) { char *expr = NULL, *label_a = NULL, *label_b = NULL; int res = 0; - struct ast_module_user *u; - u = ast_module_user_add(chan); - - if (!(expr = ast_strdupa(data))) { - ast_module_user_remove(u); + if (!(expr = ast_strdupa(data))) return -1; - } if ((label_a = strchr(expr, '?'))) { *label_a = '\0'; @@ -517,8 +502,6 @@ static int macroif_exec(struct ast_channel *chan, void *data) } else ast_log(LOG_WARNING, "Invalid Syntax.\n"); - ast_module_user_remove(u); - return res; } diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 65c8d6c96..c91570fba 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -2486,7 +2486,6 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno, /*! \brief The MeetmeCount application */ static int count_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; int res = 0; struct ast_conference *conf; int count; @@ -2501,13 +2500,9 @@ static int count_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "MeetMeCount requires an argument (conference number)\n"); return -1; } - - u = ast_module_user_add(chan); - if (!(localdata = ast_strdupa(data))) { - ast_module_user_remove(u); + if (!(localdata = ast_strdupa(data))) return -1; - } AST_STANDARD_APP_ARGS(args, localdata); @@ -2529,7 +2524,6 @@ static int count_exec(struct ast_channel *chan, void *data) ast_answer(chan); res = ast_say_number(chan, count, "", chan->language, (char *) NULL); /* Needs gender */ } - ast_module_user_remove(u); return res; } @@ -2538,7 +2532,6 @@ static int count_exec(struct ast_channel *chan, void *data) static int conf_exec(struct ast_channel *chan, void *data) { int res=-1; - struct ast_module_user *u; char confno[MAX_CONFNUM] = ""; int allowretry = 0; int retrycnt = 0; @@ -2555,8 +2548,6 @@ static int conf_exec(struct ast_channel *chan, void *data) ); char *optargs[OPT_ARG_ARRAY_SIZE] = { NULL, }; - u = ast_module_user_add(chan); - if (ast_strlen_zero(data)) { allowretry = 1; notdata = ""; @@ -2777,8 +2768,6 @@ static int conf_exec(struct ast_channel *chan, void *data) if (cnf) dispose_conf(cnf); - - ast_module_user_remove(u); return res; } @@ -2804,7 +2793,6 @@ static int admin_exec(struct ast_channel *chan, void *data) { char *params; struct ast_conference *cnf; struct ast_conf_user *user = NULL; - struct ast_module_user *u; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(confno); AST_APP_ARG(command); @@ -2816,14 +2804,11 @@ static int admin_exec(struct ast_channel *chan, void *data) { return -1; } - u = ast_module_user_add(chan); - params = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, params); if (!args.command) { ast_log(LOG_WARNING, "MeetmeAdmin requires a command!\n"); - ast_module_user_remove(u); return -1; } @@ -2836,7 +2821,6 @@ static int admin_exec(struct ast_channel *chan, void *data) { if (!cnf) { ast_log(LOG_WARNING, "Conference number '%s' not found!\n", args.confno); AST_LIST_UNLOCK(&confs); - ast_module_user_remove(u); return 0; } @@ -2946,8 +2930,6 @@ static int admin_exec(struct ast_channel *chan, void *data) { AST_LIST_UNLOCK(&confs); dispose_conf(cnf); - - ast_module_user_remove(u); return 0; } @@ -2958,7 +2940,6 @@ static int channel_admin_exec(struct ast_channel *chan, void *data) { char *params; struct ast_conference *conf = NULL; struct ast_conf_user *user = NULL; - struct ast_module_user *u; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(channel); AST_APP_ARG(command); @@ -2969,20 +2950,16 @@ static int channel_admin_exec(struct ast_channel *chan, void *data) { return -1; } - u = ast_module_user_add(chan); - params = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, params); if (!args.channel) { ast_log(LOG_WARNING, "MeetMeChannelAdmin requires a channel name!\n"); - ast_module_user_remove(u); return -1; } if (!args.command) { ast_log(LOG_WARNING, "MeetMeChannelAdmin requires a command!\n"); - ast_module_user_remove(u); return -1; } @@ -2997,7 +2974,6 @@ static int channel_admin_exec(struct ast_channel *chan, void *data) { if (!user) { ast_log(LOG_NOTICE, "Specified user (%s) not found\n", args.channel); AST_LIST_UNLOCK(&confs); - ast_module_user_remove(u); return 0; } @@ -3018,8 +2994,6 @@ static int channel_admin_exec(struct ast_channel *chan, void *data) { } AST_LIST_UNLOCK(&confs); - - ast_module_user_remove(u); return 0; } diff --git a/apps/app_milliwatt.c b/apps/app_milliwatt.c index 89ef37545..022eb6f3b 100644 --- a/apps/app_milliwatt.c +++ b/apps/app_milliwatt.c @@ -113,9 +113,6 @@ static struct ast_generator milliwattgen = static int milliwatt_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; - u = ast_module_user_add(chan); - ast_set_write_format(chan, AST_FORMAT_ULAW); ast_set_read_format(chan, AST_FORMAT_ULAW); @@ -125,7 +122,6 @@ static int milliwatt_exec(struct ast_channel *chan, void *data) if (ast_activate_generator(chan,&milliwattgen,"milliwatt") < 0) { ast_log(LOG_WARNING,"Failed to activate generator on '%s'\n",chan->name); - ast_module_user_remove(u); return -1; } @@ -133,8 +129,6 @@ static int milliwatt_exec(struct ast_channel *chan, void *data) ast_deactivate_generator(chan); - ast_module_user_remove(u); - return -1; } diff --git a/apps/app_minivm.c b/apps/app_minivm.c index f0a2f08bb..c7ab7a90d 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -1630,7 +1630,6 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav /*! \brief Notify voicemail account owners - either generic template or user specific */ static int minivm_notify_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; int argc; char *argv[2]; int res = 0; @@ -1644,18 +1643,13 @@ static int minivm_notify_exec(struct ast_channel *chan, void *data) const char *format; const char *duration_string; - u = ast_module_user_add(chan); - - if (ast_strlen_zero(data)) { ast_log(LOG_ERROR, "Minivm needs at least an account argument \n"); - ast_module_user_remove(u); return -1; } tmpptr = ast_strdupa((char *)data); if (!tmpptr) { ast_log(LOG_ERROR, "Out of memory\n"); - ast_module_user_remove(u); return -1; } argc = ast_app_separate_args(tmpptr, '|', argv, sizeof(argv) / sizeof(argv[0])); @@ -1672,7 +1666,6 @@ static int minivm_notify_exec(struct ast_channel *chan, void *data) } if (ast_strlen_zero(domain) || ast_strlen_zero(username)) { ast_log(LOG_ERROR, "Need username@domain as argument. Sorry. Argument 0 %s\n", argv[0]); - ast_module_user_remove(u); return -1; } @@ -1680,7 +1673,6 @@ static int minivm_notify_exec(struct ast_channel *chan, void *data) /* We could not find user, let's exit */ ast_log(LOG_WARNING, "Could not allocate temporary memory for '%s@%s'\n", username, domain); pbx_builtin_setvar_helper(chan, "MINIVM_NOTIFY_STATUS", "FAILED"); - ast_module_user_remove(u); return -1; } @@ -1699,7 +1691,6 @@ static int minivm_notify_exec(struct ast_channel *chan, void *data) free_user(vmu); /* Ok, we're ready to rock and roll. Return to dialplan */ - ast_module_user_remove(u); return res; @@ -1709,16 +1700,13 @@ static int minivm_notify_exec(struct ast_channel *chan, void *data) static int minivm_record_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; char *tmp; struct leave_vm_options leave_options; int argc; char *argv[2]; struct ast_flags flags = { 0 }; char *opts[OPT_ARG_ARRAY_SIZE]; - - u = ast_module_user_add(chan); - + memset(&leave_options, 0, sizeof(leave_options)); /* Answer channel if it's not already answered */ @@ -1727,19 +1715,16 @@ static int minivm_record_exec(struct ast_channel *chan, void *data) if (ast_strlen_zero(data)) { ast_log(LOG_ERROR, "Minivm needs at least an account argument \n"); - ast_module_user_remove(u); return -1; } tmp = ast_strdupa((char *)data); if (!tmp) { ast_log(LOG_ERROR, "Out of memory\n"); - ast_module_user_remove(u); return -1; } argc = ast_app_separate_args(tmp, '|', argv, sizeof(argv) / sizeof(argv[0])); if (argc == 2) { if (ast_app_parse_options(minivm_app_options, &flags, opts, argv[1])) { - ast_module_user_remove(u); return -1; } ast_copy_flags(&leave_options, &flags, OPT_SILENT | OPT_BUSY_GREETING | OPT_UNAVAIL_GREETING ); @@ -1748,7 +1733,6 @@ static int minivm_record_exec(struct ast_channel *chan, void *data) if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) { ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]); - ast_module_user_remove(u); return -1; } else leave_options.record_gain = (signed char) gain; @@ -1765,16 +1749,12 @@ static int minivm_record_exec(struct ast_channel *chan, void *data) } pbx_builtin_setvar_helper(chan, "MINIVM_RECORD_STATUS", "SUCCESS"); - - ast_module_user_remove(u); - return res; } /*! \brief Play voicemail prompts - either generic or user specific */ static int minivm_greet_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; struct leave_vm_options leave_options = { 0, '\0'}; int argc; char *argv[2]; @@ -1794,27 +1774,21 @@ static int minivm_greet_exec(struct ast_channel *chan, void *data) char *tmpptr; struct minivm_account *vmu; char *username = argv[0]; - - u = ast_module_user_add(chan); if (ast_strlen_zero(data)) { ast_log(LOG_ERROR, "Minivm needs at least an account argument \n"); - ast_module_user_remove(u); return -1; } tmpptr = ast_strdupa((char *)data); if (!tmpptr) { ast_log(LOG_ERROR, "Out of memory\n"); - ast_module_user_remove(u); return -1; } argc = ast_app_separate_args(tmpptr, '|', argv, sizeof(argv) / sizeof(argv[0])); if (argc == 2) { - if (ast_app_parse_options(minivm_app_options, &flags, opts, argv[1])) { - ast_module_user_remove(u); + if (ast_app_parse_options(minivm_app_options, &flags, opts, argv[1])) return -1; - } ast_copy_flags(&leave_options, &flags, OPT_SILENT | OPT_BUSY_GREETING | OPT_UNAVAIL_GREETING ); } @@ -1827,14 +1801,12 @@ static int minivm_greet_exec(struct ast_channel *chan, void *data) } if (ast_strlen_zero(domain) || ast_strlen_zero(username)) { ast_log(LOG_ERROR, "Need username@domain as argument. Sorry. Argument: %s\n", argv[0]); - ast_module_user_remove(u); return -1; } ast_debug(1, "-_-_- Trying to find configuration for user %s in domain %s\n", username, domain); if (!(vmu = find_account(domain, username, TRUE))) { ast_log(LOG_ERROR, "Could not allocate memory. \n"); - ast_module_user_remove(u); return -1; } @@ -1906,7 +1878,6 @@ static int minivm_greet_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, "MINIVM_GREET_STATUS", "FAILED"); if(ast_test_flag(vmu, MVM_ALLOCED)) free_user(vmu); - ast_module_user_remove(u); return -1; } if (res == '#') { @@ -1963,8 +1934,6 @@ static int minivm_greet_exec(struct ast_channel *chan, void *data) /* Ok, we're ready to rock and roll. Return to dialplan */ - ast_module_user_remove(u); - return res; } @@ -1973,18 +1942,14 @@ static int minivm_greet_exec(struct ast_channel *chan, void *data) static int minivm_delete_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; char filename[BUFSIZ]; - - u = ast_module_user_add(chan); - + if (!ast_strlen_zero(data)) ast_copy_string(filename, (char *) data, sizeof(filename)); else ast_copy_string(filename, pbx_builtin_getvar_helper(chan, "MVM_FILENAME"), sizeof(filename)); if (ast_strlen_zero(filename)) { - ast_module_user_remove(u); ast_log(LOG_ERROR, "No filename given in application arguments or channel variable MVM_FILENAME\n"); return res; } @@ -2004,8 +1969,6 @@ static int minivm_delete_exec(struct ast_channel *chan, void *data) ast_debug(2, "-_-_- Filename does not exist: %s\n", filename); pbx_builtin_setvar_helper(chan, "MINIVM_DELETE_STATUS", "FAILED"); } - - ast_module_user_remove(u); return res; } @@ -2013,7 +1976,6 @@ static int minivm_delete_exec(struct ast_channel *chan, void *data) /*! \brief Record specific messages for voicemail account */ static int minivm_accmess_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; int argc = 0; char *argv[2]; int res = 0; @@ -2030,8 +1992,6 @@ static int minivm_accmess_exec(struct ast_channel *chan, void *data) char *prompt = NULL; int duration; int cmd; - - u = ast_module_user_add(chan); if (ast_strlen_zero(data)) { ast_log(LOG_ERROR, "MinivmAccmess needs at least two arguments: account and option\n"); @@ -2060,10 +2020,8 @@ static int minivm_accmess_exec(struct ast_channel *chan, void *data) error = TRUE; } - if (error) { - ast_module_user_remove(u); + if (error) return -1; - } ast_copy_string(tmp, argv[0], sizeof(tmp)); username = tmp; @@ -2074,7 +2032,6 @@ static int minivm_accmess_exec(struct ast_channel *chan, void *data) } if (ast_strlen_zero(domain) || ast_strlen_zero(username)) { ast_log(LOG_ERROR, "Need username@domain as argument. Sorry. Argument 0 %s\n", argv[0]); - ast_module_user_remove(u); return -1; } @@ -2082,7 +2039,6 @@ static int minivm_accmess_exec(struct ast_channel *chan, void *data) /* We could not find user, let's exit */ ast_log(LOG_WARNING, "Could not allocate temporary memory for '%s@%s'\n", username, domain); pbx_builtin_setvar_helper(chan, "MINIVM_NOTIFY_STATUS", "FAILED"); - ast_module_user_remove(u); return -1; } @@ -2115,8 +2071,6 @@ static int minivm_accmess_exec(struct ast_channel *chan, void *data) /* Ok, we're ready to rock and roll. Return to dialplan */ - ast_module_user_remove(u); - return res; } diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index 308f82b4d..fbbde45aa 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -302,7 +302,6 @@ static void launch_monitor_thread(struct ast_channel *chan, const char *filename static int mixmonitor_exec(struct ast_channel *chan, void *data) { int x, readvol = 0, writevol = 0; - struct ast_module_user *u; struct ast_flags flags = {0}; char *parse, *tmp, *slash; AST_DECLARE_APP_ARGS(args, @@ -316,15 +315,12 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); if (ast_strlen_zero(args.filename)) { ast_log(LOG_WARNING, "MixMonitor requires an argument (filename)\n"); - ast_module_user_remove(u); return -1; } @@ -381,23 +377,14 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, "MIXMONITOR_FILENAME", args.filename); launch_monitor_thread(chan, args.filename, flags.flags, readvol, writevol, args.post_process); - ast_module_user_remove(u); - return 0; } static int stop_mixmonitor_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; - - u = ast_module_user_add(chan); - ast_channel_lock(chan); ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type); ast_channel_unlock(chan); - - ast_module_user_remove(u); - return 0; } diff --git a/apps/app_morsecode.c b/apps/app_morsecode.c index 61c4fe4bd..2870d5afe 100644 --- a/apps/app_morsecode.c +++ b/apps/app_morsecode.c @@ -111,13 +111,9 @@ static int morsecode_exec(struct ast_channel *chan, void *data) int res=0, ditlen, tone; char *digit; const char *ditlenc, *tonec; - struct ast_module_user *u; - - u = ast_module_user_add(chan); if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "Syntax: Morsecode() - no argument found\n"); - ast_module_user_remove(u); return 0; } @@ -155,7 +151,6 @@ static int morsecode_exec(struct ast_channel *chan, void *data) playtone(chan, 0, 2 * ditlen); } - ast_module_user_remove(u); return res; } diff --git a/apps/app_mp3.c b/apps/app_mp3.c index 2656a6b79..b8275e8bf 100644 --- a/apps/app_mp3.c +++ b/apps/app_mp3.c @@ -125,7 +125,6 @@ static int timed_read(int fd, void *data, int datalen, int timeout) static int mp3_exec(struct ast_channel *chan, void *data) { int res=0; - struct ast_module_user *u; int fds[2]; int ms = -1; int pid = -1; @@ -144,11 +143,8 @@ static int mp3_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - if (pipe(fds)) { ast_log(LOG_WARNING, "Unable to create pipe\n"); - ast_module_user_remove(u); return -1; } @@ -158,7 +154,6 @@ static int mp3_exec(struct ast_channel *chan, void *data) res = ast_set_write_format(chan, AST_FORMAT_SLINEAR); if (res < 0) { ast_log(LOG_WARNING, "Unable to set write format to signed linear\n"); - ast_module_user_remove(u); return -1; } @@ -230,8 +225,6 @@ static int mp3_exec(struct ast_channel *chan, void *data) kill(pid, SIGKILL); if (!res && owriteformat) ast_set_write_format(chan, owriteformat); - - ast_module_user_remove(u); return res; } diff --git a/apps/app_nbscat.c b/apps/app_nbscat.c index ca2b61f8b..12131dd58 100644 --- a/apps/app_nbscat.c +++ b/apps/app_nbscat.c @@ -116,7 +116,6 @@ static int timed_read(int fd, void *data, int datalen) static int NBScat_exec(struct ast_channel *chan, void *data) { int res=0; - struct ast_module_user *u; int fds[2]; int ms = -1; int pid = -1; @@ -129,11 +128,8 @@ static int NBScat_exec(struct ast_channel *chan, void *data) short frdata[160]; } myf; - u = ast_module_user_add(chan); - if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds)) { ast_log(LOG_WARNING, "Unable to create socketpair\n"); - ast_module_user_remove(u); return -1; } @@ -143,7 +139,6 @@ static int NBScat_exec(struct ast_channel *chan, void *data) res = ast_set_write_format(chan, AST_FORMAT_SLINEAR); if (res < 0) { ast_log(LOG_WARNING, "Unable to set write format to signed linear\n"); - ast_module_user_remove(u); return -1; } @@ -213,8 +208,6 @@ static int NBScat_exec(struct ast_channel *chan, void *data) if (!res && owriteformat) ast_set_write_format(chan, owriteformat); - ast_module_user_remove(u); - return res; } diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index ce1417ec9..dd75b57fd 100644 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -1262,7 +1262,6 @@ static int ospauth_exec( void* data) { int res; - struct ast_module_user* u; const char* provider = OSP_DEF_PROVIDER; struct varshead* headp; struct ast_var_t* current; @@ -1279,11 +1278,8 @@ static int ospauth_exec( AST_APP_ARG(options); ); - u = ast_module_user_add(chan); - if (!(tmp = ast_strdupa(data))) { ast_log(LOG_ERROR, "Out of memory\n"); - ast_module_user_remove(u); return -1; } @@ -1332,8 +1328,6 @@ static int ospauth_exec( res = 0; } - ast_module_user_remove(u); - return res; } @@ -1348,7 +1342,6 @@ static int osplookup_exec( void* data) { int res, cres; - struct ast_module_user* u; const char* provider = OSP_DEF_PROVIDER; struct varshead* headp; struct ast_var_t* current; @@ -1371,11 +1364,8 @@ static int osplookup_exec( return -1; } - u = ast_module_user_add(chan); - if (!(tmp = ast_strdupa(data))) { ast_log(LOG_ERROR, "Out of memory\n"); - ast_module_user_remove(u); return -1; } @@ -1426,7 +1416,6 @@ static int osplookup_exec( ast_debug(1, "OSPLookup: source device '%s'\n", srcdev); if ((cres = ast_autoservice_start(chan)) < 0) { - ast_module_user_remove(u); return -1; } @@ -1498,7 +1487,6 @@ static int osplookup_exec( } if ((cres = ast_autoservice_stop(chan)) < 0) { - ast_module_user_remove(u); return -1; } @@ -1508,8 +1496,6 @@ static int osplookup_exec( res = 0; } - ast_module_user_remove(u); - return res; } @@ -1524,7 +1510,6 @@ static int ospnext_exec( void* data) { int res; - struct ast_module_user* u; const char* provider = OSP_DEF_PROVIDER; int cause = 0; struct varshead* headp; @@ -1546,11 +1531,8 @@ static int ospnext_exec( return -1; } - u = ast_module_user_add(chan); - if (!(tmp = ast_strdupa(data))) { ast_log(LOG_ERROR, "Out of memory\n"); - ast_module_user_remove(u); return -1; } @@ -1668,8 +1650,6 @@ static int ospnext_exec( res = 0; } - ast_module_user_remove(u); - return res; } @@ -1684,7 +1664,6 @@ static int ospfinished_exec( void* data) { int res = 1; - struct ast_module_user* u; int cause = 0; struct varshead* headp; struct ast_var_t* current; @@ -1702,11 +1681,8 @@ static int ospfinished_exec( AST_APP_ARG(options); ); - u = ast_module_user_add(chan); - if (!(tmp = ast_strdupa(data))) { ast_log(LOG_ERROR, "Out of memory\n"); - ast_module_user_remove(u); return -1; } @@ -1792,8 +1768,6 @@ static int ospfinished_exec( res = 0; } - ast_module_user_remove(u); - return res; } diff --git a/apps/app_page.c b/apps/app_page.c index 8ee48bd29..8edb15833 100644 --- a/apps/app_page.c +++ b/apps/app_page.c @@ -85,7 +85,6 @@ AST_APP_OPTIONS(page_opts, { static int page_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; char *options, *tech, *resource, *tmp; char meetmeopts[88], originator[AST_CHANNEL_NAME]; struct ast_flags flags = { 0 }; @@ -99,11 +98,8 @@ static int page_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - if (!(app = pbx_findapp("MeetMe"))) { ast_log(LOG_WARNING, "There is no MeetMe application available!\n"); - ast_module_user_remove(u); return -1; }; @@ -188,8 +184,6 @@ static int page_exec(struct ast_channel *chan, void *data) ast_dial_destroy(dial); } - ast_module_user_remove(u); - return -1; } diff --git a/apps/app_parkandannounce.c b/apps/app_parkandannounce.c index fe63da9e1..138694c5a 100644 --- a/apps/app_parkandannounce.c +++ b/apps/app_parkandannounce.c @@ -90,21 +90,16 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data) struct outgoing_helper oh; int outstate; - struct ast_module_user *u; - if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "ParkAndAnnounce requires arguments: (announce:template|timeout|dial|[return_context])\n"); return -1; } - u = ast_module_user_add(chan); - s = ast_strdupa(data); template=strsep(&s,"|"); if(! template) { ast_log(LOG_WARNING, "PARK: An announce template must be defined\n"); - ast_module_user_remove(u); return -1; } @@ -115,7 +110,6 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data) dial=strsep(&s, "|"); if(!dial) { ast_log(LOG_WARNING, "PARK: A dial resource must be specified i.e: Console/dsp or Zap/g1/5551212\n"); - ast_module_user_remove(u); return -1; } else { dialtech=strsep(&dial, "/"); @@ -147,7 +141,6 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data) } if(atoi(priority) < 0) { ast_log(LOG_WARNING, "Priority '%s' must be a number > 0\n", priority); - ast_module_user_remove(u); return -1; } /* At this point we have a priority and maybe an extension and a context */ @@ -193,12 +186,10 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data) ast_verbose(VERBOSE_PREFIX_4 "Channel %s was never answered.\n", dchan->name); ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name); ast_hangup(dchan); - ast_module_user_remove(u); return -1; } } else { ast_log(LOG_WARNING, "PARK: Unable to allocate announce channel.\n"); - ast_module_user_remove(u); return -1; } @@ -235,8 +226,6 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data) ast_stopstream(dchan); ast_hangup(dchan); - ast_module_user_remove(u); - return res; } diff --git a/apps/app_playback.c b/apps/app_playback.c index 345f07ece..a3ff14cde 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -377,7 +377,6 @@ static int playback_exec(struct ast_channel *chan, void *data) { int res = 0; int mres = 0; - struct ast_module_user *u; char *tmp; int option_skip=0; int option_say=0; @@ -394,8 +393,6 @@ static int playback_exec(struct ast_channel *chan, void *data) } tmp = ast_strdupa(data); - - u = ast_module_user_add(chan); AST_STANDARD_APP_ARGS(args, tmp); if (args.options) { @@ -436,7 +433,6 @@ static int playback_exec(struct ast_channel *chan, void *data) } done: pbx_builtin_setvar_helper(chan, "PLAYBACKSTATUS", mres ? "FAILED" : "SUCCESS"); - ast_module_user_remove(u); return res; } diff --git a/apps/app_privacy.c b/apps/app_privacy.c index 000c9ef2a..830195d2b 100644 --- a/apps/app_privacy.c +++ b/apps/app_privacy.c @@ -81,7 +81,6 @@ static int privacy_exec (struct ast_channel *chan, void *data) int x = 0; const char *s; char phone[30]; - struct ast_module_user *u; struct ast_config *cfg = NULL; char *parse = NULL; AST_DECLARE_APP_ARGS(args, @@ -90,19 +89,14 @@ static int privacy_exec (struct ast_channel *chan, void *data) AST_APP_ARG(options); ); - u = ast_module_user_add(chan); - if (!ast_strlen_zero(chan->cid.cid_num)) { if (option_verbose > 2) ast_verbose (VERBOSE_PREFIX_3 "CallerID Present: Skipping\n"); } else { /*Answer the channel if it is not already*/ if (chan->_state != AST_STATE_UP) { - res = ast_answer(chan); - if (res) { - ast_module_user_remove(u); + if ((res = ast_answer(chan))) return -1; - } } if (!ast_strlen_zero(data)) { @@ -199,8 +193,6 @@ static int privacy_exec (struct ast_channel *chan, void *data) ast_config_destroy(cfg); } - ast_module_user_remove(u); - return 0; } diff --git a/apps/app_queue.c b/apps/app_queue.c index 1d30086da..8b2ddae2b 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3213,7 +3213,6 @@ static void reload_queue_members(void) static int pqm_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *lu; char *parse; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(queuename); @@ -3230,25 +3229,17 @@ static int pqm_exec(struct ast_channel *chan, void *data) AST_STANDARD_APP_ARGS(args, parse); - lu = ast_module_user_add(chan); - - if (args.options) { - } - if (ast_strlen_zero(args.interface)) { ast_log(LOG_WARNING, "Missing interface argument to PauseQueueMember ([queuename]|interface[|options])\n"); - ast_module_user_remove(lu); return -1; } if (set_member_paused(args.queuename, args.interface, 1)) { ast_log(LOG_WARNING, "Attempt to pause interface %s, not found\n", args.interface); - ast_module_user_remove(lu); pbx_builtin_setvar_helper(chan, "PQMSTATUS", "NOTFOUND"); return -1; } - ast_module_user_remove(lu); pbx_builtin_setvar_helper(chan, "PQMSTATUS", "PAUSED"); return 0; @@ -3256,7 +3247,6 @@ static int pqm_exec(struct ast_channel *chan, void *data) static int upqm_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *lu; char *parse; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(queuename); @@ -3273,25 +3263,17 @@ static int upqm_exec(struct ast_channel *chan, void *data) AST_STANDARD_APP_ARGS(args, parse); - lu = ast_module_user_add(chan); - - if (args.options) { - } - if (ast_strlen_zero(args.interface)) { ast_log(LOG_WARNING, "Missing interface argument to PauseQueueMember ([queuename]|interface[|options])\n"); - ast_module_user_remove(lu); return -1; } if (set_member_paused(args.queuename, args.interface, 0)) { ast_log(LOG_WARNING, "Attempt to unpause interface %s, not found\n", args.interface); - ast_module_user_remove(lu); pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "NOTFOUND"); return -1; } - ast_module_user_remove(lu); pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "UNPAUSED"); return 0; @@ -3300,7 +3282,6 @@ static int upqm_exec(struct ast_channel *chan, void *data) static int rqm_exec(struct ast_channel *chan, void *data) { int res=-1; - struct ast_module_user *lu; char *parse, *temppos = NULL; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(queuename); @@ -3318,8 +3299,6 @@ static int rqm_exec(struct ast_channel *chan, void *data) AST_STANDARD_APP_ARGS(args, parse); - lu = ast_module_user_add(chan); - if (ast_strlen_zero(args.interface)) { args.interface = ast_strdupa(chan->name); temppos = strrchr(args.interface, '-'); @@ -3327,9 +3306,6 @@ static int rqm_exec(struct ast_channel *chan, void *data) *temppos = '\0'; } - if (args.options) { - } - switch (remove_from_queue(args.queuename, args.interface)) { case RES_OKAY: ast_queue_log(args.queuename, chan->uniqueid, args.interface, "REMOVEMEMBER", "%s", ""); @@ -3349,15 +3325,12 @@ static int rqm_exec(struct ast_channel *chan, void *data) break; } - ast_module_user_remove(lu); - return res; } static int aqm_exec(struct ast_channel *chan, void *data) { int res=-1; - struct ast_module_user *lu; char *parse, *temppos = NULL; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(queuename); @@ -3377,8 +3350,6 @@ static int aqm_exec(struct ast_channel *chan, void *data) AST_STANDARD_APP_ARGS(args, parse); - lu = ast_module_user_add(chan); - if (ast_strlen_zero(args.interface)) { args.interface = ast_strdupa(chan->name); temppos = strrchr(args.interface, '-'); @@ -3392,9 +3363,6 @@ static int aqm_exec(struct ast_channel *chan, void *data) penalty = 0; } } - - if (args.options) { - } if (ast_strlen_zero(args.membername)) args.membername = args.interface; @@ -3422,14 +3390,11 @@ static int aqm_exec(struct ast_channel *chan, void *data) break; } - ast_module_user_remove(lu); - return res; } static int ql_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; char *parse; AST_DECLARE_APP_ARGS(args, @@ -3445,8 +3410,6 @@ static int ql_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); @@ -3454,15 +3417,12 @@ static int ql_exec(struct ast_channel *chan, void *data) if (ast_strlen_zero(args.queuename) || ast_strlen_zero(args.uniqueid) || ast_strlen_zero(args.membername) || ast_strlen_zero(args.event)) { ast_log(LOG_WARNING, "QueueLog requires arguments (queuename|uniqueid|membername|event[|additionalinfo])\n"); - ast_module_user_remove(u); return -1; } ast_queue_log(args.queuename, args.uniqueid, args.membername, args.event, "%s", args.params ? args.params : ""); - ast_module_user_remove(u); - return 0; } @@ -3470,7 +3430,6 @@ static int queue_exec(struct ast_channel *chan, void *data) { int res=-1; int ringing=0; - struct ast_module_user *lu; const char *user_priority; const char *max_penalty_str; int prio; @@ -3501,8 +3460,6 @@ static int queue_exec(struct ast_channel *chan, void *data) parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); - lu = ast_module_user_add(chan); - /* Setup our queue entry */ memset(&qe, 0, sizeof(qe)); qe.start = time(NULL); @@ -3745,7 +3702,6 @@ check_turns: set_queue_result(chan, reason); res = 0; } - ast_module_user_remove(lu); return res; } @@ -3754,7 +3710,6 @@ static int queue_function_var(struct ast_channel *chan, const char *cmd, char *d { int res = -1; struct call_queue *q; - struct ast_module_user *lu; char interfacevar[256]=""; float sl = 0; @@ -3765,8 +3720,6 @@ static int queue_function_var(struct ast_channel *chan, const char *cmd, char *d ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd); return -1; } - - lu = ast_module_user_add(chan); AST_LIST_LOCK(&queues); AST_LIST_TRAVERSE(&queues, q, list) { @@ -3797,7 +3750,6 @@ static int queue_function_var(struct ast_channel *chan, const char *cmd, char *d ast_log(LOG_WARNING, "queue %s was not found\n", data); snprintf(buf, len, "%d", res); - ast_module_user_remove(lu); return 0; } @@ -3806,7 +3758,6 @@ static int queue_function_qac(struct ast_channel *chan, const char *cmd, char *d { int count = 0; struct call_queue *q; - struct ast_module_user *lu; struct member *m; buf[0] = '\0'; @@ -3815,8 +3766,6 @@ static int queue_function_qac(struct ast_channel *chan, const char *cmd, char *d ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd); return -1; } - - lu = ast_module_user_add(chan); AST_LIST_LOCK(&queues); AST_LIST_TRAVERSE(&queues, q, list) { @@ -3839,7 +3788,6 @@ static int queue_function_qac(struct ast_channel *chan, const char *cmd, char *d ast_log(LOG_WARNING, "queue %s was not found\n", data); snprintf(buf, len, "%d", count); - ast_module_user_remove(lu); return 0; } @@ -3848,7 +3796,6 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, const char { int count = 0; struct call_queue *q; - struct ast_module_user *lu; buf[0] = '\0'; @@ -3856,8 +3803,6 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, const char ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd); return -1; } - - lu = ast_module_user_add(chan); AST_LIST_LOCK(&queues); AST_LIST_TRAVERSE(&queues, q, list) { @@ -3875,13 +3820,12 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, const char ast_log(LOG_WARNING, "queue %s was not found\n", data); snprintf(buf, len, "%d", count); - ast_module_user_remove(lu); + return 0; } static int queue_function_queuememberlist(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) { - struct ast_module_user *u; struct call_queue *q; struct member *m; @@ -3892,8 +3836,6 @@ static int queue_function_queuememberlist(struct ast_channel *chan, const char * ast_log(LOG_ERROR, "QUEUE_MEMBER_LIST requires an argument: queuename\n"); return -1; } - - u = ast_module_user_add(chan); AST_LIST_LOCK(&queues); AST_LIST_TRAVERSE(&queues, q, list) { @@ -3927,7 +3869,6 @@ static int queue_function_queuememberlist(struct ast_channel *chan, const char * /* We should already be terminated, but let's make sure. */ buf[len - 1] = '\0'; - ast_module_user_remove(u); return 0; } diff --git a/apps/app_read.c b/apps/app_read.c index b2354bb33..e6c364873 100644 --- a/apps/app_read.c +++ b/apps/app_read.c @@ -87,7 +87,6 @@ static char *descrip = static int read_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; char tmp[256] = ""; int maxdigits = 255; int tries = 1, to = 0, x = 0; @@ -109,8 +108,6 @@ static int read_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "Read requires an argument (variable)\n"); return -1; } - - u = ast_module_user_add(chan); argcopy = ast_strdupa(data); @@ -146,7 +143,6 @@ static int read_exec(struct ast_channel *chan, void *data) } if (ast_strlen_zero(arglist.variable)) { ast_log(LOG_WARNING, "Invalid! Usage: Read(variable[|filename][|maxdigits][|option][|attempts][|timeout])\n\n"); - ast_module_user_remove(u); return -1; } ts=NULL; @@ -159,7 +155,6 @@ static int read_exec(struct ast_channel *chan, void *data) if (ast_test_flag(&flags,OPT_SKIP)) { /* At the user's option, skip if the line is not up */ pbx_builtin_setvar_helper(chan, arglist.variable, "\0"); - ast_module_user_remove(u); return 0; } else if (!ast_test_flag(&flags,OPT_NOANSWER)) { /* Otherwise answer unless we're supposed to read while on-hook */ @@ -212,7 +207,7 @@ static int read_exec(struct ast_channel *chan, void *data) } } } - ast_module_user_remove(u); + return res; } diff --git a/apps/app_readfile.c b/apps/app_readfile.c index be25aac92..e857f8318 100644 --- a/apps/app_readfile.c +++ b/apps/app_readfile.c @@ -56,7 +56,6 @@ static char *readfile_descrip = static int readfile_exec(struct ast_channel *chan, void *data) { int res=0; - struct ast_module_user *u; char *s, *varname=NULL, *file=NULL, *length=NULL, *returnvar=NULL; int len=0; @@ -65,8 +64,6 @@ static int readfile_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - s = ast_strdupa(data); varname = strsep(&s, "="); @@ -75,7 +72,6 @@ static int readfile_exec(struct ast_channel *chan, void *data) if (!varname || !file) { ast_log(LOG_ERROR, "No file or variable specified!\n"); - ast_module_user_remove(u); return -1; } @@ -96,7 +92,7 @@ static int readfile_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, varname, returnvar); ast_free(returnvar); } - ast_module_user_remove(u); + return res; } diff --git a/apps/app_record.c b/apps/app_record.c index 8475791e3..0bbe0b008 100644 --- a/apps/app_record.c +++ b/apps/app_record.c @@ -87,7 +87,6 @@ static int record_exec(struct ast_channel *chan, void *data) char tmp[256]; struct ast_filestream *s = '\0'; - struct ast_module_user *u; struct ast_frame *f = NULL; struct ast_dsp *sildet = NULL; /* silence detector dsp */ @@ -113,8 +112,6 @@ static int record_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - /* Yay for strsep being easy */ vdata = ast_strdupa(data); @@ -137,7 +134,6 @@ static int record_exec(struct ast_channel *chan, void *data) } if (!ext) { ast_log(LOG_WARNING, "No extension specified to filename!\n"); - ast_module_user_remove(u); return -1; } if (silstr) { @@ -222,7 +218,6 @@ static int record_exec(struct ast_channel *chan, void *data) if (chan->_state != AST_STATE_UP) { if (option_skip) { /* At the user's option, skip if the line is not up */ - ast_module_user_remove(u); return 0; } else if (!option_noanswer) { /* Otherwise answer unless we're supposed to record while on-hook */ @@ -253,13 +248,11 @@ static int record_exec(struct ast_channel *chan, void *data) res = ast_set_read_format(chan, AST_FORMAT_SLINEAR); if (res < 0) { ast_log(LOG_WARNING, "Unable to set to linear mode, giving up\n"); - ast_module_user_remove(u); return -1; } sildet = ast_dsp_new(); if (!sildet) { ast_log(LOG_WARNING, "Unable to create silence detector :(\n"); - ast_module_user_remove(u); return -1; } ast_dsp_set_threshold(sildet, 256); @@ -368,8 +361,6 @@ static int record_exec(struct ast_channel *chan, void *data) ast_dsp_free(sildet); } - ast_module_user_remove(u); - return res; } diff --git a/apps/app_rpt.c b/apps/app_rpt.c index d67b5eef3..70badd255 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -6806,7 +6806,6 @@ static void *rpt_master(void *config) static int rpt_exec(struct ast_channel *chan, void *data) { int res = -1, i, rem_totx, n, phone_mode = 0; - struct ast_module_user *u; char *tmp, keyed = 0; char *options, *tele, c; struct rpt *myrpt; @@ -7089,7 +7088,6 @@ static int rpt_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "Cant get io permission on IO port %x hex\n", myrpt->p.iobase); return -1; } - u = ast_module_user_add(chan); rpt_mutex_unlock(&myrpt->lock); /* find our index, and load the vars initially */ for (i = 0; i < nrpts; i++) { @@ -7429,7 +7427,6 @@ static int rpt_exec(struct ast_channel *chan, void *data) myrpt->remoteon = 0; rpt_mutex_unlock(&myrpt->lock); closerem(myrpt); - ast_module_user_remove(u); return res; } diff --git a/apps/app_sayunixtime.c b/apps/app_sayunixtime.c index 0cb2406ae..7d7a74c7f 100644 --- a/apps/app_sayunixtime.c +++ b/apps/app_sayunixtime.c @@ -75,7 +75,6 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data) ); char *parse; int res = 0; - struct ast_module_user *u; time_t unixtime; if (!data) @@ -83,8 +82,6 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data) parse = ast_strdupa(data); - u = ast_module_user_add(chan); - AST_STANDARD_APP_ARGS(args, parse); ast_get_time_t(args.timeval, &unixtime, time(NULL), NULL); @@ -96,8 +93,6 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data) res = ast_say_date_with_format(chan, unixtime, AST_DIGIT_ANY, chan->language, args.format, args.timezone); - ast_module_user_remove(u); - return res; } diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c index 987fac2f9..1389542ee 100644 --- a/apps/app_senddtmf.c +++ b/apps/app_senddtmf.c @@ -59,7 +59,6 @@ static char *descrip = static int senddtmf_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; char *digits = NULL, *to = NULL; int timeout = 250; @@ -68,8 +67,6 @@ static int senddtmf_exec(struct ast_channel *chan, void *data) return 0; } - u = ast_module_user_add(chan); - digits = ast_strdupa(data); if ((to = strchr(digits,'|'))) { @@ -82,8 +79,6 @@ static int senddtmf_exec(struct ast_channel *chan, void *data) timeout = 250; res = ast_dtmf_stream(chan,NULL,digits,timeout); - - ast_module_user_remove(u); return res; } diff --git a/apps/app_sendtext.c b/apps/app_sendtext.c index bb3ca180d..7577a8f46 100644 --- a/apps/app_sendtext.c +++ b/apps/app_sendtext.c @@ -63,19 +63,15 @@ static const char *descrip = static int sendtext_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; char *status = "UNSUPPORTED"; char *parse = NULL; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(text); AST_APP_ARG(options); ); - - u = ast_module_user_add(chan); if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "SendText requires an argument (text[|options])\n"); - ast_module_user_remove(u); return -1; } else parse = ast_strdupa(data); @@ -89,7 +85,6 @@ static int sendtext_exec(struct ast_channel *chan, void *data) if (!chan->tech->send_text) { ast_channel_unlock(chan); /* Does not support transport */ - ast_module_user_remove(u); return 0; } status = "FAILURE"; @@ -98,7 +93,6 @@ static int sendtext_exec(struct ast_channel *chan, void *data) if (!res) status = "SUCCESS"; pbx_builtin_setvar_helper(chan, "SENDTEXTSTATUS", status); - ast_module_user_remove(u); return 0; } diff --git a/apps/app_setcallerid.c b/apps/app_setcallerid.c index daf97c728..6a236a0cd 100644 --- a/apps/app_setcallerid.c +++ b/apps/app_setcallerid.c @@ -66,12 +66,9 @@ static char *descrip2 = static int setcallerid_pres_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; int pres = -1; static int deprecated = 0; - u = ast_module_user_add(chan); - if (!deprecated) { deprecated = 1; ast_log(LOG_WARNING, "SetCallerPres is deprecated. Please use Set(CALLERPRES()=%s) instead.\n", (char *)data); @@ -81,12 +78,10 @@ static int setcallerid_pres_exec(struct ast_channel *chan, void *data) if (pres < 0) { ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show application SetCallerPres')\n", (char *) data); - ast_module_user_remove(u); return 0; } chan->cid.cid_pres = pres; - ast_module_user_remove(u); return 0; } diff --git a/apps/app_skel.c b/apps/app_skel.c index 05897a264..9cd759c69 100644 --- a/apps/app_skel.c +++ b/apps/app_skel.c @@ -77,7 +77,6 @@ static int app_exec(struct ast_channel *chan, void *data) { int res = 0; struct ast_flags flags; - struct ast_module_user *u; char *parse, *opts[OPTION_ARG_ARRAY_SIZE]; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(dummy); @@ -89,8 +88,6 @@ static int app_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - /* Do our thing here */ /* We need to make a copy of the input string if we are going to modify it! */ @@ -113,8 +110,6 @@ static int app_exec(struct ast_channel *chan, void *data) if (ast_test_flag(&flags, OPTION_C)) ast_log(LOG_NOTICE, "Option C is set with : %s\n", opts[OPTION_ARG_C] ? opts[OPTION_ARG_C] : ""); - ast_module_user_remove(u); - return res; } diff --git a/apps/app_sms.c b/apps/app_sms.c index 710ba82c5..5575945eb 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -1748,7 +1748,6 @@ AST_APP_OPTIONS(sms_options, { static int sms_exec(struct ast_channel *chan, void *data) { int res = -1; - struct ast_module_user *u; sms_t h = { 0 }; /* argument parsing support */ struct ast_flags sms_flags; @@ -1777,7 +1776,6 @@ static int sms_exec(struct ast_channel *chan, void *data) S_OR(sms_args.addr, ""), S_OR(sms_args.body, "") ); - u = ast_module_user_add(chan); h.ipc0 = h.ipc1 = 20; /* phase for cosine */ h.dcs = 0xF1; /* default */ @@ -1923,7 +1921,6 @@ static int sms_exec(struct ast_channel *chan, void *data) sms_log(&h, '?'); /* log incomplete message */ done: - ast_module_user_remove(u); return (res); } diff --git a/apps/app_softhangup.c b/apps/app_softhangup.c index a011c3225..42f48aac7 100644 --- a/apps/app_softhangup.c +++ b/apps/app_softhangup.c @@ -55,7 +55,6 @@ static char *app = "SoftHangup"; static int softhangup_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; struct ast_channel *c=NULL; char *options, *cut, *cdata, *match; char name[AST_CHANNEL_NAME] = ""; @@ -66,8 +65,6 @@ static int softhangup_exec(struct ast_channel *chan, void *data) return 0; } - u = ast_module_user_add(chan); - cdata = ast_strdupa(data); match = strsep(&cdata, "|"); options = strsep(&cdata, "|"); @@ -96,8 +93,6 @@ static int softhangup_exec(struct ast_channel *chan, void *data) } c = ast_channel_walk_locked(c); } - - ast_module_user_remove(u); return 0; } diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c index b8dd634fd..fe77b7f52 100644 --- a/apps/app_speech_utils.c +++ b/apps/app_speech_utils.c @@ -342,18 +342,14 @@ static struct ast_custom_function speech_function = { /*! \brief SpeechCreate() Dialplan Application */ static int speech_create(struct ast_channel *chan, void *data) { - struct ast_module_user *u = NULL; struct ast_speech *speech = NULL; struct ast_datastore *datastore = NULL; - u = ast_module_user_add(chan); - /* Request a speech object */ speech = ast_speech_new(data, chan->nativeformats); if (speech == NULL) { /* Not available */ pbx_builtin_setvar_helper(chan, "ERROR", "1"); - ast_module_user_remove(u); return 0; } @@ -361,14 +357,11 @@ static int speech_create(struct ast_channel *chan, void *data) if (datastore == NULL) { ast_speech_destroy(speech); pbx_builtin_setvar_helper(chan, "ERROR", "1"); - ast_module_user_remove(u); return 0; } datastore->data = speech; ast_channel_datastore_add(chan, datastore); - ast_module_user_remove(u); - return 0; } @@ -376,33 +369,24 @@ static int speech_create(struct ast_channel *chan, void *data) static int speech_load(struct ast_channel *chan, void *data) { int res = 0, argc = 0; - struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); char *argv[2], *args = NULL, *name = NULL, *path = NULL; args = ast_strdupa(data); - u = ast_module_user_add(chan); - - if (speech == NULL) { - ast_module_user_remove(u); + if (speech == NULL) return -1; - } /* Parse out arguments */ argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])); - if (argc != 2) { - ast_module_user_remove(u); + if (argc != 2) return -1; - } name = argv[0]; path = argv[1]; /* Load the grammar locally on the object */ res = ast_speech_grammar_load(speech, name, path); - ast_module_user_remove(u); - return res; } @@ -410,21 +394,14 @@ static int speech_load(struct ast_channel *chan, void *data) static int speech_unload(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); - u = ast_module_user_add(chan); - - if (speech == NULL) { - ast_module_user_remove(u); - return -1; - } + if (speech == NULL) + return -1; /* Unload the grammar */ res = ast_speech_grammar_unload(speech, data); - ast_module_user_remove(u); - return res; } @@ -432,21 +409,14 @@ static int speech_unload(struct ast_channel *chan, void *data) static int speech_deactivate(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); - u = ast_module_user_add(chan); - - if (speech == NULL) { - ast_module_user_remove(u); + if (speech == NULL) return -1; - } /* Deactivate the grammar on the speech object */ res = ast_speech_grammar_deactivate(speech, data); - ast_module_user_remove(u); - return res; } @@ -454,21 +424,14 @@ static int speech_deactivate(struct ast_channel *chan, void *data) static int speech_activate(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); - u = ast_module_user_add(chan); - - if (speech == NULL) { - ast_module_user_remove(u); + if (speech == NULL) return -1; - } /* Activate the grammar on the speech object */ res = ast_speech_grammar_activate(speech, data); - ast_module_user_remove(u); - return res; } @@ -476,20 +439,13 @@ static int speech_activate(struct ast_channel *chan, void *data) static int speech_start(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); - u = ast_module_user_add(chan); - - if (speech == NULL) { - ast_module_user_remove(u); + if (speech == NULL) return -1; - } ast_speech_start(speech); - ast_module_user_remove(u); - return res; } @@ -497,15 +453,10 @@ static int speech_start(struct ast_channel *chan, void *data) static int speech_processing_sound(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); - u = ast_module_user_add(chan); - - if (speech == NULL) { - ast_module_user_remove(u); + if (speech == NULL) return -1; - } if (speech->processing_sound != NULL) { ast_free(speech->processing_sound); @@ -514,8 +465,6 @@ static int speech_processing_sound(struct ast_channel *chan, void *data) speech->processing_sound = ast_strdup(data); - ast_module_user_remove(u); - return res; } @@ -540,7 +489,6 @@ static int speech_background(struct ast_channel *chan, void *data) { unsigned int timeout = 0; int res = 0, done = 0, argc = 0, started = 0, quieted = 0, max_dtmf_len = 0; - struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); struct ast_frame *f = NULL; int oldreadformat = AST_FORMAT_SLINEAR; @@ -552,27 +500,19 @@ static int speech_background(struct ast_channel *chan, void *data) args = ast_strdupa(data); - u = ast_module_user_add(chan); - - if (speech == NULL) { - ast_module_user_remove(u); + if (speech == NULL) return -1; - } /* If channel is not already answered, then answer it */ - if (chan->_state != AST_STATE_UP && ast_answer(chan)) { - ast_module_user_remove(u); + if (chan->_state != AST_STATE_UP && ast_answer(chan)) return -1; - } /* Record old read format */ oldreadformat = chan->readformat; /* Change read format to be signed linear */ - if (ast_set_read_format(chan, speech->format)) { - ast_module_user_remove(u); + if (ast_set_read_format(chan, speech->format)) return -1; - } /* Parse out options */ argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])); @@ -769,8 +709,6 @@ static int speech_background(struct ast_channel *chan, void *data) ast_set_read_format(chan, oldreadformat); } - ast_module_user_remove(u); - return 0; } @@ -779,16 +717,11 @@ static int speech_background(struct ast_channel *chan, void *data) static int speech_destroy(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); struct ast_datastore *datastore = NULL; - u = ast_module_user_add(chan); - - if (speech == NULL) { - ast_module_user_remove(u); + if (speech == NULL) return -1; - } /* Destroy speech structure */ ast_speech_destroy(speech); @@ -798,8 +731,6 @@ static int speech_destroy(struct ast_channel *chan, void *data) ast_channel_datastore_remove(chan, datastore); } - ast_module_user_remove(u); - return res; } diff --git a/apps/app_stack.c b/apps/app_stack.c index 4e4d78aec..2b8a67a80 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -238,7 +238,6 @@ static int gosub_exec(struct ast_channel *chan, void *data) struct gosub_stack_frame *newframe; char argname[15], *tmp = ast_strdupa(data), *label, *endparen; int i; - struct ast_module_user *u; AST_DECLARE_APP_ARGS(args2, AST_APP_ARG(argval)[100]; ); @@ -248,14 +247,11 @@ static int gosub_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - if (!stack_store) { ast_debug(1, "Channel %s has no datastore, so we're allocating one.\n", chan->name); stack_store = ast_channel_datastore_alloc(&stack_info, NULL); if (!stack_store) { ast_log(LOG_ERROR, "Unable to allocate new datastore. Gosub will fail.\n"); - ast_module_user_remove(u); return -1; } @@ -263,7 +259,6 @@ static int gosub_exec(struct ast_channel *chan, void *data) if (!oldlist) { ast_log(LOG_ERROR, "Unable to allocate datastore list head. Gosub will fail.\n"); ast_channel_datastore_free(stack_store); - ast_module_user_remove(u); return -1; } @@ -294,7 +289,6 @@ static int gosub_exec(struct ast_channel *chan, void *data) if (ast_parseable_goto(chan, label)) { ast_log(LOG_ERROR, "Gosub address is invalid: '%s'\n", (char *)data); ast_free(newframe); - ast_module_user_remove(u); return -1; } @@ -311,14 +305,11 @@ static int gosub_exec(struct ast_channel *chan, void *data) AST_LIST_INSERT_HEAD(oldlist, newframe, entries); AST_LIST_UNLOCK(oldlist); - ast_module_user_remove(u); - return 0; } static int gosubif_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; char *args; int res=0; AST_DECLARE_APP_ARGS(cond, @@ -335,13 +326,10 @@ static int gosubif_exec(struct ast_channel *chan, void *data) return 0; } - u = ast_module_user_add(chan); - args = ast_strdupa(data); AST_NONSTANDARD_APP_ARGS(cond, args, '?'); if (cond.argc != 2) { ast_log(LOG_WARNING, "GosubIf requires an argument: GosubIf(cond?label1(args):label2(args)\n"); - ast_module_user_remove(u); return 0; } @@ -354,7 +342,6 @@ static int gosubif_exec(struct ast_channel *chan, void *data) res = gosub_exec(chan, label.iffalse); } - ast_module_user_remove(u); return res; } diff --git a/apps/app_system.c b/apps/app_system.c index 57870de3c..b840028a9 100644 --- a/apps/app_system.c +++ b/apps/app_system.c @@ -71,8 +71,7 @@ static char *descrip2 = static int system_exec_helper(struct ast_channel *chan, void *data, int failmode) { - int res=0; - struct ast_module_user *u; + int res = 0; if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "System requires an argument(command)\n"); @@ -80,8 +79,6 @@ static int system_exec_helper(struct ast_channel *chan, void *data, int failmode return failmode; } - u = ast_module_user_add(chan); - /* Do our thing here */ res = ast_safe_system((char *)data); if ((res < 0) && (errno != ECHILD)) { @@ -102,8 +99,6 @@ static int system_exec_helper(struct ast_channel *chan, void *data, int failmode res = 0; } - ast_module_user_remove(u); - return res; } diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c index 6cd8572bb..9e4d2a4ee 100644 --- a/apps/app_talkdetect.c +++ b/apps/app_talkdetect.c @@ -63,7 +63,6 @@ static char *descrip = static int background_detect_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; char *tmp; char *options; char *stringp; @@ -82,8 +81,6 @@ static int background_detect_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - tmp = ast_strdupa(data); stringp=tmp; @@ -205,7 +202,6 @@ static int background_detect_exec(struct ast_channel *chan, void *data) } if (dsp) ast_dsp_free(dsp); - ast_module_user_remove(u); return res; } diff --git a/apps/app_test.c b/apps/app_test.c index 4ffd6a7ad..df221f326 100644 --- a/apps/app_test.c +++ b/apps/app_test.c @@ -129,7 +129,6 @@ static int sendnoise(struct ast_channel *chan, int ms) static int testclient_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; int res = 0; char *testid=data; char fn[80]; @@ -142,8 +141,6 @@ static int testclient_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - if (chan->_state != AST_STATE_UP) res = ast_answer(chan); @@ -298,18 +295,15 @@ static int testclient_exec(struct ast_channel *chan, void *data) ast_log(LOG_NOTICE, "Did not read a test ID on '%s'\n", chan->name); res = -1; } - ast_module_user_remove(u); return res; } static int testserver_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; int res = 0; char testid[80]=""; char fn[80]; FILE *f; - u = ast_module_user_add(chan); if (chan->_state != AST_STATE_UP) res = ast_answer(chan); /* Read version */ @@ -454,7 +448,6 @@ static int testserver_exec(struct ast_channel *chan, void *data) ast_log(LOG_NOTICE, "Did not read a test ID on '%s'\n", chan->name); res = -1; } - ast_module_user_remove(u); return res; } diff --git a/apps/app_transfer.c b/apps/app_transfer.c index 76655cede..97acc36fd 100644 --- a/apps/app_transfer.c +++ b/apps/app_transfer.c @@ -66,7 +66,6 @@ static int transfer_exec(struct ast_channel *chan, void *data) { int res; int len; - struct ast_module_user *u; char *slash; char *tech = NULL; char *dest = NULL; @@ -77,11 +76,8 @@ static int transfer_exec(struct ast_channel *chan, void *data) AST_APP_ARG(options); ); - u = ast_module_user_add(chan); - if (ast_strlen_zero((char *)data)) { ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination[|options])\n"); - ast_module_user_remove(u); pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); return 0; } else @@ -100,7 +96,6 @@ static int transfer_exec(struct ast_channel *chan, void *data) /* Allow execution only if the Tech/destination agrees with the type of the channel */ if (strncasecmp(chan->tech->type, tech, len)) { pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); - ast_module_user_remove(u); return 0; } } @@ -108,7 +103,6 @@ static int transfer_exec(struct ast_channel *chan, void *data) /* Check if the channel supports transfer before we try it */ if (!chan->tech->transfer) { pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "UNSUPPORTED"); - ast_module_user_remove(u); return 0; } @@ -124,8 +118,6 @@ static int transfer_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", status); - ast_module_user_remove(u); - return res; } diff --git a/apps/app_url.c b/apps/app_url.c index f24d5492a..46db0d37e 100644 --- a/apps/app_url.c +++ b/apps/app_url.c @@ -66,7 +66,6 @@ static char *descrip = static int sendurl_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; char *tmp; char *options; int local_option_wait=0; @@ -80,8 +79,6 @@ static int sendurl_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - tmp = ast_strdupa(data); stringp=tmp; @@ -93,13 +90,11 @@ static int sendurl_exec(struct ast_channel *chan, void *data) if (!ast_channel_supports_html(chan)) { /* Does not support transport */ pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", "UNSUPPORTED"); - ast_module_user_remove(u); return 0; } res = ast_channel_sendurl(chan, tmp); if (res == -1) { pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", "FAILURE"); - ast_module_user_remove(u); return res; } status = "SUCCESS"; @@ -139,7 +134,6 @@ static int sendurl_exec(struct ast_channel *chan, void *data) } out: pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", status); - ast_module_user_remove(u); return res; } diff --git a/apps/app_userevent.c b/apps/app_userevent.c index 64c0d9ae9..4e0e65bfe 100644 --- a/apps/app_userevent.c +++ b/apps/app_userevent.c @@ -57,7 +57,6 @@ static char *descrip = static int userevent_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; char *parse, buf[2048] = ""; int x, buflen = 0; AST_DECLARE_APP_ARGS(args, @@ -70,8 +69,6 @@ static int userevent_exec(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); @@ -85,8 +82,6 @@ static int userevent_exec(struct ast_channel *chan, void *data) manager_event(EVENT_FLAG_USER, "UserEvent", "UserEvent: %s\r\n%s", args.eventname, buf); - ast_module_user_remove(u); - return 0; } diff --git a/apps/app_verbose.c b/apps/app_verbose.c index c94ba290e..130bfa28c 100644 --- a/apps/app_verbose.c +++ b/apps/app_verbose.c @@ -56,9 +56,6 @@ static int verbose_exec(struct ast_channel *chan, void *data) { char *vtext; int vsize; - struct ast_module_user *u; - - u = ast_module_user_add(chan); if (data) { char *tmp; @@ -93,23 +90,17 @@ static int verbose_exec(struct ast_channel *chan, void *data) } } - ast_module_user_remove(u); - return 0; } static int log_exec(struct ast_channel *chan, void *data) { char *level, *ltext; - struct ast_module_user *u; int lnum = -1; char extension[AST_MAX_EXTENSION + 5], context[AST_MAX_EXTENSION + 2]; - u = ast_module_user_add(chan); - if (ast_strlen_zero(data)) { - ast_module_user_remove(u); + if (ast_strlen_zero(data)) return 0; - } ltext = ast_strdupa(data); @@ -139,7 +130,7 @@ static int log_exec(struct ast_channel *chan, void *data) ast_log(lnum, extension, chan->priority, context, "%s\n", ltext); } - ast_module_user_remove(u); + return 0; } diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 1277cc317..b700e76b2 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -6727,7 +6727,6 @@ static int vm_execmain(struct ast_channel *chan, void *data) int res=-1; int cmd=0; int valid = 0; - struct ast_module_user *u; char prefixstr[80] =""; char ext_context[256]=""; int box; @@ -6744,7 +6743,6 @@ static int vm_execmain(struct ast_channel *chan, void *data) #ifdef IMAP_STORAGE int deleted = 0; #endif - u = ast_module_user_add(chan); /* Add the vm_state to the active list and keep it active */ memset(&vms, 0, sizeof(vms)); @@ -6770,16 +6768,13 @@ static int vm_execmain(struct ast_channel *chan, void *data) AST_STANDARD_APP_ARGS(args, parse); if (args.argc == 2) { - if (ast_app_parse_options(vm_app_options, &flags, opts, args.argv1)) { - ast_module_user_remove(u); + if (ast_app_parse_options(vm_app_options, &flags, opts, args.argv1)) return -1; - } if (ast_test_flag(&flags, OPT_RECORDGAIN)) { int gain; if (!ast_strlen_zero(opts[OPT_ARG_RECORDGAIN])) { if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) { ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]); - ast_module_user_remove(u); return -1; } else { record_gain = (signed char) gain; @@ -7269,7 +7264,6 @@ out: free(vms.deleted); if (vms.heard) free(vms.heard); - ast_module_user_remove(u); return res; } @@ -7277,7 +7271,6 @@ out: static int vm_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; char *tmp; struct leave_vm_options leave_options; struct ast_flags flags = { 0 }; @@ -7286,8 +7279,6 @@ static int vm_exec(struct ast_channel *chan, void *data) AST_APP_ARG(argv0); AST_APP_ARG(argv1); ); - - u = ast_module_user_add(chan); memset(&leave_options, 0, sizeof(leave_options)); @@ -7298,17 +7289,14 @@ static int vm_exec(struct ast_channel *chan, void *data) tmp = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, tmp); if (args.argc == 2) { - if (ast_app_parse_options(vm_app_options, &flags, opts, args.argv1)) { - ast_module_user_remove(u); + if (ast_app_parse_options(vm_app_options, &flags, opts, args.argv1)) return -1; - } ast_copy_flags(&leave_options, &flags, OPT_SILENT | OPT_BUSY_GREETING | OPT_UNAVAIL_GREETING); if (ast_test_flag(&flags, OPT_RECORDGAIN)) { int gain; if (sscanf(opts[OPT_ARG_RECORDGAIN], "%d", &gain) != 1) { ast_log(LOG_WARNING, "Invalid value '%s' provided for record gain option\n", opts[OPT_ARG_RECORDGAIN]); - ast_module_user_remove(u); return -1; } else { leave_options.record_gain = (signed char) gain; @@ -7318,14 +7306,10 @@ static int vm_exec(struct ast_channel *chan, void *data) } else { char tmp[256]; res = ast_app_getdata(chan, "vm-whichbox", tmp, sizeof(tmp) - 1, 0); - if (res < 0) { - ast_module_user_remove(u); + if (res < 0) return res; - } - if (ast_strlen_zero(tmp)) { - ast_module_user_remove(u); + if (ast_strlen_zero(tmp)) return 0; - } args.argv0 = ast_strdupa(tmp); } @@ -7336,8 +7320,6 @@ static int vm_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED"); res = 0; } - - ast_module_user_remove(u); return res; } @@ -7409,7 +7391,6 @@ static int append_mailbox(char *context, char *mbox, char *data) static int vm_box_exists(struct ast_channel *chan, void *data) { - struct ast_module_user *u; struct ast_vm_user svm; char *context, *box; AST_DECLARE_APP_ARGS(args, @@ -7423,8 +7404,6 @@ static int vm_box_exists(struct ast_channel *chan, void *data) return -1; } - u = ast_module_user_add(chan); - if (!dep_warning) { dep_warning = 1; ast_log(LOG_WARNING, "MailboxExists is deprecated. Please use ${MAILBOX_EXISTS(%s)} instead.\n", (char *)data); @@ -7446,7 +7425,7 @@ static int vm_box_exists(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, "VMBOXEXISTSSTATUS", "SUCCESS"); } else pbx_builtin_setvar_helper(chan, "VMBOXEXISTSSTATUS", "FAILED"); - ast_module_user_remove(u); + return 0; } @@ -7476,14 +7455,11 @@ static struct ast_custom_function mailbox_exists_acf = { static int vmauthenticate(struct ast_channel *chan, void *data) { - struct ast_module_user *u; char *s = data, *user=NULL, *context=NULL, mailbox[AST_MAX_EXTENSION] = ""; struct ast_vm_user vmus; char *options = NULL; int silent = 0, skipuser = 0; int res = -1; - - u = ast_module_user_add(chan); if (s) { s = ast_strdupa(s); @@ -7510,7 +7486,6 @@ static int vmauthenticate(struct ast_channel *chan, void *data) res = 0; } - ast_module_user_remove(u); return res; } diff --git a/apps/app_waitforring.c b/apps/app_waitforring.c index 50d96f52f..dd1c98047 100644 --- a/apps/app_waitforring.c +++ b/apps/app_waitforring.c @@ -55,7 +55,6 @@ static char *app = "WaitForRing"; static int waitforring_exec(struct ast_channel *chan, void *data) { - struct ast_module_user *u; struct ast_frame *f; int res = 0; double s; @@ -66,8 +65,6 @@ static int waitforring_exec(struct ast_channel *chan, void *data) return 0; } - u = ast_module_user_add(chan); - ms = s*1000.0; while(ms > 0) { ms = ast_waitfor(chan, ms); @@ -113,7 +110,6 @@ static int waitforring_exec(struct ast_channel *chan, void *data) } } } - ast_module_user_remove(u); return res; } diff --git a/apps/app_while.c b/apps/app_while.c index 3733d3bdc..f7da65b19 100644 --- a/apps/app_while.c +++ b/apps/app_while.c @@ -44,9 +44,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/lock.h" #include "asterisk/options.h" -#define ALL_DONE(u,ret) {ast_module_user_remove(u); return ret;} - - static char *start_app = "While"; static char *start_desc = "Usage: While()\n" @@ -164,7 +161,6 @@ static int find_matching_endwhile(struct ast_channel *chan) static int _while_exec(struct ast_channel *chan, void *data, int end) { int res=0; - struct ast_module_user *u; const char *while_pri = NULL; char *my_name = NULL; const char *condition = NULL, *label = NULL; @@ -179,14 +175,11 @@ static int _while_exec(struct ast_channel *chan, void *data, int end) return -1; } - u = ast_module_user_add(chan); - /* dont want run away loops if the chan isn't even up this is up for debate since it slows things down a tad ...... */ if (ast_waitfordigit(chan,1) < 0) - ALL_DONE(u,-1); - + return -1; for (x=0;;x++) { if (get_index(chan, prefix, x)) { @@ -243,7 +236,7 @@ static int _while_exec(struct ast_channel *chan, void *data, int end) ast_log(LOG_WARNING, "Couldn't find matching EndWhile? (While at %s@%s priority %d)\n", chan->context, chan->exten, chan->priority); } } - ALL_DONE(u,res); + return res; } if (!end && !while_pri) { @@ -268,11 +261,8 @@ static int _while_exec(struct ast_channel *chan, void *data, int end) } ast_parseable_goto(chan, while_pri); } - - - - ALL_DONE(u, res); + return res; } static int while_start_exec(struct ast_channel *chan, void *data) { diff --git a/apps/app_zapateller.c b/apps/app_zapateller.c index 283556a9e..9c64c547d 100644 --- a/apps/app_zapateller.c +++ b/apps/app_zapateller.c @@ -59,15 +59,12 @@ static char *descrip = static int zapateller_exec(struct ast_channel *chan, void *data) { int res = 0; - struct ast_module_user *u; int i, answer = 0, nocallerid = 0; char *parse = ast_strdupa((char *)data); AST_DECLARE_APP_ARGS(args, AST_APP_ARG(options)[2]; ); - u = ast_module_user_add(chan); - AST_STANDARD_APP_ARGS(args, parse); for (i = 0; i < args.argc; i++) { @@ -85,10 +82,8 @@ static int zapateller_exec(struct ast_channel *chan, void *data) res = ast_safe_sleep(chan, 500); } - if (!ast_strlen_zero(chan->cid.cid_num) && nocallerid) { - ast_module_user_remove(u); + if (!ast_strlen_zero(chan->cid.cid_num) && nocallerid) return res; - } if (!res) res = ast_tonepair(chan, 950, 0, 330, 0); @@ -99,7 +94,6 @@ static int zapateller_exec(struct ast_channel *chan, void *data) if (!res) res = ast_tonepair(chan, 0, 0, 1000, 0); - ast_module_user_remove(u); return res; } diff --git a/apps/app_zapbarge.c b/apps/app_zapbarge.c index c8b86559c..db7ffbc9c 100644 --- a/apps/app_zapbarge.c +++ b/apps/app_zapbarge.c @@ -259,19 +259,15 @@ outrun: static int conf_exec(struct ast_channel *chan, void *data) { int res=-1; - struct ast_module_user *u; int retrycnt = 0; int confflags = 0; int confno = 0; char confstr[80] = ""; - - u = ast_module_user_add(chan); if (!ast_strlen_zero(data)) { if ((sscanf(data, "Zap/%d", &confno) != 1) && (sscanf(data, "%d", &confno) != 1)) { ast_log(LOG_WARNING, "ZapBarge Argument (if specified) must be a channel number, not '%s'\n", (char *)data); - ast_module_user_remove(u); return 0; } } @@ -294,7 +290,6 @@ static int conf_exec(struct ast_channel *chan, void *data) } out: /* Do the conference */ - ast_module_user_remove(u); return res; } diff --git a/apps/app_zapras.c b/apps/app_zapras.c index 2aa0a30ef..5456ffb29 100644 --- a/apps/app_zapras.c +++ b/apps/app_zapras.c @@ -201,14 +201,11 @@ static int zapras_exec(struct ast_channel *chan, void *data) { int res=-1; char *args; - struct ast_module_user *u; ZT_PARAMS ztp; if (!data) data = ""; - u = ast_module_user_add(chan); - args = ast_strdupa(data); /* Answer the channel if it's not up */ @@ -235,7 +232,6 @@ static int zapras_exec(struct ast_channel *chan, void *data) run_ras(chan, args); } } - ast_module_user_remove(u); return res; } diff --git a/apps/app_zapscan.c b/apps/app_zapscan.c index e95f7f557..76cfbe3b0 100644 --- a/apps/app_zapscan.c +++ b/apps/app_zapscan.c @@ -287,7 +287,6 @@ static int conf_run(struct ast_channel *chan, int confno, int confflags) static int conf_exec(struct ast_channel *chan, void *data) { int res=-1; - struct ast_module_user *u; int confflags = 0; int confno = 0; char confstr[80] = "", *tmp = NULL; @@ -295,9 +294,7 @@ static int conf_exec(struct ast_channel *chan, void *data) struct ast_frame *f; char *desired_group; int input=0,search_group=0; - - u = ast_module_user_add(chan); - + if (chan->_state != AST_STATE_UP) ast_answer(chan); @@ -357,7 +354,6 @@ static int conf_exec(struct ast_channel *chan, void *data) ast_mutex_unlock(&tempchan->lock); lastchan = tempchan; } - ast_module_user_remove(u); return res; } -- cgit v1.2.3