<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6556">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
Kevin Harwell: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_session/BUNDLE: Handle no audio codecs on endpoint<br><br>When an INVITE came in with both audio and video streams but there<br>were no audio codecs defined for the endpoint, we weren't declining<br>the audio stream. Since it's usually the first/transport stream,<br>when the video stream was processed and tried to use the transport,<br>it was empty and caused a crash. We now decline the the stream if<br>there are no matching codecs so when the video stream is processed,<br>it's now the first/transport stream and processes normally.<br><br>Change-Id: Ic854eda54c95031e66b076ecfae3041d34daa692<br>---<br>M res/res_pjsip_session.c<br>1 file changed, 22 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c<br>index 5c4041a..728ba64 100644<br>--- a/res/res_pjsip_session.c<br>+++ b/res/res_pjsip_session.c<br>@@ -549,6 +549,16 @@<br> return 0;<br> }<br> <br>+static void remove_stream_from_bundle(struct ast_sip_session_media *session_media,<br>+ struct ast_stream *stream)<br>+{<br>+ ast_stream_set_state(stream, AST_STREAM_STATE_REMOVED);<br>+ ast_free(session_media->mid);<br>+ session_media->mid = NULL;<br>+ session_media->bundle_group = -1;<br>+ session_media->bundled = 0;<br>+}<br>+<br> static int handle_incoming_sdp(struct ast_sip_session *session, const pjmedia_sdp_session *sdp)<br> {<br> int i;<br>@@ -611,9 +621,7 @@<br> if (!remote_stream->desc.port || is_stream_limitation_reached(type, session->endpoint, type_streams)) {<br> ast_debug(1, "Declining incoming SDP media stream '%s' at position '%d'\n",<br> ast_codec_media_type2str(type), i);<br>- ast_stream_set_state(stream, AST_STREAM_STATE_REMOVED);<br>- session_media->bundle_group = -1;<br>- session_media->bundled = 0;<br>+ remove_stream_from_bundle(session_media, stream);<br> continue;<br> }<br> <br>@@ -628,6 +636,11 @@<br> if (res < 0) {<br> /* Catastrophic failure. Abort! */<br> return -1;<br>+ } else if (res == 0) {<br>+ ast_debug(1, "Declining incoming SDP media stream '%s' at position '%d'\n",<br>+ ast_codec_media_type2str(type), i);<br>+ remove_stream_from_bundle(session_media, stream);<br>+ continue;<br> } else if (res > 0) {<br> ast_debug(1, "Media stream '%s' handled by %s\n",<br> ast_codec_media_type2str(session_media->type),<br>@@ -655,8 +668,12 @@<br> if (res < 0) {<br> /* Catastrophic failure. Abort! */<br> return -1;<br>- }<br>- if (res > 0) {<br>+ } else if (res == 0) {<br>+ ast_debug(1, "Declining incoming SDP media stream '%s' at position '%d'\n",<br>+ ast_codec_media_type2str(type), i);<br>+ remove_stream_from_bundle(session_media, stream);<br>+ continue;<br>+ } else if (res > 0) {<br> ast_debug(1, "Media stream '%s' handled by %s\n",<br> ast_codec_media_type2str(session_media->type),<br> handler->id);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6556">change 6556</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6556"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15.0 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ic854eda54c95031e66b076ecfae3041d34daa692 </div>
<div style="display:none"> Gerrit-Change-Number: 6556 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>