Index: channels/chan_h323.c
===================================================================
--- channels/chan_h323.c	(revision 82286)
+++ channels/chan_h323.c	(working copy)
@@ -2733,6 +2733,12 @@
 		return 1;
 	}
 
+	if (is_reload) {
+		delete_users();
+		delete_aliases();
+		prune_peers();
+	}
+
 	/* fire up the H.323 Endpoint */
 	if (!h323_end_point_exist()) {
 		h323_end_point_create();
@@ -2988,9 +2994,6 @@
 
 static int h323_do_reload(void)
 {
-	delete_users();
-	delete_aliases();
-	prune_peers();
 	reload_config(1);
 	return 0;
 }
Index: channels/chan_sip.c
===================================================================
--- channels/chan_sip.c	(revision 82286)
+++ channels/chan_sip.c	(working copy)
@@ -16488,6 +16488,36 @@
 		return -1;
 	}
 	
+	if (option_debug > 3)
+		ast_log(LOG_DEBUG, "--------------- SIP reload started\n");
+
+	clear_realm_authentication(authl);
+	clear_sip_domains();
+	authl = NULL;
+
+	/* First, destroy all outstanding registry calls */
+	/* This is needed, since otherwise active registry entries will not be destroyed */
+	ASTOBJ_CONTAINER_TRAVERSE(&regl, 1, do {
+		ASTOBJ_RDLOCK(iterator);
+		if (iterator->call) {
+			if (option_debug > 2)
+				ast_log(LOG_DEBUG, "Destroying active SIP dialog for registry %s@%s\n", iterator->username, iterator->hostname);
+			/* This will also remove references to the registry */
+			sip_destroy(iterator->call);
+		}
+		ASTOBJ_UNLOCK(iterator);
+	
+	} while(0));
+
+	/* Then, actually destroy users and registry */
+	ASTOBJ_CONTAINER_DESTROYALL(&userl, sip_destroy_user);
+	if (option_debug > 3)
+		ast_log(LOG_DEBUG, "--------------- Done destroying user list\n");
+	ASTOBJ_CONTAINER_DESTROYALL(&regl, sip_registry_destroy);
+	if (option_debug > 3)
+		ast_log(LOG_DEBUG, "--------------- Done destroying registry list\n");
+	ASTOBJ_CONTAINER_MARKALL(&peerl);
+
 	/* Initialize copy of current global_regcontext for later use in removing stale contexts */
 	ast_copy_string(oldcontexts, global_regcontext, sizeof(oldcontexts));
 	oldregcontext = oldcontexts;
@@ -17492,35 +17522,6 @@
 /*! \brief Reload module */
 static int sip_do_reload(enum channelreloadreason reason)
 {
-	if (option_debug > 3)
-		ast_log(LOG_DEBUG, "--------------- SIP reload started\n");
-
-	clear_realm_authentication(authl);
-	clear_sip_domains();
-	authl = NULL;
-
-	/* First, destroy all outstanding registry calls */
-	/* This is needed, since otherwise active registry entries will not be destroyed */
-	ASTOBJ_CONTAINER_TRAVERSE(&regl, 1, do {
-		ASTOBJ_RDLOCK(iterator);
-		if (iterator->call) {
-			if (option_debug > 2)
-				ast_log(LOG_DEBUG, "Destroying active SIP dialog for registry %s@%s\n", iterator->username, iterator->hostname);
-			/* This will also remove references to the registry */
-			sip_destroy(iterator->call);
-		}
-		ASTOBJ_UNLOCK(iterator);
-	
-	} while(0));
-
-	/* Then, actually destroy users and registry */
-	ASTOBJ_CONTAINER_DESTROYALL(&userl, sip_destroy_user);
-	if (option_debug > 3)
-		ast_log(LOG_DEBUG, "--------------- Done destroying user list\n");
-	ASTOBJ_CONTAINER_DESTROYALL(&regl, sip_registry_destroy);
-	if (option_debug > 3)
-		ast_log(LOG_DEBUG, "--------------- Done destroying registry list\n");
-	ASTOBJ_CONTAINER_MARKALL(&peerl);
 	reload_config(reason);
 
 	/* Prune peers who still are supposed to be deleted */
Index: channels/chan_iax2.c
===================================================================
--- channels/chan_iax2.c	(revision 82286)
+++ channels/chan_iax2.c	(working copy)
@@ -9457,6 +9457,20 @@
 #endif
 }
 
+static void set_config_destroy(void)
+{
+	strcpy(accountcode, "");
+	strcpy(language, "");
+	strcpy(mohinterpret, "default");
+	strcpy(mohsuggest, "");
+	amaflags = 0;
+	delayreject = 0;
+	ast_clear_flag((&globalflags), IAX_NOTRANSFER);	
+	ast_clear_flag((&globalflags), IAX_TRANSFERMEDIA);	
+	ast_clear_flag((&globalflags), IAX_USEJITTERBUF);	
+	ast_clear_flag((&globalflags), IAX_FORCEJITTERBUF);	
+	delete_users();
+}
 
 /*! \brief Load configuration */
 static int set_config(char *config_file, int reload)
@@ -9484,6 +9498,10 @@
 		return -1;
 	}
 
+	if (reload) {
+		set_config_destroy();
+	}
+
 	/* Reset global codec prefs */	
 	memset(&prefs, 0 , sizeof(struct ast_codec_pref));
 	
@@ -9809,7 +9827,7 @@
 	}
 	ast_config_destroy(cfg);
 	set_timing();
-	return capability;
+	return 1;
 }
 
 static int reload_config(void)
@@ -9817,26 +9835,16 @@
 	char *config = "iax.conf";
 	struct iax2_registry *reg;
 
-	strcpy(accountcode, "");
-	strcpy(language, "");
-	strcpy(mohinterpret, "default");
-	strcpy(mohsuggest, "");
-	amaflags = 0;
-	delayreject = 0;
-	ast_clear_flag((&globalflags), IAX_NOTRANSFER);	
-	ast_clear_flag((&globalflags), IAX_TRANSFERMEDIA);	
-	ast_clear_flag((&globalflags), IAX_USEJITTERBUF);	
-	ast_clear_flag((&globalflags), IAX_FORCEJITTERBUF);	
-	delete_users();
-	set_config(config, 1);
-	prune_peers();
-	prune_users();
-	AST_LIST_LOCK(&registrations);
-	AST_LIST_TRAVERSE(&registrations, reg, entry)
-		iax2_do_register(reg);
-	AST_LIST_UNLOCK(&registrations);
-	/* Qualify hosts, too */
-	ao2_callback(peers, 0, iax2_poke_peer_cb, NULL);
+	if (set_config(config, 1) > 0) {
+		prune_peers();
+		prune_users();
+		AST_LIST_LOCK(&registrations);
+		AST_LIST_TRAVERSE(&registrations, reg, entry)
+			iax2_do_register(reg);
+		AST_LIST_UNLOCK(&registrations);
+		/* Qualify hosts, too */
+		ao2_callback(peers, 0, iax2_poke_peer_cb, NULL);
+	}
 	reload_firmware(0);
 	iax_provision_reload();
 
Index: main/config.c
===================================================================
--- main/config.c	(revision 82286)
+++ main/config.c	(working copy)
@@ -711,7 +711,7 @@
 				if(!ast_strlen_zero(exec_file))
 					unlink(exec_file);
 				if(!do_include)
-					return 0;
+					return -1;
 
 			} else {
 				ast_log(LOG_WARNING, "Directive '#%s' needs an argument (%s) at line %d of %s\n", 
