summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith <keith@rhizomatica.org>2019-01-22 15:56:58 +0100
committerKeith Whyte <keith@rhizomatica.org>2019-03-19 16:25:35 +0000
commitc90829c3958e49e70526b5956ea38ed798bf8659 (patch)
tree593108ca91f098c999e23f77c92fd0654022eeb7
parente9113f21f6de46df8e24167c783850f8f1662157 (diff)
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
-rw-r--r--src/mncc.c24
1 files changed, 19 insertions, 5 deletions
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 int continue_setup(struct mncc_connection *conn, const struct gsm_mncc *m
}
}
+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 @@ static void check_setup(struct mncc_connection *conn, const char *buf, int rc)
}
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 @@ static void check_setup(struct mncc_connection *conn, const char *buf, int rc)
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));