[asterisk-commits] kmoore: branch 12 r425690 - in /branches/12: channels/ include/asterisk/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 16 09:25:17 CDT 2014


Author: kmoore
Date: Thu Oct 16 09:24:55 2014
New Revision: 425690

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=425690
Log:
PJSIP: Enforce module load dependencies

This enforces that res_pjsip, res_pjsip_session, and res_pjsip_pubsub
have loaded properly before attempting to load any modules that depend
on them since the module loader system is not currently capable of
resolving module dependencies on its own.

ASTERISK-24312 #close
Reported by: Dafi Ni
Review: https://reviewboard.asterisk.org/r/4062/

Modified:
    branches/12/channels/chan_pjsip.c
    branches/12/include/asterisk/res_pjsip.h
    branches/12/include/asterisk/res_pjsip_pubsub.h
    branches/12/include/asterisk/res_pjsip_session.h
    branches/12/res/res_hep_pjsip.c
    branches/12/res/res_pjsip_acl.c
    branches/12/res/res_pjsip_authenticator_digest.c
    branches/12/res/res_pjsip_caller_id.c
    branches/12/res/res_pjsip_dialog_info_body_generator.c
    branches/12/res/res_pjsip_diversion.c
    branches/12/res/res_pjsip_dtmf_info.c
    branches/12/res/res_pjsip_endpoint_identifier_anonymous.c
    branches/12/res/res_pjsip_endpoint_identifier_ip.c
    branches/12/res/res_pjsip_endpoint_identifier_user.c
    branches/12/res/res_pjsip_exten_state.c
    branches/12/res/res_pjsip_header_funcs.c
    branches/12/res/res_pjsip_logger.c
    branches/12/res/res_pjsip_messaging.c
    branches/12/res/res_pjsip_multihomed.c
    branches/12/res/res_pjsip_mwi.c
    branches/12/res/res_pjsip_mwi_body_generator.c
    branches/12/res/res_pjsip_nat.c
    branches/12/res/res_pjsip_notify.c
    branches/12/res/res_pjsip_one_touch_record_info.c
    branches/12/res/res_pjsip_outbound_authenticator_digest.c
    branches/12/res/res_pjsip_outbound_registration.c
    branches/12/res/res_pjsip_path.c
    branches/12/res/res_pjsip_phoneprov_provider.c
    branches/12/res/res_pjsip_pidf_body_generator.c
    branches/12/res/res_pjsip_pidf_digium_body_supplement.c
    branches/12/res/res_pjsip_pidf_eyebeam_body_supplement.c
    branches/12/res/res_pjsip_pubsub.c
    branches/12/res/res_pjsip_refer.c
    branches/12/res/res_pjsip_registrar.c
    branches/12/res/res_pjsip_registrar_expire.c
    branches/12/res/res_pjsip_rfc3326.c
    branches/12/res/res_pjsip_sdp_rtp.c
    branches/12/res/res_pjsip_send_to_voicemail.c
    branches/12/res/res_pjsip_session.c
    branches/12/res/res_pjsip_t38.c
    branches/12/res/res_pjsip_transport_websocket.c
    branches/12/res/res_pjsip_xpidf_body_generator.c

