summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--channels/chan_pjsip.c2
-rw-r--r--include/asterisk/res_pjsip.h9
-rw-r--r--include/asterisk/res_pjsip_pubsub.h9
-rw-r--r--include/asterisk/res_pjsip_session.h9
-rw-r--r--res/res_hep_pjsip.c2
-rw-r--r--res/res_pjsip_acl.c2
-rw-r--r--res/res_pjsip_authenticator_digest.c2
-rw-r--r--res/res_pjsip_caller_id.c2
-rw-r--r--res/res_pjsip_dialog_info_body_generator.c2
-rw-r--r--res/res_pjsip_diversion.c2
-rw-r--r--res/res_pjsip_dtmf_info.c2
-rw-r--r--res/res_pjsip_endpoint_identifier_anonymous.c2
-rw-r--r--res/res_pjsip_endpoint_identifier_ip.c2
-rw-r--r--res/res_pjsip_endpoint_identifier_user.c2
-rw-r--r--res/res_pjsip_exten_state.c2
-rw-r--r--res/res_pjsip_header_funcs.c2
-rw-r--r--res/res_pjsip_logger.c2
-rw-r--r--res/res_pjsip_messaging.c2
-rw-r--r--res/res_pjsip_multihomed.c2
-rw-r--r--res/res_pjsip_mwi.c2
-rw-r--r--res/res_pjsip_mwi_body_generator.c2
-rw-r--r--res/res_pjsip_nat.c2
-rw-r--r--res/res_pjsip_notify.c2
-rw-r--r--res/res_pjsip_one_touch_record_info.c2
-rw-r--r--res/res_pjsip_outbound_authenticator_digest.c2
-rw-r--r--res/res_pjsip_outbound_registration.c2
-rw-r--r--res/res_pjsip_path.c2
-rw-r--r--res/res_pjsip_phoneprov_provider.c2
-rw-r--r--res/res_pjsip_pidf_body_generator.c2
-rw-r--r--res/res_pjsip_pidf_digium_body_supplement.c2
-rw-r--r--res/res_pjsip_pidf_eyebeam_body_supplement.c2
-rw-r--r--res/res_pjsip_publish_asterisk.c2
-rw-r--r--res/res_pjsip_pubsub.c6
-rw-r--r--res/res_pjsip_refer.c3
-rw-r--r--res/res_pjsip_registrar.c2
-rw-r--r--res/res_pjsip_registrar_expire.c2
-rw-r--r--res/res_pjsip_rfc3326.c2
-rw-r--r--res/res_pjsip_sdp_rtp.c2
-rw-r--r--res/res_pjsip_send_to_voicemail.c2
-rw-r--r--res/res_pjsip_session.c2
-rw-r--r--res/res_pjsip_t38.c2
-rw-r--r--res/res_pjsip_transport_websocket.c2
-rw-r--r--res/res_pjsip_xpidf_body_generator.c2
43 files changed, 110 insertions, 2 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index ea55df799..f200a05d3 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 fdb2105cf..302a15d73 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 aac4261c1..d32b246af 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 3344a6b38..d50b43179 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 333719de0..b5cf0b81e 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 7cb56e78c..8155bf880 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 2688553e5..8a781254c 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 376493168..e22ce6a09 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 06cff8d58..d9725f4c5 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 f8aca35f6..a4ac157e4 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 e78f7b7a3..b0a6649a0 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 f0ea6dd50..a7956b589 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 43f1318a8..aab2c7665 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 dba3541ca..beae1cdd4 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 4cc5a5881..6b8ee6c12 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 d3a482202..4ab3fb1d8 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 320bb0301..2e5c76c29 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 db9752553..04332996a 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 30d0fd95a..38824da4e 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 bed07193e..eaf0f32af 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 2020e26de..cc558ac82 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 654e51ba8..588734352 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 8b61d1346..d7e3d803b 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(&notify_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 4d744e358..8b1ff9dab 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 fbd916884..64238a868 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 9fd5fe6d3..3e6c984b2 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 a7ad3f4ce..d0ee5a49a 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 6c2c77793..0480f0bbd 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 e5002ceb5..ef0cce599 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 eff16a85c..86e673afa 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 a8be55c5a..cd590c3d3 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 8d4d8510d..e1b095e7c 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 0d9e25a9d..4a1076d18 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 ff8ceac9e..f64f77dfa 100644
--- a/res/res_pjsip_refer.c
+++ b/res/res_pjsip_refer.c
@@ -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 @@ 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 b5cb124ce..aad3dd4a7 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 ee168bd8f..256ed9e1b 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 e0b193953..3ed8de659 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 1de675bf8..2aa8acc38 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 3bb5da87a..97f55d300 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 1d6b36fbc..56187211f 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 a031716d9..d1ec07610 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 7de65dd85..1db36bb5a 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 e7009afdf..43cb1e78b 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;
}