From 747689e13d68f7230efd6dfb4bfee9d75280a5fc Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Tue, 19 Jun 2018 00:14:28 +0700 Subject: msc/USSD: expect and reply SS/USSD messages over GSUP As we are about to finish the implementation of GSM TS 09.11, OsmoMSC will forward all SS/USSD messages over GSUP to HLR, and will expect responses back from HLR. The SS/USSD payload processing will be out of scope for OsmoMSC itself. Let's modify the existing test cases in order to expect and reply SS/USSD messages over GSUP protocol. Change-Id: I01de73aced6057328a121577a5a83bc2615fb2d4 --- msc/MSC_Tests.ttcn | 121 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 81 insertions(+), 40 deletions(-) (limited to 'msc') diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn index 640940d2..e7c0a2ac 100644 --- a/msc/MSC_Tests.ttcn +++ b/msc/MSC_Tests.ttcn @@ -2194,40 +2194,62 @@ runs on BSC_ConnHdlr { /* Send CM Service Request for SS/USSD */ f_establish_fully(EST_TYPE_SS_ACT); + /* We need to inspect GSUP activity */ + f_create_gsup_expect(hex2str(g_pars.imsi)); + + var template OCTN facility_req := f_USSD_FACILITY_IE_INVOKE( + invoke_id := 5, /* Phone may not start from 0 or 1 */ + op_code := SS_OP_CODE_PROCESS_USS_REQ, + ussd_string := "*#100#" + ); + + var template OCTN facility_rsp := f_USSD_FACILITY_IE_RETURN_RESULT( + invoke_id := 5, /* InvokeID shall be the same for both REQ and RSP */ + op_code := SS_OP_CODE_PROCESS_USS_REQ, + ussd_string := "Your extension is " & hex2str(g_pars.msisdn) & "\r" + ) + /* Compose a new SS/REGISTER message with request */ var template (value) PDU_ML3_MS_NW ussd_req := ts_ML3_MO_SS_REGISTER( tid := 1, /* We just need a single transaction */ ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ - facility := f_USSD_FACILITY_IE_INVOKE( - invoke_id := 5, /* Phone may not start from 0 or 1 */ - op_code := SS_OP_CODE_PROCESS_USS_REQ, - ussd_string := "*#100#" - ) + facility := valueof(facility_req) ); /* Compose SS/RELEASE_COMPLETE template with expected response */ var template PDU_ML3_NW_MS ussd_rsp := tr_ML3_MT_SS_RELEASE_COMPLETE( tid := 1, /* Response should arrive within the same transaction */ ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */ - facility := f_USSD_FACILITY_IE_RETURN_RESULT( - invoke_id := 5, /* InvokeID shall be the same for both REQ and RSP */ - op_code := SS_OP_CODE_PROCESS_USS_REQ, - ussd_string := "Your extension is " & hex2str(g_pars.msisdn) & "\r" - ) + facility := valueof(facility_rsp) ); - /* Request own number request */ + /* Compose expected MSC -> HLR message */ + var template GSUP_PDU gsup_req := tr_GSUP_PROC_SS_REQ( + imsi := g_pars.imsi, + state := OSMO_GSUP_SESSION_STATE_BEGIN, + ss := valueof(facility_req) + ); + + /* To be used for sending response with correct session ID */ + var GSUP_PDU gsup_req_complete; + + /* Request own number */ BSSAP.send(ts_PDU_DTAP_MO(ussd_req)); - alt { - /* We expect RELEASE_COMPLETE message with the response */ - [] BSSAP.receive(tr_PDU_DTAP_MT(ussd_rsp)) { - setverdict(pass); - } - [] BSSAP.receive { - setverdict(fail, "Unknown/unexpected BSSAP received"); - mtc.stop; - } - } + /* Expect GSUP message containing the SS payload */ + gsup_req_complete := f_expect_gsup_msg(gsup_req); + + /* Compose the response from HLR using received session ID */ + var template GSUP_PDU gsup_rsp := ts_GSUP_PROC_SS_REQ( + imsi := g_pars.imsi, + sid := gsup_req_complete.ies[1].val.session_id, + state := OSMO_GSUP_SESSION_STATE_END, + ss := valueof(facility_rsp) + ); + + /* Finally, HLR terminates the session */ + GSUP.send(gsup_rsp); + /* Expect RELEASE_COMPLETE message with the response */ + f_expect_mt_dtap_msg(ussd_rsp); f_expect_clear(); } @@ -2259,38 +2281,57 @@ runs on BSC_ConnHdlr { /* Hold the call for some time */ f_sleep(1.0); + var template OCTN facility_req := f_USSD_FACILITY_IE_INVOKE( + op_code := SS_OP_CODE_PROCESS_USS_REQ, + ussd_string := "*#100#" + ); + + var template OCTN facility_rsp := f_USSD_FACILITY_IE_RETURN_RESULT( + op_code := SS_OP_CODE_PROCESS_USS_REQ, + ussd_string := "Your extension is " & hex2str(g_pars.msisdn) & "\r" + ) + /* Compose a new SS/REGISTER message with request */ var template (value) PDU_ML3_MS_NW ussd_req := ts_ML3_MO_SS_REGISTER( tid := 1, /* We just need a single transaction */ ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */ - facility := f_USSD_FACILITY_IE_INVOKE( - op_code := SS_OP_CODE_PROCESS_USS_REQ, - ussd_string := "*#100#" - ) + facility := valueof(facility_req) ); /* Compose SS/RELEASE_COMPLETE template with expected response */ var template PDU_ML3_NW_MS ussd_rsp := tr_ML3_MT_SS_RELEASE_COMPLETE( tid := 1, /* Response should arrive within the same transaction */ ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */ - facility := f_USSD_FACILITY_IE_RETURN_RESULT( - op_code := SS_OP_CODE_PROCESS_USS_REQ, - ussd_string := "Your extension is " & hex2str(g_pars.msisdn) & "\r" - ) + facility := valueof(facility_rsp) ); - /* Request own number request */ + /* Compose expected MSC -> HLR message */ + var template GSUP_PDU gsup_req := tr_GSUP_PROC_SS_REQ( + imsi := g_pars.imsi, + state := OSMO_GSUP_SESSION_STATE_BEGIN, + ss := valueof(facility_req) + ); + + /* To be used for sending response with correct session ID */ + var GSUP_PDU gsup_req_complete; + + /* Request own number */ BSSAP.send(ts_PDU_DTAP_MO(ussd_req)); - alt { - /* We expect RELEASE_COMPLETE message with the response */ - [] BSSAP.receive(tr_PDU_DTAP_MT(ussd_rsp)) { - setverdict(pass); - } - [] BSSAP.receive { - setverdict(fail, "Unknown/unexpected BSSAP received"); - mtc.stop; - } - } + /* Expect GSUP message containing the SS payload */ + gsup_req_complete := f_expect_gsup_msg(gsup_req); + + /* Compose the response from HLR using received session ID */ + var template GSUP_PDU gsup_rsp := ts_GSUP_PROC_SS_REQ( + imsi := g_pars.imsi, + sid := gsup_req_complete.ies[1].val.session_id, + state := OSMO_GSUP_SESSION_STATE_END, + ss := valueof(facility_rsp) + ); + + /* Finally, HLR terminates the session */ + GSUP.send(gsup_rsp); + /* Expect RELEASE_COMPLETE message with the response */ + f_expect_mt_dtap_msg(ussd_rsp); /* Hold the call for some time */ f_sleep(1.0); -- cgit v1.2.3