it's a good idea to unregister everything before calling STANDARD_HANGUP_LOCALUSERS
authorRussell Bryant <russell@russellbryant.com>
Tue, 18 Oct 2005 22:52:21 +0000 (22:52 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 18 Oct 2005 22:52:21 +0000 (22:52 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6828 65c4cc65-6c06-0410-ace0-fbb531ad65f3

85 files changed:
apps/app_adsiprog.c
apps/app_alarmreceiver.c
apps/app_authenticate.c
apps/app_cdr.c
apps/app_chanisavail.c
apps/app_chanspy.c
apps/app_controlplayback.c
apps/app_curl.c
apps/app_cut.c
apps/app_datetime.c
apps/app_db.c
apps/app_dial.c
apps/app_dictate.c
apps/app_directed_pickup.c
apps/app_directory.c
apps/app_disa.c
apps/app_dumpchan.c
apps/app_echo.c
apps/app_enumlookup.c
apps/app_eval.c
apps/app_exec.c
apps/app_externalivr.c
apps/app_festival.c
apps/app_flash.c
apps/app_forkcdr.c
apps/app_getcpeid.c
apps/app_groupcount.c
apps/app_hasnewvoicemail.c
apps/app_ices.c
apps/app_image.c
apps/app_intercom.c
apps/app_ivrdemo.c
apps/app_lookupblacklist.c
apps/app_lookupcidname.c
apps/app_macro.c
apps/app_math.c
apps/app_md5.c
apps/app_meetme.c
apps/app_milliwatt.c
apps/app_mixmonitor.c
apps/app_mp3.c
apps/app_muxmon.c
apps/app_nbscat.c
apps/app_osplookup.c
apps/app_page.c
apps/app_parkandannounce.c
apps/app_playback.c
apps/app_privacy.c
apps/app_queue.c
apps/app_random.c
apps/app_read.c
apps/app_readfile.c
apps/app_realtime.c
apps/app_record.c
apps/app_sayunixtime.c
apps/app_senddtmf.c
apps/app_sendtext.c
apps/app_setcallerid.c
apps/app_setcdruserfield.c
apps/app_setcidname.c
apps/app_setcidnum.c
apps/app_setrdnis.c
apps/app_settransfercapability.c
apps/app_skel.c
apps/app_sms.c
apps/app_softhangup.c
apps/app_sql_postgres.c
apps/app_striplsd.c
apps/app_substring.c
apps/app_system.c
apps/app_talkdetect.c
apps/app_test.c
apps/app_transfer.c
apps/app_txtcidname.c
apps/app_url.c
apps/app_userevent.c
apps/app_verbose.c
apps/app_voicemail.c
apps/app_waitforring.c
apps/app_waitforsilence.c
apps/app_while.c
apps/app_zapateller.c
apps/app_zapbarge.c
apps/app_zapras.c
apps/app_zapscan.c

index 08f7117..bf6260b 100755 (executable)
@@ -1570,8 +1570,13 @@ static int adsi_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);  
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index 2b12fd4..4513acf 100755 (executable)
@@ -829,8 +829,13 @@ static int load_config(void)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index d7dcf08..d9e69fd 100755 (executable)
@@ -199,8 +199,13 @@ static int auth_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+       
+       return res;
 }
 
 int load_module(void)
index 49fa399..e5d18fa 100755 (executable)
@@ -55,8 +55,13 @@ static int nocdr_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(nocdr_app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(nocdr_app);
+
+       return res;
 }
 
 int load_module(void)
index 7dc2ba0..6f60fba 100755 (executable)
@@ -148,8 +148,13 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res = 0;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+       
+       return res;
 }
 
 int load_module(void)
index 6d6f38d..defb190 100755 (executable)
@@ -709,8 +709,13 @@ static int chanspy_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index c096869..8576cbb 100755 (executable)
@@ -132,9 +132,13 @@ static int controlplayback_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
 
-       return ast_unregister_application(app);
+       return res;
 }
 
 int load_module(void)
index d69d362..e146585 100755 (executable)
@@ -204,22 +204,31 @@ struct ast_custom_function acf_curl = {
        .synopsis = "Retrieves the contents of a URL",
        .syntax = "CURL(url[|post-data])",
        .desc =
-"  url       - URL to retrieve\n"
-"  post-data - Optional data to send as a POST (GET is default action)\n",
+       "  url       - URL to retrieve\n"
+       "  post-data - Optional data to send as a POST (GET is default action)\n",
        .read = acf_curl_exec,
 };
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_custom_function_unregister(&acf_curl);
+       res |= ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       ast_custom_function_unregister(&acf_curl);
-       return ast_unregister_application(app);
+       
+       return res;
 }
 
 int load_module(void)
 {
-       ast_custom_function_register(&acf_curl);
-       return ast_register_application(app, curl_exec, synopsis, descrip);
+       int res;
+
+       res = ast_custom_function_register(&acf_curl);
+       res |= ast_register_application(app, curl_exec, synopsis, descrip);
+
+       return res;
 }
 
 char *description(void)
