Change in osmo-sip-connector[master]: mncc: rework passing GCR over the MNCC interface

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Wed Nov 3 21:13:03 UTC 2021


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-sip-connector/+/25980 )

Change subject: mncc: rework passing GCR over the MNCC interface
......................................................................

mncc: rework passing GCR over the MNCC interface

Using *unpacked* 'struct osmo_gcr_parsed' in the MNCC PDUs makes
the protocol even more complicated than it currently is, and
moreover complicates implementing MNCCv8 in the ttcn3-sip-test.

Replace 'struct osmo_gcr_parsed' in 'struct gsm_mncc' with a
fixed-length buffer, which is supposed to hold the Global Call
Reference encoded as per 3GPP TS 29.205.

Check / indicate presence of GCR using the MNCC_F_GCR flag.

Change-Id: Iaff46732948f8f5d03e42f17c35cbac8a80af49b
Fixes: Id40d7e0fed9356f801b3627c118150055e7232b1
Related: OS#5164, OS#5282
---
M src/mncc.c
M src/mncc_protocol.h
2 files changed, 31 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/mncc.c b/src/mncc.c
index c8bf4bd..f302b3e 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -485,6 +485,7 @@
 	const struct gsm_mncc_number *called;
 	struct call *call;
 	struct mncc_call_leg *leg;
+	struct osmo_gcr_parsed gcr;
 
 	if (rc < sizeof(*data)) {
 		LOGP(DMNCC, LOGL_ERROR, "gsm_mncc of wrong size %d vs. %zu\n",
@@ -525,6 +526,16 @@
 		return;
 	}
 
+	/* Decode the Global Call Reference (if present) */
+	if (data->fields & MNCC_F_GCR) {
+		if (osmo_dec_gcr(&gcr, data->gcr, sizeof(data->gcr)) < 0) {
+			LOGP(DMNCC, LOGL_ERROR,
+				"MNCC leg(%u) failed to parse GCR\n", data->callref);
+			mncc_send(conn, MNCC_REJ_REQ, data->callref);
+			return;
+		}
+	}
+
 	/* Create an RTP port and then allocate a call */
 	call = call_mncc_create();
 	if (!call) {
@@ -543,12 +554,15 @@
 	leg->conn = conn;
 	leg->state = MNCC_CC_INITIAL;
 	leg->dir = MNCC_DIR_MO;
-	leg->base.call->gcr = data->gcr;
-	leg->base.call->gcr_present = true;
 	memcpy(&leg->called, called, sizeof(leg->called));
 	memcpy(&leg->calling, &data->calling, sizeof(leg->calling));
 	memcpy(&leg->imsi, data->imsi, sizeof(leg->imsi));
 
+	if (data->fields & MNCC_F_GCR) {
+		leg->base.call->gcr_present = true;
+		leg->base.call->gcr = gcr;
+	}
+
 	LOGP(DMNCC, LOGL_INFO,
 		"Created call(%u) with MNCC leg(%u) IMSI(%.16s)\n",
 		call->id, leg->callref, data->imsi);
@@ -873,6 +887,7 @@
 {
 	struct mncc_call_leg *leg;
 	struct gsm_mncc mncc = { 0, };
+	struct msgb *msg;
 	int rc;
 
 	leg = talloc_zero(call, struct mncc_call_leg);
@@ -900,8 +915,6 @@
 
 	mncc.fields |= MNCC_F_CALLING;
 	mncc.calling.plan = GSM48_NPI_ISDN_E164;
-	if (call->gcr_present)
-		mncc.gcr = call->gcr;
 
 	if (call->source && call->source[0] == '+') {
 		mncc.calling.type = GSM48_TON_INTERNATIONAL;
@@ -920,6 +933,16 @@
 		OSMO_STRLCPY_ARRAY(mncc.called.number, call->dest);
 	}
 
+	/* Encode the Global Call Reference (if present) */
+	if (call->gcr_present) {
+		msg = msgb_alloc(sizeof(mncc.gcr), "MNCC GCR");
+		if (msg == NULL || (rc = osmo_enc_gcr(msg, &call->gcr)) == 0)
+			LOGP(DMNCC, LOGL_ERROR, "MNCC leg(%u) failed to encode GCR\n", call->id);
+		else
+			memcpy(&mncc.gcr[0], msg->data, rc);
+		msgb_free(msg);
+	}
+
 	/*
 	 * TODO/FIXME:
 	 *  - Determine/request channel based on offered audio codecs
diff --git a/src/mncc_protocol.h b/src/mncc_protocol.h
index 11969ee..cd592ad 100644
--- a/src/mncc_protocol.h
+++ b/src/mncc_protocol.h
@@ -26,7 +26,6 @@
 
 #include <osmocom/core/linuxlist.h>
 #include <osmocom/gsm/mncc.h>
-#include <osmocom/gsm/gsm29205.h>
 
 #include <stdint.h>
 #include <netinet/in.h>
@@ -124,6 +123,7 @@
 #define MNCC_F_CCCAP		0x0800
 #define MNCC_F_KEYPAD		0x1000
 #define MNCC_F_SIGNAL		0x2000
+#define MNCC_F_GCR		0x4000
 
 struct gsm_mncc {
 	/* context based information */
@@ -160,7 +160,9 @@
 
 	unsigned char	lchan_type;
 	unsigned char	lchan_mode;
-	struct osmo_gcr_parsed gcr;
+
+	/* Global Call Reference (encoded as per 3GPP TS 29.205) */
+	uint8_t		gcr[16];
 
 	/* A buffer to contain SDP ('\0' terminated) */
 	char		sdp[1024];

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-sip-connector/+/25980
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-Change-Id: Iaff46732948f8f5d03e42f17c35cbac8a80af49b
Gerrit-Change-Number: 25980
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: keith <keith at rhizomatica.org>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211103/ab01e0e5/attachment.htm>


More information about the gerrit-log mailing list