diff options
Diffstat (limited to 'apps')
76 files changed, 860 insertions, 1771 deletions
diff --git a/apps/Makefile b/apps/Makefile index df5f60a44..0373a3b63 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -9,7 +9,7 @@ # the GNU General Public License # -ifneq ($(wildcard ../menuselect.makeopts),) +ifneq ($(wildcard $(ASTTOPDIR)/menuselect.makeopts),) include ../menuselect.makeopts include ../menuselect.makedeps endif @@ -17,22 +17,25 @@ endif C_MODS:=$(filter-out $(MENUSELECT_APPS),$(patsubst %.c,%,$(wildcard app_*.c))) CC_MODS:=$(filter-out $(MENUSELECT_APPS),$(patsubst %.cc,%,$(wildcard app_*.cc))) -SELECTED_MODS:=$(C_MODS) $(CC_MODS) +LOADABLE_MODS:=$(C_MODS) $(CC_MODS) + +ifneq ($(findstring apps,$(MENUSELECT_EMBED)),) + EMBEDDED_MODS:=$(LOADABLE_MODS) + LOADABLE_MODS:= +endif ifneq ($(findstring ODBC_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),) MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_ODBC_STORAGE) endif -ifneq ($(findstring EXTENDED_ODBC_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),) -MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_EXTENDED_ODBC_STORAGE) -endif ifneq ($(findstring IMAP_STORAGE,$(MENUSELECT_OPTS_app_voicemail)),) MENUSELECT_DEPENDS_app_voicemail+=$(MENUSELECT_DEPENDS_IMAP_STORAGE) endif +ifeq (SunOS,$(shell uname)) +MENUSELECT_DEPENDS_app_chanspy+=RT +RT_LIB=-lrt +endif + all: _all include $(ASTTOPDIR)/Makefile.moddir_rules - -ifeq (SunOS,$(shell uname)) -app_chanspy.so: LIBS+=-lrt -endif diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c index e8ab87802..04b9000fd 100644 --- a/apps/app_adsiprog.c +++ b/apps/app_adsiprog.c @@ -1545,9 +1545,9 @@ static int adsi_prog(struct ast_channel *chan, char *script) static int adsi_exec(struct ast_channel *chan, void *data) { int res=0; - struct localuser *u; + struct ast_module_user *u; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (ast_strlen_zero(data)) data = "asterisk.adsi"; @@ -1561,16 +1561,16 @@ static int adsi_exec(struct ast_channel *chan, void *data) res = adsi_prog(chan, data); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); res = ast_unregister_application(app); @@ -1578,20 +1578,9 @@ static int unload_module(void *mod) return res; } -static int load_module(void *mod) +static int load_module(void) { - __mod_desc = mod; return ast_register_application(app, adsi_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Asterisk ADSI Programming Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Asterisk ADSI Programming Application"); diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c index faa2c6a00..5b745d0ab 100644 --- a/apps/app_alarmreceiver.c +++ b/apps/app_alarmreceiver.c @@ -626,13 +626,13 @@ 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 localuser *u; + struct ast_module_user *u; event_node_t *elp, *efree; char signalling_type[64] = ""; event_node_t *event_head = NULL; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); /* Set write and read formats to ULAW */ @@ -641,13 +641,13 @@ 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); - LOCAL_USER_REMOVE(u); + 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -666,7 +666,7 @@ static int alarmreceiver_exec(struct ast_channel *chan, void *data) res = ast_answer(chan); if (res) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } } @@ -721,7 +721,7 @@ static int alarmreceiver_exec(struct ast_channel *chan, void *data) } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -818,32 +818,21 @@ static int load_config(void) */ -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { - __mod_desc = mod; load_config(); return ast_register_application(app, alarmreceiver_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Alarm Receiver for Asterisk"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Alarm Receiver for Asterisk"); diff --git a/apps/app_amd.c b/apps/app_amd.c index 1ffc463b2..2f7148b9c 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -321,11 +321,11 @@ static void isAnsweringMachine(struct ast_channel *chan, void *data) static int amd_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); isAnsweringMachine(chan, data); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -385,33 +385,26 @@ static void load_config(void) return; } -static int unload_module(void *mod) +static int unload_module(void) { - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return ast_unregister_application(app); } -static int load_module(void *mod) +static int load_module(void) { - __mod_desc = mod; load_config(); return ast_register_application(app, amd_exec, synopsis, descrip); } -static int reload(void *mod) +static int reload(void) { load_config(); return 0; } -static const char *description(void) -{ - return "Answering Machine Detection Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, reload, NULL, NULL); +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Answering Machine Detection Application", + .load = load_module, + .unload = unload_module, + .reload = reload, + ); diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c index 0e6b8eb2c..03bc5ed81 100644 --- a/apps/app_authenticate.c +++ b/apps/app_authenticate.c @@ -95,7 +95,7 @@ static int auth_exec(struct ast_channel *chan, void *data) { int res=0; int retries; - struct localuser *u; + struct ast_module_user *u; char passwd[256]; char *prompt; int maxdigits; @@ -113,12 +113,12 @@ static int auth_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (chan->_state != AST_STATE_UP) { res = ast_answer(chan); if (res) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } } @@ -226,15 +226,15 @@ static int auth_exec(struct ast_channel *chan, void *data) res = -1; } } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); res = ast_unregister_application(app); @@ -242,19 +242,9 @@ static int unload_module(void *mod) return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, auth_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Authentication Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Authentication Application"); diff --git a/apps/app_cdr.c b/apps/app_cdr.c index 8d20fb012..e8f76a602 100644 --- a/apps/app_cdr.c +++ b/apps/app_cdr.c @@ -43,48 +43,37 @@ static char *nocdr_descrip = static char *nocdr_app = "NoCDR"; static char *nocdr_synopsis = "Tell Asterisk to not maintain a CDR for the current call"; -LOCAL_USER_DECL; static int nocdr_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (chan->cdr) { ast_cdr_free(chan->cdr); chan->cdr = NULL; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(nocdr_app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(nocdr_app, nocdr_exec, nocdr_synopsis, nocdr_descrip); } -static const char *description(void) -{ - return "Tell Asterisk to not maintain a CDR for the current call"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Tell Asterisk to not maintain a CDR for the current call"); diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c index c23aa6edc..c6931d8db 100644 --- a/apps/app_chanisavail.c +++ b/apps/app_chanisavail.c @@ -63,13 +63,12 @@ static char *descrip = " s - Consider the channel unavailable if the channel is in use at all\n" " j - Support jumping to priority n+101 if no channel is available\n"; -LOCAL_USER_DECL; static int chanavail_exec(struct ast_channel *chan, void *data) { int res=-1, inuse=-1, option_state=0, priority_jump=0; int status; - struct localuser *u; + 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,7 +81,7 @@ static int chanavail_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); info = ast_strdupa(data); @@ -108,7 +107,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } *number = '\0'; @@ -145,41 +144,30 @@ static int chanavail_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, "AVAILORIGCHAN", ""); if (priority_jump || ast_opt_priority_jumping) { if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } } } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res = 0; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { - __mod_desc = mod; return ast_register_application(app, chanavail_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Check channel availability"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Check channel availability"); diff --git a/apps/app_channelredirect.c b/apps/app_channelredirect.c index ada623018..a8eedf9b4 100644 --- a/apps/app_channelredirect.c +++ b/apps/app_channelredirect.c @@ -48,12 +48,11 @@ static char *descrip = "ChannelRedirect(channel|[[context|]extension|]priority):\n" " Sends the specified channel to the specified extension priority\n"; -LOCAL_USER_DECL; static int asyncgoto_exec(struct ast_channel *chan, void *data) { int res = -1; - struct localuser *u; + struct ast_module_user *u; char *info, *context, *exten, *priority; int prio = 1; struct ast_channel *chan2 = NULL; @@ -68,7 +67,7 @@ static int asyncgoto_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); info = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, info); @@ -117,36 +116,25 @@ static int asyncgoto_exec(struct ast_channel *chan, void *data) chanquit: ast_mutex_unlock(&chan2->lock); quit: - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { - __mod_desc = mod; return ast_register_application(app, asyncgoto_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Channel Redirect"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Channel Redirect"); diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index a4fcb0b4a..1f8a9f01c 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -140,7 +140,6 @@ AST_APP_OPTIONS(spy_opts, { AST_APP_OPTION_ARG('r', OPTION_RECORD, OPT_ARG_RECORD), }); -LOCAL_USER_DECL; struct chanspy_translation_helper { /* spy data */ @@ -540,7 +539,7 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags, static int chanspy_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; char *options = NULL; char *spec = NULL; char *argv[2]; @@ -555,7 +554,7 @@ static int chanspy_exec(struct ast_channel *chan, void *data) data = ast_strdupa(data); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if ((argc = ast_app_separate_args(data, '|', argv, sizeof(argv) / sizeof(argv[0])))) { spec = argv[0]; @@ -593,7 +592,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -615,14 +614,14 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } static int extenspy_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; char *options = NULL; char *exten = NULL; char *context = NULL; @@ -638,7 +637,7 @@ static int extenspy_exec(struct ast_channel *chan, void *data) data = ast_strdupa(data); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if ((argc = ast_app_separate_args(data, '|', argv, sizeof(argv) / sizeof(argv[0])))) { context = argv[0]; @@ -676,7 +675,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -698,43 +697,31 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res = 0; res |= ast_unregister_application(app_chan); res |= ast_unregister_application(app_ext); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res = 0; - __mod_desc = mod; - res |= ast_register_application(app_chan, chanspy_exec, tdesc, desc_chan); res |= ast_register_application(app_ext, extenspy_exec, tdesc, desc_ext); return res; } -static const char *description(void) -{ - return (char *) tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Listen to the audio of an active channel"); diff --git a/apps/app_controlplayback.c b/apps/app_controlplayback.c index a2e3929da..8a5a845cd 100644 --- a/apps/app_controlplayback.c +++ b/apps/app_controlplayback.c @@ -66,7 +66,6 @@ static const char *descrip = " CPLAYBACKSTATUS - This variable contains the status of the attempt as a text\n" " string, one of: SUCCESS | USERSTOPPED | ERROR\n"; -LOCAL_USER_DECL; static int is_on_phonepad(char key) { @@ -77,7 +76,7 @@ static int controlplayback_exec(struct ast_channel *chan, void *data) { int res = 0, priority_jump = 0; int skipms = 0; - struct localuser *u; + struct ast_module_user *u; char *tmp; int argc; char *argv[8]; @@ -97,7 +96,7 @@ static int controlplayback_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); tmp = ast_strdupa(data); memset(argv, 0, sizeof(argv)); @@ -106,7 +105,7 @@ static int controlplayback_exec(struct ast_channel *chan, void *data) if (argc < 1) { ast_log(LOG_WARNING, "ControlPlayback requires an argument (filename)\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -149,31 +148,21 @@ static int controlplayback_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, "CPLAYBACKSTATUS", "SUCCESS"); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, controlplayback_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Control Playback Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Control Playback Application"); diff --git a/apps/app_db.c b/apps/app_db.c index fc8c52b1a..73d092ab6 100644 --- a/apps/app_db.c +++ b/apps/app_db.c @@ -64,14 +64,13 @@ static char *dt_app = "DBdeltree"; static char *d_synopsis = "Delete a key from the database"; static char *dt_synopsis = "Delete a family or keytree from the database"; -LOCAL_USER_DECL; static int deltree_exec(struct ast_channel *chan, void *data) { char *argv, *family, *keytree; - struct localuser *u; + struct ast_module_user *u; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); argv = ast_strdupa(data); @@ -80,7 +79,7 @@ static int deltree_exec(struct ast_channel *chan, void *data) keytree = strsep(&argv, "\0"); if (!family || !keytree) { ast_log(LOG_DEBUG, "Ignoring; Syntax error in argument\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } if (ast_strlen_zero(keytree)) @@ -102,7 +101,7 @@ static int deltree_exec(struct ast_channel *chan, void *data) ast_verbose(VERBOSE_PREFIX_3 "DBdeltree: Error deleting key from database.\n"); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -110,10 +109,10 @@ static int deltree_exec(struct ast_channel *chan, void *data) static int del_exec(struct ast_channel *chan, void *data) { char *argv, *family, *key; - struct localuser *u; + struct ast_module_user *u; static int deprecation_warning = 0; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!deprecation_warning) { deprecation_warning = 1; @@ -127,7 +126,7 @@ static int del_exec(struct ast_channel *chan, void *data) key = strsep(&argv, "\0"); if (!family || !key) { ast_log(LOG_DEBUG, "Ignoring; Syntax error in argument\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } if (option_verbose > 2) @@ -140,12 +139,12 @@ static int del_exec(struct ast_channel *chan, void *data) ast_log(LOG_DEBUG, "Ignoring, no parameters\n"); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int retval; @@ -155,25 +154,14 @@ static int unload_module(void *mod) return retval; } -static int load_module(void *mod) +static int load_module(void) { int retval; - __mod_desc = mod; retval = ast_register_application(d_app, del_exec, d_synopsis, d_descrip); retval |= ast_register_application(dt_app, deltree_exec, dt_synopsis, dt_descrip); return retval; } -static const char *description(void) -{ - return "Database Access Functions"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Database Access Functions"); diff --git a/apps/app_dial.c b/apps/app_dial.c index 99392abbc..13b5b3371 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -298,7 +298,6 @@ struct dial_localuser { struct dial_localuser *next; }; -LOCAL_USER_DECL; static void hanguptree(struct dial_localuser *outgoing, struct ast_channel *exception) { @@ -769,7 +768,7 @@ static int valid_priv_reply(struct ast_flags *opts, int res) static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags *peerflags) { int res = -1; - struct localuser *u; + struct ast_module_user *u; char *rest, *cur; struct dial_localuser *outgoing = NULL; struct ast_channel *peer; @@ -813,7 +812,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); parse = ast_strdupa(data); @@ -1634,7 +1633,7 @@ out: res = 0; done: - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -1650,7 +1649,7 @@ 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 localuser *u; + struct ast_module_user *u; struct ast_flags peerflags; if (ast_strlen_zero(data)) { @@ -1658,7 +1657,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); announce = ast_strdupa(data); @@ -1739,23 +1738,23 @@ static int retrydial_exec(struct ast_channel *chan, void *data) if (ast_test_flag(chan, AST_FLAG_MOH)) ast_moh_stop(chan); done: - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); res |= ast_unregister_application(rapp); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -1765,14 +1764,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return "Dialing Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dialing Application"); diff --git a/apps/app_dictate.c b/apps/app_dictate.c index b77a389ae..0c46118e4 100644 --- a/apps/app_dictate.c +++ b/apps/app_dictate.c @@ -51,7 +51,6 @@ static char *synopsis = "Virtual Dictation Machine"; static char *desc = " Dictate([<base_dir>[|<filename>]])\n" "Start dictation machine using optional base dir for files.\n"; -LOCAL_USER_DECL; typedef enum { DFLAG_RECORD = (1 << 0), @@ -90,7 +89,7 @@ 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 localuser *u; + struct ast_module_user *u; int ffactor = 320 * 80, res = 0, done = 0, @@ -103,7 +102,7 @@ static int dictate_exec(struct ast_channel *chan, void *data) maxlen = 0, mode = 0; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR); if (!ast_strlen_zero(data)) { @@ -123,7 +122,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -330,31 +329,20 @@ static int dictate_exec(struct ast_channel *chan, void *data) if (oldr) { ast_set_read_format(chan, oldr); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); return res; } -static int load_module(void *mod) +static int load_module(void) { - __mod_desc = mod; return ast_register_application(app, dictate_exec, synopsis, desc); } -static const char *description(void) -{ - return "Virtual Dictation Machine"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Virtual Dictation Machine"); diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c index c79bad26f..e45c87603 100644 --- a/apps/app_directed_pickup.c +++ b/apps/app_directed_pickup.c @@ -53,12 +53,11 @@ static const char *descrip = "10@PICKUPMARK, this application tries to find a channel which has defined a channel variable with the same context\n" "as \"extension\"."; -LOCAL_USER_DECL; static int pickup_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u = NULL; + struct ast_module_user *u = NULL; struct ast_channel *origin = NULL, *target = NULL; char *tmp = NULL, *exten = NULL, *context = NULL, *rest=data; char workspace[256] = ""; @@ -69,7 +68,7 @@ static int pickup_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); while (!target && (exten = rest) ) { res = 0; @@ -146,12 +145,12 @@ static int pickup_exec(struct ast_channel *chan, void *data) if (target) ast_mutex_unlock(&target->lock); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; @@ -160,20 +159,9 @@ static int unload_module(void *mod) return res; } -static int load_module(void *mod) +static int load_module(void) { - __mod_desc = mod; return ast_register_application(app, pickup_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Directed Call Pickup Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, NULL, NULL, NULL); +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Directed Call Pickup Application"); diff --git a/apps/app_directory.c b/apps/app_directory.c index 55e91ce49..6f660e326 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -87,7 +87,6 @@ static char *descrip = /* How many digits to read in */ #define NUMDIGITS 3 -LOCAL_USER_DECL; #ifdef USE_ODBC_STORAGE static void retrieve_file(char *dir) @@ -514,7 +513,7 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, char * static int directory_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u; + struct ast_module_user *u; struct ast_config *cfg; int last = 1; int readext = 0; @@ -531,7 +530,7 @@ static int directory_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); parse = ast_strdupa(data); @@ -552,7 +551,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -583,20 +582,19 @@ static int directory_exec(struct ast_channel *chan, void *data) break; } ast_config_destroy(cfg); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); return res; } -static int load_module(void *mod) +static int load_module(void) { - __mod_desc = mod; #ifdef USE_ODBC_STORAGE struct ast_config *cfg = ast_config_load(VOICEMAIL_CONFIG); char *tmp; @@ -619,14 +617,4 @@ static int load_module(void *mod) return ast_register_application(app, directory_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Extension Directory"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Extension Directory"); diff --git a/apps/app_disa.c b/apps/app_disa.c index 12019acbd..1ec0531bf 100644 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -95,7 +95,6 @@ static char *descrip = "exists in the context, it will be used. Also, if you set the 5th argument\n" "to 'NOANSWER', the DISA application will not answer initially.\n"; -LOCAL_USER_DECL; static void play_dialtone(struct ast_channel *chan, char *mailbox) { @@ -115,7 +114,7 @@ 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 localuser *u; + struct ast_module_user *u; char *tmp, exten[AST_MAX_EXTENSION],acctcode[20]=""; char pwline[256]; char ourcidname[256],ourcidnum[256]; @@ -137,7 +136,7 @@ static int disa_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (chan->pbx) { firstdigittimeout = chan->pbx->rtimeout*1000; @@ -146,12 +145,12 @@ 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); - LOCAL_USER_REMOVE(u); + 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -209,13 +208,13 @@ static int disa_exec(struct ast_channel *chan, void *data) f = ast_read(chan); if (f == NULL) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) { ast_frfree(f); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } if (f->frametype == AST_FRAME_VOICE) { @@ -245,7 +244,7 @@ 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } pwline[0] = 0; @@ -346,7 +345,7 @@ 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } } @@ -367,34 +366,24 @@ reorder: ast_frfree(f); } ast_playtones_stop(chan); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, disa_exec, synopsis, descrip); } -static const char *description(void) -{ - return "DISA (Direct Inward System Access) Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "DISA (Direct Inward System Access) Application"); diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c index 8a06baef3..426ba4eab 100644 --- a/apps/app_dumpchan.c +++ b/apps/app_dumpchan.c @@ -56,7 +56,6 @@ static char *desc = "displayed when the verbose level is currently set to that number\n" "or greater. \n"; -LOCAL_USER_DECL; static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) { @@ -137,13 +136,13 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) static int dumpchan_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; char vars[BUFSIZ * 4]; char info[1024]; int level = 0; static char *line = "================================================================================"; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!ast_strlen_zero(data)) level = atoi(data); @@ -153,35 +152,25 @@ static int dumpchan_exec(struct ast_channel *chan, void *data) 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, line); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, dumpchan_exec, synopsis, desc); } -static const char *description(void) -{ - return "Dump Info About The Calling Channel"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dump Info About The Calling Channel"); diff --git a/apps/app_echo.c b/apps/app_echo.c index 85df130f1..19a86382e 100644 --- a/apps/app_echo.c +++ b/apps/app_echo.c @@ -41,8 +41,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/pbx.h" #include "asterisk/module.h" -static char *tdesc = "Simple Echo Application"; - static char *app = "Echo"; static char *synopsis = "Echo audio, video, or DTMF back to the calling party"; @@ -52,15 +50,14 @@ static char *descrip = "the calling channel back to itself. If the DTMF digit '#' is received, the\n" "application will exit.\n"; -LOCAL_USER_DECL; static int echo_exec(struct ast_channel *chan, void *data) { int res = -1; int format; - struct localuser *u; + struct ast_module_user *u; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); format = ast_best_codec(chan->nativeformats); ast_set_write_format(chan, format); @@ -95,34 +92,24 @@ static int echo_exec(struct ast_channel *chan, void *data) ast_frfree(f); } end: - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, echo_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Simple Echo Application"); diff --git a/apps/app_exec.c b/apps/app_exec.c index d0c2591df..0aafac343 100644 --- a/apps/app_exec.c +++ b/apps/app_exec.c @@ -45,8 +45,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") /* Maximum length of any variable */ #define MAXRESULT 1024 -static char *tdesc = "Executes dialplan applications"; - /*! Note * * The key difference between these two apps is exit status. In a @@ -90,16 +88,14 @@ static char *execif_descrip = "If <expr> is true, but <app> is not found, then the application\n" "will return a non-zero value.\n"; -LOCAL_USER_DECL; - static int exec_exec(struct ast_channel *chan, void *data) { int res=0; - struct localuser *u; + struct ast_module_user *u; char *s, *appname, *endargs, args[MAXRESULT] = ""; struct ast_app *app; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); /* Check and parse arguments */ if (data) { @@ -122,18 +118,18 @@ static int exec_exec(struct ast_channel *chan, void *data) } } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } static int tryexec_exec(struct ast_channel *chan, void *data) { int res=0; - struct localuser *u; + struct ast_module_user *u; char *s, *appname, *endargs, args[MAXRESULT] = ""; struct ast_app *app; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); /* Check and parse arguments */ if (data) { @@ -157,19 +153,20 @@ static int tryexec_exec(struct ast_channel *chan, void *data) } } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } -static int execif_exec(struct ast_channel *chan, void *data) { - int res=0; - struct localuser *u; +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; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); expr = ast_strdupa(data); @@ -195,11 +192,12 @@ static int execif_exec(struct ast_channel *chan, void *data) { res = -1; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); + return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; @@ -207,12 +205,12 @@ static int unload_module(void *mod) res |= ast_unregister_application(app_tryexec); res |= ast_unregister_application(app_execif); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res = ast_register_application(app_exec, exec_exec, exec_synopsis, exec_descrip); res |= ast_register_application(app_tryexec, tryexec_exec, tryexec_synopsis, tryexec_descrip); @@ -220,14 +218,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Executes dialplan applications"); diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c index 787cc369c..e81f4f34f 100644 --- a/apps/app_externalivr.c +++ b/apps/app_externalivr.c @@ -83,7 +83,6 @@ struct ivr_localuser { int option_autoclear; }; -LOCAL_USER_DECL; struct gen_state { struct ivr_localuser *u; @@ -242,7 +241,7 @@ static struct playlist_entry *make_entry(const char *filename) static int app_exec(struct ast_channel *chan, void *data) { - struct localuser *lu = NULL; + struct ast_module_user *lu; struct playlist_entry *entry; const char *args = data; int child_stdin[2] = { 0,0 }; @@ -263,14 +262,14 @@ static int app_exec(struct ast_channel *chan, void *data) }; struct ivr_localuser *u = &foo; - LOCAL_USER_ADD(lu); + lu = ast_module_user_add(chan); u->abort_current_sound = 0; u->chan = chan; if (ast_strlen_zero(args)) { ast_log(LOG_WARNING, "ExternalIVR requires a command to execute\n"); - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); return -1; } @@ -545,35 +544,25 @@ static int app_exec(struct ast_channel *chan, void *data) while ((entry = AST_LIST_REMOVE_HEAD(&u->playlist, list))) free(entry); - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, app_exec, synopsis, descrip); } -static const char *description(void) -{ - return "External IVR Interface Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "External IVR Interface Application"); diff --git a/apps/app_festival.c b/apps/app_festival.c index caec727c8..f6e1d7503 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -68,7 +68,6 @@ static char *descrip = "play it to the user, allowing any given interrupt keys to immediately terminate and return\n" "the value, or 'any' to allow any number back (useful in dialplan)\n"; -LOCAL_USER_DECL; static char *socket_receive_file_to_buff(int fd,int *size) { @@ -275,7 +274,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata) { int usecache; int res=0; - struct localuser *u; + struct ast_module_user *u; struct sockaddr_in serv_addr; struct hostent *serverhost; struct ast_hostent ahp; @@ -314,12 +313,12 @@ static int festival_exec(struct ast_channel *chan, void *vdata) return -1; } - LOCAL_USER_ADD(u); + 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } if (!(host = ast_variable_retrieve(cfg, "general", "host"))) { @@ -376,7 +375,7 @@ 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } memset(&serv_addr, 0, sizeof(serv_addr)); @@ -386,7 +385,7 @@ 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } memmove(&serv_addr.sin_addr,serverhost->h_addr, serverhost->h_length); @@ -397,7 +396,7 @@ 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -489,7 +488,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata) ast_log(LOG_WARNING,"Unable to read from cache/festival fd"); close(fd); ast_config_destroy(cfg); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } n += read_data; @@ -516,36 +515,25 @@ static int festival_exec(struct ast_channel *chan, void *vdata) } while (strcmp(ack,"OK\n") != 0); close(fd); ast_config_destroy(cfg); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, festival_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Simple Festival Interface"; - -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Simple Festival Interface"); diff --git a/apps/app_flash.c b/apps/app_flash.c index d237fbc06..446b2a1f8 100644 --- a/apps/app_flash.c +++ b/apps/app_flash.c @@ -59,7 +59,6 @@ static char *descrip = "people who want to perform transfers and such via AGI and is generally\n" "quite useless oths application will only work on Zap trunks.\n"; -LOCAL_USER_DECL; static inline int zt_wait_event(int fd) { @@ -75,9 +74,9 @@ static int flash_exec(struct ast_channel *chan, void *data) { int res = -1; int x; - struct localuser *u; + struct ast_module_user *u; struct zt_params ztp; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!strcasecmp(chan->tech->type, "Zap")) { memset(&ztp, 0, sizeof(ztp)); res = ioctl(chan->fds[0], ZT_GET_PARAMS, &ztp); @@ -101,35 +100,25 @@ static int flash_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "Unable to get parameters of %s: %s\n", chan->name, strerror(errno)); } else ast_log(LOG_WARNING, "%s is not a Zap channel\n", chan->name); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, flash_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Flash zap trunk application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Flash channel application"); diff --git a/apps/app_followme.c b/apps/app_followme.c index 09fb45169..24f134d85 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -72,10 +72,7 @@ static char *descrip = " s - Playback the incoming status message prior to starting the follow-me step(s)\n" " a - Record the caller's name so it can be announced to the callee on each step\n" " n - Playback the unreachable status message if we've run out of steps to reach the\n" -" or the callee has elected not to be reachable.\n" - - -LOCAL_USER_DECL; +" or the callee has elected not to be reachable.\n"; struct number { char number[512]; /*!< Phone Number(s) and/or Extension(s) */ @@ -916,7 +913,7 @@ static int app_exec(struct ast_channel *chan, void *data) struct ast_call_followme *f; struct number *nm, *newnm; int res = 0; - struct localuser *u; + struct ast_module_user *u; char *argstr; char namerecloc[255]; int duration = 0; @@ -938,7 +935,7 @@ static int app_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); AST_STANDARD_APP_ARGS(args, argstr); @@ -1074,47 +1071,47 @@ static int app_exec(struct ast_channel *chan, void *data) } outrun: - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); + return res; } -static int unload_module(void *mod) +static int unload_module(void) { struct ast_call_followme *f; - STANDARD_HANGUP_LOCALUSERS; + + ast_module_user_hangup_all(); + ast_unregister_application(app); + /* Free Memory. Yeah! I'm free! */ AST_LIST_LOCK(&followmes); - AST_LIST_TRAVERSE_SAFE_BEGIN(&followmes, f, entry) { + while ((f = AST_LIST_REMOVE_HEAD(&followmes, entry))) { free_numbers(f); - AST_LIST_REMOVE_CURRENT(&followmes, entry); free(f); } - AST_LIST_TRAVERSE_SAFE_END + AST_LIST_UNLOCK(&followmes); + return 0; } -static int load_module(void *mod) +static int load_module(void) { reload_followme(); - return ast_register_application(app, app_exec, synopsis, descrip); -} -static const char *description(void) -{ - return "Find-Me/Follow-Me Application"; + return ast_register_application(app, app_exec, synopsis, descrip); } -static int reload(void *mod) +static int reload(void) { reload_followme(); - return 0; -} -static const char *key(void) -{ - return ASTERISK_GPL_KEY; + return 0; } -STD_MOD(MOD_1, reload, NULL, NULL); +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Find-Me/Follow-Me Application", + .load = load_module, + .unload = unload_module, + .reload = reload, + ); diff --git a/apps/app_forkcdr.c b/apps/app_forkcdr.c index 620148604..d9c5b293f 100644 --- a/apps/app_forkcdr.c +++ b/apps/app_forkcdr.c @@ -50,7 +50,6 @@ static char *descrip = "cdr record starting from the time of the fork call\n" "If the option 'v' is passed all cdr variables will be passed along also.\n"; -LOCAL_USER_DECL; static void ast_cdr_fork(struct ast_channel *chan) { @@ -78,48 +77,38 @@ static void ast_cdr_fork(struct ast_channel *chan) static int forkcdr_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u; + struct ast_module_user *u; if (!chan->cdr) { ast_log(LOG_WARNING, "Channel does not have a CDR\n"); return 0; } - LOCAL_USER_ADD(u); + 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, forkcdr_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Fork The CDR into 2 separate entities."; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Fork The CDR into 2 separate entities"); diff --git a/apps/app_getcpeid.c b/apps/app_getcpeid.c index be0e0657d..7dbd5f6fd 100644 --- a/apps/app_getcpeid.c +++ b/apps/app_getcpeid.c @@ -51,7 +51,6 @@ static char *descrip = " GetCPEID: Obtains and displays ADSI CPE ID and other information in order\n" "to properly setup zapata.conf for on-hook operations.\n"; -LOCAL_USER_DECL; static int cpeid_setstatus(struct ast_channel *chan, char *stuff[], int voice) { @@ -67,7 +66,7 @@ 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 localuser *u; + struct ast_module_user *u; unsigned char cpeid[4]; int gotgeometry = 0; int gotcpeid = 0; @@ -75,7 +74,7 @@ static int cpeid_exec(struct ast_channel *chan, void *idata) char data[4][80]; char *stuff[4]; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); stuff[0] = data[0]; stuff[1] = data[1]; stuff[2] = data[2]; @@ -127,34 +126,24 @@ static int cpeid_exec(struct ast_channel *chan, void *idata) adsi_unload_session(chan); } } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, cpeid_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Get ADSI CPE ID"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Get ADSI CPE ID"); diff --git a/apps/app_hasnewvoicemail.c b/apps/app_hasnewvoicemail.c index 22a5d3f30..33204bbe9 100644 --- a/apps/app_hasnewvoicemail.c +++ b/apps/app_hasnewvoicemail.c @@ -77,11 +77,10 @@ static char *hasnewvoicemail_descrip = " HASVMSTATUS The result of the new voicemail check returned as a text string as follows\n" " <# of messages in the folder, 0 for NONE>\n"; -LOCAL_USER_DECL; static int hasvoicemail_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; char *input, *varname = NULL, *vmbox, *context = "default"; char *vmfolder; int vmcount = 0; @@ -104,7 +103,7 @@ static int hasvoicemail_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); input = ast_strdupa(data); @@ -146,21 +145,21 @@ static int hasvoicemail_exec(struct ast_channel *chan, void *data) snprintf(tmp, sizeof(tmp), "%d", vmcount); pbx_builtin_setvar_helper(chan, "HASVMSTATUS", tmp); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } static int acf_vmcount_exec(struct ast_channel *chan, char *cmd, char *argsstr, char *buf, size_t len) { - struct localuser *u; + struct ast_module_user *u; char *context; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(vmbox); AST_APP_ARG(folder); ); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); buf[0] = '\0'; @@ -179,7 +178,7 @@ static int acf_vmcount_exec(struct ast_channel *chan, char *cmd, char *argsstr, snprintf(buf, len, "%d", ast_app_messagecount(context, args.vmbox, args.folder)); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -194,7 +193,7 @@ struct ast_custom_function acf_vmcount = { .read = acf_vmcount_exec, }; -static int unload_module(void *mod) +static int unload_module(void) { int res; @@ -202,12 +201,12 @@ static int unload_module(void *mod) res |= ast_unregister_application(app_hasvoicemail); res |= ast_unregister_application(app_hasnewvoicemail); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -218,14 +217,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return "Indicator for whether a voice mailbox has messages in a given folder."; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Indicator for whether a voice mailbox has messages in a given folder."); diff --git a/apps/app_ices.c b/apps/app_ices.c index 67b107e41..9d93dabdf 100644 --- a/apps/app_ices.c +++ b/apps/app_ices.c @@ -60,7 +60,6 @@ static char *descrip = "(available separately). A configuration file must be supplied\n" "for ices (see examples/asterisk-ices.conf). \n"; -LOCAL_USER_DECL; static int icesencode(char *filename, int fd) { @@ -91,7 +90,7 @@ static int icesencode(char *filename, int fd) static int ices_exec(struct ast_channel *chan, void *data) { int res=0; - struct localuser *u; + struct ast_module_user *u; int fds[2]; int ms = -1; int pid = -1; @@ -107,13 +106,13 @@ static int ices_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); last = ast_tv(0, 0); if (pipe(fds)) { ast_log(LOG_WARNING, "Unable to create pipe\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } flags = fcntl(fds[1], F_GETFL); @@ -128,7 +127,7 @@ static int ices_exec(struct ast_channel *chan, void *data) close(fds[0]); close(fds[1]); ast_log(LOG_WARNING, "Answer failed!\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -138,7 +137,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } if (((char *)data)[0] == '/') @@ -188,35 +187,25 @@ static int ices_exec(struct ast_channel *chan, void *data) if (!res && oreadformat) ast_set_read_format(chan, oreadformat); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, ices_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Encode and Stream via icecast and ices"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Encode and Stream via icecast and ices"); diff --git a/apps/app_image.c b/apps/app_image.c index b6308f0be..f5f327197 100644 --- a/apps/app_image.c +++ b/apps/app_image.c @@ -44,8 +44,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/app.h" #include "asterisk/options.h" -static char *tdesc = "Image Transmission Application"; - static char *app = "SendImage"; static char *synopsis = "Send an image file"; @@ -61,12 +59,11 @@ static char *descrip = " SENDIMAGESTATUS The status is the result of the attempt as a text string, one of\n" " OK | NOSUPPORT \n"; -LOCAL_USER_DECL; static int sendimage_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u; + struct ast_module_user *u; char *parse; int priority_jump = 0; AST_DECLARE_APP_ARGS(args, @@ -74,7 +71,7 @@ static int sendimage_exec(struct ast_channel *chan, void *data) AST_APP_ARG(options); ); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); parse = ast_strdupa(data); @@ -95,7 +92,7 @@ static int sendimage_exec(struct ast_channel *chan, void *data) if (priority_jump || ast_opt_priority_jumping) ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101); pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "NOSUPPORT"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -104,35 +101,25 @@ static int sendimage_exec(struct ast_channel *chan, void *data) if (!res) pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "OK"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, sendimage_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Image Transmission Application"); diff --git a/apps/app_ivrdemo.c b/apps/app_ivrdemo.c index d3dd2e9a0..933ae9040 100644 --- a/apps/app_ivrdemo.c +++ b/apps/app_ivrdemo.c @@ -88,19 +88,18 @@ AST_IVR_DECLARE_MENU(ivr_demo, "IVR Demo Main Menu", 0, { NULL }, }); -LOCAL_USER_DECL; static int skel_exec(struct ast_channel *chan, void *data) { int res=0; - struct localuser *u; + struct ast_module_user *u; if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "skel requires an argument (filename)\n"); return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); /* Do our thing here */ @@ -109,36 +108,25 @@ static int skel_exec(struct ast_channel *chan, void *data) if (!res) res = ast_ivr_menu_run(chan, &ivr_demo, data); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, skel_exec, tdesc, synopsis); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; - +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "IVR Demo Application"); diff --git a/apps/app_lookupblacklist.c b/apps/app_lookupblacklist.c index b0f3a419f..2eb1e545a 100644 --- a/apps/app_lookupblacklist.c +++ b/apps/app_lookupblacklist.c @@ -47,8 +47,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/astdb.h" #include "asterisk/options.h" -static char *tdesc = "Look up Caller*ID name/number from blacklist database"; - static char *app = "LookupBlacklist"; static char *synopsis = "Look up Caller*ID name/number from blacklist database"; @@ -63,7 +61,6 @@ static char *descrip = " FOUND | NOTFOUND\n" "Example: exten => 1234,1,LookupBlacklist()\n"; -LOCAL_USER_DECL; static int blacklist_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) { @@ -95,12 +92,12 @@ static int lookupblacklist_exec (struct ast_channel *chan, void *data) { char blacklist[1]; - struct localuser *u; + struct ast_module_user *u; int bl = 0; int priority_jump = 0; static int dep_warning = 0; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!dep_warning) { dep_warning = 1; @@ -134,38 +131,28 @@ lookupblacklist_exec (struct ast_channel *chan, void *data) } else pbx_builtin_setvar_helper(chan, "LOOKUPBLSTATUS", "NOTFOUND"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); res |= ast_custom_function_unregister(&blacklist_function); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res = ast_custom_function_register(&blacklist_function); res |= ast_register_application (app, lookupblacklist_exec, synopsis,descrip); return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Look up Caller*ID name/number from blacklist database"); diff --git a/apps/app_lookupcidname.c b/apps/app_lookupcidname.c index 711ca5b76..5a0042a29 100644 --- a/apps/app_lookupcidname.c +++ b/apps/app_lookupcidname.c @@ -45,8 +45,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/callerid.h" #include "asterisk/astdb.h" -static char *tdesc = "Look up CallerID Name from local database"; - static char *app = "LookupCIDName"; static char *synopsis = "Look up CallerID Name from local database"; @@ -59,56 +57,45 @@ static char *descrip = "name delivery, or if you want to change the names on some incoming\n" "calls.\n"; -LOCAL_USER_DECL; -static int -lookupcidname_exec (struct ast_channel *chan, void *data) +static int lookupcidname_exec (struct ast_channel *chan, void *data) { - char dbname[64]; - struct localuser *u; + char dbname[64]; + struct ast_module_user *u; static int dep_warning = 0; - LOCAL_USER_ADD (u); + u = ast_module_user_add(chan); if (!dep_warning) { dep_warning = 1; ast_log(LOG_WARNING, "LookupCIDName is deprecated. Please use ${DB(cidname/${CALLERID(num)})} instead.\n"); } - if (chan->cid.cid_num) { - if (!ast_db_get ("cidname", chan->cid.cid_num, dbname, sizeof (dbname))) { - ast_set_callerid (chan, NULL, dbname, NULL); - if (option_verbose > 2) - ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID name to %s\n", - dbname); + if (chan->cid.cid_num) { + if (!ast_db_get ("cidname", chan->cid.cid_num, dbname, sizeof (dbname))) { + ast_set_callerid (chan, NULL, dbname, NULL); + if (option_verbose > 2) + ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID name to %s\n", + dbname); + } } - } - LOCAL_USER_REMOVE (u); - return 0; + ast_module_user_remove(u); + + return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application (app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application (app, lookupcidname_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Look up CallerID Name from local database"); diff --git a/apps/app_macro.c b/apps/app_macro.c index 13db5ce8a..5adc0a07f 100644 --- a/apps/app_macro.c +++ b/apps/app_macro.c @@ -50,8 +50,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") /* special result value used to force macro exit */ #define MACRO_EXIT_RESULT 1024 -static char *tdesc = "Extension Macros"; - static char *descrip = " Macro(macroname|arg1|arg2...): Executes a macro using the context\n" "'macro-<macroname>', jumping to the 's' extension of that context and\n" @@ -94,7 +92,6 @@ static char *if_synopsis = "Conditional Macro Implementation"; static char *exclusive_synopsis = "Exclusive Macro Implementation"; static char *exit_synopsis = "Exit From Macro"; -LOCAL_USER_DECL; static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) { @@ -120,14 +117,14 @@ 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 localuser *u; + 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; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); /* does the user want a deeper rabbit hole? */ s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION"); @@ -140,7 +137,7 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) sscanf(s, "%d", &depth); if (depth >= maxdepth) { ast_log(LOG_ERROR, "Macro(): possible infinite loop detected. Returning early.\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } snprintf(depthc, sizeof(depthc), "%d", depth + 1); @@ -151,7 +148,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -161,7 +158,7 @@ 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -172,7 +169,8 @@ 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); + return 0; } ast_autoservice_stop(chan); @@ -339,7 +337,8 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) } } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); + return res; } @@ -357,12 +356,12 @@ static int macroif_exec(struct ast_channel *chan, void *data) { char *expr = NULL, *label_a = NULL, *label_b = NULL; int res = 0; - struct localuser *u; + struct ast_module_user *u; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!(expr = ast_strdupa(data))) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -380,7 +379,7 @@ static int macroif_exec(struct ast_channel *chan, void *data) } else ast_log(LOG_WARNING, "Invalid Syntax.\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -390,7 +389,7 @@ static int macro_exit_exec(struct ast_channel *chan, void *data) return MACRO_EXIT_RESULT; } -static int unload_module(void *mod) +static int unload_module(void) { int res; @@ -399,12 +398,12 @@ static int unload_module(void *mod) res |= ast_unregister_application(app); res |= ast_unregister_application(exclusive_app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -416,14 +415,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Extension Macros"); diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 4abfdb3c3..1f2ffc5c7 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -64,8 +64,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "enter.h" #include "leave.h" -LOCAL_USER_DECL; - #define CONFIG_FILE_NAME "meetme.conf" /*! each buffer is 20ms, so this is 640ms total */ @@ -292,8 +290,6 @@ static const char *descripslat = #define CONFIG_FILE_NAME "meetme.conf" #define CONFIG_FILE_NAME_SLA "sla.conf" -LOCAL_USER_DECL; - /*! \brief The MeetMe Conference object */ struct ast_conference { ast_mutex_t playlock; /*!< Conference specific lock (players) */ @@ -2099,7 +2095,7 @@ 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 localuser *u; + struct ast_module_user *u; int res = 0; struct ast_conference *conf; int count; @@ -2115,10 +2111,10 @@ static int count_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!(localdata = ast_strdupa(data))) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -2140,7 +2136,7 @@ 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 */ } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -2149,7 +2145,7 @@ static int count_exec(struct ast_channel *chan, void *data) static int conf_exec(struct ast_channel *chan, void *data) { int res=-1; - struct localuser *u; + struct ast_module_user *u; char confno[AST_MAX_EXTENSION] = ""; int allowretry = 0; int retrycnt = 0; @@ -2165,7 +2161,7 @@ static int conf_exec(struct ast_channel *chan, void *data) AST_APP_ARG(pin); ); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (ast_strlen_zero(data)) { allowretry = 1; @@ -2403,7 +2399,7 @@ static int conf_exec(struct ast_channel *chan, void *data) } } while (allowretry); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -2500,7 +2496,7 @@ static int sla_checkforhold(struct ast_conference *conf, int hangup) static int sla_exec(struct ast_channel *chan, void *data, int trunk) { int res=-1; - struct localuser *u; + struct ast_module_user *u; char confno[AST_MAX_EXTENSION] = ""; struct ast_sla *sla; struct ast_conference *cnf; @@ -2526,8 +2522,7 @@ static int sla_exec(struct ast_channel *chan, void *data, int trunk) return -1; } - LOCAL_USER_ADD(u); - + u = ast_module_user_add(chan); if (args.options) ast_app_parse_options(sla_opts, &confflags, NULL, args.options); @@ -2562,7 +2557,7 @@ static int sla_exec(struct ast_channel *chan, void *data, int trunk) ast_log(LOG_WARNING, "SLA%c: SLA '%s' not found!\n", trunk ? 'T' : 'S', args.confno); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -2600,7 +2595,7 @@ static int admin_exec(struct ast_channel *chan, void *data) { char *params; struct ast_conference *cnf; struct ast_conf_user *user = NULL; - struct localuser *u; + struct ast_module_user *u; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(confno); AST_APP_ARG(command); @@ -2612,7 +2607,7 @@ static int admin_exec(struct ast_channel *chan, void *data) { return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); AST_LIST_LOCK(&confs); @@ -2622,7 +2617,7 @@ static int admin_exec(struct ast_channel *chan, void *data) { if (!args.command) { ast_log(LOG_WARNING, "MeetmeAdmin requires a command!\n"); AST_LIST_UNLOCK(&confs); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } AST_LIST_TRAVERSE(&confs, cnf, list) { @@ -2632,8 +2627,8 @@ static int admin_exec(struct ast_channel *chan, void *data) { if (!cnf) { ast_log(LOG_WARNING, "Conference number '%s' not found!\n", args.confno); - LOCAL_USER_REMOVE(u); AST_LIST_UNLOCK(&confs); + ast_module_user_remove(u); return 0; } @@ -2740,7 +2735,7 @@ static int admin_exec(struct ast_channel *chan, void *data) { AST_LIST_UNLOCK(&confs); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -3051,11 +3046,11 @@ static void load_config(void) load_config_sla(); } -static int unload_module(void *mod) +static int unload_module(void) { - int res; + int res = 0; - res = ast_cli_unregister(&cli_show_confs); + res |= ast_cli_unregister(&cli_show_confs); res |= ast_cli_unregister(&cli_sla_show); res |= ast_cli_unregister(&cli_conf); res |= ast_manager_unregister("MeetmeMute"); @@ -3066,14 +3061,14 @@ static int unload_module(void *mod) res |= ast_unregister_application(appslas); res |= ast_unregister_application(appslat); + ast_module_user_hangup_all(); ast_devstate_prov_del("Meetme"); ast_devstate_prov_del("SLA"); - STANDARD_HANGUP_LOCALUSERS; return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -3095,22 +3090,16 @@ static int load_module(void *mod) return res; } -static int reload(void *mod) +static int reload(void) { load_config(); return 0; } -static const char *description(void) -{ - return "MeetMe conference bridge"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, reload, NULL, NULL); +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "MeetMe conference bridge", + .load = load_module, + .unload = unload_module, + .reload = reload, + ); diff --git a/apps/app_milliwatt.c b/apps/app_milliwatt.c index 8c7fbe4c0..08a96f96b 100644 --- a/apps/app_milliwatt.c +++ b/apps/app_milliwatt.c @@ -50,7 +50,6 @@ static char *synopsis = "Generate a Constant 1000Hz tone at 0dbm (mu-law)"; static char *descrip = "Milliwatt(): Generate a Constant 1000Hz tone at 0dbm (mu-law)\n"; -LOCAL_USER_DECL; static char digital_milliwatt[] = {0x1e,0x0b,0x0b,0x1e,0x9e,0x8b,0x8b,0x9e} ; @@ -118,8 +117,8 @@ static struct ast_generator milliwattgen = static int milliwatt_exec(struct ast_channel *chan, void *data) { - struct localuser *u; - LOCAL_USER_ADD(u); + 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); if (chan->_state != AST_STATE_UP) @@ -129,39 +128,29 @@ 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } while(!ast_safe_sleep(chan, 10000)); ast_deactivate_generator(chan); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, milliwatt_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Digital Milliwatt (mu-law) Test Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Digital Milliwatt (mu-law) Test Application"); diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index 35511c4b2..2aaf7d6a8 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -164,7 +164,6 @@ static void *mixmonitor_thread(void *obj) struct mixmonitor *mixmonitor = obj; struct ast_frame *f = NULL; - ast_atomic_fetchadd_int(&__mod_desc->usecnt, +1); if (option_verbose > 1) ast_verbose(VERBOSE_PREFIX_2 "Begin MixMonitor Recording %s\n", mixmonitor->name); @@ -219,7 +218,6 @@ static void *mixmonitor_thread(void *obj) free(mixmonitor); - ast_atomic_fetchadd_int(&__mod_desc->usecnt, -1); return NULL; } @@ -322,7 +320,7 @@ 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 localuser *u; + struct ast_module_user *u; struct ast_flags flags = {0}; char *parse; AST_DECLARE_APP_ARGS(args, @@ -336,7 +334,7 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); parse = ast_strdupa(data); @@ -344,7 +342,7 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data) if (ast_strlen_zero(args.filename)) { ast_log(LOG_WARNING, "MixMonitor requires an argument (filename)\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -396,22 +394,22 @@ 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } static int stop_mixmonitor_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; - LOCAL_USER_ADD(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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -453,7 +451,7 @@ static struct ast_cli_entry cli_mixmonitor = { complete_mixmonitor_cli }; -static int unload_module(void *mod) +static int unload_module(void) { int res; @@ -461,12 +459,12 @@ static int unload_module(void *mod) res |= ast_unregister_application(stop_app); res |= ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -477,14 +475,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return "Mixed Audio Monitoring Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Mixed Audio Monitoring Application"); diff --git a/apps/app_morsecode.c b/apps/app_morsecode.c index 9bb02479e..cd4211231 100644 --- a/apps/app_morsecode.c +++ b/apps/app_morsecode.c @@ -41,8 +41,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/module.h" #include "asterisk/indications.h" -static char *tdesc = "Morse code"; - static char *app_morsecode = "Morsecode"; static char *morsecode_synopsis = "Plays morse code"; @@ -54,7 +52,6 @@ static char *morsecode_descrip = "(defaults to 80). Additionally, if MORSETONE is set, it will use that tone\n" "(in Hz). The tone default is 800.\n"; -LOCAL_USER_DECL; static char *morsecode[] = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* 0-15 */ @@ -114,13 +111,13 @@ static int morsecode_exec(struct ast_channel *chan, void *data) int res=0, ditlen, tone; char *digit; const char *ditlenc, *tonec; - struct localuser *u; + struct ast_module_user *u; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "Syntax: Morsecode(<string>) - no argument found\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -158,34 +155,24 @@ static int morsecode_exec(struct ast_channel *chan, void *data) playtone(chan, 0, 2 * ditlen); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app_morsecode); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app_morsecode, morsecode_exec, morsecode_synopsis, morsecode_descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Morse code"); diff --git a/apps/app_mp3.c b/apps/app_mp3.c index 3a48e7ef8..667de67ad 100644 --- a/apps/app_mp3.c +++ b/apps/app_mp3.c @@ -50,8 +50,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #define LOCAL_MPG_123 "/usr/local/bin/mpg123" #define MPG_123 "/usr/bin/mpg123" -static char *tdesc = "Silly MP3 Application"; - static char *app = "MP3Player"; static char *synopsis = "Play an MP3 file or stream"; @@ -61,7 +59,6 @@ static char *descrip = "which typically would be a filename or a URL. User can exit by pressing\n" "any key on the dialpad, or by hanging up."; -LOCAL_USER_DECL; static int mp3play(char *filename, int fd) { @@ -118,7 +115,7 @@ 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 localuser *u; + struct ast_module_user *u; int fds[2]; int ms = -1; int pid = -1; @@ -137,11 +134,11 @@ static int mp3_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (pipe(fds)) { ast_log(LOG_WARNING, "Unable to create pipe\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -151,7 +148,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -224,35 +221,25 @@ static int mp3_exec(struct ast_channel *chan, void *data) if (!res && owriteformat) ast_set_write_format(chan, owriteformat); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, mp3_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Silly MP3 Application"); diff --git a/apps/app_nbscat.c b/apps/app_nbscat.c index 188aa3c97..346584346 100644 --- a/apps/app_nbscat.c +++ b/apps/app_nbscat.c @@ -55,8 +55,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #define AF_LOCAL AF_UNIX #endif -static char *tdesc = "Silly NBS Stream Application"; - static char *app = "NBScat"; static char *synopsis = "Play an NBS local stream"; @@ -65,7 +63,6 @@ static char *descrip = " NBScat: Executes nbscat to listen to the local NBS stream.\n" "User can exit by pressing any key\n."; -LOCAL_USER_DECL; static int NBScatplay(int fd) { @@ -109,7 +106,7 @@ static int timed_read(int fd, void *data, int datalen) static int NBScat_exec(struct ast_channel *chan, void *data) { int res=0; - struct localuser *u; + struct ast_module_user *u; int fds[2]; int ms = -1; int pid = -1; @@ -122,11 +119,11 @@ static int NBScat_exec(struct ast_channel *chan, void *data) short frdata[160]; } myf; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (socketpair(AF_LOCAL, SOCK_STREAM, 0, fds)) { ast_log(LOG_WARNING, "Unable to create socketpair\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -136,7 +133,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -206,35 +203,25 @@ static int NBScat_exec(struct ast_channel *chan, void *data) if (!res && owriteformat) ast_set_write_format(chan, owriteformat); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, NBScat_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Silly NBS Stream Application"); diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index 88d90a984..c700e81ce 100644 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -878,29 +878,29 @@ static int osp_finish(int handle, int recorded, int cause, time_t start, time_t static int ospauth_exec(struct ast_channel* chan, void* data) { int res; - struct localuser* u; + struct ast_module_user *u; const char* provider = OSP_DEF_PROVIDER; int priority_jump = 0; - struct varshead* headp; - struct ast_var_t* current; - const char* source = ""; - const char* token = ""; + struct varshead *headp; + struct ast_var_t *current; + const char *source = ""; + const char *token = ""; int handle; unsigned int timelimit; char buffer[OSP_INTSTR_SIZE]; - const char* status; - char* tmp; + const char *status; + char *tmp; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(provider); AST_APP_ARG(options); ); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!(tmp = ast_strdupa(data))) { ast_log(LOG_ERROR, "Out of memory\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -959,7 +959,7 @@ static int ospauth_exec(struct ast_channel* chan, void* data) res = 0; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -973,16 +973,16 @@ static int ospauth_exec(struct ast_channel* chan, void* data) static int osplookup_exec(struct ast_channel* chan, void* data) { int res, cres; - struct localuser* u; - const char* provider = OSP_DEF_PROVIDER; + struct ast_module_user *u; + const char *provider = OSP_DEF_PROVIDER; int priority_jump = 0; - struct varshead* headp; + struct varshead *headp; struct ast_var_t* current; - const char* srcdev = ""; + const char *srcdev = ""; char buffer[OSP_TOKSTR_SIZE]; struct osp_result result; - const char* status; - char* tmp; + const char *status; + char *tmp; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(exten); @@ -995,11 +995,11 @@ static int osplookup_exec(struct ast_channel* chan, void* data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!(tmp = ast_strdupa(data))) { ast_log(LOG_ERROR, "Out of memory\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -1039,7 +1039,7 @@ static int osplookup_exec(struct ast_channel* chan, void* data) ast_log(LOG_DEBUG, "OSPLookup: source device '%s'\n", srcdev); if ((cres = ast_autoservice_start(chan)) < 0) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -1090,7 +1090,7 @@ static int osplookup_exec(struct ast_channel* chan, void* data) } if ((cres = ast_autoservice_stop(chan)) < 0) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -1105,7 +1105,7 @@ static int osplookup_exec(struct ast_channel* chan, void* data) res = 0; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -1119,7 +1119,7 @@ static int osplookup_exec(struct ast_channel* chan, void* data) static int ospnext_exec(struct ast_channel* chan, void* data) { int res; - struct localuser* u; + struct ast_module_user *u; int priority_jump = 0; int cause = 0; struct varshead* headp; @@ -1139,11 +1139,11 @@ static int ospnext_exec(struct ast_channel* chan, void* data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!(tmp = ast_strdupa(data))) { ast_log(LOG_ERROR, "Out of memory\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -1243,7 +1243,7 @@ static int ospnext_exec(struct ast_channel* chan, void* data) res = 0; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -1257,30 +1257,30 @@ static int ospnext_exec(struct ast_channel* chan, void* data) static int ospfinished_exec(struct ast_channel* chan, void* data) { int res = 1; - struct localuser* u; + struct ast_module_user *u; int priority_jump = 0; int cause = 0; - struct varshead* headp; - struct ast_var_t* current; + struct varshead *headp; + struct ast_var_t *current; int inhandle = OSP_INVALID_HANDLE; int outhandle = OSP_INVALID_HANDLE; int recorded = 0; time_t start, connect, end; unsigned int release; char buffer[OSP_INTSTR_SIZE]; - const char* status; - char* tmp; + const char *status; + char *tmp; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(cause); AST_APP_ARG(options); ); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!(tmp = ast_strdupa(data))) { ast_log(LOG_ERROR, "Out of memory\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -1376,7 +1376,7 @@ static int ospfinished_exec(struct ast_channel* chan, void* data) res = 0; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -1602,9 +1602,7 @@ static struct ast_cli_entry osp_cli = { osp_usage }; -LOCAL_USER_DECL; - -static int load_module(void* mod) +static int load_module(void) { int res; @@ -1618,7 +1616,7 @@ static int load_module(void* mod) return res; } -static int unload_module(void* mod) +static int unload_module(void) { int res; @@ -1629,26 +1627,21 @@ static int unload_module(void* mod) res |= ast_cli_unregister(&osp_cli); osp_unload(); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int reload(void* mod) +static int reload(void) { osp_unload(); osp_load(); - return 0; -} -static const char* description(void) -{ - return "Open Settlement Protocol Applications"; -} - -static const char* key(void) -{ - return ASTERISK_GPL_KEY; + return 0; } -STD_MOD(MOD_1, reload, NULL, NULL); +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Open Settlement Protocol Applications", + .load = load_module, + .unload = unload_module, + .reload = reload, + ); diff --git a/apps/app_page.c b/apps/app_page.c index 0d8965976..93146c9cd 100644 --- a/apps/app_page.c +++ b/apps/app_page.c @@ -63,7 +63,6 @@ static const char *page_descrip = " q - quiet, do not play beep to caller\n" " r - record the page into a file (see 'r' for app_meetme)\n"; -LOCAL_USER_DECL; enum { PAGE_DUPLEX = (1 << 0), @@ -143,7 +142,7 @@ static void launch_page(struct ast_channel *chan, const char *meetmeopts, const static int page_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; char *options; char *tech, *resource; char meetmeopts[80]; @@ -159,11 +158,11 @@ static int page_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!(app = pbx_findapp("MeetMe"))) { ast_log(LOG_WARNING, "There is no MeetMe application available!\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; }; @@ -204,36 +203,26 @@ static int page_exec(struct ast_channel *chan, void *data) pbx_exec(chan, app, meetmeopts); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app_page); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app_page, page_exec, page_synopsis, page_descrip); } -static const char *description(void) -{ - return "Page Multiple Phones"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Page Multiple Phones"); diff --git a/apps/app_parkandannounce.c b/apps/app_parkandannounce.c index 1b30a4902..66203b1b0 100644 --- a/apps/app_parkandannounce.c +++ b/apps/app_parkandannounce.c @@ -51,8 +51,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/lock.h" #include "asterisk/utils.h" -static char *tdesc = "Call Parking and Announce Application"; - static char *app = "ParkAndAnnounce"; static char *synopsis = "Park and Announce"; @@ -75,7 +73,6 @@ static char *descrip = "call was placed. Use with the Local channel to allow the dialplan to make\n" "use of this information.\n"; -LOCAL_USER_DECL; static int parkandannounce_exec(struct ast_channel *chan, void *data) { @@ -93,18 +90,18 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data) struct outgoing_helper oh; int outstate; - struct localuser *u; + 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; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); l=strlen(data)+2; if (!(orig_s = ast_malloc(l))) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } s=orig_s; @@ -114,7 +111,7 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data) if(! template) { ast_log(LOG_WARNING, "PARK: An announce template must be defined\n"); free(orig_s); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -126,7 +123,7 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data) if(!dial) { ast_log(LOG_WARNING, "PARK: A dial resource must be specified i.e: Console/dsp or Zap/g1/5551212\n"); free(orig_s); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } else { dialtech=strsep(&dial, "/"); @@ -159,7 +156,7 @@ 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); free(orig_s); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } /* At this point we have a priority and maybe an extension and a context */ @@ -206,13 +203,13 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "PARK: Channel %s was never answered for the announce.\n", dchan->name); ast_hangup(dchan); free(orig_s); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } } else { ast_log(LOG_WARNING, "PARK: Unable to allocate announce channel.\n"); free(orig_s); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -250,36 +247,26 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data) ast_hangup(dchan); free(orig_s); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { /* return ast_register_application(app, park_exec); */ return ast_register_application(app, parkandannounce_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Call Parking and Announce Application"); diff --git a/apps/app_playback.c b/apps/app_playback.c index 32114cad7..f3788c351 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -47,8 +47,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/localtime.h" #include "asterisk/say.h" -static char *tdesc = "Sound File Playback Application"; - static char *app = "Playback"; static char *synopsis = "Play a file"; @@ -69,7 +67,6 @@ static char *descrip = " SUCCESS | FAILED\n" ; -LOCAL_USER_DECL; static struct ast_config *say_cfg; /* save the say' api calls. @@ -381,7 +378,7 @@ static struct ast_cli_entry myclis[] = { static int playback_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u; + struct ast_module_user *u; char *tmp; int option_skip=0; int option_say=0; @@ -400,7 +397,7 @@ static int playback_exec(struct ast_channel *chan, void *data) tmp = ast_strdupa(data); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); AST_STANDARD_APP_ARGS(args, tmp); if (args.options) { @@ -446,11 +443,11 @@ static int playback_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, "PLAYBACKSTATUS", mres ? "FAILED" : "SUCCESS"); } done: - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int reload(void *mod) +static int reload(void) { if (say_cfg) { ast_config_destroy(say_cfg); @@ -464,13 +461,13 @@ static int reload(void *mod) return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); if (say_cfg) ast_config_destroy(say_cfg); @@ -478,21 +475,15 @@ static int unload_module(void *mod) return res; } -static int load_module(void *mod) +static int load_module(void) { - reload(mod); + reload(); ast_cli_register_multiple(myclis, sizeof(myclis)/sizeof(struct ast_cli_entry)); return ast_register_application(app, playback_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1,reload,NULL,NULL); +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Sound File Playback Application", + .load = load_module, + .unload = unload_module, + .reload = reload, + ); diff --git a/apps/app_privacy.c b/apps/app_privacy.c index 45c80ac16..277ffba4c 100644 --- a/apps/app_privacy.c +++ b/apps/app_privacy.c @@ -49,8 +49,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #define PRIV_CONFIG "privacy.conf" -static char *tdesc = "Require phone number to be entered, if no CallerID sent"; - static char *app = "PrivacyManager"; static char *synopsis = "Require phone number to be entered, if no CallerID sent"; @@ -76,7 +74,6 @@ static char *descrip = " SUCCESS | FAILED \n" ; -LOCAL_USER_DECL; static int privacy_exec (struct ast_channel *chan, void *data) { @@ -87,7 +84,7 @@ static int privacy_exec (struct ast_channel *chan, void *data) int x = 0; char *s; char phone[30]; - struct localuser *u; + struct ast_module_user *u; struct ast_config *cfg = NULL; char *parse = NULL; int priority_jump = 0; @@ -97,7 +94,8 @@ static int privacy_exec (struct ast_channel *chan, void *data) AST_APP_ARG(options); ); - LOCAL_USER_ADD (u); + 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"); @@ -106,13 +104,12 @@ static int privacy_exec (struct ast_channel *chan, void *data) if (chan->_state != AST_STATE_UP) { res = ast_answer(chan); if (res) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } } - if (!ast_strlen_zero((char *)data)) - { + if (!ast_strlen_zero(data)) { parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); @@ -211,34 +208,25 @@ static int privacy_exec (struct ast_channel *chan, void *data) ast_config_destroy(cfg); } - LOCAL_USER_REMOVE (u); - return 0; + ast_module_user_remove(u); + + return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application (app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application (app, privacy_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Require phone number to be entered, if no CallerID sent"); diff --git a/apps/app_queue.c b/apps/app_queue.c index 3e2f15340..448e8ca74 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -124,8 +124,6 @@ static struct strategy { #define RES_OUTOFMEMORY (-2) /* Out of memory */ #define RES_NOSUCHQUEUE (-3) /* No such queue */ -static char *tdesc = "True Call Queueing"; - static char *app = "Queue"; static char *synopsis = "Queue a call for a call queue"; @@ -289,7 +287,6 @@ struct callattempt { struct member *member; }; -LOCAL_USER_DECL; struct queue_ent { struct call_queue *parent; /*!< What queue is our parent */ @@ -2936,7 +2933,7 @@ static void reload_queue_members(void) static int pqm_exec(struct ast_channel *chan, void *data) { - struct localuser *lu; + struct ast_module_user *lu; char *parse; int priority_jump = 0; AST_DECLARE_APP_ARGS(args, @@ -2954,7 +2951,7 @@ static int pqm_exec(struct ast_channel *chan, void *data) AST_STANDARD_APP_ARGS(args, parse); - LOCAL_USER_ADD(lu); + lu = ast_module_user_add(chan); if (args.options) { if (strchr(args.options, 'j')) @@ -2963,7 +2960,7 @@ static int pqm_exec(struct ast_channel *chan, void *data) if (ast_strlen_zero(args.interface)) { ast_log(LOG_WARNING, "Missing interface argument to PauseQueueMember ([queuename]|interface[|options])\n"); - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); return -1; } @@ -2972,16 +2969,16 @@ static int pqm_exec(struct ast_channel *chan, void *data) if (priority_jump || ast_opt_priority_jumping) { if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) { pbx_builtin_setvar_helper(chan, "PQMSTATUS", "NOTFOUND"); - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); return 0; } } - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); pbx_builtin_setvar_helper(chan, "PQMSTATUS", "NOTFOUND"); return -1; } - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); pbx_builtin_setvar_helper(chan, "PQMSTATUS", "PAUSED"); return 0; @@ -2989,7 +2986,7 @@ static int pqm_exec(struct ast_channel *chan, void *data) static int upqm_exec(struct ast_channel *chan, void *data) { - struct localuser *lu; + struct ast_module_user *lu; char *parse; int priority_jump = 0; AST_DECLARE_APP_ARGS(args, @@ -3007,7 +3004,7 @@ static int upqm_exec(struct ast_channel *chan, void *data) AST_STANDARD_APP_ARGS(args, parse); - LOCAL_USER_ADD(lu); + lu = ast_module_user_add(chan); if (args.options) { if (strchr(args.options, 'j')) @@ -3016,7 +3013,7 @@ static int upqm_exec(struct ast_channel *chan, void *data) if (ast_strlen_zero(args.interface)) { ast_log(LOG_WARNING, "Missing interface argument to PauseQueueMember ([queuename]|interface[|options])\n"); - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); return -1; } @@ -3025,16 +3022,16 @@ static int upqm_exec(struct ast_channel *chan, void *data) if (priority_jump || ast_opt_priority_jumping) { if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101)) { pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "NOTFOUND"); - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); return 0; } } - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "NOTFOUND"); return -1; } - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "UNPAUSED"); return 0; @@ -3043,7 +3040,7 @@ static int upqm_exec(struct ast_channel *chan, void *data) static int rqm_exec(struct ast_channel *chan, void *data) { int res=-1; - struct localuser *lu; + struct ast_module_user *lu; char *parse, *temppos = NULL; int priority_jump = 0; AST_DECLARE_APP_ARGS(args, @@ -3062,7 +3059,7 @@ static int rqm_exec(struct ast_channel *chan, void *data) AST_STANDARD_APP_ARGS(args, parse); - LOCAL_USER_ADD(lu); + lu = ast_module_user_add(chan); if (ast_strlen_zero(args.interface)) { args.interface = ast_strdupa(chan->name); @@ -3096,7 +3093,7 @@ static int rqm_exec(struct ast_channel *chan, void *data) break; } - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); return res; } @@ -3104,7 +3101,7 @@ static int rqm_exec(struct ast_channel *chan, void *data) static int aqm_exec(struct ast_channel *chan, void *data) { int res=-1; - struct localuser *lu; + struct ast_module_user *lu; char *parse, *temppos = NULL; int priority_jump = 0; AST_DECLARE_APP_ARGS(args, @@ -3124,7 +3121,7 @@ static int aqm_exec(struct ast_channel *chan, void *data) AST_STANDARD_APP_ARGS(args, parse); - LOCAL_USER_ADD(lu); + lu = ast_module_user_add(chan); if (ast_strlen_zero(args.interface)) { args.interface = ast_strdupa(chan->name); @@ -3169,14 +3166,14 @@ static int aqm_exec(struct ast_channel *chan, void *data) break; } - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); return res; } static int ql_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; char *parse; AST_DECLARE_APP_ARGS(args, @@ -3192,7 +3189,7 @@ static int ql_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); parse = ast_strdupa(data); @@ -3201,14 +3198,14 @@ 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.peer) || ast_strlen_zero(args.event)) { ast_log(LOG_WARNING, "QueueLog requires arguments (queuename|uniqueid|peer|event[|additionalinfo])\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } ast_queue_log(args.queuename, args.uniqueid, args.peer, args.event, "%s", args.params ? args.params : ""); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -3217,7 +3214,7 @@ static int queue_exec(struct ast_channel *chan, void *data) { int res=-1; int ringing=0; - struct localuser *lu; + struct ast_module_user *lu; const char *user_priority; const char *max_penalty_str; int prio; @@ -3245,7 +3242,7 @@ static int queue_exec(struct ast_channel *chan, void *data) parse = ast_strdupa(data); AST_STANDARD_APP_ARGS(args, parse); - LOCAL_USER_ADD(lu); + lu = ast_module_user_add(chan); /* Setup our queue entry */ memset(&qe, 0, sizeof(qe)); @@ -3473,7 +3470,7 @@ check_turns: set_queue_result(chan, reason); res = 0; } - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); return res; } @@ -3482,7 +3479,7 @@ static int queue_function_qac(struct ast_channel *chan, char *cmd, char *data, c { int count = 0; struct call_queue *q; - struct localuser *lu; + struct ast_module_user *lu; struct member *m; buf[0] = '\0'; @@ -3492,7 +3489,7 @@ static int queue_function_qac(struct ast_channel *chan, char *cmd, char *data, c return -1; } - LOCAL_USER_ADD(lu); + lu = ast_module_user_add(chan); AST_LIST_LOCK(&queues); AST_LIST_TRAVERSE(&queues, q, list) { @@ -3515,7 +3512,7 @@ static int queue_function_qac(struct ast_channel *chan, char *cmd, char *data, c ast_log(LOG_WARNING, "queue %s was not found\n", data); snprintf(buf, len, "%d", count); - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); return 0; } @@ -3524,7 +3521,7 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, char *cmd, { int count = 0; struct call_queue *q; - struct localuser *lu; + struct ast_module_user *lu; buf[0] = '\0'; @@ -3533,7 +3530,7 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, char *cmd, return -1; } - LOCAL_USER_ADD(lu); + lu = ast_module_user_add(chan); AST_LIST_LOCK(&queues); AST_LIST_TRAVERSE(&queues, q, list) { @@ -3551,13 +3548,13 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, char *cmd, ast_log(LOG_WARNING, "queue %s was not found\n", data); snprintf(buf, len, "%d", count); - LOCAL_USER_REMOVE(lu); + ast_module_user_remove(lu); return 0; } static int queue_function_queuememberlist(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) { - struct localuser *u; + struct ast_module_user *u; struct call_queue *q; struct member *m; @@ -3569,7 +3566,7 @@ static int queue_function_queuememberlist(struct ast_channel *chan, char *cmd, c return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); AST_LIST_LOCK(&queues); AST_LIST_TRAVERSE(&queues, q, list) { @@ -3603,7 +3600,7 @@ static int queue_function_queuememberlist(struct ast_channel *chan, char *cmd, c /* We should already be terminated, but let's make sure. */ buf[len - 1] = '\0'; - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -4328,7 +4325,7 @@ static struct ast_cli_entry cli_remove_queue_member = { { "remove", "queue", "member", NULL }, handle_remove_queue_member, "Removes a channel from a specified queue", rqm_cmd_usage, complete_remove_queue_member }; -static int unload_module(void *mod) +static int unload_module(void) { int res; @@ -4352,14 +4349,14 @@ static int unload_module(void *mod) res |= ast_custom_function_unregister(&queuewaitingcount_function); res |= ast_unregister_application(app); - clear_and_free_interfaces(); + ast_module_user_hangup_all(); - STANDARD_HANGUP_LOCALUSERS; + clear_and_free_interfaces(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -4393,21 +4390,15 @@ static int load_module(void *mod) return res; } -static int reload(void *mod) +static int reload(void) { reload_queues(); return 0; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, reload, NULL, NULL); +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "True Call Queueing", + .load = load_module, + .unload = unload_module, + .reload = reload, + ); diff --git a/apps/app_random.c b/apps/app_random.c index 60ac2c141..8484f656d 100644 --- a/apps/app_random.c +++ b/apps/app_random.c @@ -41,8 +41,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") /*! \todo The Random() app should be removed from trunk following the release of 1.4 */ -static char *tdesc = "Random goto"; - static char *app_random = "Random"; static char *random_synopsis = "Conditionally branches, based upon a probability"; @@ -52,12 +50,11 @@ static char *random_descrip = " probability := INTEGER in the range 1 to 100\n" "DEPRECATED: Use GotoIf($[${RAND(1,100)} > <number>]?<label>)\n"; -LOCAL_USER_DECL; static int random_exec(struct ast_channel *chan, void *data) { int res=0; - struct localuser *u; + struct ast_module_user *u; char *s; char *prob; @@ -69,7 +66,7 @@ static int random_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); s = ast_strdupa(data); @@ -88,34 +85,24 @@ static int random_exec(struct ast_channel *chan, void *data) ast_verbose( VERBOSE_PREFIX_3 "Random branches to (%s,%s,%d)\n", chan->context,chan->exten, chan->priority+1); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app_random); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app_random, random_exec, random_synopsis, random_descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Random goto"); diff --git a/apps/app_read.c b/apps/app_read.c index f9c1f486f..262bbbbd2 100644 --- a/apps/app_read.c +++ b/apps/app_read.c @@ -57,8 +57,6 @@ AST_APP_OPTIONS(read_app_options, { AST_APP_OPTION('n', OPT_NOANSWER), }); -static char *tdesc = "Read Variable Application"; - static char *app = "Read"; static char *synopsis = "Read a variable"; @@ -82,14 +80,13 @@ static char *descrip = " timeout -- if greater than 0, that value will override the default timeout.\n\n" "Read should disconnect if the function fails or errors out.\n"; -LOCAL_USER_DECL; #define ast_next_data(instr,ptr,delim) if((ptr=strchr(instr,delim))) { *(ptr) = '\0' ; ptr++;} static int read_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u; + struct ast_module_user *u; char tmp[256]; int maxdigits=255; int tries = 1; @@ -113,7 +110,7 @@ static int read_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); argcopy = ast_strdupa(data); @@ -149,7 +146,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } ts=NULL; @@ -162,7 +159,7 @@ 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"); - LOCAL_USER_REMOVE(u); + 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 */ @@ -214,34 +211,24 @@ static int read_exec(struct ast_channel *chan, void *data) } } } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, read_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Read Variable Application"); diff --git a/apps/app_readfile.c b/apps/app_readfile.c index 8c5c4b1b5..7e43a3806 100644 --- a/apps/app_readfile.c +++ b/apps/app_readfile.c @@ -42,8 +42,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/app.h" #include "asterisk/module.h" -static char *tdesc = "Stores output of file into a variable"; - static char *app_readfile = "ReadFile"; static char *readfile_synopsis = "ReadFile(varname=file,length)"; @@ -54,12 +52,11 @@ static char *readfile_descrip = " File - The name of the file to read.\n" " Length - Maximum number of characters to capture.\n"; -LOCAL_USER_DECL; static int readfile_exec(struct ast_channel *chan, void *data) { int res=0; - struct localuser *u; + struct ast_module_user *u; char *s, *varname=NULL, *file=NULL, *length=NULL, *returnvar=NULL; int len=0; @@ -68,7 +65,7 @@ static int readfile_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); s = ast_strdupa(data); @@ -78,7 +75,7 @@ static int readfile_exec(struct ast_channel *chan, void *data) if (!varname || !file) { ast_log(LOG_ERROR, "No file or variable specified!\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -99,35 +96,25 @@ static int readfile_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, varname, returnvar); free(returnvar); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app_readfile); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app_readfile, readfile_exec, readfile_synopsis, readfile_descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Stores output of file into a variable"); diff --git a/apps/app_realtime.c b/apps/app_realtime.c index 3a974b629..cc7ad7dd4 100644 --- a/apps/app_realtime.c +++ b/apps/app_realtime.c @@ -49,7 +49,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #define next_one(var) var = var->next #define crop_data(str) { *(str) = '\0' ; (str)++; } -static char *tdesc = "Realtime Data Lookup/Rewrite"; static char *app = "RealTime"; static char *uapp = "RealTimeUpdate"; static char *synopsis = "Realtime Data Lookup"; @@ -69,7 +68,6 @@ static char *udesc = "Use the RealTime config handler system to update a value\n "updated to <newval>. REALTIMECOUNT will be set with the number of rows\n" "updated or -1 if an error occurs.\n"; -LOCAL_USER_DECL; static int cli_load_realtime(int fd, int argc, char **argv) { @@ -136,7 +134,7 @@ static struct ast_cli_entry cli_update_realtime_cmd = { static int realtime_update_exec(struct ast_channel *chan, void *data) { char *family=NULL, *colmatch=NULL, *value=NULL, *newcol=NULL, *newval=NULL; - struct localuser *u; + struct ast_module_user *u; int res = 0, count = 0; char countc[13]; @@ -147,7 +145,7 @@ static int realtime_update_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); family = ast_strdupa(data); if ((colmatch = strchr(family,'|'))) { @@ -171,7 +169,7 @@ static int realtime_update_exec(struct ast_channel *chan, void *data) snprintf(countc, sizeof(countc), "%d", count); pbx_builtin_setvar_helper(chan, "REALTIMECOUNT", countc); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -180,7 +178,7 @@ static int realtime_update_exec(struct ast_channel *chan, void *data) static int realtime_exec(struct ast_channel *chan, void *data) { int res=0, count=0; - struct localuser *u; + struct ast_module_user *u; struct ast_variable *var, *itt; char *family=NULL, *colmatch=NULL, *value=NULL, *prefix=NULL, *vname=NULL; char countc[13]; @@ -193,7 +191,7 @@ static int realtime_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); family = ast_strdupa(data); if ((colmatch = strchr(family,'|'))) { @@ -230,11 +228,11 @@ static int realtime_exec(struct ast_channel *chan, void *data) snprintf(countc, sizeof(countc), "%d", count); pbx_builtin_setvar_helper(chan, "REALTIMECOUNT", countc); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; @@ -243,12 +241,12 @@ static int unload_module(void *mod) res |= ast_unregister_application(uapp); res |= ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -260,14 +258,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Realtime Data Lookup/Rewrite"); diff --git a/apps/app_record.c b/apps/app_record.c index d30a3a791..243977ffb 100644 --- a/apps/app_record.c +++ b/apps/app_record.c @@ -72,7 +72,6 @@ static char *descrip = "If the user should hangup during a recording, all data will be lost and the\n" "application will teminate. \n"; -LOCAL_USER_DECL; static int record_exec(struct ast_channel *chan, void *data) { @@ -85,7 +84,7 @@ static int record_exec(struct ast_channel *chan, void *data) char tmp[256]; struct ast_filestream *s = '\0'; - struct localuser *u; + struct ast_module_user *u; struct ast_frame *f = NULL; struct ast_dsp *sildet = NULL; /* silence detector dsp */ @@ -111,7 +110,7 @@ static int record_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); /* Yay for strsep being easy */ vdata = ast_strdupa(data); @@ -135,7 +134,7 @@ static int record_exec(struct ast_channel *chan, void *data) } if (!ext) { ast_log(LOG_WARNING, "No extension specified to filename!\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } if (silstr) { @@ -194,7 +193,7 @@ 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 */ - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } else if (!option_noanswer) { /* Otherwise answer unless we're supposed to record while on-hook */ @@ -225,13 +224,13 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } sildet = ast_dsp_new(); if (!sildet) { ast_log(LOG_WARNING, "Unable to create silence detector :(\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } ast_dsp_set_threshold(sildet, 256); @@ -335,35 +334,25 @@ static int record_exec(struct ast_channel *chan, void *data) ast_dsp_free(sildet); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, record_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Trivial Record Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Trivial Record Application"); diff --git a/apps/app_rpt.c b/apps/app_rpt.c index 8449bd465..e1da544c9 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -1,4 +1,3 @@ -/* #define OLD_ASTERISK */ /* * Asterisk -- An open source telephony toolkit. * @@ -243,8 +242,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/say.h" #include "asterisk/localtime.h" -static char *tdesc = "Radio Repeater / Remote Base version 0.48 06/13/2006"; - static char *app = "Rpt"; static char *synopsis = "Radio Repeater/Remote Base Control System"; @@ -284,6 +281,9 @@ static char *descrip = " available to the phone user.\n" "\n"; +static unsigned int vmajor = 0; +static unsigned int vminor = 47; + static int debug = 0; /* FIXME Set this >0 for extra debug output */ static int nrpts = 0; @@ -295,7 +295,6 @@ static char *remote_rig_rbi="rbi"; STANDARD_LOCAL_USER; #endif -LOCAL_USER_DECL; #define MSWAIT 200 #define HANGTIME 5000 @@ -1960,7 +1959,6 @@ struct rpt_tele *tlist; struct rpt *myrpt; struct rpt_link *l,*m,linkbase; struct ast_channel *mychannel; -int vmajor, vminor; char *p,*ct,*ct_copy,*ident, *nodename; time_t t; struct tm localtm; @@ -2454,11 +2452,6 @@ struct tm localtm; imdone = 1; break; case STATS_VERSION: - p = strstr(tdesc, "version"); - if(!p) - break; - if(sscanf(p, "version %d.%d", &vmajor, &vminor) != 2) - break; wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */ /* Say "version" */ if (sayfile(mychannel,"rpt/version") == -1) @@ -7275,7 +7268,7 @@ char *this,*val; static int rpt_exec(struct ast_channel *chan, void *data) { int res=-1,i,rem_totx,n,phone_mode = 0; - struct localuser *u; + struct ast_module_user *u; char tmp[256], keyed = 0; char *options,*stringp,*tele,c; struct rpt *myrpt; @@ -7644,7 +7637,7 @@ 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; } - LOCAL_USER_ADD(u); + 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++) @@ -8009,19 +8002,15 @@ static int rpt_exec(struct ast_channel *chan, void *data) myrpt->remoteon = 0; rpt_mutex_unlock(&myrpt->lock); closerem(myrpt); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -#ifdef OLD_ASTERISK -int unload_module() -#else -static int unload_module(void* mod) -#endif +static int unload_module(void) { int i; - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); for(i = 0; i < nrpts; i++) { if (!strcmp(rpt_vars[i].name,rpt_vars[i].p.nodes)) continue; ast_mutex_destroy(&rpt_vars[i].lock); @@ -8039,11 +8028,7 @@ static int unload_module(void* mod) return i; } -#ifdef OLD_ASTERISK -int load_module() -#else -static int load_module(void *mod) -#endif +static int load_module(void) { ast_pthread_create(&rpt_master_thread,NULL,rpt_master,NULL); @@ -8058,45 +8043,16 @@ static int load_module(void *mod) return ast_register_application(app, rpt_exec, synopsis, descrip); } -#ifdef OLD_ASTERISK -char *description() -#else -static const char *description(void) -#endif -{ - return tdesc; -} - -#ifdef OLD_ASTERISK -int usecount(void) -{ - int res; - STANDARD_USECOUNT(res); - return res; -} -#endif - -#ifdef OLD_ASTERISK -char *key() -#else -static const char *key(void) -#endif +static int reload(void) { - return ASTERISK_GPL_KEY; -} - -#ifdef OLD_ASTERISK -int reload() -#else -static int reload(void *mod) -#endif -{ -int n; + int n; for(n = 0; n < nrpts; n++) rpt_vars[n].reload = 1; return(0); } -#ifndef OLD_ASTERISK -STD_MOD(MOD_1, reload, NULL, NULL); -#endif +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Radio Repeater / Remote Base", + .load = load_module, + .unload = unload_module, + .reload = reload, + ); diff --git a/apps/app_sayunixtime.c b/apps/app_sayunixtime.c index 31b69f9f9..2e9c9b323 100644 --- a/apps/app_sayunixtime.c +++ b/apps/app_sayunixtime.c @@ -43,8 +43,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/say.h" #include "asterisk/app.h" -static char *tdesc = "Say time"; - static char *app_sayunixtime = "SayUnixTime"; static char *app_datetime = "DateTime"; @@ -67,7 +65,6 @@ static char *datetime_descrip = " format: a format the time is to be said in. See voicemail.conf.\n" " defaults to \"ABdY 'digits/at' IMp\"\n"; -LOCAL_USER_DECL; static int sayunixtime_exec(struct ast_channel *chan, void *data) { @@ -78,7 +75,7 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data) ); char *parse; int res = 0; - struct localuser *u; + struct ast_module_user *u; time_t unixtime; if (!data) @@ -86,7 +83,7 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data) parse = ast_strdupa(data); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); AST_STANDARD_APP_ARGS(args, parse); @@ -99,24 +96,24 @@ 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app_sayunixtime); res |= ast_unregister_application(app_datetime); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -126,14 +123,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Say time"); diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c index 5ee4ecb01..67cb2d5c1 100644 --- a/apps/app_senddtmf.c +++ b/apps/app_senddtmf.c @@ -45,8 +45,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/app.h" #include "asterisk/manager.h" -static char *tdesc = "Send DTMF digits Application"; - static char *app = "SendDTMF"; static char *synopsis = "Sends arbitrary DTMF digits"; @@ -57,12 +55,11 @@ static char *descrip = " The application will either pass the assigned digits or terminate if it\n" " encounters an error.\n"; -LOCAL_USER_DECL; static int senddtmf_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u; + struct ast_module_user *u; char *digits = NULL, *to = NULL; int timeout = 250; @@ -71,7 +68,7 @@ static int senddtmf_exec(struct ast_channel *chan, void *data) return 0; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); digits = ast_strdupa(data); @@ -86,7 +83,7 @@ static int senddtmf_exec(struct ast_channel *chan, void *data) res = ast_dtmf_stream(chan,NULL,digits,timeout); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -122,19 +119,19 @@ static int manager_play_dtmf(struct mansession *s, struct message *m) return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); res |= ast_manager_unregister("PlayDTMF"); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -144,14 +141,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Send DTMF digits Application"); diff --git a/apps/app_sendtext.c b/apps/app_sendtext.c index 5be7726de..6828e3f76 100644 --- a/apps/app_sendtext.c +++ b/apps/app_sendtext.c @@ -63,12 +63,11 @@ static const char *descrip = "'j' -- jump to n+101 priority if the channel doesn't support\n" " text transport\n"; -LOCAL_USER_DECL; static int sendtext_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u; + struct ast_module_user *u; char *status = "UNSUPPORTED"; char *parse = NULL; int priority_jump = 0; @@ -77,11 +76,11 @@ static int sendtext_exec(struct ast_channel *chan, void *data) AST_APP_ARG(options); ); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "SendText requires an argument (text[|options])\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } else parse = ast_strdupa(data); @@ -99,7 +98,7 @@ static int sendtext_exec(struct ast_channel *chan, void *data) /* Does not support transport */ if (priority_jump || ast_opt_priority_jumping) ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } status = "FAILURE"; @@ -108,34 +107,24 @@ static int sendtext_exec(struct ast_channel *chan, void *data) if (!res) status = "SUCCESS"; pbx_builtin_setvar_helper(chan, "SENDTEXTSTATUS", status); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, sendtext_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Send Text Applications"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Send Text Applications"); diff --git a/apps/app_setcallerid.c b/apps/app_setcallerid.c index b8b079a39..4456e1ee0 100644 --- a/apps/app_setcallerid.c +++ b/apps/app_setcallerid.c @@ -47,7 +47,6 @@ static char *app2 = "SetCallerPres"; static char *synopsis2 = "Set CallerID Presentation"; -LOCAL_USER_DECL; static char *descrip2 = " SetCallerPres(presentation): Set Caller*ID presentation on a call.\n" @@ -67,29 +66,25 @@ static char *descrip2 = static int setcallerid_pres_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; int pres = -1; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); pres = ast_parse_caller_presentation(data); if (pres < 0) { ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show application SetCallerPres')\n", (char *) data); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } chan->cid.cid_pres = pres; - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } - - -static char *tdesc = "Set CallerID Application"; - static char *app = "SetCallerID"; static char *synopsis = "Set CallerID"; @@ -104,7 +99,7 @@ static int setcallerid_exec(struct ast_channel *chan, void *data) char *tmp = NULL; char name[256]; char num[256]; - struct localuser *u; + struct ast_module_user *u; char *opt; int anitoo = 0; static int dep_warning = 0; @@ -114,7 +109,7 @@ static int setcallerid_exec(struct ast_channel *chan, void *data) return 0; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!dep_warning) { dep_warning = 1; @@ -134,24 +129,24 @@ static int setcallerid_exec(struct ast_channel *chan, void *data) ast_callerid_split(tmp, name, sizeof(name), num, sizeof(num)); ast_set_callerid(chan, num, name, anitoo ? num : NULL); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app2); res |= ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -161,14 +156,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Set CallerID Application"); diff --git a/apps/app_setcdruserfield.c b/apps/app_setcdruserfield.c index 363532fe6..f6c83f48b 100644 --- a/apps/app_setcdruserfield.c +++ b/apps/app_setcdruserfield.c @@ -43,8 +43,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/utils.h" -static char *tdesc = "CDR user field apps"; - static char *setcdruserfield_descrip = "[Synopsis]\n" "SetCDRUserField(value)\n\n" @@ -74,7 +72,6 @@ static char *appendcdruserfield_descrip = static char *appendcdruserfield_app = "AppendCDRUserField"; static char *appendcdruserfield_synopsis = "Append to the CDR user field"; -LOCAL_USER_DECL; static int action_setcdruserfield(struct mansession *s, struct message *m) { @@ -107,11 +104,11 @@ static int action_setcdruserfield(struct mansession *s, struct message *m) static int setcdruserfield_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; int res = 0; static int dep_warning = 0; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (chan->cdr && data) { ast_cdr_setuserfield(chan, (char*)data); @@ -122,18 +119,18 @@ static int setcdruserfield_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "SetCDRUserField is deprecated. Please use CDR(userfield) instead.\n"); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } static int appendcdruserfield_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; int res = 0; static int dep_warning = 0; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (chan->cdr && data) { ast_cdr_appenduserfield(chan, (char*)data); @@ -144,12 +141,12 @@ static int appendcdruserfield_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "AppendCDRUserField is deprecated. Please use CDR(userfield) instead.\n"); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; @@ -157,12 +154,12 @@ static int unload_module(void *mod) res |= ast_unregister_application(appendcdruserfield_app); res |= ast_manager_unregister("SetCDRUserField"); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -173,14 +170,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "CDR user field apps"); diff --git a/apps/app_settransfercapability.c b/apps/app_settransfercapability.c index 6aff25c3b..ff67a4282 100644 --- a/apps/app_settransfercapability.c +++ b/apps/app_settransfercapability.c @@ -44,7 +44,6 @@ static char *app = "SetTransferCapability"; static char *synopsis = "Set ISDN Transfer Capability"; -LOCAL_USER_DECL; static struct { int val; char *name; } transcaps[] = { { AST_TRANS_CAP_SPEECH, "SPEECH" }, @@ -72,13 +71,13 @@ static char *descrip = static int settransfercapability_exec(struct ast_channel *chan, void *data) { char *tmp = NULL; - struct localuser *u; + struct ast_module_user *u; int x; char *opts; int transfercapability = -1; static int dep_warning = 0; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (!dep_warning) { dep_warning = 1; @@ -102,7 +101,7 @@ static int settransfercapability_exec(struct ast_channel *chan, void *data) } if (transfercapability < 0) { ast_log(LOG_WARNING, "'%s' is not a valid transfer capability (see 'show application SetTransferCapability')\n", tmp); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -111,36 +110,26 @@ static int settransfercapability_exec(struct ast_channel *chan, void *data) if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Setting transfer capability to: 0x%.2x - %s.\n", transfercapability, tmp); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, settransfercapability_exec, synopsis, descrip); } -static const char *description(void) -{ - return synopsis; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Set ISDN Transfer Capability"); diff --git a/apps/app_skel.c b/apps/app_skel.c index 33cc28a94..55830ebee 100644 --- a/apps/app_skel.c +++ b/apps/app_skel.c @@ -72,13 +72,12 @@ AST_APP_OPTIONS(app_opts,{ AST_APP_OPTION_ARG('c', OPTION_C, OPTION_ARG_C), }); -LOCAL_USER_DECL; static int app_exec(struct ast_channel *chan, void *data) { int res = 0; struct ast_flags flags; - struct localuser *u; + struct ast_module_user *u; char *parse, *opts[OPTION_ARG_ARRAY_SIZE]; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(dummy); @@ -90,7 +89,7 @@ static int app_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); /* Do our thing here */ @@ -114,32 +113,21 @@ 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] : "<unspecified>"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, app_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Trivial skeleton Application"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; - +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Skeleton (sample) Application"); diff --git a/apps/app_sms.c b/apps/app_sms.c index 816cc426f..aa9619b76 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -61,8 +61,6 @@ static volatile unsigned int seq; /* arbitrary message sequence number for static char log_file[255]; static char spool_dir[255]; -static char *tdesc = "SMS/PSTN handler"; - static char *app = "SMS"; static char *synopsis = "Communicates with SMS service centres and SMS capable analogue phones"; @@ -95,7 +93,6 @@ static signed short wave[] = { static unsigned char wavea[80]; #endif -LOCAL_USER_DECL; /* SMS 7 bit character mapping to UCS-2 */ static const unsigned short defaultalphabet[] = { @@ -1359,17 +1356,17 @@ static struct ast_generator smsgen = { static int sms_exec (struct ast_channel *chan, void *data) { int res = -1; - struct localuser *u; + struct ast_module_user *u; struct ast_frame *f; sms_t h = { 0 }; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); h.ipc0 = h.ipc1 = 20; /* phase for cosine */ h.dcs = 0xF1; /* default */ if (!data) { ast_log (LOG_ERROR, "Requires queue name at least\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -1382,13 +1379,13 @@ static int sms_exec (struct ast_channel *chan, void *data) answer = 0; if (!*d || *d == '|') { ast_log (LOG_ERROR, "Requires queue name\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } for (p = d; *p && *p != '|'; p++); if (p - d >= sizeof (h.queue)) { ast_log (LOG_ERROR, "Queue name too long\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } strncpy (h.queue, (char *)d, p - d); @@ -1457,7 +1454,7 @@ static int sms_exec (struct ast_channel *chan, void *data) h.rx = 0; /* sent message */ h.mr = -1; sms_writefile (&h); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -1481,13 +1478,13 @@ static int sms_exec (struct ast_channel *chan, void *data) res = ast_set_read_format (chan, AST_FORMAT_SLINEAR); if (res < 0) { ast_log (LOG_ERROR, "Unable to set to linear mode, giving up\n"); - LOCAL_USER_REMOVE (u); + ast_module_user_remove(u); return -1; } if (ast_activate_generator (chan, &smsgen, &h) < 0) { ast_log (LOG_ERROR, "Failed to activate generator on '%s'\n", chan->name); - LOCAL_USER_REMOVE (u); + ast_module_user_remove(u); return -1; } @@ -1506,22 +1503,22 @@ static int sms_exec (struct ast_channel *chan, void *data) sms_log (&h, '?'); /* log incomplete message */ - LOCAL_USER_REMOVE (u); + ast_module_user_remove(u); return (h.err); } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application (app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { #ifdef OUTALAW { @@ -1535,14 +1532,4 @@ static int load_module(void *mod) return ast_register_application (app, sms_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "SMS/PSTN handler"); diff --git a/apps/app_softhangup.c b/apps/app_softhangup.c index 5f2666561..46584c3e7 100644 --- a/apps/app_softhangup.c +++ b/apps/app_softhangup.c @@ -44,8 +44,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *synopsis = "Soft Hangup Application"; -static char *tdesc = "Hangs up the requested channel"; - static char *desc = " SoftHangup(Technology/resource|options)\n" "Hangs up the requested channel. If there are no channels to hangup,\n" "the application will report it.\n" @@ -54,11 +52,10 @@ static char *desc = " SoftHangup(Technology/resource|options)\n" static char *app = "SoftHangup"; -LOCAL_USER_DECL; static int softhangup_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; struct ast_channel *c=NULL; char *options, *cut, *cdata, *match; char name[AST_CHANNEL_NAME] = ""; @@ -69,7 +66,7 @@ static int softhangup_exec(struct ast_channel *chan, void *data) return 0; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); cdata = ast_strdupa(data); match = strsep(&cdata, "|"); @@ -100,35 +97,25 @@ static int softhangup_exec(struct ast_channel *chan, void *data) c = ast_channel_walk_locked(c); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, softhangup_exec, synopsis, desc); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Hangs up the requested channel"); diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c index a63eee828..397022fd4 100644 --- a/apps/app_speech_utils.c +++ b/apps/app_speech_utils.c @@ -43,10 +43,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$"); #include "asterisk/app.h" #include "asterisk/speech.h" -static char *tdesc = "Dialplan Speech Applications"; - -LOCAL_USER_DECL; - /* Descriptions for each application */ static char *speechcreate_descrip = "SpeechCreate(engine name)\n" @@ -312,18 +308,18 @@ static struct ast_custom_function speech_function = { /*! \brief SpeechCreate() Dialplan Application */ static int speech_create(struct ast_channel *chan, void *data) { - struct localuser *u = NULL; + struct ast_module_user *u = NULL; struct ast_speech *speech = NULL; struct ast_datastore *datastore = NULL; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); /* Request a speech object */ speech = ast_speech_new(data, AST_FORMAT_SLINEAR); if (speech == NULL) { /* Not available */ pbx_builtin_setvar_helper(chan, "ERROR", "1"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -331,13 +327,13 @@ static int speech_create(struct ast_channel *chan, void *data) if (datastore == NULL) { ast_speech_destroy(speech); pbx_builtin_setvar_helper(chan, "ERROR", "1"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } datastore->data = speech; ast_channel_datastore_add(chan, datastore); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -346,23 +342,23 @@ 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 localuser *u = NULL; + 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); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (speech == NULL) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } /* Parse out arguments */ argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])); if (argc != 2) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } name = argv[0]; @@ -371,7 +367,7 @@ static int speech_load(struct ast_channel *chan, void *data) /* Load the grammar locally on the object */ res = ast_speech_grammar_load(speech, name, path); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -380,20 +376,20 @@ static int speech_load(struct ast_channel *chan, void *data) static int speech_unload(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u = NULL; + struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (speech == NULL) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } /* Unload the grammar */ res = ast_speech_grammar_unload(speech, data); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -402,20 +398,20 @@ static int speech_unload(struct ast_channel *chan, void *data) static int speech_deactivate(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u = NULL; + struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (speech == NULL) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } /* Deactivate the grammar on the speech object */ res = ast_speech_grammar_deactivate(speech, data); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -424,20 +420,20 @@ static int speech_deactivate(struct ast_channel *chan, void *data) static int speech_activate(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u = NULL; + struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (speech == NULL) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } /* Activate the grammar on the speech object */ res = ast_speech_grammar_activate(speech, data); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -446,19 +442,19 @@ static int speech_activate(struct ast_channel *chan, void *data) static int speech_start(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u = NULL; + struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (speech == NULL) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } ast_speech_start(speech); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -467,13 +463,13 @@ 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 localuser *u = NULL; + struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (speech == NULL) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -484,7 +480,7 @@ static int speech_processing_sound(struct ast_channel *chan, void *data) speech->processing_sound = strdup(data); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -517,7 +513,7 @@ static int speech_background(struct ast_channel *chan, void *data) { unsigned int timeout = 0; int res = 0, done = 0, argc = 0, started = 0; - struct localuser *u = NULL; + struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); struct ast_frame *f = NULL; int oldreadformat = AST_FORMAT_SLINEAR; @@ -528,16 +524,16 @@ static int speech_background(struct ast_channel *chan, void *data) args = ast_strdupa(data); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (speech == NULL) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } /* If channel is not already answered, then answer it */ if (chan->_state != AST_STATE_UP && ast_answer(chan)) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -546,7 +542,7 @@ static int speech_background(struct ast_channel *chan, void *data) /* Change read format to be signed linear */ if (ast_set_read_format(chan, AST_FORMAT_SLINEAR)) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -563,7 +559,7 @@ static int speech_background(struct ast_channel *chan, void *data) if (filename != NULL && ast_streamfile(chan, filename, chan->language)) { /* An error occured while streaming */ ast_set_read_format(chan, oldreadformat); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -718,7 +714,7 @@ static int speech_background(struct ast_channel *chan, void *data) ast_set_read_format(chan, oldreadformat); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -728,14 +724,14 @@ static int speech_background(struct ast_channel *chan, void *data) static int speech_destroy(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u = NULL; + struct ast_module_user *u = NULL; struct ast_speech *speech = find_speech(chan); struct ast_datastore *datastore = NULL; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (speech == NULL) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } @@ -747,12 +743,12 @@ static int speech_destroy(struct ast_channel *chan, void *data) ast_channel_datastore_remove(chan, datastore); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res = 0; @@ -771,12 +767,12 @@ static int unload_module(void *mod) res |= ast_custom_function_unregister(&speech_grammar_function); res |= ast_custom_function_unregister(&speech_engine_function); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res = 0; @@ -798,14 +794,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dialplan Speech Applications"); diff --git a/apps/app_stack.c b/apps/app_stack.c index af1967799..34aa8693f 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -70,7 +70,6 @@ static const char *pop_descrip = "StackPop()\n" " Removes last label on the stack, discarding it.\n"; -LOCAL_USER_DECL; static int pop_exec(struct ast_channel *chan, void *data) { @@ -98,30 +97,30 @@ static int return_exec(struct ast_channel *chan, void *data) static int gosub_exec(struct ast_channel *chan, void *data) { char newlabel[AST_MAX_EXTENSION * 2 + 3 + 11]; - struct localuser *u; + struct ast_module_user *u; if (ast_strlen_zero(data)) { ast_log(LOG_ERROR, "%s requires an argument: %s([[context|]exten|]priority)\n", app_gosub, app_gosub); return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); snprintf(newlabel, sizeof(newlabel), "%s|%s|%d", chan->context, chan->exten, chan->priority + 1); if (ast_parseable_goto(chan, data)) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } pbx_builtin_pushvar_helper(chan, STACKVAR, newlabel); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } static int gosubif_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; char *condition="", *label1, *label2, *args; int res=0; @@ -132,7 +131,7 @@ static int gosubif_exec(struct ast_channel *chan, void *data) args = ast_strdupa(data); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); condition = strsep(&args, "?"); label1 = strsep(&args, ":"); @@ -146,23 +145,23 @@ static int gosubif_exec(struct ast_channel *chan, void *data) res = gosub_exec(chan, label2); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { ast_unregister_application(app_return); ast_unregister_application(app_pop); ast_unregister_application(app_gosubif); ast_unregister_application(app_gosub); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return 0; } -static int load_module(void *mod) +static int load_module(void) { ast_register_application(app_pop, pop_exec, pop_synopsis, pop_descrip); ast_register_application(app_return, return_exec, return_synopsis, return_descrip); @@ -172,14 +171,4 @@ static int load_module(void *mod) return 0; } -static const char *description(void) -{ - return "Stack Routines"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Stack Routines"); diff --git a/apps/app_system.c b/apps/app_system.c index 31585ab94..4bada66b2 100644 --- a/apps/app_system.c +++ b/apps/app_system.c @@ -44,8 +44,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/app.h" #include "asterisk/options.h" -static char *tdesc = "Generic System() application"; - static char *app = "System"; static char *app2 = "TrySystem"; @@ -83,12 +81,11 @@ static char *descrip2 = "instance, then the channel will be setup to continue at that\n" "priority level. Otherwise, System will terminate.\n"; -LOCAL_USER_DECL; static int system_exec_helper(struct ast_channel *chan, void *data, int failmode) { int res=0; - struct localuser *u; + struct ast_module_user *u; if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "System requires an argument(command)\n"); @@ -96,7 +93,7 @@ static int system_exec_helper(struct ast_channel *chan, void *data, int failmode return failmode; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); /* Do our thing here */ res = ast_safe_system((char *)data); @@ -121,7 +118,7 @@ static int system_exec_helper(struct ast_channel *chan, void *data, int failmode res = 0; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -136,19 +133,19 @@ static int trysystem_exec(struct ast_channel *chan, void *data) return system_exec_helper(chan, data, 0); } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); res |= ast_unregister_application(app2); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -158,14 +155,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Generic System() application"); diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c index 84368ec72..79cbbd5d0 100644 --- a/apps/app_talkdetect.c +++ b/apps/app_talkdetect.c @@ -43,8 +43,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/utils.h" #include "asterisk/dsp.h" -static char *tdesc = "Playback with Talk Detection"; - static char *app = "BackgroundDetect"; static char *synopsis = "Background a file with talk detect"; @@ -60,12 +58,11 @@ static char *descrip = "if available. If unspecified, sil, min, and max default to 1000, 100, and\n" "infinity respectively.\n"; -LOCAL_USER_DECL; static int background_detect_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u; + struct ast_module_user *u; char *tmp; char *options; char *stringp; @@ -84,7 +81,7 @@ static int background_detect_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); tmp = ast_strdupa(data); @@ -207,34 +204,24 @@ static int background_detect_exec(struct ast_channel *chan, void *data) } if (dsp) ast_dsp_free(dsp); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, background_detect_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Playback with Talk Detection"); diff --git a/apps/app_test.c b/apps/app_test.c index 885dd2572..b38fe4ca7 100644 --- a/apps/app_test.c +++ b/apps/app_test.c @@ -48,10 +48,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/pbx.h" #include "asterisk/utils.h" -LOCAL_USER_DECL; - -static char *tdesc = "Interface Test Application"; - static char *tests_descrip = "TestServer(): Perform test server function and write call report.\n" "Results stored in /var/log/asterisk/testreports/<testid>-server.txt"; @@ -133,7 +129,7 @@ static int sendnoise(struct ast_channel *chan, int ms) static int testclient_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; int res = 0; char *testid=data; char fn[80]; @@ -146,7 +142,7 @@ static int testclient_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (chan->_state != AST_STATE_UP) res = ast_answer(chan); @@ -318,18 +314,18 @@ 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; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } static int testserver_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; int res = 0; char testid[80]=""; char fn[80]; FILE *f; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (chan->_state != AST_STATE_UP) res = ast_answer(chan); /* Read version */ @@ -487,23 +483,23 @@ 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; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(testc_app); res |= ast_unregister_application(tests_app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -513,14 +509,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Interface Test Application"); diff --git a/apps/app_transfer.c b/apps/app_transfer.c index ff3182702..cda2914c7 100644 --- a/apps/app_transfer.c +++ b/apps/app_transfer.c @@ -45,7 +45,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/options.h" #include "asterisk/app.h" -LOCAL_USER_DECL; static const char *app = "Transfer"; @@ -70,7 +69,7 @@ static int transfer_exec(struct ast_channel *chan, void *data) { int res; int len; - struct localuser *u; + struct ast_module_user *u; char *slash; char *tech = NULL; char *dest = NULL; @@ -82,11 +81,11 @@ static int transfer_exec(struct ast_channel *chan, void *data) AST_APP_ARG(options); ); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (ast_strlen_zero((char *)data)) { ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination[|options])\n"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE"); return 0; } else @@ -107,7 +106,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } } @@ -115,7 +114,7 @@ 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"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -133,35 +132,25 @@ static int transfer_exec(struct ast_channel *chan, void *data) pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", status); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, transfer_exec, synopsis, descrip); } -static const char *description(void) -{ - return "Transfer"; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Transfer"); diff --git a/apps/app_url.c b/apps/app_url.c index 3c5d873a8..272c18928 100644 --- a/apps/app_url.c +++ b/apps/app_url.c @@ -43,8 +43,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/image.h" #include "asterisk/options.h" -static char *tdesc = "Send URL Applications"; - static char *app = "SendURL"; static char *synopsis = "Send a URL"; @@ -70,12 +68,11 @@ static char *descrip = " SendURL only returns 0 if the URL was sent correctly or if\n" " the channel does not support HTML transport, and -1 otherwise.\n"; -LOCAL_USER_DECL; static int sendurl_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u; + struct ast_module_user *u; char *tmp; char *options; int local_option_wait=0; @@ -90,7 +87,7 @@ static int sendurl_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); tmp = ast_strdupa(data); @@ -107,13 +104,13 @@ static int sendurl_exec(struct ast_channel *chan, void *data) if (local_option_jump || ast_opt_priority_jumping) ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101); pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", "UNSUPPORTED"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } res = ast_channel_sendurl(chan, tmp); if (res == -1) { pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", "FAILURE"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } status = "SUCCESS"; @@ -155,34 +152,24 @@ static int sendurl_exec(struct ast_channel *chan, void *data) } out: pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", status); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, sendurl_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Send URL Applications"); diff --git a/apps/app_userevent.c b/apps/app_userevent.c index 9e7c3b107..075618507 100644 --- a/apps/app_userevent.c +++ b/apps/app_userevent.c @@ -39,8 +39,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/manager.h" #include "asterisk/app.h" -static char *tdesc = "Custom User Event Application"; - static char *app = "UserEvent"; static char *synopsis = "Send an arbitrary event to the manager interface"; @@ -56,11 +54,10 @@ static char *descrip = " [body]\n" "If no body is specified, only Event and UserEvent headers will be present.\n"; -LOCAL_USER_DECL; static int userevent_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; char *parse, buf[2048] = ""; int x, buflen = 0; AST_DECLARE_APP_ARGS(args, @@ -73,7 +70,7 @@ static int userevent_exec(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); parse = ast_strdupa(data); @@ -88,34 +85,25 @@ static int userevent_exec(struct ast_channel *chan, void *data) manager_event(EVENT_FLAG_USER, "UserEvent", "UserEvent: %s\r\n%s\r\n", args.eventname, buf); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); + return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, userevent_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Custom User Event Application"); diff --git a/apps/app_verbose.c b/apps/app_verbose.c index 33f666025..f9bcfd116 100644 --- a/apps/app_verbose.c +++ b/apps/app_verbose.c @@ -39,9 +39,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/pbx.h" #include "asterisk/module.h" - -static char *tdesc = "Send verbose output"; - static char *app_verbose = "Verbose"; static char *verbose_synopsis = "Send arbitrary text to verbose output"; static char *verbose_descrip = @@ -54,15 +51,14 @@ static char *log_descrip = "Log(<level>|<message>)\n" " level must be one of ERROR, WARNING, NOTICE, DEBUG, VERBOSE, DTMF\n"; -LOCAL_USER_DECL; static int verbose_exec(struct ast_channel *chan, void *data) { char *vtext; int vsize; - struct localuser *u; + struct ast_module_user *u; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (data) { char *tmp; @@ -97,7 +93,7 @@ static int verbose_exec(struct ast_channel *chan, void *data) } } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -105,13 +101,13 @@ static int verbose_exec(struct ast_channel *chan, void *data) static int log_exec(struct ast_channel *chan, void *data) { char *level, *ltext; - struct localuser *u; + struct ast_module_user *u; int lnum = -1; char extension[AST_MAX_EXTENSION + 5], context[AST_MAX_EXTENSION + 2]; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (ast_strlen_zero(data)) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } @@ -143,23 +139,23 @@ static int log_exec(struct ast_channel *chan, void *data) ast_log(lnum, extension, chan->priority, context, "%s\n", ltext); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app_verbose); res |= ast_unregister_application(app_log); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -169,14 +165,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Send verbose output"); diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index c6520ec75..60df5dcea 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -397,12 +397,12 @@ static char VM_SPOOL_DIR[PATH_MAX]; static char ext_pass_cmd[128]; #ifdef ODBC_STORAGE -static char *tdesc = "Comedian Mail (Voicemail System) with ODBC Storage"; +#define tdesc "Comedian Mail (Voicemail System) with ODBC Storage" #else #ifdef IMAP_STORAGE -static char *tdesc = "Comedian Mail (Voicemail System) with IMAP Storage"; +#define tdesc "Comedian Mail (Voicemail System) with IMAP Storage" #else -static char *tdesc = "Comedian Mail (Voicemail System)"; +#define tdesc "Comedian Mail (Voicemail System)" #endif #endif @@ -531,7 +531,6 @@ static unsigned char adsisec[4] = "\x9B\xDB\xF7\xAC"; static int adsiver = 1; static char emaildateformat[32] = "%A, %B %d, %Y at %r"; -LOCAL_USER_DECL; static void populate_defaults(struct ast_vm_user *vmu) { @@ -5971,7 +5970,7 @@ static int vm_execmain(struct ast_channel *chan, void *data) int res=-1; int cmd=0; int valid = 0; - struct localuser *u; + struct ast_module_user *u; char prefixstr[80] =""; char ext_context[256]=""; int box; @@ -5988,7 +5987,7 @@ static int vm_execmain(struct ast_channel *chan, void *data) #ifdef IMAP_STORAGE int deleted = 0; #endif - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); /* Add the vm_state to the active list and keep it active */ memset(&vms, 0, sizeof(vms)); @@ -6015,7 +6014,7 @@ static int vm_execmain(struct ast_channel *chan, void *data) if (args.argc == 2) { if (ast_app_parse_options(vm_app_options, &flags, opts, args.argv1)) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } if (ast_test_flag(&flags, OPT_RECORDGAIN)) { @@ -6023,7 +6022,7 @@ static int vm_execmain(struct ast_channel *chan, void *data) if (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]); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } else { record_gain = (signed char) gain; @@ -6493,7 +6492,7 @@ out: free(vms.deleted); if (vms.heard) free(vms.heard); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -6501,7 +6500,7 @@ out: static int vm_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u; + struct ast_module_user *u; char *tmp; struct leave_vm_options leave_options; struct ast_flags flags = { 0 }; @@ -6512,7 +6511,7 @@ static int vm_exec(struct ast_channel *chan, void *data) AST_APP_ARG(argv1); ); - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); memset(&leave_options, 0, sizeof(leave_options)); @@ -6524,7 +6523,7 @@ static int vm_exec(struct ast_channel *chan, void *data) AST_STANDARD_APP_ARGS(args, tmp); if (args.argc == 2) { if (ast_app_parse_options(vm_app_options, &flags, opts, args.argv1)) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } ast_copy_flags(&leave_options, &flags, OPT_SILENT | OPT_BUSY_GREETING | OPT_UNAVAIL_GREETING | OPT_PRIORITY_JUMP); @@ -6533,7 +6532,7 @@ static int vm_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]); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return -1; } else { leave_options.record_gain = (signed char) gain; @@ -6570,11 +6569,11 @@ static int vm_exec(struct ast_channel *chan, void *data) char tmp[256]; res = ast_app_getdata(chan, "vm-whichbox", tmp, sizeof(tmp) - 1, 0); if (res < 0) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } if (ast_strlen_zero(tmp)) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } args.argv0 = ast_strdupa(tmp); @@ -6592,7 +6591,7 @@ static int vm_exec(struct ast_channel *chan, void *data) res = 0; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -6631,7 +6630,7 @@ static int append_mailbox(char *context, char *mbox, char *data) static int vm_box_exists(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; struct ast_vm_user svm; char *context, *box; int priority_jump = 0; @@ -6645,7 +6644,7 @@ static int vm_box_exists(struct ast_channel *chan, void *data) return -1; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); box = ast_strdupa(data); @@ -6668,20 +6667,20 @@ static int vm_box_exists(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "VM box %s@%s exists, but extension %s, priority %d doesn't exist\n", box, context, chan->exten, chan->priority + 101); } else pbx_builtin_setvar_helper(chan, "VMBOXEXISTSSTATUS", "FAILED"); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } static int vmauthenticate(struct ast_channel *chan, void *data) { - struct localuser *u; + 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; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (s) { s = ast_strdupa(s); @@ -6708,7 +6707,7 @@ static int vmauthenticate(struct ast_channel *chan, void *data) res = 0; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } @@ -7333,12 +7332,12 @@ static int load_config(void) } } -static int reload(void *mod) +static int reload(void) { return(load_config()); } -static int unload_module(void *mod) +static int unload_module(void) { int res; @@ -7350,12 +7349,12 @@ static int unload_module(void *mod) res |= ast_cli_unregister(&show_voicemail_zones_cli); ast_uninstall_vm_functions(); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; res = ast_register_application(app, vm_exec, synopsis_vm, descrip_vm); @@ -8556,16 +8555,11 @@ static void get_mailbox_delimiter(MAILSTREAM *stream) { mail_list(stream, "", "*"); } -#endif - -static const char *description(void) -{ - return tdesc; -} -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD(MOD_1, reload, NULL, NULL); +#endif /* IMAP_STORAGE */ + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, tdesc, + .load = load_module, + .unload = unload_module, + .reload = reload, + ); diff --git a/apps/app_waitforring.c b/apps/app_waitforring.c index 9da5d0702..a4f69ae77 100644 --- a/apps/app_waitforring.c +++ b/apps/app_waitforring.c @@ -45,8 +45,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *synopsis = "Wait for Ring Application"; -static char *tdesc = "Waits until first ring after time"; - static char *desc = " WaitForRing(timeout)\n" "Returns 0 after waiting at least timeout seconds. and\n" "only after the next ring has completed. Returns 0 on\n" @@ -54,11 +52,10 @@ static char *desc = " WaitForRing(timeout)\n" static char *app = "WaitForRing"; -LOCAL_USER_DECL; static int waitforring_exec(struct ast_channel *chan, void *data) { - struct localuser *u; + struct ast_module_user *u; struct ast_frame *f; int res = 0; int ms; @@ -68,7 +65,7 @@ static int waitforring_exec(struct ast_channel *chan, void *data) return 0; } - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); ms *= 1000; while(ms > 0) { @@ -115,35 +112,25 @@ static int waitforring_exec(struct ast_channel *chan, void *data) } } } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, waitforring_exec, synopsis, desc); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Waits until first ring after time"); diff --git a/apps/app_waitforsilence.c b/apps/app_waitforsilence.c index 3352aa4b9..890bf01eb 100644 --- a/apps/app_waitforsilence.c +++ b/apps/app_waitforsilence.c @@ -48,7 +48,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/module.h" #include "asterisk/options.h" -static char *tdesc = "Wait For Silence"; static char *app = "WaitForSilence"; static char *synopsis = "Waits for a specified amount of silence"; static char *descrip = @@ -61,7 +60,6 @@ static char *descrip = " - WaitForSilence(500|2) will wait for 1/2 second of silence, twice\n" " - WaitForSilence(1000) will wait for 1 second of silence, once\n"; -LOCAL_USER_DECL; static int do_waiting(struct ast_channel *chan, int maxsilence) { @@ -149,11 +147,11 @@ static int do_waiting(struct ast_channel *chan, int maxsilence) { static int waitforsilence_exec(struct ast_channel *chan, void *data) { int res = 1; - struct localuser *u; + struct ast_module_user *u; int maxsilence = 1000; int iterations = 1, i; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); res = ast_answer(chan); /* Answer the channel */ @@ -169,36 +167,26 @@ static int waitforsilence_exec(struct ast_channel *chan, void *data) for (i=0; (i<iterations) && (res == 1); i++) { res = do_waiting(chan, maxsilence); } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); if (res > 0) res = 0; return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, waitforsilence_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Wait For Silence"); diff --git a/apps/app_while.c b/apps/app_while.c index 2aec886bc..33f9bbb51 100644 --- a/apps/app_while.c +++ b/apps/app_while.c @@ -44,7 +44,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/lock.h" #include "asterisk/options.h" -#define ALL_DONE(u,ret) {LOCAL_USER_REMOVE(u); return ret;} +#define ALL_DONE(u,ret) {ast_module_user_remove(u); return ret;} static char *start_app = "While"; @@ -75,10 +75,6 @@ static char *continue_desc = "Returns to the top of the while loop and re-evaluates the conditional.\n"; static char *continue_synopsis = "Restart a While loop"; -static char *tdesc = "While Loops and Conditional Execution"; - -LOCAL_USER_DECL; - #define VAR_SIZE 64 @@ -168,7 +164,7 @@ 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 localuser *u; + struct ast_module_user *u; const char *while_pri = NULL; char *my_name = NULL; const char *condition = NULL, *label = NULL; @@ -183,7 +179,7 @@ static int _while_exec(struct ast_channel *chan, void *data, int end) return -1; } - LOCAL_USER_ADD(u); + 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 ...... @@ -310,7 +306,7 @@ static int while_continue_exec(struct ast_channel *chan, void *data) return 0; } -static int unload_module(void *mod) +static int unload_module(void) { int res; @@ -319,12 +315,12 @@ static int unload_module(void *mod) res |= ast_unregister_application(exit_app); res |= ast_unregister_application(continue_app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { int res; @@ -336,14 +332,4 @@ static int load_module(void *mod) return res; } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "While Loops and Conditional Execution"); diff --git a/apps/app_zapateller.c b/apps/app_zapateller.c index 21f6e2fa4..06941b16a 100644 --- a/apps/app_zapateller.c +++ b/apps/app_zapateller.c @@ -41,8 +41,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/module.h" #include "asterisk/translate.h" -static char *tdesc = "Block Telemarketers with Special Information Tone"; - static char *app = "Zapateller"; static char *synopsis = "Block telemarketers with SIT"; @@ -56,17 +54,16 @@ static char *descrip = "is no callerid information available. Options should be separated by |\n" "characters\n"; -LOCAL_USER_DECL; static int zapateller_exec(struct ast_channel *chan, void *data) { int res = 0; - struct localuser *u; + struct ast_module_user *u; int answer = 0, nocallerid = 0; char *c; char *stringp=NULL; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); stringp=data; c = strsep(&stringp, "|"); @@ -89,7 +86,7 @@ static int zapateller_exec(struct ast_channel *chan, void *data) } } if (chan->cid.cid_num && nocallerid) { - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } if (!res) @@ -100,34 +97,24 @@ static int zapateller_exec(struct ast_channel *chan, void *data) res = ast_tonepair(chan, 1800, 0, 330, 0); if (!res) res = ast_tonepair(chan, 0, 0, 1000, 0); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, zapateller_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Block Telemarketers with Special Information Tone"); diff --git a/apps/app_zapbarge.c b/apps/app_zapbarge.c index 843e6151a..735020f60 100644 --- a/apps/app_zapbarge.c +++ b/apps/app_zapbarge.c @@ -60,8 +60,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/say.h" #include "asterisk/utils.h" -static char *tdesc = "Barge in on Zap channel application"; - static char *app = "ZapBarge"; static char *synopsis = "Barge in (monitor) Zap channel"; @@ -72,7 +70,6 @@ static char *descrip = "-1 when caller user hangs up and is independent of the\n" "state of the channel being monitored."; -LOCAL_USER_DECL; #define CONF_SIZE 160 @@ -263,19 +260,19 @@ outrun: static int conf_exec(struct ast_channel *chan, void *data) { int res=-1; - struct localuser *u; + struct ast_module_user *u; int retrycnt = 0; int confflags = 0; int confno = 0; char confstr[80] = ""; - LOCAL_USER_ADD(u); + 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); - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return 0; } } @@ -298,35 +295,24 @@ static int conf_exec(struct ast_channel *chan, void *data) } out: /* Do the conference */ - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, conf_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; - +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Barge in on Zap channel application"); diff --git a/apps/app_zapras.c b/apps/app_zapras.c index 8896eb274..de682f72c 100644 --- a/apps/app_zapras.c +++ b/apps/app_zapras.c @@ -58,8 +58,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/module.h" #include "asterisk/options.h" -static char *tdesc = "Zap RAS Application"; - static char *app = "ZapRAS"; static char *synopsis = "Executes Zaptel ISDN RAS application"; @@ -71,7 +69,6 @@ static char *descrip = "Your pppd must be patched to be zaptel aware. Arguments should be\n" "separated by | characters.\n"; -LOCAL_USER_DECL; #define PPP_MAX_ARGS 32 #define PPP_EXEC "/usr/sbin/pppd" @@ -195,13 +192,13 @@ static int zapras_exec(struct ast_channel *chan, void *data) { int res=-1; char *args; - struct localuser *u; + struct ast_module_user *u; ZT_PARAMS ztp; if (!data) data = ""; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); args = ast_strdupa(data); @@ -229,35 +226,25 @@ static int zapras_exec(struct ast_channel *chan, void *data) run_ras(chan, args); } } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, zapras_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Zap RAS Application"); diff --git a/apps/app_zapscan.c b/apps/app_zapscan.c index d0a017072..690d9a5cc 100644 --- a/apps/app_zapscan.c +++ b/apps/app_zapscan.c @@ -59,8 +59,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/cli.h" #include "asterisk/say.h" -static char *tdesc = "Scan Zap channels application"; - static char *app = "ZapScan"; static char *synopsis = "Scan Zap channels to monitor calls"; @@ -70,7 +68,6 @@ static char *descrip = "a convenient way. Use '#' to select the next channel and use '*' to exit\n" "Limit scanning to a channel GROUP by setting the option group argument.\n"; -LOCAL_USER_DECL; #define CONF_SIZE 160 @@ -290,7 +287,7 @@ 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 localuser *u; + struct ast_module_user *u; int confflags = 0; int confno = 0; char confstr[80] = "", *tmp = NULL; @@ -299,7 +296,7 @@ static int conf_exec(struct ast_channel *chan, void *data) char *desired_group; int input=0,search_group=0; - LOCAL_USER_ADD(u); + u = ast_module_user_add(chan); if (chan->_state != AST_STATE_UP) ast_answer(chan); @@ -360,35 +357,25 @@ static int conf_exec(struct ast_channel *chan, void *data) ast_mutex_unlock(&tempchan->lock); lastchan = tempchan; } - LOCAL_USER_REMOVE(u); + ast_module_user_remove(u); return res; } -static int unload_module(void *mod) +static int unload_module(void) { int res; res = ast_unregister_application(app); - STANDARD_HANGUP_LOCALUSERS; + ast_module_user_hangup_all(); return res; } -static int load_module(void *mod) +static int load_module(void) { return ast_register_application(app, conf_exec, synopsis, descrip); } -static const char *description(void) -{ - return tdesc; -} - -static const char *key(void) -{ - return ASTERISK_GPL_KEY; -} - -STD_MOD1; +AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Scan Zap channels application"); |