Modified: branches/12/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_pjsip.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/channels/chan_pjsip.c (original)
+++ branches/12/channels/chan_pjsip.c Thu Oct 16 09:24:55 2014
@@ -2181,6 +2181,8 @@
 {
 	struct ao2_container *endpoints;
 
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	if (!(chan_pjsip_tech.capabilities = ast_format_cap_alloc(0))) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/include/asterisk/res_pjsip.h
URL: http://svnview.digium.com/svn/asterisk/branches/12/include/asterisk/res_pjsip.h?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/include/asterisk/res_pjsip.h (original)
+++ branches/12/include/asterisk/res_pjsip.h Thu Oct 16 09:24:55 2014
@@ -1949,4 +1949,13 @@
  */
 char *ast_sip_get_debug(void);
 
+/*! \brief Determines whether the res_pjsip module is loaded */
+#define CHECK_PJSIP_MODULE_LOADED()				\
+	do {							\
+		if (!ast_module_check("res_pjsip.so")		\
+			|| !ast_sip_get_pjsip_endpoint()) {	\
+			return AST_MODULE_LOAD_DECLINE;		\
+		}						\
+	} while(0)
+
 #endif /* _RES_PJSIP_H */

Modified: branches/12/include/asterisk/res_pjsip_pubsub.h
URL: http://svnview.digium.com/svn/asterisk/branches/12/include/asterisk/res_pjsip_pubsub.h?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/include/asterisk/res_pjsip_pubsub.h (original)
+++ branches/12/include/asterisk/res_pjsip_pubsub.h Thu Oct 16 09:24:55 2014
@@ -739,4 +739,13 @@
  */
 const char *ast_sip_subscription_get_body_subtype(struct ast_sip_subscription *sub);
 
+/*! \brief Determines whether the res_pjsip_pubsub module is loaded */
+#define CHECK_PJSIP_PUBSUB_MODULE_LOADED()			\
+	do {							\
+		CHECK_PJSIP_MODULE_LOADED();			\
+		if (!ast_module_check("res_pjsip_pubsub.so")) {	\
+			return AST_MODULE_LOAD_DECLINE;		\
+		}						\
+	} while(0)
+
 #endif /* RES_PJSIP_PUBSUB_H */

Modified: branches/12/include/asterisk/res_pjsip_session.h
URL: http://svnview.digium.com/svn/asterisk/branches/12/include/asterisk/res_pjsip_session.h?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/include/asterisk/res_pjsip_session.h (original)
+++ branches/12/include/asterisk/res_pjsip_session.h Thu Oct 16 09:24:55 2014
@@ -638,4 +638,13 @@
  */
 void ast_sip_session_resume_reinvite(struct ast_sip_session *session);
 
+/*! \brief Determines whether the res_pjsip_session module is loaded */
+#define CHECK_PJSIP_SESSION_MODULE_LOADED()				\
+	do {								\
+		CHECK_PJSIP_MODULE_LOADED();				\
+		if (!ast_module_check("res_pjsip_session.so")) {	\
+			return AST_MODULE_LOAD_DECLINE;			\
+		}							\
+	} while(0)
+
 #endif /* _RES_PJSIP_SESSION_H */

Modified: branches/12/res/res_hep_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_hep_pjsip.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_hep_pjsip.c (original)
+++ branches/12/res/res_hep_pjsip.c Thu Oct 16 09:24:55 2014
@@ -160,6 +160,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	ast_sip_register_service(&logging_module);
 	return AST_MODULE_LOAD_SUCCESS;
 }

Modified: branches/12/res/res_pjsip_acl.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_acl.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_acl.c (original)
+++ branches/12/res/res_pjsip_acl.c Thu Oct 16 09:24:55 2014
@@ -266,6 +266,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	ast_sorcery_apply_default(ast_sip_get_sorcery(), SIP_SORCERY_ACL_TYPE,
 				  "config", "pjsip.conf,criteria=type=acl");
 

Modified: branches/12/res/res_pjsip_authenticator_digest.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_authenticator_digest.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_authenticator_digest.c (original)
+++ branches/12/res/res_pjsip_authenticator_digest.c Thu Oct 16 09:24:55 2014
@@ -461,6 +461,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	if (build_entity_id()) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_caller_id.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_caller_id.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_caller_id.c (original)
+++ branches/12/res/res_pjsip_caller_id.c Thu Oct 16 09:24:55 2014
@@ -730,6 +730,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	ast_sip_session_register_supplement(&caller_id_supplement);
 	return AST_MODULE_LOAD_SUCCESS;
 }

