<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6616">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge_softmix:  Forward TEXT frames<br><br>res_pjsip_messaging queues TEXT frames to the channel when it<br>receives an in-dialog MESSAGE from an endpoint and chan_pjsip will<br>send an MESSAGE when it gets a TEXT frame.  On a normal<br>point-to-point call, the frames are forwarded between the two<br>correctly.  bridge_softmix was not though so messages weren't<br>getting forwarded to conference bridge participants.<br><br>* bridge_softmix now does a ast_bridge_queue_everyone_else.  It also<br>forwards the frame back to the sender as a confirmation and to make<br>client side development a little easier.<br><br>Change-Id: Idacf5900bfd5f22ab8cd235aa56dfad090d18489<br>---<br>M bridges/bridge_softmix.c<br>M channels/chan_pjsip.c<br>M main/bridge_channel.c<br>M res/res_pjsip_messaging.c<br>4 files changed, 37 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/16/6616/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c<br>index 5e0a485..55008d0 100644<br>--- a/bridges/bridge_softmix.c<br>+++ b/bridges/bridge_softmix.c<br>@@ -1103,6 +1103,25 @@<br> <br> /*!<br>  * \internal<br>+ * \brief Determine what to do with a text frame.<br>+ * \since 13.18.0<br>+ * \since 14.7.0<br>+ * \since 15.1.0<br>+ *<br>+ * \param bridge Which bridge is getting the frame<br>+ * \param bridge_channel Which channel is writing the frame.<br>+ * \param frame What is being written.<br>+ *<br>+ * \return Nothing<br>+ */<br>+static void softmix_bridge_write_text(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)<br>+{<br>+    ast_bridge_queue_everyone_else(bridge, bridge_channel, frame);<br>+       ast_bridge_channel_queue_frame(bridge_channel, frame);<br>+}<br>+<br>+/*!<br>+ * \internal<br>  * \brief Determine what to do with a control frame.<br>  * \since 12.0.0<br>  *<br>@@ -1184,6 +1203,11 @@<br>     case AST_FRAME_VIDEO:<br>                 softmix_bridge_write_video(bridge, bridge_channel, frame);<br>            break;<br>+       case AST_FRAME_TEXT:<br>+         ast_debug(1, "Received TEXT frame from channel %s: %*.s\n",<br>+                        ast_channel_name(bridge_channel->chan), frame->datalen, (char *)frame->data.ptr);<br>+           softmix_bridge_write_text(bridge, bridge_channel, frame);<br>+            break;<br>        case AST_FRAME_CONTROL:<br>               res = softmix_bridge_write_control(bridge, bridge_channel, frame);<br>            break;<br>diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c<br>index 7520c2b..2ac5b88 100644<br>--- a/channels/chan_pjsip.c<br>+++ b/channels/chan_pjsip.c<br>@@ -2517,8 +2517,6 @@<br>                    data->session->inv_session->cause,<br>                   pjsip_get_status_text(data->session->inv_session->cause)->ptr);<br>   } else {<br>-             ast_debug(3, "Sending in dialog SIP message\n");<br>-<br>                 ast_sip_create_request("MESSAGE", data->session->inv_session->dlg, data->session->endpoint, NULL, NULL, &tdata);<br>                 ast_sip_add_body(tdata, &body);<br>           ast_sip_send_request(tdata, data->session->inv_session->dlg, data->session->endpoint, NULL, NULL);<br>@@ -2537,6 +2535,8 @@<br>      struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(ast);<br>      struct sendtext_data *data = sendtext_data_create(channel->session, text);<br> <br>+     ast_debug(3, "Sending MESSAGE to %s: %s\n", ast_channel_name(ast), text);<br>+<br>        if (!data) {<br>          return -1;<br>    }<br>diff --git a/main/bridge_channel.c b/main/bridge_channel.c<br>index 89e5571..71e9c53 100644<br>--- a/main/bridge_channel.c<br>+++ b/main/bridge_channel.c<br>@@ -1053,7 +1053,10 @@<br>                bridge_frame_free(dup);<br>               return 0;<br>     }<br>-<br>+ if (fr->frametype == AST_FRAME_TEXT) {<br>+            ast_debug(3, "Queuing TEXT frame to %s: %*.s\n", ast_channel_name(bridge_channel->chan),<br>+                        fr->datalen, (char *)fr->data.ptr);<br>+    }<br>     AST_LIST_INSERT_TAIL(&bridge_channel->wr_queue, dup, frame_list);<br>      if (ast_alertpipe_write(bridge_channel->alert_pipe)) {<br>             ast_log(LOG_ERROR, "We couldn't write alert pipe for %p(%s)... something is VERY wrong\n",<br>@@ -2380,6 +2383,7 @@<br>       AST_LIST_TRAVERSE_SAFE_END;<br> <br>        ast_bridge_channel_unlock(bridge_channel);<br>+<br>         if (!fr) {<br>            /*<br>             * Wait some to reduce CPU usage from a tight loop<br>@@ -2403,6 +2407,11 @@<br>            break;<br>        case AST_FRAME_NULL:<br>          break;<br>+       case AST_FRAME_TEXT:<br>+         ast_debug(3, "Sending TEXT frame to %s: %*.s\n", ast_channel_name(bridge_channel->chan),<br>+                        fr->datalen, (char *)fr->data.ptr);<br>+            ast_sendtext(bridge_channel->chan, fr->data.ptr);<br>+              break;<br>        default:<br>              /* Assume that there is no mapped stream for this */<br>          num = -1;<br>diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c<br>index b6e7a64..f8bd39c 100644<br>--- a/res/res_pjsip_messaging.c<br>+++ b/res/res_pjsip_messaging.c<br>@@ -778,7 +778,7 @@<br>           return 0;<br>     }<br> <br>- ast_debug(3, "Received in dialog SIP message\n");<br>+  ast_debug(3, "Received in-dialog MESSAGE from %s: %s\n", ast_channel_name(session->channel), buf);<br> <br>    memset(&f, 0, sizeof(f));<br>         f.frametype = AST_FRAME_TEXT;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6616">change 6616</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/6616"/><meta itemprop="name" content="View Change"/></div></div>

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