index 9c0629a..96f0f9c 100755 (executable)
@@ -427,19 +427,28 @@ struct ast_custom_function acf_cut = {
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_custom_function_unregister(&acf_cut);
+       res |= ast_custom_function_unregister(&acf_sort);
+       res |= ast_unregister_application(app_sort);
+       res |= ast_unregister_application(app_cut);
+
        STANDARD_HANGUP_LOCALUSERS;
-       ast_custom_function_unregister(&acf_cut);
-       ast_custom_function_unregister(&acf_sort);
-       ast_unregister_application(app_sort);
-       return ast_unregister_application(app_cut);
+
+       return res;
 }
 
 int load_module(void)
 {
-       ast_custom_function_register(&acf_cut);
-       ast_custom_function_register(&acf_sort);
-       ast_register_application(app_sort, sort_exec, app_sort_synopsis, app_sort_descrip);
-       return ast_register_application(app_cut, cut_exec, cut_synopsis, cut_descrip);
+       int res;
+
+       res = ast_custom_function_register(&acf_cut);
+       res |= ast_custom_function_register(&acf_sort);
+       res |= ast_register_application(app_sort, sort_exec, app_sort_synopsis, app_sort_descrip);
+       res |= ast_register_application(app_cut, cut_exec, cut_synopsis, cut_descrip);
+
+       return res;
 }
 
 char *description(void)
index 5a75910..345fc8a 100755 (executable)
@@ -69,8 +69,13 @@ static int datetime_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index 670d091..b0c3d13 100755 (executable)
@@ -241,12 +241,13 @@ int unload_module(void)
 {
        int retval;
 
-       STANDARD_HANGUP_LOCALUSERS;
        retval = ast_unregister_application(dt_app);
        retval |= ast_unregister_application(d_app);
        retval |= ast_unregister_application(p_app);
        retval |= ast_unregister_application(g_app);
 
+       STANDARD_HANGUP_LOCALUSERS;
+
        return retval;
 }
 
index 5a14d5b..7675a91 100755 (executable)
@@ -1791,16 +1791,23 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       res |= ast_unregister_application(rapp);
+
        STANDARD_HANGUP_LOCALUSERS;
-       ast_unregister_application(app);
-       return ast_unregister_application(rapp);
+       
+       return res;
 }
 
 int load_module(void)
 {
        int res;
-       if (!(res = ast_register_application(app, dial_exec, synopsis, descrip)))
-               res = ast_register_application(rapp, retrydial_exec, rsynopsis, rdescrip);
+
+       res = ast_register_application(app, dial_exec, synopsis, descrip);
+       res |= ast_register_application(rapp, retrydial_exec, rsynopsis, rdescrip);
+       
        return res;
 }
 
index 9cadf85..d1b2015 100755 (executable)
@@ -322,8 +322,13 @@ static int dictate_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+       
+       return res;
 }
 
 int load_module(void)
index df76636..66aab01 100755 (executable)
@@ -129,9 +129,13 @@ static int pickup_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
 
-       return ast_unregister_application(app);
+       return res;
 }
 
 int load_module(void)
index c7d2a8b..1ebd77b 100755 (executable)
@@ -476,8 +476,13 @@ static int directory_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index 173441d..20e5228 100755 (executable)
@@ -379,8 +379,13 @@ reorder:
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index cfc297a..0a295e9 100755 (executable)
@@ -155,8 +155,13 @@ static int dumpchan_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index 96e0f1c..6c4faaa 100755 (executable)
@@ -88,8 +88,13 @@ static int echo_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index 70a5130..48e0079 100755 (executable)
@@ -194,27 +194,32 @@ static int load_config(void)
 /*--- unload_module: Unload this application from PBX */
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 /*--- load_module: Load this application into PBX */
 int load_module(void)
 {
        int res;
+       
        res = ast_register_application(app, enumlookup_exec, synopsis, descrip);
-       if (res)
-               return(res);
-       if ((res=load_config())) {
-               return(res);
-       }
-       return(0);
+       
+       if (!res)
+               res = load_config();
+       
+       return res;
 }
 
 /*--- reload: Reload configuration file */
 int reload(void)
 {
-       return(load_config());
+       return load_config();
 }
 
 
index 6b0f612..0b0f3b2 100755 (executable)
@@ -93,8 +93,13 @@ static int eval_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app_eval);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app_eval);
+
+       return res;
 }
 
 int load_module(void)
index a58baea..4b277cf 100755 (executable)
@@ -100,8 +100,13 @@ static int exec_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app_exec);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app_exec);
+
+       return res;
 }
 
 int load_module(void)
index c8ea555..e5af548 100755 (executable)
@@ -545,9 +545,13 @@ static int app_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
 
-       return ast_unregister_application(app);
+       return res;
 }
 
 int load_module(void)
