[Freeswitch-svn] [commit] r10072 - in freeswitch/trunk/src/mod: applications/mod_conference applications/mod_voicemail asr_tts/mod_openmrcp formats/mod_shout

Freeswitch SVN mikej at freeswitch.org
Sun Oct 19 19:58:43 EDT 2008


Author: mikej
Date: Sun Oct 19 19:58:43 2008
New Revision: 10072

Modified:
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
   freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
   freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c

Log:
(MDXMLINT-36) don't add module interfaces before returning from error conditions in module load functions

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Sun Oct 19 19:58:43 2008
@@ -5290,11 +5290,6 @@
 	}
 	api_syntax = p;
 
-	SWITCH_ADD_API(api_interface, "conference", "Conference module commands", conf_api_main, p);
-	SWITCH_ADD_APP(app_interface, global_app_name, global_app_name, NULL, conference_function, NULL, SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "conference_set_auto_outcall", "conference_set_auto_outcall", NULL, conference_auto_function, NULL, SAF_NONE);
-	SWITCH_ADD_CHAT(chat_interface, CONF_CHAT_PROTO, chat_send);
-
 	/* create/register custom event message type */
 	if (switch_event_reserve_subclass(CONF_EVENT_MAINT) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", CONF_EVENT_MAINT);
@@ -5316,6 +5311,11 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
+	SWITCH_ADD_API(api_interface, "conference", "Conference module commands", conf_api_main, p);
+	SWITCH_ADD_APP(app_interface, global_app_name, global_app_name, NULL, conference_function, NULL, SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "conference_set_auto_outcall", "conference_set_auto_outcall", NULL, conference_auto_function, NULL, SAF_NONE);
+	SWITCH_ADD_CHAT(chat_interface, CONF_CHAT_PROTO, chat_send);
+
 	send_presence(SWITCH_EVENT_PRESENCE_IN);
 
 	globals.running = 1;

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	Sun Oct 19 19:58:43 2008
@@ -3555,7 +3555,6 @@
 	}
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-	SWITCH_ADD_APP(app_interface, "voicemail", "Voicemail", VM_DESC, voicemail_function, VM_USAGE, SAF_NONE);
 
 	if (switch_event_bind(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL)
 		!= SWITCH_STATUS_SUCCESS) {
@@ -3563,6 +3562,7 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
+	SWITCH_ADD_APP(app_interface, "voicemail", "Voicemail", VM_DESC, voicemail_function, VM_USAGE, SAF_NONE);
 	SWITCH_ADD_API(commands_api_interface, "voicemail", "voicemail", voicemail_api_function, VOICEMAIL_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "voicemail_inject", "voicemail_inject", voicemail_inject_api_function, VM_INJECT_USAGE);
 	SWITCH_ADD_API(commands_api_interface, "vm_boxcount", "vm_boxcount", boxcount_api_function, BOXCOUNT_SYNTAX);

Modified: freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	(original)
+++ freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	Sun Oct 19 19:58:43 2008
@@ -937,6 +937,11 @@
 	switch_speech_interface_t *speech_interface;
 	switch_asr_interface_t *asr_interface;
 
+	/* initialize openmrcp */
+	if (openmrcp_init() != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	speech_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SPEECH_INTERFACE);
@@ -961,11 +966,6 @@
 	asr_interface->asr_check_results = openmrcp_asr_check_results;
 	asr_interface->asr_get_results = openmrcp_asr_get_results;
 
-	/* initialize openmrcp */
-	if (openmrcp_init() != SWITCH_STATUS_SUCCESS) {
-		return SWITCH_STATUS_FALSE;
-	}
-
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	Sun Oct 19 19:58:43 2008
@@ -1458,6 +1458,7 @@
 
 	curl_global_init(CURL_GLOBAL_ALL);
 
+	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
 	file_interface->interface_name = modname;
@@ -1470,16 +1471,12 @@
 	file_interface->file_set_string = shout_file_set_string;
 	file_interface->file_get_string = shout_file_get_string;
 
-	/* connect my internal structure to the blank pointer passed to me */
-	//*module_interface = &shout_module_interface;
-
 	shout_init();
 	mpg123_init();
+	load_config();
 
 	SWITCH_ADD_API(shout_api_interface, "telecast", "telecast", telecast_api_function, TELECAST_SYNTAX);
 
-	load_config();
-
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }



More information about the Freeswitch-svn mailing list