diff --git a/modules/siprec/siprec.c b/modules/siprec/siprec.c index c940c4034f6..d57501b84d5 100644 --- a/modules/siprec/siprec.c +++ b/modules/siprec/siprec.c @@ -199,14 +199,6 @@ static void mod_destroy(void) { } -static void tm_src_unref_session(void *p) -{ - struct src_sess *ss = (struct src_sess *)p; - srec_dlg.dlg_unref(ss->ctx->dlg, 1); /* release the dialog */ - srec_hlog(ss, SREC_UNREF, "start recording unref"); - SIPREC_UNREF(ss); -} - /* * function that simply prints the parameters passed */ @@ -318,7 +310,7 @@ static int siprec_start_rec(struct sip_msg *msg, str *srs, str *instance) SIPREC_REF_UNSAFE(ss); srec_hlog(ss, SREC_REF, "starting recording"); if (srec_tm.register_tmcb(msg, 0, TMCB_RESPONSE_OUT, tm_start_recording, - ss, tm_src_unref_session) <= 0) { + ss, NULL) <= 0) { LM_ERR("cannot register tm callbacks\n"); srec_hlog(ss, SREC_UNREF, "error starting recording"); SIPREC_UNREF_UNSAFE(ss); diff --git a/modules/siprec/siprec_logic.c b/modules/siprec/siprec_logic.c index 9b4912bf39b..c34eafeaac0 100644 --- a/modules/siprec/siprec_logic.c +++ b/modules/siprec/siprec_logic.c @@ -748,6 +748,13 @@ void tm_start_recording(struct cell *t, int type, struct tmcb_params *ps) SIPREC_UNLOCK(ss->ctx); } +static void src_unref_session(struct src_sess *ss) +{ + srec_dlg.dlg_unref(ss->dlg, 1); /* release the dialog */ + srec_hlog(ss, SREC_UNREF, "start recording unref"); + SIPREC_UNREF(ss); +} + void srec_logic_destroy(struct src_sess *sess, int keep_sdp) { if (!sess->b2b_key.s) @@ -758,6 +765,10 @@ void srec_logic_destroy(struct src_sess *sess, int keep_sdp) sess->initial_sdp.s = NULL; } + if (!keep_sdp) { + src_unref_session(sess); + } + srec_b2b.entity_delete(B2B_CLIENT, &sess->b2b_key, sess->dlginfo, 1, 1); if (sess->dlginfo) { shm_free(sess->dlginfo);