index d1f2571..59b0c5b 100755 (executable)
@@ -470,8 +470,13 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index 6409979..2fd3870 100755 (executable)
@@ -108,8 +108,13 @@ static int flash_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index d0a725d..601e8ff 100755 (executable)
@@ -85,8 +85,13 @@ static int forkcdr_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index b5e5588..45a2a4b 100755 (executable)
@@ -134,8 +134,13 @@ static int cpeid_exec(struct ast_channel *chan, void *idata)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 63702bb..493070f 100755 (executable)
@@ -267,23 +267,28 @@ static struct ast_cli_entry  cli_show_channels =
 int unload_module(void)
 {
        int res;
-       STANDARD_HANGUP_LOCALUSERS;
-       ast_cli_unregister(&cli_show_channels);
-       res = ast_unregister_application(app_group_count);
+
+       res = ast_cli_unregister(&cli_show_channels);
+       res |= ast_unregister_application(app_group_count);
        res |= ast_unregister_application(app_group_set);
        res |= ast_unregister_application(app_group_check);
        res |= ast_unregister_application(app_group_match_count);
+
+       STANDARD_HANGUP_LOCALUSERS;
+
        return res;
 }
 
 int load_module(void)
 {
        int res;
+
        res = ast_register_application(app_group_count, group_count_exec, group_count_synopsis, group_count_descrip);
        res |= ast_register_application(app_group_set, group_set_exec, group_set_synopsis, group_set_descrip);
        res |= ast_register_application(app_group_check, group_check_exec, group_check_synopsis, group_check_descrip);
        res |= ast_register_application(app_group_match_count, group_match_count_exec, group_match_count_synopsis, group_match_count_descrip);
-       ast_cli_register(&cli_show_channels);
+       res |= ast_cli_register(&cli_show_channels);
+       
        return res;
 }
 
index 83f8349..5d681eb 100755 (executable)
@@ -189,27 +189,32 @@ struct ast_custom_function acf_vmcount = {
        .synopsis = "Counts the voicemail in a specified mailbox",
        .syntax = "VMCOUNT(vmbox[@context][|folder])",
        .desc =
-"  context - defaults to \"default\"\n"
-"  folder  - defaults to \"INBOX\"\n",
+       "  context - defaults to \"default\"\n"
+       "  folder  - defaults to \"INBOX\"\n",
        .read = acf_vmcount_exec,
 };
 
 int unload_module(void)
 {
        int res;
-       STANDARD_HANGUP_LOCALUSERS;
+       
        res = ast_custom_function_unregister(&acf_vmcount);
        res |= ast_unregister_application(app_hasvoicemail);
        res |= ast_unregister_application(app_hasnewvoicemail);
+       
+       STANDARD_HANGUP_LOCALUSERS;
+
        return res;
 }
 
 int load_module(void)
 {
        int res;
+
        res = ast_custom_function_register(&acf_vmcount);
        res |= ast_register_application(app_hasvoicemail, hasvoicemail_exec, hasvoicemail_synopsis, hasvoicemail_descrip);
        res |= ast_register_application(app_hasnewvoicemail, hasvoicemail_exec, hasnewvoicemail_synopsis, hasnewvoicemail_descrip);
+
        return res;
 }
 
index 776dfda..1ce63ad 100755 (executable)
@@ -184,8 +184,13 @@ static int ices_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index e0a48c1..e54c908 100755 (executable)
@@ -60,26 +60,38 @@ static int sendimage_exec(struct ast_channel *chan, void *data)
 {
        int res = 0;
        struct localuser *u;
+       
+       LOCAL_USER_ADD(u);
+
        if (!data || !strlen((char *)data)) {
                ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
+               LOCAL_USER_REMOVE(u);
                return -1;
        }
-       LOCAL_USER_ADD(u);
+
        if (!ast_supports_images(chan)) {
                /* Does not support transport */
-               if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
-                       chan->priority += 100;
+               ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
+               LOCAL_USER_REMOVE(u);
                return 0;
        }
+
        res = ast_send_image(chan, data);
+       
        LOCAL_USER_REMOVE(u);
+       
        return res;
 }
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res; 
 }
 
 int load_module(void)
index 522be5b..996576b 100755 (executable)
@@ -192,10 +192,16 @@ static int intercom_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
-       STANDARD_HANGUP_LOCALUSERS;
+       int res;
+
        if (sound > -1)
                close(sound);
-       return ast_unregister_application(app);
+
+       res = ast_unregister_application(app);
+
+       STANDARD_HANGUP_LOCALUSERS;
+
+       return res;
 }
 
 int load_module(void)
index be214c4..fa28f51 100755 (executable)
@@ -104,8 +104,13 @@ static int skel_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+       
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+       
+       return res;
 }
 
 int load_module(void)
index 8916d7b..98efa9f 100755 (executable)
@@ -96,8 +96,13 @@ lookupblacklist_exec (struct ast_channel *chan, void *data)
 
 int unload_module (void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application (app);
+
+       return res;     
 }
 
 int load_module (void)
