<p>Neels Hofmeyr has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13115">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">mgcp client: allow setting conn mode for CRCX and MDCX<br><br>Add conn_mode to struct mgcp_conn_peer, to allow setting an explicit connection<br>mode instead of implicit MGCP_CONN_RECV_ONLY / MGCP_CONN_RECV_SEND depending on<br>remote RTP port presence. Default to old behavior if this is left unset.<br><br>Rationale:<br><br>For IuUP Initialization, osmo-msc currently still uses a hack at osmo-mgw to<br>echo the IuUP Initialization back to the sender as an ACK. For sanity checking<br>reasons, this is done iff the CRCX created the CI in loopback mode. So, in<br>order to be able to switch to the mgcp_client_fsm in osmo-msc instead of<br>"manual" MGCP message composition and yet still be able to support IuUP and<br>IuCS, we need to be able to set the conn mode upon CRCX to loopback.<br><br>If we merged the IuUP patch (which is already on a branch somewhere) to<br>osmo-mgw, we wouldn't bother with this patch, but adding this conn mode choice<br>has these benefits:<br><br>- post-IuUP-fix osmo-msc versions can interop with older osmo-mgw IuUP for<br>  IuCS.<br><br>- It is conceivable that some MGCP clients prefer explicit conn modes instead<br>  of the implicit MGCP_CONN_RECV_ONLY / MGCP_CONN_RECV_SEND choice. This opens<br>  the possibility to switch between conn modes with MDCX messages.<br><br>Change-Id: I26be5c4b06a680f25f19797407ab56a5a4880ddc<br>---<br>M include/osmocom/mgcp_client/mgcp_client_fsm.h<br>M src/libosmo-mgcp-client/mgcp_client_fsm.c<br>2 files changed, 15 insertions(+), 0 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/15/13115/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/mgcp_client/mgcp_client_fsm.h b/include/osmocom/mgcp_client/mgcp_client_fsm.h</span><br><span>index bb07872..716a6d4 100644</span><br><span>--- a/include/osmocom/mgcp_client/mgcp_client_fsm.h</span><br><span>+++ b/include/osmocom/mgcp_client/mgcp_client_fsm.h</span><br><span>@@ -47,6 +47,10 @@</span><br><span>         * known to issue incoherent or unknown CallIDs / to issue CRCX commands with a different domain</span><br><span>      * name than the BSC. An OsmoMGW will then ignore these and not fail on mismatches. */</span><br><span>       uint32_t x_osmo_ign;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        /*! If left MGCP_CONN_NONE, use MGCP_CONN_RECV_ONLY or MGCP_CONN_RECV_SEND, depending on whether an audio RTP</span><br><span style="color: hsl(120, 100%, 40%);">+  * address is set. If != MGCP_CONN_NONE, force this conn mode. */</span><br><span style="color: hsl(120, 100%, 40%);">+     enum mgcp_connection_mode conn_mode;</span><br><span> };</span><br><span> </span><br><span> struct osmo_fsm_inst *mgcp_conn_create(struct mgcp_client *mgcp, struct osmo_fsm_inst *parent_fi, uint32_t parent_term_evt,</span><br><span>diff --git a/src/libosmo-mgcp-client/mgcp_client_fsm.c b/src/libosmo-mgcp-client/mgcp_client_fsm.c</span><br><span>index da900c5..7c4e081 100644</span><br><span>--- a/src/libosmo-mgcp-client/mgcp_client_fsm.c</span><br><span>+++ b/src/libosmo-mgcp-client/mgcp_client_fsm.c</span><br><span>@@ -134,6 +134,13 @@</span><br><span>        mgcp_msg->conn_mode = MGCP_CONN_RECV_SEND;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static void set_conn_mode(struct mgcp_msg *mgcp_msg, struct mgcp_conn_peer *peer)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  enum mgcp_connection_mode conn_mode = peer->conn_mode;</span><br><span style="color: hsl(120, 100%, 40%);">+     if (conn_mode != MGCP_CONN_NONE)</span><br><span style="color: hsl(120, 100%, 40%);">+              mgcp_msg->conn_mode = conn_mode;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static struct msgb *make_mdcx_msg(struct mgcp_ctx *mgcp_ctx)</span><br><span> {</span><br><span>        struct mgcp_msg mgcp_msg;</span><br><span>@@ -155,6 +162,8 @@</span><br><span>      memcpy(mgcp_msg.codecs, mgcp_ctx->conn_peer_local.codecs, sizeof(mgcp_msg.codecs));</span><br><span>       memcpy(mgcp_msg.ptmap, mgcp_ctx->conn_peer_local.ptmap, sizeof(mgcp_msg.ptmap));</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+       set_conn_mode(&mgcp_msg, &mgcp_ctx->conn_peer_local);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>   /* Note: We take the endpoint and the call_id from the remote</span><br><span>         * connection info, because we can be confident that the</span><br><span>      * information there is valid. For the local info, we explicitly</span><br><span>@@ -199,6 +208,8 @@</span><br><span>               make_crcx_msg(&mgcp_msg, &mgcp_ctx->conn_peer_local);</span><br><span>             if (mgcp_ctx->conn_peer_local.port)</span><br><span>                       add_audio(&mgcp_msg, &mgcp_ctx->conn_peer_local);</span><br><span style="color: hsl(120, 100%, 40%);">+          set_conn_mode(&mgcp_msg, &mgcp_ctx->conn_peer_local);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>           msg = mgcp_msg_gen(mgcp_ctx->mgcp, &mgcp_msg);</span><br><span>                OSMO_ASSERT(msg);</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13115">change 13115</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/13115"/><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: I26be5c4b06a680f25f19797407ab56a5a4880ddc </div>
<div style="display:none"> Gerrit-Change-Number: 13115 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>