res_hep_{pjsip|rtcp}: Decline module loads if res_hep had not loaded

A crash can occur in res_hep_pjsip or res_hep_rtcp if res_hep has not
loaded and does not have a configuration file. Previously when this
occurred, checks were put in to see if the configuration was loaded
successfully. While this is a good idea - and has been added to the
offending function in res_hep - the reality is res_hep_pjsip and
res_hep_rtcp have no business running if res_hep isn't also running.

As such, this patch also adds a function to res_hep that returns whether
or not it successfully loaded. Oddly enough, ast_module_check returns
"everything is peachy" even if a module declined its load - so it cannot
be solely relied on. res_hep_pjsip and res_hep_rtcp now also check this
function to see if they should continue to load; if it fails, they
decline their load as well.

ASTERISK-26096 #close

Change-Id: I007e535fcc2e51c2ca48534f48c5fc2ac38935ea
This commit is contained in:
Matt Jordan
2016-06-08 12:26:29 -05:00
parent 5164e1fd85
commit 7f5ca67e5f
5 changed files with 30 additions and 0 deletions

View File

@@ -149,6 +149,10 @@ 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);