index cc9db23..a2ce8b4 100755 (executable)
@@ -81,8 +81,13 @@ lookupcidname_exec (struct ast_channel *chan, void *data)
 int
 unload_module (void)
 {
-  STANDARD_HANGUP_LOCALUSERS;
-  return ast_unregister_application (app);
+       int res;
+
+       res = ast_unregister_application (app);
+
+       STANDARD_HANGUP_LOCALUSERS;
+
+       return res;
 }
 
 int
index 720e66c..c63886e 100755 (executable)
@@ -333,17 +333,26 @@ static int macro_exit_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(if_app);
+       res |= ast_unregister_application(exit_app);
+       res |= ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       ast_unregister_application(if_app);
-       ast_unregister_application(exit_app);
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
 {
-       ast_register_application(exit_app, macro_exit_exec, exit_synopsis, exit_descrip);
-       ast_register_application(if_app, macroif_exec, if_synopsis, if_descrip);
-       return ast_register_application(app, macro_exec, synopsis, descrip);
+       int res;
+
+       res = ast_register_application(exit_app, macro_exit_exec, exit_synopsis, exit_descrip);
+       res |= ast_register_application(if_app, macroif_exec, if_synopsis, if_descrip);
+       res |= ast_register_application(app, macro_exec, synopsis, descrip);
+
+       return res;
 }
 
 char *description(void)
index 201882a..225c929 100755 (executable)
@@ -258,17 +258,17 @@ static int math_exec(struct ast_channel *chan, void *data)
 int unload_module(void)
 {
        int res;
+       
+       res = ast_unregister_application(app_math);
+
        STANDARD_HANGUP_LOCALUSERS;
 
-       res  = ast_unregister_application(app_math);
        return res;
 }
 
 int load_module(void)
 {
-       int res;
-       res = ast_register_application(app_math, math_exec, math_synopsis, math_descrip);
-       return res;
+       return ast_register_application(app_math, math_exec, math_synopsis, math_descrip);
 }
 
 char *description(void)
index 5f9c506..11f59a0 100755 (executable)
@@ -141,9 +141,11 @@ int unload_module(void)
 {
        int res;
 
-       STANDARD_HANGUP_LOCALUSERS;
-       res =ast_unregister_application(app_md5);
+       res = ast_unregister_application(app_md5);
        res |= ast_unregister_application(app_md5check);
+
+       STANDARD_HANGUP_LOCALUSERS;
+
        return res;
 }
 
@@ -153,6 +155,7 @@ int load_module(void)
 
        res = ast_register_application(app_md5check, md5check_exec, desc_md5check, synopsis_md5check);
        res |= ast_register_application(app_md5, md5_exec, desc_md5, synopsis_md5);
+       
        return res;
 }
 
