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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_sendtext:  Allow content types other than text/plain<br><br>There was no real reason to limit the conteny type to text/plain other<br>than that's what it was limited to before.  Now any text/* content<br>type will be allowed for channel drivers that don't support enhanced<br>messaging and any type will be allowed for channel drivers that do<br>support enhanced messaging.<br><br>Change-Id: I94a90cfee98b4bc8e22aa5c0b6afb7b862f979d9<br>---<br>M apps/app_sendtext.c<br>M main/channel.c<br>2 files changed, 13 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/apps/app_sendtext.c b/apps/app_sendtext.c<br>index d1cd120..6d0c7d3 100644<br>--- a/apps/app_sendtext.c<br>+++ b/apps/app_sendtext.c<br>@@ -68,9 +68,13 @@<br>                                 </variable><br>                             <variable name="SENDTEXT_CONTENT_TYPE"><br>                                       <para>If set and this channel supports enhanced messaging, this value will be<br>-                                  used as the message <literal>Content-Type</literal>.  It <emphasis>MUST</emphasis><br>-                                   be a <literal>text/&#42;</literal> content type.  If not specified, the<br>+                                      used as the message <literal>Content-Type</literal>.  If not specified, the<br>                                       default of <literal>text/plain</literal> will be used.</para><br>+                                      <para><emphasis>Warning:</emphasis> Messages of types other than<br>+                                   <literal>text/&#42;</literal> cannot be sent via channel drivers that do not<br>+                                 support Enhanced Messaging. An attempt to do so will be ignored and will result<br>+                                      in the <literal>SENDTEXTSTATUS</literal> variable being set to<br>+                                   <literal>UNSUPPORTED</literal>.</para><br>                              </variable><br>                             <variable name="SENDTEXT_BODY"><br>                                       <para>If set this value will be used as the message body and any text supplied<br>@@ -193,11 +197,6 @@<br>                    },<br>            };<br> <br>-                if (!ast_strlen_zero(content_type) && !ast_begins_with(content_type, "text/")) {<br>-                   ast_log(LOG_ERROR, "SENDTEXT_CONTENT_TYPE must begin with 'text/'\n");<br>-                     rc = -1;<br>-                     goto cleanup;<br>-                }<br>             msg_type = "ENHANCED";<br>              msg = ast_msg_data_alloc(AST_MSG_DATA_SOURCE_TYPE_IN_DIALOG, attrs, ARRAY_LEN(attrs));<br>                if (msg) {<br>@@ -214,6 +213,11 @@<br>              }<br> <br>  } else if (ast_channel_tech(chan)->send_text) {<br>+           if (!ast_strlen_zero(content_type) && !ast_begins_with(content_type, "text/")) {<br>+                   rc = -1;<br>+                     goto cleanup;<br>+                }<br>+<br>          msg_type = "BASIC";<br>                 if (ast_sendtext(chan, body) == 0) {<br>                  status = "SUCCESS";<br>diff --git a/main/channel.c b/main/channel.c<br>index 8de7ad2..a5cc4e7 100644<br>--- a/main/channel.c<br>+++ b/main/channel.c<br>@@ -4890,7 +4890,7 @@<br> <br>      CHECK_BLOCKING(chan);<br>         if (ast_channel_tech(chan)->write_text<br>-            && (ast_strlen_zero(content_type) || strcasecmp(content_type, "text/plain") == 0)<br>+          && (ast_strlen_zero(content_type) || ast_begins_with(content_type, "text/"))<br>                && (ast_format_cap_has_type(ast_channel_nativeformats(chan), AST_MEDIA_TYPE_TEXT))) {<br>                 struct ast_frame f;<br>           size_t body_len = strlen(body) + 1;<br>@@ -4918,7 +4918,7 @@<br>                    ast_channel_name(chan), body);<br>                res = ast_channel_tech(chan)->send_text_data(chan, msg);<br>   } else if (ast_channel_tech(chan)->send_text<br>-              && (ast_strlen_zero(content_type) || strcasecmp(content_type, "text/plain") == 0)) {<br>+               && (ast_strlen_zero(content_type) || ast_begins_with(content_type, "text/"))) {<br>             /* Send the body of an enhanced message to a channel driver that supports only a char str */<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></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9074">change 9074</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/9074"/><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: I94a90cfee98b4bc8e22aa5c0b6afb7b862f979d9 </div>
<div style="display:none"> Gerrit-Change-Number: 9074 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </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: Matthew Fredrickson <creslin@digium.com> </div>