Skip to content

Commit

Permalink
rtp_relay: avoid crash when dialog/b2b not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed May 29, 2023
1 parent 96eac0b commit e00300c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/rtp_relay/rtp_relay_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,10 @@ int rtp_relay_ctx_preinit(void)
if (load_b2b_logic_api(&rtp_relay_b2b)==0) {
rtp_relay_b2b_ctx_idx = rtp_relay_b2b.ctx_register_ptr(rtp_relay_b2b_end);
}
if (rtp_relay_dlg_ctx_idx < 0 && rtp_relay_b2b_ctx_idx < 0) {
LM_ERR("nor dialog not b2b modules loaded - cannot use this module!\n");
return -1;
}
return 0;
}

Expand Down Expand Up @@ -1852,6 +1856,10 @@ int rtp_relay_ctx_engage(struct sip_msg *msg,
}

if (route_type != LOCAL_ROUTE) {
if (rtp_relay_dlg_ctx_idx < 0) {
LM_ERR("dialog module not loaded - failed to engage\n");
return -1;
}
if (!rtp_relay_ctx_engaged(ctx)) {

/* handles the replies to the original INVITE */
Expand Down

0 comments on commit e00300c

Please sign in to comment.