index dc4f8fb..aa3e615 100755 (executable)
@@ -2106,23 +2106,31 @@ static void *recordthread(void *args)
 
 int unload_module(void)
 {
+       int res;
+       
+       res = ast_cli_unregister(&cli_show_confs);
+       res |= ast_cli_unregister(&cli_conf);
+       res |= ast_unregister_application(app3);
+       res |= ast_unregister_application(app2);
+       res |= ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       ast_cli_unregister(&cli_show_confs);
-       ast_cli_unregister(&cli_conf);
-       ast_unregister_application(app3);
-       ast_unregister_application(app2);
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
 {
-       ast_cli_register(&cli_show_confs);
-       ast_cli_register(&cli_conf);
-       ast_register_application(app3, admin_exec, synopsis3, descrip3);
-       ast_register_application(app2, count_exec, synopsis2, descrip2);
-       return ast_register_application(app, conf_exec, synopsis, descrip);
-}
+       int res;
+
+       res = ast_cli_register(&cli_show_confs);
+       res |= ast_cli_register(&cli_conf);
+       res |= ast_register_application(app3, admin_exec, synopsis3, descrip3);
+       res |= ast_register_application(app2, count_exec, synopsis2, descrip2);
+       res |= ast_register_application(app, conf_exec, synopsis, descrip);
 
+       return res;
+}
 
 char *description(void)
 {
index 7c12bea..587085d 100755 (executable)
@@ -137,8 +137,13 @@ static int milliwatt_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index 73e5c5a..c389353 100755 (executable)
@@ -495,15 +495,24 @@ static struct ast_cli_entry cli_muxmon = {
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_cli_unregister(&cli_muxmon);
+       res |= ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       ast_cli_unregister(&cli_muxmon);
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
 {
-       ast_cli_register(&cli_muxmon);
-       return ast_register_application(app, muxmon_exec, synopsis, desc);
+       int res;
+
+       res = ast_cli_register(&cli_muxmon);
+       res |= ast_register_application(app, muxmon_exec, synopsis, desc);
+
+       return res;
 }
 
 char *description(void)
index 95a2f19..63f6546 100755 (executable)
@@ -218,8 +218,13 @@ static int mp3_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+       
+       return res;
 }
 
 int load_module(void)
index 73e5c5a..c389353 100755 (executable)
@@ -495,15 +495,24 @@ static struct ast_cli_entry cli_muxmon = {
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_cli_unregister(&cli_muxmon);
+       res |= ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       ast_cli_unregister(&cli_muxmon);
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
 {
-       ast_cli_register(&cli_muxmon);
-       return ast_register_application(app, muxmon_exec, synopsis, desc);
+       int res;
+
+       res = ast_cli_register(&cli_muxmon);
+       res |= ast_register_application(app, muxmon_exec, synopsis, desc);
+
+       return res;
 }
 
 char *description(void)
index 7e59aa8..5158069 100755 (executable)
@@ -201,8 +201,13 @@ static int NBScat_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index dfd819d..d141ae1 100755 (executable)
@@ -243,26 +243,25 @@ static int ospfinished_exec(struct ast_channel *chan, void *data)
 int unload_module(void)
 {
        int res;
-       STANDARD_HANGUP_LOCALUSERS;
+       
        res = ast_unregister_application(app3);
        res |= ast_unregister_application(app2);
        res |= ast_unregister_application(app);
+
+       STANDARD_HANGUP_LOCALUSERS;
+
        return res;
 }
 
 int load_module(void)
 {
        int res;
+       
        res = ast_register_application(app, osplookup_exec, synopsis, descrip);
-       if (res)
-               return(res);
-       res = ast_register_application(app2, ospnext_exec, synopsis2, descrip2);
-       if (res)
-               return(res);
-       res = ast_register_application(app3, ospfinished_exec, synopsis3, descrip3);
-       if (res)
-               return(res);
-       return(0);
+       res |= ast_register_application(app2, ospnext_exec, synopsis2, descrip2);
+       res |= ast_register_application(app3, ospfinished_exec, synopsis3, descrip3);
+       
+       return res;
 }
 
 int reload(void)
index aac200b..6f6463e 100755 (executable)
@@ -170,9 +170,13 @@ static int page_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res =  ast_unregister_application(app_page);
+
        STANDARD_HANGUP_LOCALUSERS;
 
-       return ast_unregister_application(app_page);
+       return res;
 }
 
 int load_module(void)
index 59115aa..ff49e80 100755 (executable)
@@ -238,8 +238,13 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index 0d27160..66f4fd0 100755 (executable)
@@ -116,8 +116,13 @@ static int playback_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 2404f0c..90eb381 100755 (executable)
@@ -169,8 +169,13 @@ privacy_exec (struct ast_channel *chan, void *data)
 int
 unload_module (void)
 {
-  STANDARD_HANGUP_LOCALUSERS;
-  return ast_unregister_application (app);
+       int res;
+
+       res = ast_unregister_application (app);
+
+       STANDARD_HANGUP_LOCALUSERS;
+
+       return res;
 }
 
 int
index 7a09914..27d73ca 100755 (executable)
@@ -3693,50 +3693,56 @@ static struct ast_cli_entry cli_remove_queue_member = {
 
 int unload_module(void)
 {
-       STANDARD_HANGUP_LOCALUSERS;
-       ast_cli_unregister(&cli_show_queue);
-       ast_cli_unregister(&cli_show_queues);
-       ast_cli_unregister(&cli_add_queue_member);
-       ast_cli_unregister(&cli_remove_queue_member);
-       ast_manager_unregister("Queues");
-       ast_manager_unregister("QueueStatus");
-       ast_manager_unregister("QueueAdd");
-       ast_manager_unregister("QueueRemove");
-       ast_manager_unregister("QueuePause");
+       int res;
+
+       res = ast_cli_unregister(&cli_show_queue);
+       res |= ast_cli_unregister(&cli_show_queues);
+       res |= ast_cli_unregister(&cli_add_queue_member);
+       res |= ast_cli_unregister(&cli_remove_queue_member);
+       res |= ast_manager_unregister("Queues");
+       res |= ast_manager_unregister("QueueStatus");
+       res |= ast_manager_unregister("QueueAdd");
+       res |= ast_manager_unregister("QueueRemove");
+       res |= ast_manager_unregister("QueuePause");
        ast_devstate_del(statechange_queue, NULL);
-       ast_unregister_application(app_aqm);
-       ast_unregister_application(app_rqm);
-       ast_unregister_application(app_pqm);
-       ast_unregister_application(app_upqm);
-       ast_custom_function_unregister(&queueagentcount_function);
-       return ast_unregister_application(app);
+       res |= ast_unregister_application(app_aqm);
+       res |= ast_unregister_application(app_rqm);
+       res |= ast_unregister_application(app_pqm);
+       res |= ast_unregister_application(app_upqm);
+       res |= ast_custom_function_unregister(&queueagentcount_function);
+       res |= ast_unregister_application(app);
+
+       STANDARD_HANGUP_LOCALUSERS;
+
+       return res;
 }
 
 int load_module(void)
 {
        int res;
+       
        res = ast_register_application(app, queue_exec, synopsis, descrip);
-       if (!res) {
-               ast_cli_register(&cli_show_queue);
-               ast_cli_register(&cli_show_queues);
-               ast_cli_register(&cli_add_queue_member);
-               ast_cli_register(&cli_remove_queue_member);
-               ast_devstate_add(statechange_queue, NULL);
-               ast_manager_register( "Queues", 0, manager_queues_show, "Queues" );
-               ast_manager_register( "QueueStatus", 0, manager_queues_status, "Queue Status" );
-               ast_manager_register( "QueueAdd", EVENT_FLAG_AGENT, manager_add_queue_member, "Add interface to queue." );
-               ast_manager_register( "QueueRemove", EVENT_FLAG_AGENT, manager_remove_queue_member, "Remove interface from queue." );
-               ast_manager_register( "QueuePause", EVENT_FLAG_AGENT, manager_pause_queue_member, "Makes a queue member temporarily unavailable" );
-               ast_register_application(app_aqm, aqm_exec, app_aqm_synopsis, app_aqm_descrip) ;
-               ast_register_application(app_rqm, rqm_exec, app_rqm_synopsis, app_rqm_descrip) ;
-               ast_register_application(app_pqm, pqm_exec, app_pqm_synopsis, app_pqm_descrip) ;
-               ast_register_application(app_upqm, upqm_exec, app_upqm_synopsis, app_upqm_descrip) ;
-               ast_custom_function_register(&queueagentcount_function);
+       res |= ast_cli_register(&cli_show_queue);
+       res |= ast_cli_register(&cli_show_queues);
+       res |= ast_cli_register(&cli_add_queue_member);
+       res |= ast_cli_register(&cli_remove_queue_member);
+       res |= ast_devstate_add(statechange_queue, NULL);
+       res |= ast_manager_register( "Queues", 0, manager_queues_show, "Queues" );
+       res |= ast_manager_register( "QueueStatus", 0, manager_queues_status, "Queue Status" );
+       res |= ast_manager_register( "QueueAdd", EVENT_FLAG_AGENT, manager_add_queue_member, "Add interface to queue." );
+       res |= ast_manager_register( "QueueRemove", EVENT_FLAG_AGENT, manager_remove_queue_member, "Remove interface from queue." );
+       res |= ast_manager_register( "QueuePause", EVENT_FLAG_AGENT, manager_pause_queue_member, "Makes a queue member temporarily unavailable" );
+       res |= ast_register_application(app_aqm, aqm_exec, app_aqm_synopsis, app_aqm_descrip) ;
+       res |= ast_register_application(app_rqm, rqm_exec, app_rqm_synopsis, app_rqm_descrip) ;
+       res |= ast_register_application(app_pqm, pqm_exec, app_pqm_synopsis, app_pqm_descrip) ;
+       res |= ast_register_application(app_upqm, upqm_exec, app_upqm_synopsis, app_upqm_descrip) ;
+       res |= ast_custom_function_register(&queueagentcount_function);
+
+       if (!res) {     
+               reload_queues();
+               if (queue_persistent_members)
+                       reload_queue_members();
        }
-       reload_queues();
-       
-       if (queue_persistent_members)
-           reload_queue_members();
 
        return res;
 }
index 7054057..bbd1e0c 100755 (executable)
@@ -85,8 +85,13 @@ static int random_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+       
+       res = ast_unregister_application(app_random);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app_random);
+
+       return res;     
 }
 
 int load_module(void)
index c1e0aca..4fd6401 100755 (executable)
@@ -188,8 +188,13 @@ static int read_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 805760c..537786f 100755 (executable)
@@ -104,8 +104,13 @@ static int readfile_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app_readfile);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app_readfile);
+
+       return res;     
 }
 
 int load_module(void)
