<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17797">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip_message_filter: Make multipart aware<br><br>filter_on_tx_message's multihomed check assumed the body of<br>the outgoing message was single-part sdp which would fail if the<br>body was multi-part.  It now uses the new pjsip_get_sdp_info()<br>function which searches for an sdp in both single- and multi- part<br>message bodies.<br><br>ASTERISK_29813<br>(not ready to close)<br><br>Change-Id: I8f5b8cfdc27f1d4bd3e7491ea9090951a4525c56<br>---<br>M res/res_pjsip/pjsip_message_filter.c<br>1 file changed, 19 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/97/17797/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip/pjsip_message_filter.c b/res/res_pjsip/pjsip_message_filter.c</span><br><span>index 2e3efcd..5267a27 100644</span><br><span>--- a/res/res_pjsip/pjsip_message_filter.c</span><br><span>+++ b/res/res_pjsip/pjsip_message_filter.c</span><br><span>@@ -230,6 +230,8 @@</span><br><span>    pjsip_via_hdr *via;</span><br><span>  pjsip_fromto_hdr *from;</span><br><span>      pjsip_tpselector sel;</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_sdp_info *sdp_info;</span><br><span style="color: hsl(120, 100%, 40%);">+     pjmedia_sdp_session *sdp;</span><br><span> </span><br><span>        sanitize_tdata(tdata);</span><br><span> </span><br><span>@@ -325,10 +327,23 @@</span><br><span>           }</span><br><span>    }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   /* Update the SDP if it is present */</span><br><span style="color: hsl(0, 100%, 40%);">-   if (tdata->msg->body && ast_sip_is_content_type(&tdata->msg->body->content_type, "application", "sdp") &&</span><br><span style="color: hsl(0, 100%, 40%);">-                multihomed_rewrite_sdp(tdata->msg->body->data)) {</span><br><span style="color: hsl(0, 100%, 40%);">-              struct pjmedia_sdp_session *sdp = tdata->msg->body->data;</span><br><span style="color: hsl(120, 100%, 40%);">+    /* If there's no body in the tdata we can just return here. */</span><br><span style="color: hsl(120, 100%, 40%);">+    if (!tdata->msg->body) {</span><br><span style="color: hsl(120, 100%, 40%);">+                return PJ_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   /*</span><br><span style="color: hsl(120, 100%, 40%);">+     * pjsip_get_sdp_info will search for an SDP even if it's in</span><br><span style="color: hsl(120, 100%, 40%);">+       * a multipart message body.</span><br><span style="color: hsl(120, 100%, 40%);">+   */</span><br><span style="color: hsl(120, 100%, 40%);">+   sdp_info = pjsip_get_sdp_info(tdata->pool, tdata->msg->body, NULL, &pjsip_media_type_application_sdp);</span><br><span style="color: hsl(120, 100%, 40%);">+   if (sdp_info != PJ_SUCCESS || !sdp_info->sdp) {</span><br><span style="color: hsl(120, 100%, 40%);">+            return PJ_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   sdp = sdp_info->sdp;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     if (multihomed_rewrite_sdp(sdp)) {</span><br><span>           static const pj_str_t STR_IP4 = { "IP4", 3 };</span><br><span>              static const pj_str_t STR_IP6 = { "IP6", 3 };</span><br><span>              pj_str_t STR_IP;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17797">change 17797</a>. To unsubscribe, or for help writing mail filters, 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/c/asterisk/+/17797"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I8f5b8cfdc27f1d4bd3e7491ea9090951a4525c56 </div>
<div style="display:none"> Gerrit-Change-Number: 17797 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>