<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/6489">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_rtp: Use μ-law by default instead of signed linear<br><br>Multicast/Unicast RTP do not use SDP so we need to use a format that<br>cleanly maps to one of the static RTP payload types. Without this<br>change, an Originate to a Multicast or Unicast channel without a format<br>specified would produce no audio on the receiving device.<br><br>ASTERISK-21399 #close<br>Reported by: Tzafrir Cohen<br><br>Change-Id: I97e332b566e85da04b0004b9b0daae746cfca0e3<br>---<br>M channels/chan_rtp.c<br>1 file changed, 18 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/89/6489/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/channels/chan_rtp.c b/channels/chan_rtp.c<br>index 6eec91e..e1c29a2 100644<br>--- a/channels/chan_rtp.c<br>+++ b/channels/chan_rtp.c<br>@@ -117,6 +117,22 @@<br>  return 0;<br> }<br> <br>+static struct ast_format *derive_format_from_cap(struct ast_format_cap *cap)<br>+{<br>+  struct ast_format *fmt = ast_format_cap_get_format(cap, 0);<br>+<br>+       if (ast_format_cap_count(cap) == 1 && fmt == ast_format_slin) {<br>+              /*<br>+            * Because we have no SDP, we must use one of the static RTP payload<br>+          * assignments. Signed linear @ 8kHz does not map, so if that is our<br>+          * only capability, we force μ-law instead.<br>+          */<br>+          fmt = ast_format_ulaw;<br>+       }<br>+<br>+ return fmt;<br>+}<br>+<br> /*! \brief Function called when we should prepare to call the multicast destination */<br> static struct ast_channel *multicast_rtp_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)<br> {<br>@@ -171,7 +187,7 @@<br> <br>       fmt = ast_multicast_rtp_options_get_format(mcast_options);<br>    if (!fmt) {<br>-          fmt = ast_format_cap_get_format(cap, 0);<br>+             fmt = derive_format_from_cap(cap);<br>    }<br>     if (!fmt) {<br>           ast_log(LOG_ERROR, "No codec available for sending RTP to '%s'\n",<br>@@ -298,7 +314,7 @@<br>                     goto failure;<br>                 }<br>     } else {<br>-             fmt = ast_format_cap_get_format(cap, 0);<br>+             fmt = derive_format_from_cap(cap);<br>            if (!fmt) {<br>                   ast_log(LOG_ERROR, "No codec available for sending RTP to '%s'\n",<br>                          args.destination);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6489">change 6489</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/6489"/><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: I97e332b566e85da04b0004b9b0daae746cfca0e3 </div>
<div style="display:none"> Gerrit-Change-Number: 6489 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>