index f1ed42f..4e28832 100755 (executable)
@@ -212,19 +212,28 @@ static int realtime_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_cli_unregister(&cli_load_realtime_cmd);
+       res |= ast_cli_unregister(&cli_update_realtime_cmd);
+       res |= ast_unregister_application(uapp);
+       res |= ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       ast_cli_unregister(&cli_load_realtime_cmd);
-       ast_cli_unregister(&cli_update_realtime_cmd);
-       ast_unregister_application(uapp);
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
 {
-       ast_cli_register(&cli_load_realtime_cmd);
-       ast_cli_register(&cli_update_realtime_cmd);
-       ast_register_application(uapp, realtime_update_exec, usynopsis, udesc);
-       return ast_register_application(app, realtime_exec, synopsis, desc);
+       int res;
+
+       res = ast_cli_register(&cli_load_realtime_cmd);
+       res |= ast_cli_register(&cli_update_realtime_cmd);
+       res |= ast_register_application(uapp, realtime_update_exec, usynopsis, udesc);
+       res |= ast_register_application(app, realtime_exec, synopsis, desc);
+
+       return res;
 }
 
 char *description(void)
index bed5bd3..7b8e145 100755 (executable)
@@ -321,8 +321,13 @@ static int record_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 960d0b5..0abce7b 100755 (executable)
@@ -127,22 +127,23 @@ static int sayunixtime_exec(struct ast_channel *chan, void *data)
 int unload_module(void)
 {
        int res;
-       STANDARD_HANGUP_LOCALUSERS;
+       
        res = ast_unregister_application(app_sayunixtime);
-       if (! res)
-               return ast_unregister_application(app_datetime);
-       else
-               return res;
+       res |= ast_unregister_application(app_datetime);
+
+       STANDARD_HANGUP_LOCALUSERS;
+       
+       return res;
 }
 
 int load_module(void)
 {
        int res;
+       
        res = ast_register_application(app_sayunixtime, sayunixtime_exec, sayunixtime_synopsis, sayunixtime_descrip);
-       if (! res)
-               return ast_register_application(app_datetime, sayunixtime_exec, sayunixtime_synopsis, datetime_descrip);
-       else
-               return res;
+       res |= ast_register_application(app_datetime, sayunixtime_exec, sayunixtime_synopsis, datetime_descrip);
+       
+       return res;
 }
 
 char *description(void)
