Skip to content
Snippets Groups Projects
Commit 217c3a39 authored by Yalu Zhang's avatar Yalu Zhang
Browse files

Fix a bug that RTP/RTCP ports are not closed for non-answered incoming calls

In ast_sip_session_terminate(), reset both active and pending media to prevent
non-freed resources after a call. Otherwise RTP/RTCP ports won't be closed after
the call in some call scenarios, e.g. a non-answered incoming call. In that case,
there are no active media sessions before the swapping.
parent 95b434d0
Branches
Tags
No related merge requests found
...@@ -3578,7 +3578,13 @@ void ast_sip_session_terminate(struct ast_sip_session *session, int response) ...@@ -3578,7 +3578,13 @@ void ast_sip_session_terminate(struct ast_sip_session *session, int response)
*/ */
ast_sip_session_media_stats_save(session, session->active_media_state); ast_sip_session_media_stats_save(session, session->active_media_state);
SWAP(session->active_media_state, session->pending_media_state); SWAP(session->active_media_state, session->pending_media_state);
/*
* Reset both active and pending media to prevent non-freed resources after a call. Otherwise RTP/RTCP ports
* won't be closed after the call in some call scenarios, e.g. a non-answered incoming call. In that case,
* there are no active media sessions before the swapping.
*/
ast_sip_session_media_state_reset(session->pending_media_state); ast_sip_session_media_state_reset(session->pending_media_state);
ast_sip_session_media_state_reset(session->active_media_state);
switch (session->inv_session->state) { switch (session->inv_session->state) {
case PJSIP_INV_STATE_NULL: case PJSIP_INV_STATE_NULL:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment