diff options
Diffstat (limited to 'res/res_pjsip_session.c')
-rw-r--r-- | res/res_pjsip_session.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index f25201731..d13b372be 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -2702,10 +2702,8 @@ int ast_sip_session_defer_termination(struct ast_sip_session *session) session->defer_end = 1; session->ended_while_deferred = 0; - session->scheduled_termination.id = 0; ao2_ref(session, +1); - session->scheduled_termination.user_data = session; - session->scheduled_termination.cb = session_termination_cb; + pj_timer_entry_init(&session->scheduled_termination, 0, session, session_termination_cb); res = (pjsip_endpt_schedule_timer(ast_sip_get_pjsip_endpoint(), &session->scheduled_termination, &delay) != PJ_SUCCESS) ? -1 : 0; @@ -2727,8 +2725,8 @@ int ast_sip_session_defer_termination(struct ast_sip_session *session) */ static void sip_session_defer_termination_stop_timer(struct ast_sip_session *session) { - if (pj_timer_heap_cancel(pjsip_endpt_get_timer_heap(ast_sip_get_pjsip_endpoint()), - &session->scheduled_termination)) { + if (pj_timer_heap_cancel_if_active(pjsip_endpt_get_timer_heap(ast_sip_get_pjsip_endpoint()), + &session->scheduled_termination, session->scheduled_termination.id)) { ao2_ref(session, -1); } } |