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

</div><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;">diff --git a/channels/chan_rtp.c b/channels/chan_rtp.c<br>index d671706..2ab8414 100644<br>--- a/channels/chan_rtp.c<br>+++ b/channels/chan_rtp.c<br>@@ -119,6 +119,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>@@ -173,7 +189,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>@@ -300,7 +316,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/6488">change 6488</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/6488"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 14 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I97e332b566e85da04b0004b9b0daae746cfca0e3 </div>
<div style="display:none"> Gerrit-Change-Number: 6488 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.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: Matthew Fredrickson <creslin@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>