Modified: branches/12/res/res_pjsip_dialog_info_body_generator.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_dialog_info_body_generator.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_dialog_info_body_generator.c (original)
+++ branches/12/res/res_pjsip_dialog_info_body_generator.c Thu Oct 16 09:24:55 2014
@@ -196,6 +196,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_PUBSUB_MODULE_LOADED();
+
 	if (ast_sip_pubsub_register_body_generator(&dialog_info_body_generator)) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_diversion.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_diversion.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_diversion.c (original)
+++ branches/12/res/res_pjsip_diversion.c Thu Oct 16 09:24:55 2014
@@ -330,6 +330,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	ast_sip_session_register_supplement(&diversion_supplement);
 	return AST_MODULE_LOAD_SUCCESS;
 }

Modified: branches/12/res/res_pjsip_dtmf_info.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_dtmf_info.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_dtmf_info.c (original)
+++ branches/12/res/res_pjsip_dtmf_info.c Thu Oct 16 09:24:55 2014
@@ -150,6 +150,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	ast_sip_session_register_supplement(&dtmf_info_supplement);
 	return AST_MODULE_LOAD_SUCCESS;
 }

Modified: branches/12/res/res_pjsip_endpoint_identifier_anonymous.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_endpoint_identifier_anonymous.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_endpoint_identifier_anonymous.c (original)
+++ branches/12/res/res_pjsip_endpoint_identifier_anonymous.c Thu Oct 16 09:24:55 2014
@@ -108,6 +108,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	ast_sip_register_endpoint_identifier(&anonymous_identifier);
 	return AST_MODULE_LOAD_SUCCESS;
 }

Modified: branches/12/res/res_pjsip_endpoint_identifier_ip.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_endpoint_identifier_ip.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_endpoint_identifier_ip.c (original)
+++ branches/12/res/res_pjsip_endpoint_identifier_ip.c Thu Oct 16 09:24:55 2014
@@ -410,6 +410,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	ast_sorcery_apply_config(ast_sip_get_sorcery(), "res_pjsip_endpoint_identifier_ip");
 	ast_sorcery_apply_default(ast_sip_get_sorcery(), "identify", "config", "pjsip.conf,criteria=type=identify");
 

Modified: branches/12/res/res_pjsip_endpoint_identifier_user.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_endpoint_identifier_user.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_endpoint_identifier_user.c (original)
+++ branches/12/res/res_pjsip_endpoint_identifier_user.c Thu Oct 16 09:24:55 2014
@@ -114,6 +114,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	ast_sip_register_endpoint_identifier(&username_identifier);
 	return AST_MODULE_LOAD_SUCCESS;
 }

