Merge "rtp_engine/res_rtp_asterisk: Fix RTP struct reentrancy crashes."
[asterisk/asterisk.git] / res / res_hep_rtcp.c
index 8643d4d..7191f46 100644 (file)
@@ -31,8 +31,6 @@
 
 #include "asterisk.h"
 
-ASTERISK_REGISTER_FILE()
-
 #include "asterisk/res_hep.h"
 #include "asterisk/module.h"
 #include "asterisk/netsock2.h"
@@ -149,11 +147,15 @@ static void rtp_topic_handler(void *data, struct stasis_subscription *sub, struc
 
 static int load_module(void)
 {
+       if (!ast_module_check("res_hep.so") || !hepv3_is_loaded()) {
+               ast_log(AST_LOG_WARNING, "res_hep is not loaded or running; declining module load\n");
+               return AST_MODULE_LOAD_DECLINE;
+       }
 
        stasis_rtp_subscription = stasis_subscribe(ast_rtp_topic(),
                rtp_topic_handler, NULL);
        if (!stasis_rtp_subscription) {
-               return AST_MODULE_LOAD_FAILURE;
+               return AST_MODULE_LOAD_DECLINE;
        }
 
        return AST_MODULE_LOAD_SUCCESS;