From: Kinsey Moore Date: Thu, 16 Oct 2014 16:32:25 +0000 (+0000) Subject: PJSIP: Enforce module load dependencies X-Git-Tag: 14.0.0-beta1~1549 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86a4ce495783434f6d4fef5484b44147e4b3a7b7;p=thirdparty%2Fasterisk.git 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/ ........ Merged revisions 425690 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 425691 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425700 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index ea55df799a..f200a05d34 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -2214,6 +2214,8 @@ static int load_module(void) { struct ao2_container *endpoints; + CHECK_PJSIP_SESSION_MODULE_LOADED(); + if (!(chan_pjsip_tech.capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) { return AST_MODULE_LOAD_DECLINE; } diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h index fdb2105cfa..302a15d730 100644 --- a/include/asterisk/res_pjsip.h +++ b/include/asterisk/res_pjsip.h @@ -1944,4 +1944,13 @@ void ast_sip_unregister_supplement(struct ast_sip_supplement *supplement); */ 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 */ diff --git a/include/asterisk/res_pjsip_pubsub.h b/include/asterisk/res_pjsip_pubsub.h index aac4261c1e..d32b246af5 100644 --- a/include/asterisk/res_pjsip_pubsub.h +++ b/include/asterisk/res_pjsip_pubsub.h @@ -674,4 +674,13 @@ const char *ast_sip_subscription_get_body_type(struct ast_sip_subscription *sub) */ 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 */ diff --git a/include/asterisk/res_pjsip_session.h b/include/asterisk/res_pjsip_session.h index 3344a6b381..d50b431792 100644 --- a/include/asterisk/res_pjsip_session.h +++ b/include/asterisk/res_pjsip_session.h @@ -636,4 +636,13 @@ struct ast_sip_session *ast_sip_dialog_get_session(pjsip_dialog *dlg); */ 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 */ diff --git a/res/res_hep_pjsip.c b/res/res_hep_pjsip.c index 333719de0a..b5cf0b81e9 100644 --- a/res/res_hep_pjsip.c +++ b/res/res_hep_pjsip.c @@ -159,6 +159,8 @@ static pjsip_module logging_module = { static int load_module(void) { + CHECK_PJSIP_MODULE_LOADED(); + ast_sip_register_service(&logging_module); return AST_MODULE_LOAD_SUCCESS; } diff --git a/res/res_pjsip_acl.c b/res/res_pjsip_acl.c index 7cb56e78c1..8155bf8802 100644 --- a/res/res_pjsip_acl.c +++ b/res/res_pjsip_acl.c @@ -266,6 +266,8 @@ static void *acl_alloc(const char *name) 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"); diff --git a/res/res_pjsip_authenticator_digest.c b/res/res_pjsip_authenticator_digest.c index 2688553e56..8a781254c3 100644 --- a/res/res_pjsip_authenticator_digest.c +++ b/res/res_pjsip_authenticator_digest.c @@ -466,6 +466,8 @@ static int reload_module(void) static int load_module(void) { + CHECK_PJSIP_MODULE_LOADED(); + if (build_entity_id()) { return AST_MODULE_LOAD_DECLINE; } diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c index 3764931684..e22ce6a09e 100644 --- a/res/res_pjsip_caller_id.c +++ b/res/res_pjsip_caller_id.c @@ -730,6 +730,8 @@ static struct ast_sip_session_supplement caller_id_supplement = { static int load_module(void) { + CHECK_PJSIP_SESSION_MODULE_LOADED(); + ast_sip_session_register_supplement(&caller_id_supplement); return AST_MODULE_LOAD_SUCCESS; } diff --git a/res/res_pjsip_dialog_info_body_generator.c b/res/res_pjsip_dialog_info_body_generator.c index 06cff8d580..d9725f4c53 100644 --- a/res/res_pjsip_dialog_info_body_generator.c +++ b/res/res_pjsip_dialog_info_body_generator.c @@ -191,6 +191,8 @@ static struct ast_sip_pubsub_body_generator dialog_info_body_generator = { 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; } diff --git a/res/res_pjsip_diversion.c b/res/res_pjsip_diversion.c index f8aca35f6d..a4ac157e4e 100644 --- a/res/res_pjsip_diversion.c +++ b/res/res_pjsip_diversion.c @@ -330,6 +330,8 @@ static struct ast_sip_session_supplement diversion_supplement = { static int load_module(void) { + CHECK_PJSIP_SESSION_MODULE_LOADED(); + ast_sip_session_register_supplement(&diversion_supplement); return AST_MODULE_LOAD_SUCCESS; } diff --git a/res/res_pjsip_dtmf_info.c b/res/res_pjsip_dtmf_info.c index e78f7b7a34..b0a6649a0b 100644 --- a/res/res_pjsip_dtmf_info.c +++ b/res/res_pjsip_dtmf_info.c @@ -150,6 +150,8 @@ static struct ast_sip_session_supplement dtmf_info_supplement = { static int load_module(void) { + CHECK_PJSIP_SESSION_MODULE_LOADED(); + ast_sip_session_register_supplement(&dtmf_info_supplement); return AST_MODULE_LOAD_SUCCESS; } diff --git a/res/res_pjsip_endpoint_identifier_anonymous.c b/res/res_pjsip_endpoint_identifier_anonymous.c index f0ea6dd50d..a7956b5896 100644 --- a/res/res_pjsip_endpoint_identifier_anonymous.c +++ b/res/res_pjsip_endpoint_identifier_anonymous.c @@ -108,6 +108,8 @@ static struct ast_sip_endpoint_identifier anonymous_identifier = { static int load_module(void) { + CHECK_PJSIP_MODULE_LOADED(); + ast_sip_register_endpoint_identifier(&anonymous_identifier); return AST_MODULE_LOAD_SUCCESS; } diff --git a/res/res_pjsip_endpoint_identifier_ip.c b/res/res_pjsip_endpoint_identifier_ip.c index 43f1318a8b..aab2c7665e 100644 --- a/res/res_pjsip_endpoint_identifier_ip.c +++ b/res/res_pjsip_endpoint_identifier_ip.c @@ -410,6 +410,8 @@ static struct ast_sip_cli_formatter_entry *cli_formatter; 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"); diff --git a/res/res_pjsip_endpoint_identifier_user.c b/res/res_pjsip_endpoint_identifier_user.c index dba3541cac..beae1cdd45 100644 --- a/res/res_pjsip_endpoint_identifier_user.c +++ b/res/res_pjsip_endpoint_identifier_user.c @@ -114,6 +114,8 @@ static struct ast_sip_endpoint_identifier username_identifier = { static int load_module(void) { + CHECK_PJSIP_MODULE_LOADED(); + ast_sip_register_endpoint_identifier(&username_identifier); return AST_MODULE_LOAD_SUCCESS; } diff --git a/res/res_pjsip_exten_state.c b/res/res_pjsip_exten_state.c index 4cc5a5881a..6b8ee6c12f 100644 --- a/res/res_pjsip_exten_state.c +++ b/res/res_pjsip_exten_state.c @@ -465,6 +465,8 @@ static void to_ami(struct ast_sip_subscription *sub, 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); diff --git a/res/res_pjsip_header_funcs.c b/res/res_pjsip_header_funcs.c index d3a482202f..4ab3fb1d82 100644 --- a/res/res_pjsip_header_funcs.c +++ b/res/res_pjsip_header_funcs.c @@ -604,6 +604,8 @@ static struct ast_sip_session_supplement header_funcs_supplement = { 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); diff --git a/res/res_pjsip_logger.c b/res/res_pjsip_logger.c index 320bb03016..2e5c76c29f 100644 --- a/res/res_pjsip_logger.c +++ b/res/res_pjsip_logger.c @@ -233,6 +233,8 @@ static const struct ast_sorcery_observer global_observer = { 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; diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c index db9752553f..04332996ab 100644 --- a/res/res_pjsip_messaging.c +++ b/res/res_pjsip_messaging.c @@ -723,6 +723,8 @@ static pjsip_module messaging_module = { static int load_module(void) { + CHECK_PJSIP_SESSION_MODULE_LOADED(); + if (ast_sip_register_service(&messaging_module) != PJ_SUCCESS) { return AST_MODULE_LOAD_DECLINE; } diff --git a/res/res_pjsip_multihomed.c b/res/res_pjsip_multihomed.c index 30d0fd95a9..38824da4e9 100644 --- a/res/res_pjsip_multihomed.c +++ b/res/res_pjsip_multihomed.c @@ -201,6 +201,8 @@ static int load_module(void) { pj_sockaddr addr; + CHECK_PJSIP_MODULE_LOADED(); + if (!pj_gethostip(pj_AF_INET(), &addr)) { pj_sockaddr_print(&addr, host_ipv4, sizeof(host_ipv4), 2); } diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c index bed07193e2..eaf0f32afc 100644 --- a/res/res_pjsip_mwi.c +++ b/res/res_pjsip_mwi.c @@ -895,6 +895,8 @@ static int reload(void) static int load_module(void) { + CHECK_PJSIP_MODULE_LOADED(); + if (ast_sip_register_subscription_handler(&mwi_handler)) { return AST_MODULE_LOAD_DECLINE; } diff --git a/res/res_pjsip_mwi_body_generator.c b/res/res_pjsip_mwi_body_generator.c index 2020e26ded..cc558ac82e 100644 --- a/res/res_pjsip_mwi_body_generator.c +++ b/res/res_pjsip_mwi_body_generator.c @@ -94,6 +94,8 @@ static struct ast_sip_pubsub_body_generator mwi_generator = { static int load_module(void) { + CHECK_PJSIP_PUBSUB_MODULE_LOADED(); + if (ast_sip_pubsub_register_body_generator(&mwi_generator)) { return AST_MODULE_LOAD_DECLINE; } diff --git a/res/res_pjsip_nat.c b/res/res_pjsip_nat.c index 654e51ba89..588734352a 100644 --- a/res/res_pjsip_nat.c +++ b/res/res_pjsip_nat.c @@ -281,6 +281,8 @@ static int unload_module(void) 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; diff --git a/res/res_pjsip_notify.c b/res/res_pjsip_notify.c index 8b61d1346c..d7e3d803b7 100644 --- a/res/res_pjsip_notify.c +++ b/res/res_pjsip_notify.c @@ -987,6 +987,8 @@ static int manager_notify(struct mansession *s, const struct message *m) static int load_module(void) { + CHECK_PJSIP_MODULE_LOADED(); + if (aco_info_init(¬ify_cfg)) { return AST_MODULE_LOAD_DECLINE; } diff --git a/res/res_pjsip_one_touch_record_info.c b/res/res_pjsip_one_touch_record_info.c index 4d744e3582..8b1ff9dab4 100644 --- a/res/res_pjsip_one_touch_record_info.c +++ b/res/res_pjsip_one_touch_record_info.c @@ -107,6 +107,8 @@ static struct ast_sip_session_supplement info_supplement = { 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; diff --git a/res/res_pjsip_outbound_authenticator_digest.c b/res/res_pjsip_outbound_authenticator_digest.c index fbd916884a..64238a868f 100644 --- a/res/res_pjsip_outbound_authenticator_digest.c +++ b/res/res_pjsip_outbound_authenticator_digest.c @@ -146,6 +146,8 @@ static struct ast_sip_outbound_authenticator digest_authenticator = { static int load_module(void) { + CHECK_PJSIP_MODULE_LOADED(); + if (ast_sip_register_outbound_authenticator(&digest_authenticator)) { return AST_MODULE_LOAD_DECLINE; } diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c index 9fd5fe6d36..3e6c984b2e 100644 --- a/res/res_pjsip_outbound_registration.c +++ b/res/res_pjsip_outbound_registration.c @@ -1239,6 +1239,8 @@ static struct ast_sip_cli_formatter_entry *cli_formatter; 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)) { diff --git a/res/res_pjsip_path.c b/res/res_pjsip_path.c index a7ad3f4ce7..d0ee5a49a5 100644 --- a/res/res_pjsip_path.c +++ b/res/res_pjsip_path.c @@ -224,6 +224,8 @@ static struct ast_sip_session_supplement path_session_supplement = { static int load_module(void) { + CHECK_PJSIP_SESSION_MODULE_LOADED(); + if (ast_sip_register_supplement(&path_supplement)) { return AST_MODULE_LOAD_DECLINE; } diff --git a/res/res_pjsip_phoneprov_provider.c b/res/res_pjsip_phoneprov_provider.c index 6c2c777935..0480f0bbd1 100644 --- a/res/res_pjsip_phoneprov_provider.c +++ b/res/res_pjsip_phoneprov_provider.c @@ -370,6 +370,8 @@ static int users_apply_handler(const struct ast_sorcery *sorcery, void *obj) 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; diff --git a/res/res_pjsip_pidf_body_generator.c b/res/res_pjsip_pidf_body_generator.c index e5002ceb56..ef0cce599a 100644 --- a/res/res_pjsip_pidf_body_generator.c +++ b/res/res_pjsip_pidf_body_generator.c @@ -117,6 +117,8 @@ static struct ast_sip_pubsub_body_generator pidf_body_generator = { 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; } diff --git a/res/res_pjsip_pidf_digium_body_supplement.c b/res/res_pjsip_pidf_digium_body_supplement.c index eff16a85c2..86e673afa1 100644 --- a/res/res_pjsip_pidf_digium_body_supplement.c +++ b/res/res_pjsip_pidf_digium_body_supplement.c @@ -95,6 +95,8 @@ static struct ast_sip_pubsub_body_supplement pidf_supplement = { static int load_module(void) { + CHECK_PJSIP_PUBSUB_MODULE_LOADED(); + if (ast_sip_pubsub_register_body_supplement(&pidf_supplement)) { return AST_MODULE_LOAD_DECLINE; } diff --git a/res/res_pjsip_pidf_eyebeam_body_supplement.c b/res/res_pjsip_pidf_eyebeam_body_supplement.c index a8be55c5a1..cd590c3d37 100644 --- a/res/res_pjsip_pidf_eyebeam_body_supplement.c +++ b/res/res_pjsip_pidf_eyebeam_body_supplement.c @@ -94,6 +94,8 @@ static struct ast_sip_pubsub_body_supplement pidf_supplement = { static int load_module(void) { + CHECK_PJSIP_PUBSUB_MODULE_LOADED(); + if (ast_sip_pubsub_register_body_supplement(&pidf_supplement)) { return AST_MODULE_LOAD_DECLINE; } diff --git a/res/res_pjsip_publish_asterisk.c b/res/res_pjsip_publish_asterisk.c index 8d4d8510d1..e1b095e7c6 100644 --- a/res/res_pjsip_publish_asterisk.c +++ b/res/res_pjsip_publish_asterisk.c @@ -856,6 +856,8 @@ static int regex_filter_handler(const struct aco_option *opt, struct ast_variabl static int load_module(void) { + CHECK_PJSIP_PUBSUB_MODULE_LOADED(); + ast_sorcery_apply_default(ast_sip_get_sorcery(), "asterisk-publication", "config", "pjsip.conf,criteria=type=asterisk-publication"); if (ast_sorcery_object_register(ast_sip_get_sorcery(), "asterisk-publication", asterisk_publication_config_alloc, NULL, NULL)) { diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c index 0d9e25a9d8..4a1076d187 100644 --- a/res/res_pjsip_pubsub.c +++ b/res/res_pjsip_pubsub.c @@ -4168,7 +4168,11 @@ static int resource_event_handler(const struct aco_option *opt, struct ast_varia 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()); diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c index ff8ceac9ea..f64f77dfad 100644 --- a/res/res_pjsip_refer.c +++ b/res/res_pjsip_refer.c @@ -20,7 +20,6 @@ pjproject res_pjsip res_pjsip_session - res_pjsip_pubsub core ***/ @@ -985,6 +984,8 @@ static int load_module(void) { 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); diff --git a/res/res_pjsip_registrar.c b/res/res_pjsip_registrar.c index b5cb124cee..aad3dd4a7a 100644 --- a/res/res_pjsip_registrar.c +++ b/res/res_pjsip_registrar.c @@ -793,6 +793,8 @@ static int load_module(void) { 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; diff --git a/res/res_pjsip_registrar_expire.c b/res/res_pjsip_registrar_expire.c index ee168bd8fc..256ed9e1b8 100644 --- a/res/res_pjsip_registrar_expire.c +++ b/res/res_pjsip_registrar_expire.c @@ -177,6 +177,8 @@ static void contact_expiration_initialize_existing(void) 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"); diff --git a/res/res_pjsip_rfc3326.c b/res/res_pjsip_rfc3326.c index e0b1939535..3ed8de6592 100644 --- a/res/res_pjsip_rfc3326.c +++ b/res/res_pjsip_rfc3326.c @@ -130,6 +130,8 @@ static struct ast_sip_session_supplement rfc3326_supplement = { static int load_module(void) { + CHECK_PJSIP_SESSION_MODULE_LOADED(); + ast_sip_session_register_supplement(&rfc3326_supplement); return AST_MODULE_LOAD_SUCCESS; } diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 1de675bf88..2aa8acc381 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -1230,6 +1230,8 @@ static int unload_module(void) */ 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); diff --git a/res/res_pjsip_send_to_voicemail.c b/res/res_pjsip_send_to_voicemail.c index 3bb5da87a6..97f55d300a 100644 --- a/res/res_pjsip_send_to_voicemail.c +++ b/res/res_pjsip_send_to_voicemail.c @@ -207,6 +207,8 @@ static struct ast_sip_session_supplement refer_supplement = { 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; diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 1d6b36fbca..56187211fb 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -2415,6 +2415,8 @@ static int load_module(void) { pjsip_endpoint *endpt; + CHECK_PJSIP_MODULE_LOADED(); + if (!ast_sip_get_sorcery() || !ast_sip_get_pjsip_endpoint()) { return AST_MODULE_LOAD_DECLINE; } diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c index a031716d94..d1ec07610f 100644 --- a/res/res_pjsip_t38.c +++ b/res/res_pjsip_t38.c @@ -850,6 +850,8 @@ static int unload_module(void) */ 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); diff --git a/res/res_pjsip_transport_websocket.c b/res/res_pjsip_transport_websocket.c index 7de65dd858..1db36bb5a9 100644 --- a/res/res_pjsip_transport_websocket.c +++ b/res/res_pjsip_transport_websocket.c @@ -361,6 +361,8 @@ static struct ast_sip_session_supplement websocket_supplement = { 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); diff --git a/res/res_pjsip_xpidf_body_generator.c b/res/res_pjsip_xpidf_body_generator.c index e7009afdfc..43cb1e78bc 100644 --- a/res/res_pjsip_xpidf_body_generator.c +++ b/res/res_pjsip_xpidf_body_generator.c @@ -150,6 +150,8 @@ static void unregister_all(void) static int load_module(void) { + CHECK_PJSIP_PUBSUB_MODULE_LOADED(); + if (ast_sip_pubsub_register_body_generator(&xpidf_body_generator)) { goto fail; }