index a4bdf5c..79001ac 100755 (executable)
@@ -82,8 +82,13 @@ static int senddtmf_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 36ab85c..c33561a 100755 (executable)
@@ -98,9 +98,13 @@ static int sendtext_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+       
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
 
-       return ast_unregister_application(app);
+       return res;     
 }
 
 int load_module(void)
index a1b2c41..4fd381f 100755 (executable)
@@ -121,15 +121,24 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app2);
+       res |= ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       ast_unregister_application(app2);
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
 {
-       ast_register_application(app2, setcallerid_pres_exec, synopsis2, descrip2);
-       return ast_register_application(app, setcallerid_exec, synopsis, descrip);
+       int res;
+       
+       res = ast_register_application(app2, setcallerid_pres_exec, synopsis2, descrip2);
+       res |= ast_register_application(app, setcallerid_exec, synopsis, descrip);
+
+       return res;
 }
 
 char *description(void)
index e204d5a..143ca73 100755 (executable)
@@ -141,19 +141,24 @@ static int appendcdruserfield_exec(struct ast_channel *chan, void *data)
 int unload_module(void)
 {
        int res;
-       STANDARD_HANGUP_LOCALUSERS;
+       
        res = ast_unregister_application(setcdruserfield_app);
        res |= ast_unregister_application(appendcdruserfield_app);
-       ast_manager_unregister("SetCDRUserField");
+       res |= ast_manager_unregister("SetCDRUserField");
+
+       STANDARD_HANGUP_LOCALUSERS;
+
        return res;
 }
 
 int load_module(void)
 {
        int res;
+
        res = ast_register_application(setcdruserfield_app, setcdruserfield_exec, setcdruserfield_synopsis, setcdruserfield_descrip);
        res |= ast_register_application(appendcdruserfield_app, appendcdruserfield_exec, appendcdruserfield_synopsis, appendcdruserfield_descrip);
-       ast_manager_register("SetCDRUserField", EVENT_FLAG_CALL, action_setcdruserfield, "Set the CDR UserField");
+       res |= ast_manager_register("SetCDRUserField", EVENT_FLAG_CALL, action_setcdruserfield, "Set the CDR UserField");
+       
        return res;
 }
 
index 0539039..019adeb 100755 (executable)
@@ -85,8 +85,13 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index dbd78bd..07a064b 100755 (executable)
@@ -90,8 +90,13 @@ static int setcallerid_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+       
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index e9fbc0f..c0f155f 100755 (executable)
@@ -93,8 +93,13 @@ static int setrdnis_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+       
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index f9ea43c..1b05533 100755 (executable)
@@ -103,8 +103,13 @@ static int settransfercapability_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+       
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 9f30124..1581744 100755 (executable)
@@ -108,8 +108,13 @@ static int app_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index d6ae221..80ad3dd 100755 (executable)
@@ -1507,8 +1507,13 @@ static int sms_exec (struct ast_channel *chan, void *data)
 
 int unload_module (void)
 {
+       int res;
+
+       res = ast_unregister_application (app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application (app);
+
+       return res;     
 }
 
 int load_module (void)
index 94a3474..9c57465 100755 (executable)
@@ -102,8 +102,13 @@ static int softhangup_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index d9c85ff..94dc8ea 100755 (executable)
@@ -546,8 +546,13 @@ static int PGSQL_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+       
+       return res;
 }
 
 int load_module(void)
index fcc4ca5..8c1c97e 100755 (executable)
@@ -85,8 +85,13 @@ static int striplsd_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 6324290..bb1b835 100755 (executable)
@@ -123,8 +123,13 @@ static int substring_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 1e332a0..00fed10 100755 (executable)
@@ -135,15 +135,24 @@ static int trysystem_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       res |= ast_unregister_application(app2);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       ast_unregister_application(app2);
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
 {
-       ast_register_application(app2, trysystem_exec, synopsis2, descrip2);
-       return ast_register_application(app, system_exec, synopsis, descrip);
+       int res;
+
+       res = ast_register_application(app2, trysystem_exec, synopsis2, descrip2);
+       res |= ast_register_application(app, system_exec, synopsis, descrip);
+
+       return res;
 }
 
 char *description(void)
