Skip to content

Commit

Permalink
rtpengine: search through rtp_relay calldis when terminating
Browse files Browse the repository at this point in the history
Reported as part of the #3121 ticket
  • Loading branch information
razvancrainea committed Jul 12, 2023
1 parent 2ff9c59 commit 58863fc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions modules/rtpengine/rtpengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ static struct tm_binds tmb;

static struct dlg_binds dlgb;

static struct rtp_relay_hooks rtp_relay;

static pv_elem_t *extra_id_pv = NULL;

static const cmd_export_t cmds[] = {
Expand Down Expand Up @@ -1417,7 +1419,8 @@ static mi_response_t *mi_reload_rtpengines(const mi_params_t *params,
static mi_response_t *mi_teardown_call(const mi_params_t *params,
struct mi_handler *async_hdl)
{
str callid;
str callid, *pcallid = NULL;
unsigned int h_entry = 0, h_id = 0;

if (dlgb.terminate_dlg == NULL)
return init_mi_error(500, MI_SSTR("Dialog module not loaded"));
Expand All @@ -1427,7 +1430,10 @@ static mi_response_t *mi_teardown_call(const mi_params_t *params,
if(callid.s == NULL || callid.len ==0)
return init_mi_error(400, MI_SSTR("Empty callid"));

if (dlgb.terminate_dlg(&callid, 0, 0, _str("MI Termination")) < 0)
/* try to "resolve" the callid first through rtp_relay */
if (rtp_relay.get_dlg_ids(&callid, &h_entry, &h_id) == 0)
pcallid = &callid; /* search for callid, if dialog was not found */
if (dlgb.terminate_dlg(pcallid, h_entry, h_id, _str("MI Termination")) < 0)
return init_mi_error(500, MI_SSTR("Failed to terminate dialog"));

return init_mi_result_ok();
Expand Down Expand Up @@ -1469,8 +1475,6 @@ void rtpengine_timer(unsigned int ticks, void *param)
/* hack to get the rtpengine node used for the offer */
static pv_spec_t media_pvar;

static struct rtp_relay_hooks rtp_relay;

static int mod_preinit(void)
{
static str rtpengine_relay_pvar_str = str_init("$var(___rtpengine_relay_var__)");
Expand Down

0 comments on commit 58863fc

Please sign in to comment.