Modified: branches/12/res/res_pjsip_exten_state.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_exten_state.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_exten_state.c (original)
+++ branches/12/res/res_pjsip_exten_state.c Thu Oct 16 09:24:55 2014
@@ -528,6 +528,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	if (ast_sip_register_subscription_handler(&presence_handler)) {
 		ast_log(LOG_WARNING, "Unable to register subscription handler %s\n",
 			presence_handler.event_name);

Modified: branches/12/res/res_pjsip_header_funcs.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_header_funcs.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_header_funcs.c (original)
+++ branches/12/res/res_pjsip_header_funcs.c Thu Oct 16 09:24:55 2014
@@ -604,6 +604,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	ast_sip_session_register_supplement(&header_funcs_supplement);
 	ast_custom_function_register(&pjsip_header_function);
 

Modified: branches/12/res/res_pjsip_logger.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_logger.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_logger.c (original)
+++ branches/12/res/res_pjsip_logger.c Thu Oct 16 09:24:55 2014
@@ -233,6 +233,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	if (ast_sorcery_observer_add(ast_sip_get_sorcery(), "global", &global_observer)) {
 		ast_log(LOG_WARNING, "Unable to add global observer\n");
 		return AST_MODULE_LOAD_DECLINE;

Modified: branches/12/res/res_pjsip_messaging.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_messaging.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_messaging.c (original)
+++ branches/12/res/res_pjsip_messaging.c Thu Oct 16 09:24:55 2014
@@ -723,6 +723,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	if (ast_sip_register_service(&messaging_module) != PJ_SUCCESS) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_multihomed.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_multihomed.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_multihomed.c (original)
+++ branches/12/res/res_pjsip_multihomed.c Thu Oct 16 09:24:55 2014
@@ -201,6 +201,8 @@
 {
 	pj_sockaddr addr;
 
+	CHECK_PJSIP_MODULE_LOADED();
+
 	if (!pj_gethostip(pj_AF_INET(), &addr)) {
 		pj_sockaddr_print(&addr, host_ipv4, sizeof(host_ipv4), 2);
 	}

Modified: branches/12/res/res_pjsip_mwi.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_mwi.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_mwi.c (original)
+++ branches/12/res/res_pjsip_mwi.c Thu Oct 16 09:24:55 2014
@@ -958,6 +958,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	if (ast_sip_register_subscription_handler(&mwi_handler)) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_mwi_body_generator.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_mwi_body_generator.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_mwi_body_generator.c (original)
+++ branches/12/res/res_pjsip_mwi_body_generator.c Thu Oct 16 09:24:55 2014
@@ -94,6 +94,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_PUBSUB_MODULE_LOADED();
+
 	if (ast_sip_pubsub_register_body_generator(&mwi_generator)) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_nat.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_nat.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_nat.c (original)
+++ branches/12/res/res_pjsip_nat.c Thu Oct 16 09:24:55 2014
@@ -281,6 +281,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	if (ast_sip_register_service(&nat_module)) {
 		ast_log(LOG_ERROR, "Could not register NAT module for incoming and outgoing requests\n");
 		return AST_MODULE_LOAD_FAILURE;

Modified: branches/12/res/res_pjsip_notify.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_notify.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_notify.c (original)
+++ branches/12/res/res_pjsip_notify.c Thu Oct 16 09:24:55 2014
@@ -750,6 +750,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	if (aco_info_init(&notify_cfg)) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_one_touch_record_info.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_one_touch_record_info.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_one_touch_record_info.c (original)
+++ branches/12/res/res_pjsip_one_touch_record_info.c Thu Oct 16 09:24:55 2014
@@ -107,6 +107,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	if (ast_sip_session_register_supplement(&info_supplement)) {
 		ast_log(LOG_ERROR, "Unable to register One Touch Recording supplement\n");
 		return AST_MODULE_LOAD_FAILURE;

Modified: branches/12/res/res_pjsip_outbound_authenticator_digest.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_outbound_authenticator_digest.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_outbound_authenticator_digest.c (original)
+++ branches/12/res/res_pjsip_outbound_authenticator_digest.c Thu Oct 16 09:24:55 2014
@@ -145,6 +145,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	if (ast_sip_register_outbound_authenticator(&digest_authenticator)) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_outbound_registration.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_outbound_registration.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_outbound_registration.c (original)
+++ branches/12/res/res_pjsip_outbound_registration.c Thu Oct 16 09:24:55 2014
@@ -1241,6 +1241,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	ast_sorcery_apply_default(ast_sip_get_sorcery(), "registration", "config", "pjsip.conf,criteria=type=registration");
 
 	if (ast_sorcery_object_register(ast_sip_get_sorcery(), "registration", sip_outbound_registration_alloc, NULL, sip_outbound_registration_apply)) {

Modified: branches/12/res/res_pjsip_path.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_path.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_path.c (original)
+++ branches/12/res/res_pjsip_path.c Thu Oct 16 09:24:55 2014
@@ -224,6 +224,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	if (ast_sip_register_supplement(&path_supplement)) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_phoneprov_provider.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_phoneprov_provider.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_phoneprov_provider.c (original)
+++ branches/12/res/res_pjsip_phoneprov_provider.c Thu Oct 16 09:24:55 2014
@@ -370,6 +370,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	if (!(sorcery = ast_sorcery_open())) {
 		ast_log(LOG_ERROR, "Unable to open a sorcery instance.\n");
 		return AST_MODULE_LOAD_DECLINE;

Modified: branches/12/res/res_pjsip_pidf_body_generator.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_pidf_body_generator.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_pidf_body_generator.c (original)
+++ branches/12/res/res_pjsip_pidf_body_generator.c Thu Oct 16 09:24:55 2014
@@ -118,6 +118,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_PUBSUB_MODULE_LOADED();
+
 	if (ast_sip_pubsub_register_body_generator(&pidf_body_generator)) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_pidf_digium_body_supplement.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_pidf_digium_body_supplement.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_pidf_digium_body_supplement.c (original)
+++ branches/12/res/res_pjsip_pidf_digium_body_supplement.c Thu Oct 16 09:24:55 2014
@@ -95,6 +95,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_PUBSUB_MODULE_LOADED();
+
 	if (ast_sip_pubsub_register_body_supplement(&pidf_supplement)) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_pidf_eyebeam_body_supplement.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_pidf_eyebeam_body_supplement.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_pidf_eyebeam_body_supplement.c (original)
+++ branches/12/res/res_pjsip_pidf_eyebeam_body_supplement.c Thu Oct 16 09:24:55 2014
@@ -94,6 +94,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_PUBSUB_MODULE_LOADED();
+
 	if (ast_sip_pubsub_register_body_supplement(&pidf_supplement)) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_pubsub.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_pubsub.c (original)
+++ branches/12/res/res_pjsip_pubsub.c Thu Oct 16 09:24:55 2014
@@ -1867,7 +1867,11 @@
 static int load_module(void)
 {
 	static const pj_str_t str_PUBLISH = { "PUBLISH", 7 };
-	struct ast_sorcery *sorcery = ast_sip_get_sorcery();
+	struct ast_sorcery *sorcery;
+
+	CHECK_PJSIP_MODULE_LOADED();
+
+	sorcery = ast_sip_get_sorcery();
 
 	pjsip_evsub_init_module(ast_sip_get_pjsip_endpoint());
 

Modified: branches/12/res/res_pjsip_refer.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_refer.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_refer.c (original)
+++ branches/12/res/res_pjsip_refer.c Thu Oct 16 09:24:55 2014
@@ -20,7 +20,6 @@
 	<depend>pjproject</depend>
 	<depend>res_pjsip</depend>
 	<depend>res_pjsip_session</depend>
-	<depend>res_pjsip_pubsub</depend>
 	<support_level>core</support_level>
  ***/
 
@@ -985,6 +984,8 @@
 {
 	const pj_str_t str_norefersub = { "norefersub", 10 };
 
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	pjsip_replaces_init_module(ast_sip_get_pjsip_endpoint());
 	pjsip_xfer_init_module(ast_sip_get_pjsip_endpoint());
 	pjsip_endpt_add_capability(ast_sip_get_pjsip_endpoint(), NULL, PJSIP_H_SUPPORTED, NULL, 1, &str_norefersub);

Modified: branches/12/res/res_pjsip_registrar.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_registrar.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_registrar.c (original)
+++ branches/12/res/res_pjsip_registrar.c Thu Oct 16 09:24:55 2014
@@ -793,6 +793,8 @@
 {
 	const pj_str_t STR_REGISTER = { "REGISTER", 8 };
 
+	CHECK_PJSIP_MODULE_LOADED();
+
 	if (!(serializers = ao2_container_alloc(
 		      SERIALIZER_BUCKETS, serializer_hash, serializer_cmp))) {
 		return AST_MODULE_LOAD_DECLINE;

Modified: branches/12/res/res_pjsip_registrar_expire.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_registrar_expire.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_registrar_expire.c (original)
+++ branches/12/res/res_pjsip_registrar_expire.c Thu Oct 16 09:24:55 2014
@@ -177,6 +177,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	if (!(contact_autoexpire = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, CONTACT_AUTOEXPIRE_BUCKETS,
 		contact_expiration_hash, contact_expiration_cmp))) {
 		ast_log(LOG_ERROR, "Could not create container for contact auto-expiration\n");

Modified: branches/12/res/res_pjsip_rfc3326.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_rfc3326.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_rfc3326.c (original)
+++ branches/12/res/res_pjsip_rfc3326.c Thu Oct 16 09:24:55 2014
@@ -130,6 +130,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	ast_sip_session_register_supplement(&rfc3326_supplement);
 	return AST_MODULE_LOAD_SUCCESS;
 }

Modified: branches/12/res/res_pjsip_sdp_rtp.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_sdp_rtp.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_sdp_rtp.c (original)
+++ branches/12/res/res_pjsip_sdp_rtp.c Thu Oct 16 09:24:55 2014
@@ -1254,6 +1254,8 @@
  */
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	ast_sockaddr_parse(&address_ipv4, "0.0.0.0", 0);
 	ast_sockaddr_parse(&address_ipv6, "::", 0);
 

Modified: branches/12/res/res_pjsip_send_to_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_send_to_voicemail.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_send_to_voicemail.c (original)
+++ branches/12/res/res_pjsip_send_to_voicemail.c Thu Oct 16 09:24:55 2014
@@ -207,6 +207,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	if (ast_sip_session_register_supplement(&refer_supplement)) {
 		ast_log(LOG_ERROR, "Unable to register Send to Voicemail supplement\n");
 		return AST_MODULE_LOAD_FAILURE;

Modified: branches/12/res/res_pjsip_session.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_session.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_session.c (original)
+++ branches/12/res/res_pjsip_session.c Thu Oct 16 09:24:55 2014
@@ -2405,6 +2405,8 @@
 {
 	pjsip_endpoint *endpt;
 
+	CHECK_PJSIP_MODULE_LOADED();
+
 	if (!ast_sip_get_sorcery() || !ast_sip_get_pjsip_endpoint()) {
 		return AST_MODULE_LOAD_DECLINE;
 	}

Modified: branches/12/res/res_pjsip_t38.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_t38.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_t38.c (original)
+++ branches/12/res/res_pjsip_t38.c Thu Oct 16 09:24:55 2014
@@ -850,6 +850,8 @@
  */
 static int load_module(void)
 {
+	CHECK_PJSIP_SESSION_MODULE_LOADED();
+
 	ast_sockaddr_parse(&address_ipv4, "0.0.0.0", 0);
 	ast_sockaddr_parse(&address_ipv6, "::", 0);
 

Modified: branches/12/res/res_pjsip_transport_websocket.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_transport_websocket.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_transport_websocket.c (original)
+++ branches/12/res/res_pjsip_transport_websocket.c Thu Oct 16 09:24:55 2014
@@ -361,6 +361,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_MODULE_LOADED();
+
 	pjsip_transport_register_type(PJSIP_TRANSPORT_RELIABLE, "WS", 5060, &transport_type_ws);
 	pjsip_transport_register_type(PJSIP_TRANSPORT_RELIABLE, "WSS", 5060, &transport_type_wss);
 

Modified: branches/12/res/res_pjsip_xpidf_body_generator.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_pjsip_xpidf_body_generator.c?view=diff&rev=425690&r1=425689&r2=425690
==============================================================================
--- branches/12/res/res_pjsip_xpidf_body_generator.c (original)
+++ branches/12/res/res_pjsip_xpidf_body_generator.c Thu Oct 16 09:24:55 2014
@@ -151,6 +151,8 @@
 
 static int load_module(void)
 {
+	CHECK_PJSIP_PUBSUB_MODULE_LOADED();
+
 	if (ast_sip_pubsub_register_body_generator(&xpidf_body_generator)) {
 		goto fail;
 	}




More information about the asterisk-commits mailing list