<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/9292">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_messaging:  Allow application/* for in-dialog MESSAGEs<br><br>In addition to text/* content types, incoming_in_dialog_request now<br>accepts application/* content types.<br><br>Also fixed a length issue when copying the body text.  It was one<br>character short.<br><br>ASTERISK-27942<br><br>Change-Id: I4e54d8cc6158dc47eb8fdd6ba0108c6fd53f2818<br>---<br>M main/channel.c<br>M res/res_pjsip_messaging.c<br>2 files changed, 13 insertions(+), 10 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/channel.c b/main/channel.c<br>index 49f3be7..fe24695 100644<br>--- a/main/channel.c<br>+++ b/main/channel.c<br>@@ -4930,8 +4930,8 @@<br>          ast_debug(1, "Sending TEXT to %s: %s\n", ast_channel_name(chan), body);<br>             res = ast_channel_tech(chan)->send_text(chan, body);<br>       } else {<br>-             ast_debug(1, "Channel technology does not support sending text on channel '%s'\n",<br>-                 ast_channel_name(chan));<br>+             ast_debug(1, "Channel technology does not support sending content type '%s' on channel '%s'\n",<br>+                    S_OR(content_type, "text/plain"), ast_channel_name(chan));<br>          res = -1;<br>     }<br>     ast_clear_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING);<br>diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c<br>index cbc6ea5..c6ea1dc 100644<br>--- a/res/res_pjsip_messaging.c<br>+++ b/res/res_pjsip_messaging.c<br>@@ -80,22 +80,25 @@<br>  * \internal<br>  * \brief Checks to make sure the request has the correct content type.<br>  *<br>- * \details This module supports the following media types: "text/\*".<br>+ * \details This module supports the following media types: "text/\*", "application/\*".<br>  * Return unsupported otherwise.<br>  *<br>  * \param rdata The SIP request<br>  */<br>-static enum pjsip_status_code check_content_type_any_text(const pjsip_rx_data *rdata)<br>+static enum pjsip_status_code check_content_type_in_dialog(const pjsip_rx_data *rdata)<br> {<br>    int res = PJSIP_SC_UNSUPPORTED_MEDIA_TYPE;<br>-   pj_str_t text = { "text", 4};<br>+      static const pj_str_t text = { "text", 4};<br>+ static const pj_str_t application = { "application", 11};<br> <br>-       /* We'll accept any text/ content type */<br>+        /* We'll accept any text/ or application/ content type */<br>         if (rdata->msg_info.msg->body && rdata->msg_info.msg->body->len<br>-               && pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0) {<br>+         && (pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &text) == 0<br>+                   || pj_stricmp(&rdata->msg_info.msg->body->content_type.type, &application) == 0)) {<br>          res = PJSIP_SC_OK;<br>    } else if (rdata->msg_info.ctype<br>-          && pj_stricmp(&rdata->msg_info.ctype->media.type, &text) == 0) {<br>+               && (pj_stricmp(&rdata->msg_info.ctype->media.type, &text) == 0<br>+         || pj_stricmp(&rdata->msg_info.ctype->media.type, &application) == 0)) {<br>                res = PJSIP_SC_OK;<br>    }<br> <br>@@ -800,7 +803,7 @@<br>             return 0;<br>     }<br> <br>- code = check_content_type_any_text(rdata);<br>+   code = check_content_type_in_dialog(rdata);<br>   if (code != PJSIP_SC_OK) {<br>            send_response(rdata, code, dlg, tsx);<br>                 return 0;<br>@@ -849,7 +852,7 @@<br>                send_response(rdata, PJSIP_SC_INTERNAL_SERVER_ERROR, dlg, tsx);<br>               return 0;<br>     }<br>-    ast_copy_string(attrs[pos].value, rdata->msg_info.msg->body->data, rdata->msg_info.msg->body->len);<br>+        ast_copy_string(attrs[pos].value, rdata->msg_info.msg->body->data, rdata->msg_info.msg->body->len + 1);<br>     pos++;<br> <br>     msg = ast_msg_data_alloc(AST_MSG_DATA_SOURCE_TYPE_IN_DIALOG, attrs, pos);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9292">change 9292</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/9292"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I4e54d8cc6158dc47eb8fdd6ba0108c6fd53f2818 </div>
<div style="display:none"> Gerrit-Change-Number: 9292 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: 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>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>