[PATCH] osmo-ttcn3-hacks[master]: msc: Add Emergency call to f_mo_call() and use it from TC_em...

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Feb 10 10:07:09 UTC 2018


Review at  https://gerrit.osmocom.org/6362

msc: Add Emergency call to f_mo_call() and use it from TC_emerg_call_imsi

This fixes TC_emerg_call_imsi with current osmo-msc master. The old
implementation was broken as it didn't deal with MGCP yet.

Change-Id: Ic35797931387b078205269365421ad730db7af15
---
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
2 files changed, 20 insertions(+), 40 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/62/6362/1

diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 1d39ab4..403064b 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -188,6 +188,7 @@
 
 type enumerated EstablishType {
 	EST_TYPE_MO_CALL,
+	EST_TYPE_EMERG_CALL,
 	EST_TYPE_PAG_RESP
 };
 
@@ -198,6 +199,9 @@
 	select (etype) {
 	case (EST_TYPE_MO_CALL) {
 		l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi));
+		}
+	case (EST_TYPE_EMERG_CALL) {
+		l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_EMERG_CALL, mi));
 		}
 	case (EST_TYPE_PAG_RESP) {
 		l3_info := valueof(ts_PAG_RESP(mi));
@@ -211,7 +215,7 @@
 	if (g_pars.net.expect_ciph) {
 		/* implicit CM SERVICE ACCEPT? */
 	} else {
-		if (etype == EST_TYPE_MO_CALL) {
+		if (etype != EST_TYPE_PAG_RESP) {
 			/* explicit CM SERVICE ACCEPT */
 			BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_ACC));
 		}
@@ -373,6 +377,7 @@
 	hexstring called_party,				/* whom are we calling */
 	integer transaction_id optional,		/* which TS 04.08 CC transaction ID to use */
 	BearerCapability_TLV bearer_cap,		/* which bearer capabilities to claim */
+	boolean emergency,				/* is this an emergency call? */
 
 	/* MNCC related parameters */
 	uint32_t mncc_callref optional,			/* call reference on the MNCC side */
@@ -400,6 +405,7 @@
 	called_party := called,
 	transaction_id := tid,
 	bearer_cap := valueof(ts_Bcap_voice),
+	emergency := false,
 	mncc_callref := omit,
 	mncc_bearer_cap := valueof(ts_MNCC_bcap_voice),
 	bss_rtp_ip := "9.8.7.6",
@@ -432,13 +438,21 @@
 	} else {
 		mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
 	}
-	f_establish_fully(mi);
+	if (cpars.emergency) {
+		f_establish_fully(mi, EST_TYPE_EMERG_CALL);
+	} else {
+		f_establish_fully(mi, EST_TYPE_MO_CALL);
+	}
 
 	/* Create MNCC and MGCP expect */
 	f_create_mncc_expect(hex2str(cpars.called_party));
 	f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
-	BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party)));
+	if (cpars.emergency) {
+		BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_EMERG_SETUP(cpars.transaction_id)));
+	} else {
+		BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, cpars.called_party)));
+	}
 	interleave {
 	[] MNCC.receive(tr_MNCC_SETUP_ind(?, tr_MNCC_number(hex2str(cpars.called_party)))) -> value mncc {
 		cpars.mncc_callref := mncc.u.signal.callref;
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 99580f6..5fa29cd 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -831,44 +831,10 @@
 
 /* helper function for an emergency call. caller passes in mobile identity to use */
 private function f_emerg_call(MobileIdentityLV mi) runs on BSC_ConnHdlr {
+	var CallParameters cpars := valueof(t_CallParams('112'H, 0));
+	cpars.emergency := true;
 
-	var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_EMERG_CALL, mi));
-	f_bssap_compl_l3(l3_info);
-	BSSAP.receive(tr_PDU_DTAP_MT(tr_CM_SERV_ACC));
-
-	var hexstring called := '112'H;
-	var integer tid := 0;
-	var MNCC_PDU mncc;
-	f_create_mncc_expect(hex2str(called));
-
-	BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_EMERG_SETUP(tid)));
-	MNCC.receive(tr_MNCC_SETUP_ind(?, tr_MNCC_number(hex2str(called)))) -> value mncc;
-	/* FIXME: extract call_id */
-
-	/* Call Proceeding */
-	MNCC.send(ts_MNCC_CALL_PROC_req(mncc.u.signal.callref, ts_MNCC_bcap_voice));
-	BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(tid)));
-
-	/* Alerting */
-	MNCC.send(ts_MNCC_ALERT_req(mncc.u.signal.callref));
-	BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_ALERTING(tid)));
-
-	/* Answer. This causes TCH assignment in case of "late assignment" */
-	//MNCC.send(ts_MNCC_SETUP_COMPL_req(mncc.u.signal.callref));
-	MNCC.send(ts_MNCC_SETUP_rsp(mncc.u.signal.callref));
-
-	f_sleep(3.0);
-
-	/* Hangup by "B" side */
-	MNCC.send(ts_MNCC_DISC_req(mncc.u.signal.callref, valueof(ts_MNCC_cause(23))));
-	BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_DISC(tid)));
-
-	/* Release of call */
-	MNCC.send(ts_MNCC_REL_req(mncc.u.signal.callref, valueof(ts_MNCC_cause(42))));
-	BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_RELEASE(tid)));
-
-	/* clearing of radio channel */
-	f_expect_clear();
+	f_mo_call(cpars);
 }
 
 /* establish an emergency call by IMEI, no SIM inserted (and hence no IMSI) */

-- 
To view, visit https://gerrit.osmocom.org/6362
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic35797931387b078205269365421ad730db7af15
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list