From: Joshua Colp Date: Tue, 18 Sep 2018 11:08:24 +0000 (+0000) Subject: res_pjsip_session: Don't add declined stream if one does not exist. X-Git-Tag: 16.1.0-rc1~124^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e79e6b09718f3cb8eeb5964048daf71a0895d45;p=thirdparty%2Fasterisk.git res_pjsip_session: Don't add declined stream if one does not exist. Given a scenario where a session refresh was done with a removed stream we would always add a removed stream to the outgoing SDP even if one did not already exist. This change makes it so that a removed stream is only placed into the SDP if one already exists. ASTERISK-28047 Change-Id: Ibb97d21cdeb87a8acae0c720861b0ff255708442 --- diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 2b78cfa4af..e681dcb1a7 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -1572,6 +1572,11 @@ int ast_sip_session_refresh(struct ast_sip_session *session, /* No need to do anything with stream if it's media state is removed */ if (ast_stream_get_state(stream) == AST_STREAM_STATE_REMOVED) { + /* If there is no existing stream we can just not have this stream in the topology at all. */ + if (!existing_stream) { + ast_stream_topology_del_stream(media_state->topology, index); + index -= 1; + } continue; }