<p>Pau Espin Pedrol has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/14027">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">osmux: Handle Osmux MGCP extension in MDCX messages<br><br>Change-Id: I65e53bd5dd08b58c253e03d2f358f3be523a2688<br>---<br>M src/libosmo-mgcp/mgcp_protocol.c<br>1 file changed, 30 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/27/14027/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c</span><br><span>index e1bf12b..35141f8 100644</span><br><span>--- a/src/libosmo-mgcp/mgcp_protocol.c</span><br><span>+++ b/src/libosmo-mgcp/mgcp_protocol.c</span><br><span>@@ -1048,6 +1048,7 @@</span><br><span>   const char *mode = NULL;</span><br><span>     struct mgcp_conn_rtp *conn = NULL;</span><br><span>         const char *conn_id = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+     int osmux_cid = -2;</span><br><span>  int rc;</span><br><span> </span><br><span>  LOGPENDP(endp, DLMGCP, LOGL_NOTICE, "MDCX: modifying existing connection ...\n");</span><br><span>@@ -1095,6 +1096,16 @@</span><br><span>                 case 'Z':</span><br><span>                    silent = strcmp("noanswer", line + 3) == 0;</span><br><span>                        break;</span><br><span style="color: hsl(120, 100%, 40%);">+                case 'X':</span><br><span style="color: hsl(120, 100%, 40%);">+                     if (strncmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                               /* If osmux is disabled, just skip setting it up */</span><br><span style="color: hsl(120, 100%, 40%);">+                           if (!p->endp->cfg->osmux)</span><br><span style="color: hsl(120, 100%, 40%);">+                                    break;</span><br><span style="color: hsl(120, 100%, 40%);">+                                osmux_cid = mgcp_osmux_setup(endp, line);</span><br><span style="color: hsl(120, 100%, 40%);">+                             break;</span><br><span style="color: hsl(120, 100%, 40%);">+                        }</span><br><span style="color: hsl(120, 100%, 40%);">+                     /* Ignore unknown X-headers */</span><br><span style="color: hsl(120, 100%, 40%);">+                        break;</span><br><span>               case '\0':</span><br><span>                   have_sdp = 1;</span><br><span>                        goto mgcp_header_done;</span><br><span>@@ -1166,6 +1177,25 @@</span><br><span>              goto error3;</span><br><span>         }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (mgcp_conn_rtp_is_osmux(conn)) {</span><br><span style="color: hsl(120, 100%, 40%);">+           OSMO_ASSERT(conn->osmux.cid_allocated);</span><br><span style="color: hsl(120, 100%, 40%);">+            if (osmux_cid < -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      LOGPCONN(conn->conn, DLMGCP, LOGL_ERROR,</span><br><span style="color: hsl(120, 100%, 40%);">+                            "MDCX: Failed to parse Osmux CID!\n");</span><br><span style="color: hsl(120, 100%, 40%);">+                     goto error3;</span><br><span style="color: hsl(120, 100%, 40%);">+          } else if (osmux_cid == -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+                 LOGPCONN(conn->conn, DLMGCP, LOGL_ERROR,</span><br><span style="color: hsl(120, 100%, 40%);">+                            "MDCX: wilcard in MDCX is not supported!\n");</span><br><span style="color: hsl(120, 100%, 40%);">+                      goto error3;</span><br><span style="color: hsl(120, 100%, 40%);">+          } else if (osmux_cid != (int) conn->osmux.cid) {</span><br><span style="color: hsl(120, 100%, 40%);">+                   LOGPCONN(conn->conn, DLMGCP, LOGL_ERROR,</span><br><span style="color: hsl(120, 100%, 40%);">+                            "MDCX: changing already allocated CID is not supported!\n");</span><br><span style="color: hsl(120, 100%, 40%);">+                       goto error3;</span><br><span style="color: hsl(120, 100%, 40%);">+          }</span><br><span style="color: hsl(120, 100%, 40%);">+             /* TODO: In the future (when we have recvCID!=sendCID), we need to</span><br><span style="color: hsl(120, 100%, 40%);">+               tell Osmux code that osmux_cid is to be used as sendCID for</span><br><span style="color: hsl(120, 100%, 40%);">+                   that conn. */</span><br><span style="color: hsl(120, 100%, 40%);">+      }</span><br><span> </span><br><span>        if (setup_rtp_processing(endp, conn) != 0) {</span><br><span>                 rate_ctr_inc(&rate_ctrs->ctr[MGCP_MDCX_FAIL_START_RTP]);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/14027">change 14027</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/14027"/><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: I65e53bd5dd08b58c253e03d2f358f3be523a2688 </div>
<div style="display:none"> Gerrit-Change-Number: 14027 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Pau Espin Pedrol <pespin@sysmocom.de> </div>