neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/37282?usp=email )


Change subject: do not FAIL on CRCX in sendrecv mode
......................................................................

do not FAIL on CRCX in sendrecv mode

Currently, a CRCX in sendrecv mode results in:

  DLMGCP ERROR endpoint:rtpbridge/2@mgw CI:7F4C8EDD CRCX: selected connection 
mode type requires an opposite end! (mgcp_protocol.c:1090)

But it is not actually practical, nor logical to require another conn
for the 'sendrecv' ConnectionMode.

Impractical: If I want to create two conns on an endpoint that both are
in 'sendrecv' mode, I have to send two CRCX, one for each conn. At the
time of the first CRCX, there cannot be any other conn, so I am
currently forced to send a different ConnectionMode in the CRCX,
followed by another MDCX later, just to change the first conn to
sendrecv.

Illogical: In a situation where two conns are currently in sendrecv
mode, if I now DLCX one of them, I can legally reach a state with a
single conn in sendrecv mode, just as currently forbidden for CRCX.

In general, MGCP is not forcing any particular number of connections.

Simply start forwarding RTP as soon as there is a remote conn, and not
require another explicit MDCX.

Related: SYS#6974 SYS#6907
Related: osmo-ttcn3-hacks I00fd854f058f7f53e2f579e8481ca2b9253f08e3
Change-Id: Ic089485543c5c97a35c7ae24fe0f622bf57d1976
---
M src/libosmo-mgcp/mgcp_protocol.c
M tests/mgcp/mgcp_test.c
M tests/mgcp/mgcp_test.ok
3 files changed, 46 insertions(+), 25 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/82/37282/1

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index ac5c682..16dee03 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -1083,17 +1083,6 @@

        mgcp_rtp_end_config(endp, 0, &conn->end);
 
-       /* check connection mode setting */
-       if (conn->conn->mode != MGCP_CONN_LOOPBACK
-           && conn->conn->mode != MGCP_CONN_RECV_ONLY
-           && osmo_sockaddr_port(&conn->end.addr.u.sa) == 0) {
-               LOGPCONN(_conn, DLMGCP, LOGL_ERROR,
-                        "CRCX: selected connection mode type requires an 
opposite end!\n");
-               error_code = 527;
-               rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, 
MGCP_CRCX_FAIL_NO_REMOTE_CONN_DESC));
-               goto error2;
-       }
-
        /* Find a local address for conn based on policy and initial SDP remote
           information, then find a free port for it */
        if (mgcp_get_local_addr(conn->end.local_addr, conn) < 0) {
@@ -1295,17 +1284,6 @@
        if (conn->type == MGCP_RTP_DEFAULT && 
strcmp(conn->end.codec->subtype_name, "VND.3GPP.IUFP") == 0)
                rc = mgcp_conn_iuup_init(conn);

-       /* check connection mode setting */
-       if (conn->conn->mode != MGCP_CONN_LOOPBACK
-           && conn->conn->mode != MGCP_CONN_RECV_ONLY
-           && !mgcp_rtp_end_remote_addr_available(&conn->end)) {
-               LOGPCONN(conn->conn, DLMGCP, LOGL_ERROR,
-                        "MDCX: selected connection mode type requires an 
opposite end!\n");
-               error_code = 527;
-               rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, 
MGCP_MDCX_FAIL_NO_REMOTE_CONN_DESC));
-               goto error3;
-       }
-
        if (mgcp_conn_rtp_is_osmux(conn)) {
                OSMO_ASSERT(conn->osmux.local_cid_allocated);
                if (remote_osmux_cid < -1) {
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 2e06639..21be037 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -145,7 +145,16 @@
        "a=ptime:20\r\n"

 #define MDCX4_ADDR0000_RET \
-       "527 18983216 FAIL\r\n"
+       "200 18983216 OK\r\n" \
+       "\r\n" \
+       "v=0\r\n" \
+       "o=- %s 23 IN IP4 0.0.0.0\r\n" \
+       "s=-\r\n" \
+       "c=IN IP4 0.0.0.0\r\n" \
+       "t=0 0\r\n" \
+       "m=audio 16002 RTP/AVP 99\r\n" \
+       "a=rtpmap:99 AMR/8000\r\n" \
+       "a=ptime:20\r\n"

 #define MDCX4 \
        "MDCX 18983217 1@mgw MGCP 1.0\r\n" \
diff --git a/tests/mgcp/mgcp_test.ok b/tests/mgcp/mgcp_test.ok
index 5dc00cd..4e72145 100644
--- a/tests/mgcp/mgcp_test.ok
+++ b/tests/mgcp/mgcp_test.ok
@@ -116,9 +116,9 @@

 ---------8<---------
 checking response:
-using message as statically defined for comparison
+using message with patched conn_id for comparison
 Response matches our expectations.
-(response does not contain a connection id)
+(response contains a connection id)

 ================================================
 Testing MDCX4

--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/37282?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ic089485543c5c97a35c7ae24fe0f622bf57d1976
Gerrit-Change-Number: 37282
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofm...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to