Skip to content

Commit

Permalink
siprec: unref failed dialogs
Browse files Browse the repository at this point in the history
Close #2674
  • Loading branch information
razvancrainea committed Nov 23, 2022
1 parent 7402451 commit e3c74a3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions modules/siprec/siprec_logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,15 +625,20 @@ void tm_start_recording(struct cell *t, int type, struct tmcb_params *ps)
str *body;
struct src_sess *ss;

if (!is_invite(t) || ps->code >= 300)
if (!is_invite(t))
return;
ss = (struct src_sess *)*ps->param;
if (ps->code >= 300) {
/* unref so we can release the dialog */
srec_dlg.dlg_unref(ss->dlg, 1);
return;
}

/* check if we have a reply with body */
body = get_body_part(ps->rpl, TYPE_APPLICATION, SUBTYPE_SDP);
if (!body || body->len == 0)
return;

ss = (struct src_sess *)*ps->param;
/* engage only on successful calls */
SIPREC_LOCK(ss);
/* if session has been started, do not start it again */
Expand Down

0 comments on commit e3c74a3

Please sign in to comment.