GSUP_Types: Make sure our MSISDN encoding agrees with OsmoMSC

OsmoMSC seems to have broken encoding of MSISDN which is not in-line
with the spec.  Let's adapt to it.

Change-Id: I4892df63f1a135573dcac977f5eb0a79cbaffad3
Related: OS#2883
diff --git a/library/GSUP_Types.ttcn b/library/GSUP_Types.ttcn
index 7f239ca..4d2c3c5 100644
--- a/library/GSUP_Types.ttcn
+++ b/library/GSUP_Types.ttcn
@@ -80,6 +80,11 @@
 	OSMO_GSUP_CN_DOMAIN_CS			(2)
 } with { variant "FIELDLENGTH(8)" };
 
+type record GSUP_MSISDN {
+	uint8_t	len,
+	hexstring digits optional
+} with { variant (len) "LENGTHTO(digits)" };
+
 type record GSUP_IE {
 	GSUP_IEI	tag,
 	uint8_t		len,
@@ -121,7 +126,7 @@
 	octetstring	ck,
 	octetstring	autn,
 	octetstring	res,
-	hexstring	msisdn,
+	GSUP_MSISDN	msisdn,
 	octetstring	hlr_number,
 	GSUP_CnDomain	cn_domain,
 	octetstring	charg_char
@@ -158,6 +163,27 @@
 	}
 }
 
+template (value) GSUP_MSISDN ts_GSUP_MSISDN(hexstring digits,
+					    BIT3 ton := '000'B,
+					    BIT4 npi := '0000'B) := {
+	len := 0, /* overwritten */
+	/* numberingPlanIdentification := npi,
+	typeOfNumber := ton,
+	ext1 := '0'B, */
+	digits := digits
+}
+
+template GSUP_MSISDN tr_GSUP_MSISDN(template hexstring digits,
+				    template BIT3 ton := ?,
+				    template BIT4 npi := ?) := {
+	len := ?,
+	/* numberingPlanIdentification := npi,
+	typeOfNumber := ton,
+	ext1 := '0'B, */
+	digits := digits
+}
+
+
 
 template GSUP_IE ts_GSUP_IE_AuthTuple2G(octetstring rand, octetstring sres,
 				        octetstring kc) := {
@@ -273,7 +299,7 @@
 	tag := OSMO_GSUP_MSISDN_IE,
 	len := 0, /* overwritten */
 	val := {
-		msisdn := msisdn
+		msisdn := ts_GSUP_MSISDN(msisdn)
 	}
 }
 
@@ -281,7 +307,7 @@
 	tag := OSMO_GSUP_MSISDN_IE,
 	len := ?,
 	val := {
-		msisdn := msisdn
+		msisdn := tr_GSUP_MSISDN(msisdn)
 	}
 }