Change in osmo-sip-connector[master]: Support Emergency Calling

Keith Whyte gerrit-no-reply at lists.osmocom.org
Tue Mar 19 16:25:35 UTC 2019


Keith Whyte has submitted this change and it was merged. ( https://gerrit.osmocom.org/12682 )

Change subject: Support Emergency Calling
......................................................................

Support Emergency Calling

LCR supports emergency calling by sending the string 'emergency' as callee to
the SIP side.

This does the same

Change-Id: I5d0adb61dfa82e7ded5f41d9bc773d546112c9f1
---
M src/mncc.c
1 file changed, 19 insertions(+), 5 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/mncc.c b/src/mncc.c
index 0f003bd..b7977c4 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -409,10 +409,17 @@
 	}
 }
 
+static const struct gsm_mncc_number emergency_number = {
+	.type = CALL_TYPE_MNCC,
+	.plan = GSM48_NPI_UNKNOWN,
+	.number = "emergency",
+};
+
 /* Check + Process MNCC_SETUP_IND (MO call) */
 static void check_setup(struct mncc_connection *conn, const char *buf, int rc)
 {
 	const struct gsm_mncc *data;
+	const struct gsm_mncc_number *called;
 	struct call *call;
 	struct mncc_call_leg *leg;
 
@@ -423,14 +430,21 @@
 	}
 
 	data = (const struct gsm_mncc *) buf;
+	called = &data->called;
 
 	/* screen arguments */
 	if ((data->fields & MNCC_F_CALLED) == 0) {
-		LOGP(DMNCC, LOGL_ERROR,
-			"MNCC leg(%u) without called addr fields(%u)\n",
-			data->callref, data->fields);
-		return mncc_send(conn, MNCC_REJ_REQ, data->callref);
+		if (!data->emergency) {
+			LOGP(DMNCC, LOGL_ERROR,
+				"MNCC leg(%u) without called addr fields(%u)\n",
+				data->callref, data->fields);
+			return mncc_send(conn, MNCC_REJ_REQ, data->callref);
+		}
+
+		/* Emergency without a called number present. Use the standard "emergency" number. */
+		called = &emergency_number;
 	}
+
 	if ((data->fields & MNCC_F_CALLING) == 0) {
 		LOGP(DMNCC, LOGL_ERROR,
 			"MNCC leg(%u) without calling addr fields(%u)\n",
@@ -461,7 +475,7 @@
 	leg->conn = conn;
 	leg->state = MNCC_CC_INITIAL;
 	leg->dir = MNCC_DIR_MO;
-	memcpy(&leg->called, &data->called, sizeof(leg->called));
+	memcpy(&leg->called, called, sizeof(leg->called));
 	memcpy(&leg->calling, &data->calling, sizeof(leg->calling));
 	memcpy(&leg->imsi, data->imsi, sizeof(leg->imsi));
 

-- 
To view, visit https://gerrit.osmocom.org/12682
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sip-connector
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5d0adb61dfa82e7ded5f41d9bc773d546112c9f1
Gerrit-Change-Number: 12682
Gerrit-PatchSet: 13
Gerrit-Owner: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190319/3b9367dc/attachment.html>


More information about the gerrit-log mailing list