index 3d678b3..7729f61 100755 (executable)
@@ -208,8 +208,13 @@ static int background_detect_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index e1ffdba..4ded538 100755 (executable)
@@ -488,15 +488,24 @@ static int testserver_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(testc_app);
+       res |= ast_unregister_application(tests_app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       ast_unregister_application(testc_app);
-       return ast_unregister_application(tests_app);
+
+       return res;     
 }
 
 int load_module(void)
 {
-       ast_register_application(testc_app, testclient_exec, testc_synopsis, testc_descrip);
-       return ast_register_application(tests_app, testserver_exec, tests_synopsis, tests_descrip);
+       int res;
+
+       res = ast_register_application(testc_app, testclient_exec, testc_synopsis, testc_descrip);
+       res |= ast_register_application(tests_app, testserver_exec, tests_synopsis, tests_descrip);
+
+       return res;
 }
 
 char *description(void)
index 85d1e5e..7a1d17b 100755 (executable)
@@ -120,9 +120,13 @@ static int transfer_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
 
-       return ast_unregister_application(app);
+       return res;     
 }
 
 int load_module(void)
index 25547c2..f1970ad 100755 (executable)
@@ -96,17 +96,18 @@ static int txtcidname_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
 {
-       int res;
-       
-       res = ast_register_application(app, txtcidname_exec, synopsis, descrip);
-       
-       return res;
+       return ast_register_application(app, txtcidname_exec, synopsis, descrip);
 }
 
 char *description(void)
index 86d2db3..512ea9d 100755 (executable)
@@ -154,8 +154,13 @@ out:
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 737949c..681231a 100755 (executable)
@@ -97,8 +97,13 @@ static int userevent_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 434b822..e23bf1a 100755 (executable)
@@ -98,8 +98,13 @@ static int verbose_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app_verbose);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app_verbose);
+
+       return res;     
 }
 
 int load_module(void)
index 8f19fbb..54351f9 100755 (executable)
@@ -6212,14 +6212,17 @@ int reload(void)
 int unload_module(void)
 {
        int res;
-       STANDARD_HANGUP_LOCALUSERS;
+       
        res = ast_unregister_application(app);
        res |= ast_unregister_application(app2);
        res |= ast_unregister_application(app3);
        res |= ast_unregister_application(app4);
-       ast_cli_unregister(&show_voicemail_users_cli);
-       ast_cli_unregister(&show_voicemail_zones_cli);
+       res |= ast_cli_unregister(&show_voicemail_users_cli);
+       res |= ast_cli_unregister(&show_voicemail_zones_cli);
        ast_uninstall_vm_functions();
+       
+       STANDARD_HANGUP_LOCALUSERS;
+
        return res;
 }
 
index a6ed89d..30ba1d4 100755 (executable)
@@ -118,8 +118,13 @@ static int waitforring_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index abe7787..a5e7a77 100755 (executable)
@@ -174,8 +174,13 @@ static int waitforsilence_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index 5de2172..49c6312 100755 (executable)
@@ -319,17 +319,26 @@ static int while_end_exec(struct ast_channel *chan, void *data) {
 
 int unload_module(void)
 {
+       int res;
+       
+       res = ast_unregister_application(start_app);
+       res |= ast_unregister_application(exec_app);
+       res |= ast_unregister_application(stop_app);
+
        STANDARD_HANGUP_LOCALUSERS;
-       ast_unregister_application(start_app);
-       ast_unregister_application(exec_app);
-       return ast_unregister_application(stop_app);
+
+       return res;
 }
 
 int load_module(void)
 {
-       ast_register_application(start_app, while_start_exec, start_synopsis, start_desc);
-       ast_register_application(exec_app, execif_exec, exec_synopsis, exec_desc);
-       return ast_register_application(stop_app, while_end_exec, stop_synopsis, stop_desc);
+       int res;
+
+       res = ast_register_application(start_app, while_start_exec, start_synopsis, start_desc);
+       res |= ast_register_application(exec_app, execif_exec, exec_synopsis, exec_desc);
+       res |= ast_register_application(stop_app, while_end_exec, stop_synopsis, stop_desc);
+
+       return res;
 }
 
 char *description(void)
index 05062b6..a5b3724 100755 (executable)
@@ -104,8 +104,13 @@ static int zapateller_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 23300e0..1485433 100755 (executable)
@@ -299,8 +299,13 @@ out:
 
 int unload_module(void)
 {
+       int res;
+       
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;     
 }
 
 int load_module(void)
index 738d733..76a81bd 100755 (executable)
@@ -235,8 +235,13 @@ static int zapras_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)
index afcf366..fc900b5 100755 (executable)
@@ -364,8 +364,13 @@ static int conf_exec(struct ast_channel *chan, void *data)
 
 int unload_module(void)
 {
+       int res;
+
+       res = ast_unregister_application(app);
+       
        STANDARD_HANGUP_LOCALUSERS;
-       return ast_unregister_application(app);
+
+       return res;
 }
 
 int load_module(void)