<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/9685">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">msc/USSD: expect and reply SS/USSD messages over GSUP<br><br>As we are about to finish the implementation of GSM TS 09.11,<br>OsmoMSC will forward all SS/USSD messages over GSUP to HLR,<br>and will expect responses back from HLR. The SS/USSD payload<br>processing will be out of scope for OsmoMSC itself.<br><br>Let's modify the existing test cases in order to expect and<br>reply SS/USSD messages over GSUP protocol.<br><br>Change-Id: I01de73aced6057328a121577a5a83bc2615fb2d4<br>---<br>M msc/MSC_Tests.ttcn<br>1 file changed, 81 insertions(+), 40 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn</span><br><span>index 640940d..e7c0a2a 100644</span><br><span>--- a/msc/MSC_Tests.ttcn</span><br><span>+++ b/msc/MSC_Tests.ttcn</span><br><span>@@ -2194,40 +2194,62 @@</span><br><span>  /* Send CM Service Request for SS/USSD */</span><br><span>    f_establish_fully(EST_TYPE_SS_ACT);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+       /* We need to inspect GSUP activity */</span><br><span style="color: hsl(120, 100%, 40%);">+        f_create_gsup_expect(hex2str(g_pars.imsi));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ var template OCTN facility_req := f_USSD_FACILITY_IE_INVOKE(</span><br><span style="color: hsl(120, 100%, 40%);">+          invoke_id := 5, /* Phone may not start from 0 or 1 */</span><br><span style="color: hsl(120, 100%, 40%);">+         op_code := SS_OP_CODE_PROCESS_USS_REQ,</span><br><span style="color: hsl(120, 100%, 40%);">+                ussd_string := "*#100#"</span><br><span style="color: hsl(120, 100%, 40%);">+     );</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  var template OCTN facility_rsp := f_USSD_FACILITY_IE_RETURN_RESULT(</span><br><span style="color: hsl(120, 100%, 40%);">+           invoke_id := 5, /* InvokeID shall be the same for both REQ and RSP */</span><br><span style="color: hsl(120, 100%, 40%);">+         op_code := SS_OP_CODE_PROCESS_USS_REQ,</span><br><span style="color: hsl(120, 100%, 40%);">+                ussd_string := "Your extension is " & hex2str(g_pars.msisdn) & "\r"</span><br><span style="color: hsl(120, 100%, 40%);">+       )</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  /* Compose a new SS/REGISTER message with request */</span><br><span>         var template (value) PDU_ML3_MS_NW ussd_req := ts_ML3_MO_SS_REGISTER(</span><br><span>                tid := 1, /* We just need a single transaction */</span><br><span>            ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */</span><br><span style="color: hsl(0, 100%, 40%);">-          facility := f_USSD_FACILITY_IE_INVOKE(</span><br><span style="color: hsl(0, 100%, 40%);">-                  invoke_id := 5, /* Phone may not start from 0 or 1 */</span><br><span style="color: hsl(0, 100%, 40%);">-                   op_code := SS_OP_CODE_PROCESS_USS_REQ,</span><br><span style="color: hsl(0, 100%, 40%);">-                  ussd_string := "*#100#"</span><br><span style="color: hsl(0, 100%, 40%);">-               )</span><br><span style="color: hsl(120, 100%, 40%);">+             facility := valueof(facility_req)</span><br><span>    );</span><br><span> </span><br><span>       /* Compose SS/RELEASE_COMPLETE template with expected response */</span><br><span>    var template PDU_ML3_NW_MS ussd_rsp := tr_ML3_MT_SS_RELEASE_COMPLETE(</span><br><span>                tid := 1, /* Response should arrive within the same transaction */</span><br><span>           ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */</span><br><span style="color: hsl(0, 100%, 40%);">-            facility := f_USSD_FACILITY_IE_RETURN_RESULT(</span><br><span style="color: hsl(0, 100%, 40%);">-                   invoke_id := 5, /* InvokeID shall be the same for both REQ and RSP */</span><br><span style="color: hsl(0, 100%, 40%);">-                   op_code := SS_OP_CODE_PROCESS_USS_REQ,</span><br><span style="color: hsl(0, 100%, 40%);">-                  ussd_string := "Your extension is " & hex2str(g_pars.msisdn) & "\r"</span><br><span style="color: hsl(0, 100%, 40%);">-         )</span><br><span style="color: hsl(120, 100%, 40%);">+             facility := valueof(facility_rsp)</span><br><span>    );</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  /* Request own number request */</span><br><span style="color: hsl(120, 100%, 40%);">+      /* Compose expected MSC -> HLR message */</span><br><span style="color: hsl(120, 100%, 40%);">+  var template GSUP_PDU gsup_req := tr_GSUP_PROC_SS_REQ(</span><br><span style="color: hsl(120, 100%, 40%);">+                imsi := g_pars.imsi,</span><br><span style="color: hsl(120, 100%, 40%);">+          state := OSMO_GSUP_SESSION_STATE_BEGIN,</span><br><span style="color: hsl(120, 100%, 40%);">+               ss := valueof(facility_req)</span><br><span style="color: hsl(120, 100%, 40%);">+   );</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  /* To be used for sending response with correct session ID */</span><br><span style="color: hsl(120, 100%, 40%);">+ var GSUP_PDU gsup_req_complete;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Request own number */</span><br><span>     BSSAP.send(ts_PDU_DTAP_MO(ussd_req));</span><br><span style="color: hsl(0, 100%, 40%);">-   alt {</span><br><span style="color: hsl(0, 100%, 40%);">-   /* We expect RELEASE_COMPLETE message with the response */</span><br><span style="color: hsl(0, 100%, 40%);">-      [] BSSAP.receive(tr_PDU_DTAP_MT(ussd_rsp)) {</span><br><span style="color: hsl(0, 100%, 40%);">-            setverdict(pass);</span><br><span style="color: hsl(0, 100%, 40%);">-               }</span><br><span style="color: hsl(0, 100%, 40%);">-       [] BSSAP.receive {</span><br><span style="color: hsl(0, 100%, 40%);">-              setverdict(fail, "Unknown/unexpected BSSAP received");</span><br><span style="color: hsl(0, 100%, 40%);">-                mtc.stop;</span><br><span style="color: hsl(0, 100%, 40%);">-               }</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Expect GSUP message containing the SS payload */</span><br><span style="color: hsl(120, 100%, 40%);">+   gsup_req_complete := f_expect_gsup_msg(gsup_req);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   /* Compose the response from HLR using received session ID */</span><br><span style="color: hsl(120, 100%, 40%);">+ var template GSUP_PDU gsup_rsp := ts_GSUP_PROC_SS_REQ(</span><br><span style="color: hsl(120, 100%, 40%);">+                imsi := g_pars.imsi,</span><br><span style="color: hsl(120, 100%, 40%);">+          sid := gsup_req_complete.ies[1].val.session_id,</span><br><span style="color: hsl(120, 100%, 40%);">+               state := OSMO_GSUP_SESSION_STATE_END,</span><br><span style="color: hsl(120, 100%, 40%);">+         ss := valueof(facility_rsp)</span><br><span style="color: hsl(120, 100%, 40%);">+   );</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  /* Finally, HLR terminates the session */</span><br><span style="color: hsl(120, 100%, 40%);">+     GSUP.send(gsup_rsp);</span><br><span style="color: hsl(120, 100%, 40%);">+  /* Expect RELEASE_COMPLETE message with the response */</span><br><span style="color: hsl(120, 100%, 40%);">+       f_expect_mt_dtap_msg(ussd_rsp);</span><br><span> </span><br><span>  f_expect_clear();</span><br><span> }</span><br><span>@@ -2259,38 +2281,57 @@</span><br><span>     /* Hold the call for some time */</span><br><span>    f_sleep(1.0);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+     var template OCTN facility_req := f_USSD_FACILITY_IE_INVOKE(</span><br><span style="color: hsl(120, 100%, 40%);">+          op_code := SS_OP_CODE_PROCESS_USS_REQ,</span><br><span style="color: hsl(120, 100%, 40%);">+                ussd_string := "*#100#"</span><br><span style="color: hsl(120, 100%, 40%);">+     );</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  var template OCTN facility_rsp := f_USSD_FACILITY_IE_RETURN_RESULT(</span><br><span style="color: hsl(120, 100%, 40%);">+           op_code := SS_OP_CODE_PROCESS_USS_REQ,</span><br><span style="color: hsl(120, 100%, 40%);">+                ussd_string := "Your extension is " & hex2str(g_pars.msisdn) & "\r"</span><br><span style="color: hsl(120, 100%, 40%);">+       )</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  /* Compose a new SS/REGISTER message with request */</span><br><span>         var template (value) PDU_ML3_MS_NW ussd_req := ts_ML3_MO_SS_REGISTER(</span><br><span>                tid := 1, /* We just need a single transaction */</span><br><span>            ti_flag := c_TIF_ORIG, /* Sent from the side that originates the TI */</span><br><span style="color: hsl(0, 100%, 40%);">-          facility := f_USSD_FACILITY_IE_INVOKE(</span><br><span style="color: hsl(0, 100%, 40%);">-                  op_code := SS_OP_CODE_PROCESS_USS_REQ,</span><br><span style="color: hsl(0, 100%, 40%);">-                  ussd_string := "*#100#"</span><br><span style="color: hsl(0, 100%, 40%);">-               )</span><br><span style="color: hsl(120, 100%, 40%);">+             facility := valueof(facility_req)</span><br><span>    );</span><br><span> </span><br><span>       /* Compose SS/RELEASE_COMPLETE template with expected response */</span><br><span>    var template PDU_ML3_NW_MS ussd_rsp := tr_ML3_MT_SS_RELEASE_COMPLETE(</span><br><span>                tid := 1, /* Response should arrive within the same transaction */</span><br><span>           ti_flag := c_TIF_REPL, /* Sent to the side that originates the TI */</span><br><span style="color: hsl(0, 100%, 40%);">-            facility := f_USSD_FACILITY_IE_RETURN_RESULT(</span><br><span style="color: hsl(0, 100%, 40%);">-                   op_code := SS_OP_CODE_PROCESS_USS_REQ,</span><br><span style="color: hsl(0, 100%, 40%);">-                  ussd_string := "Your extension is " & hex2str(g_pars.msisdn) & "\r"</span><br><span style="color: hsl(0, 100%, 40%);">-         )</span><br><span style="color: hsl(120, 100%, 40%);">+             facility := valueof(facility_rsp)</span><br><span>    );</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  /* Request own number request */</span><br><span style="color: hsl(120, 100%, 40%);">+      /* Compose expected MSC -> HLR message */</span><br><span style="color: hsl(120, 100%, 40%);">+  var template GSUP_PDU gsup_req := tr_GSUP_PROC_SS_REQ(</span><br><span style="color: hsl(120, 100%, 40%);">+                imsi := g_pars.imsi,</span><br><span style="color: hsl(120, 100%, 40%);">+          state := OSMO_GSUP_SESSION_STATE_BEGIN,</span><br><span style="color: hsl(120, 100%, 40%);">+               ss := valueof(facility_req)</span><br><span style="color: hsl(120, 100%, 40%);">+   );</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  /* To be used for sending response with correct session ID */</span><br><span style="color: hsl(120, 100%, 40%);">+ var GSUP_PDU gsup_req_complete;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Request own number */</span><br><span>     BSSAP.send(ts_PDU_DTAP_MO(ussd_req));</span><br><span style="color: hsl(0, 100%, 40%);">-   alt {</span><br><span style="color: hsl(0, 100%, 40%);">-   /* We expect RELEASE_COMPLETE message with the response */</span><br><span style="color: hsl(0, 100%, 40%);">-      [] BSSAP.receive(tr_PDU_DTAP_MT(ussd_rsp)) {</span><br><span style="color: hsl(0, 100%, 40%);">-            setverdict(pass);</span><br><span style="color: hsl(0, 100%, 40%);">-               }</span><br><span style="color: hsl(0, 100%, 40%);">-       [] BSSAP.receive {</span><br><span style="color: hsl(0, 100%, 40%);">-              setverdict(fail, "Unknown/unexpected BSSAP received");</span><br><span style="color: hsl(0, 100%, 40%);">-                mtc.stop;</span><br><span style="color: hsl(0, 100%, 40%);">-               }</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Expect GSUP message containing the SS payload */</span><br><span style="color: hsl(120, 100%, 40%);">+   gsup_req_complete := f_expect_gsup_msg(gsup_req);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   /* Compose the response from HLR using received session ID */</span><br><span style="color: hsl(120, 100%, 40%);">+ var template GSUP_PDU gsup_rsp := ts_GSUP_PROC_SS_REQ(</span><br><span style="color: hsl(120, 100%, 40%);">+                imsi := g_pars.imsi,</span><br><span style="color: hsl(120, 100%, 40%);">+          sid := gsup_req_complete.ies[1].val.session_id,</span><br><span style="color: hsl(120, 100%, 40%);">+               state := OSMO_GSUP_SESSION_STATE_END,</span><br><span style="color: hsl(120, 100%, 40%);">+         ss := valueof(facility_rsp)</span><br><span style="color: hsl(120, 100%, 40%);">+   );</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  /* Finally, HLR terminates the session */</span><br><span style="color: hsl(120, 100%, 40%);">+     GSUP.send(gsup_rsp);</span><br><span style="color: hsl(120, 100%, 40%);">+  /* Expect RELEASE_COMPLETE message with the response */</span><br><span style="color: hsl(120, 100%, 40%);">+       f_expect_mt_dtap_msg(ussd_rsp);</span><br><span> </span><br><span>  /* Hold the call for some time */</span><br><span>    f_sleep(1.0);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/9685">change 9685</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/9685"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ttcn3-hacks </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I01de73aced6057328a121577a5a83bc2615fb2d4 </div>
<div style="display:none"> Gerrit-Change-Number: 9685 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>