<p>Pau Espin Pedrol has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/14068">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">osmux: Fix loopback for Osmux connections<br><br>Move code in RTP specific path to generic dispatch_rtp_cb. This way<br>loopback logic is applied both for Osmux and RTP connections.<br><br>Change-Id: Ia30f5a14f150e4d151eac4d1046ea834f1685a5f<br>---<br>M src/libosmo-mgcp/mgcp_network.c<br>1 file changed, 16 insertions(+), 15 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/68/14068/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c</span><br><span>index 650d4c0..bb29d2b 100644</span><br><span>--- a/src/libosmo-mgcp/mgcp_network.c</span><br><span>+++ b/src/libosmo-mgcp/mgcp_network.c</span><br><span>@@ -1233,6 +1233,22 @@</span><br><span> * destination connection is known the RTP packet is sent via</span><br><span> * the destination connection. */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Check if the connection is in loopback mode, if yes, just send the</span><br><span style="color: hsl(120, 100%, 40%);">+ * incoming data back to the origin */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (conn->mode == MGCP_CONN_LOOPBACK) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* When we are in loopback mode, we loop back all incoming</span><br><span style="color: hsl(120, 100%, 40%);">+ * packets back to their origin. We will use the originating</span><br><span style="color: hsl(120, 100%, 40%);">+ * address data from the UDP packet header to patch the</span><br><span style="color: hsl(120, 100%, 40%);">+ * outgoing address in connection on the fly */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (conn->u.rtp.end.rtp_port == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+ conn->u.rtp.end.addr = addr->sin_addr;</span><br><span style="color: hsl(120, 100%, 40%);">+ conn->u.rtp.end.rtp_port = addr->sin_port;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ return mgcp_send_rtp(proto, addr, buf,</span><br><span style="color: hsl(120, 100%, 40%);">+ buf_size, &conn->u.rtp, &conn->u.rtp);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* Find a destination connection. */</span><br><span> /* NOTE: This code path runs every time an RTP packet is received. The</span><br><span> * function mgcp_find_dst_conn() we use to determine the detination</span><br><span>@@ -1319,21 +1335,6 @@</span><br><span> </span><br><span> mgcp_conn_watchdog_kick(conn_src->conn);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- /* Check if the connection is in loopback mode, if yes, just send the</span><br><span style="color: hsl(0, 100%, 40%);">- * incoming data back to the origin */</span><br><span style="color: hsl(0, 100%, 40%);">- if (conn_src->conn->mode == MGCP_CONN_LOOPBACK) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* When we are in loopback mode, we loop back all incoming</span><br><span style="color: hsl(0, 100%, 40%);">- * packets back to their origin. We will use the originating</span><br><span style="color: hsl(0, 100%, 40%);">- * address data from the UDP packet header to patch the</span><br><span style="color: hsl(0, 100%, 40%);">- * outgoing address in connection on the fly */</span><br><span style="color: hsl(0, 100%, 40%);">- if (conn_src->end.rtp_port == 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- conn_src->end.addr = addr.sin_addr;</span><br><span style="color: hsl(0, 100%, 40%);">- conn_src->end.rtp_port = addr.sin_port;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return mgcp_send_rtp(proto, &addr, buf,</span><br><span style="color: hsl(0, 100%, 40%);">- len, conn_src, conn_src);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /* If AMR is configured for the ingress connection a conversion of the</span><br><span> * framing mode (octet-aligned vs. bandwith-efficient is explicitly</span><br><span> * define, then we check if the incoming payload matches that</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/14068">change 14068</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.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.osmocom.org/14068"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: osmo-mgw </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ia30f5a14f150e4d151eac4d1046ea834f1685a5f </div>
<div style="display:none"> Gerrit-Change-Number: 14068 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Pau Espin Pedrol <pespin@sysmocom.de> </div>