WIP: msc: First test case for mobile terminated call testing

We start the call from the MNCC side, match on the paging and then
pick it up from there.

It currently fails as the MNCC_Emulation cannot yet handle "ConnHdlr
originated" MNCC calls yet.

Change-Id: I28c465187fd8b1dcfd687180b373a47bb9ac6734
diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 2050e3d..7736ff5 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -435,6 +435,22 @@
 	digits := digits
 }
 
+template CalledPartyBCD_Number tr_Called(template hexstring digits) := {
+	elementIdentifier := '5E'O,
+	lengthIndicator := ?,
+	numberingPlanIdentification := ?,
+	typeOfNumber := ?,
+	ext1 := ?,
+	digits := digits
+}
+
+template CallingPartyBCD_Number tr_Calling(template hexstring digits) := {
+	elementIdentifier := '5C'O,
+	lengthIndicator := ?,
+	oct3 := ?,
+	digits := digits
+}
+
 type integer SpeechVer;
 
 template (value) Speech_AuxiliarySpeech ts_SpeechAux(SpeechVer ver, BIT1 suffix) := {
@@ -756,5 +772,79 @@
 	}
 }
 
+template PDU_ML3_MS_NW ts_ML3_MO_CC_CALL_CONF(integer tid,
+						template BearerCapability_TLV bcap := omit) := {
+	discriminator := '0011'B,
+	tiOrSkip := {
+		transactionId := {
+			tio := int2bit(tid, 3),
+			tiFlag := '1'B, /* response from destination */
+			tIExtension := omit
+		}
+	},
+	msgs := {
+		cc := {
+			callConfirmed := {
+				messageType := '001000'B,
+				nsd := '00'B,
+				repeatIndicator := omit,
+				bearerCapability1 := bcap,
+				bearerCapability2 := omit,
+				cause := omit,
+				cC_Capabilities := omit,
+				streamIdentifier := omit,
+				supportedCodecs := omit
+			}
+		}
+	}
+}
+
+
+template PDU_ML3_NW_MS tr_ML3_MT_CC_SETUP(integer tid, template hexstring called := *,
+					template hexstring calling := *,
+					template BearerCapability_TLV bcap := *) := {
+	discriminator := '0011'B,
+	tiOrSkip := {
+		transactionId := {
+			tio := int2bit(tid, 3),
+			tiFlag := '0'B, /* from originator */
+			tIExtension := omit
+		}
+	},
+	msgs := {
+		cc := {
+			setup_NW_MS := {
+				messageType := '000101'B,
+				nsd := '00'B,
+				bcRepeatIndicator := *,
+				bearerCapability1 := bcap,
+				bearerCapability2 := *,
+				facility := *,
+				progressIndicator := *,
+				signal := *,
+				callingPartyBCD_Number := tr_Calling(calling) ifpresent,
+				callingPartySubAddress := *,
+				calledPartyBCD_Number := tr_Called(called) ifpresent,
+				calledPartySubAddress := *,
+				redirectingPartyBCDNumber := *,
+				redirectingPartySubaddress := *,
+				llc_RepeatIndicator := *,
+				lowLayerCompatibility1 := *,
+				lowLayerCompatibility2 := *,
+				hlc_RepeatIndicator := *,
+				highLayerCompatibility1 := *,
+				highLayerCompatibility2 := *,
+				user_user := *,
+				priority := *,
+				alert := *,
+				networkCCCapabilities := *,
+				causeofNoCli := *,
+				backupBearerCapacity := *
+			}
+		}
+	}
+}
+
+
 
 }
diff --git a/library/MNCC_Emulation.ttcn b/library/MNCC_Emulation.ttcn
index 4bf516d..de29288 100644
--- a/library/MNCC_Emulation.ttcn
+++ b/library/MNCC_Emulation.ttcn
@@ -280,6 +280,14 @@
 			f_call_table_del(call_id);
 			}
 
+		/* Client -> MNCC Socket: SETUP.req: forward + add call table entry */
+		[] MNCC_CLIENT.receive(MNCC_PDU:{msg_type := MNCC_SETUP_REQ, u:=?}) -> value mncc sender vc_conn {
+			/* add to call table */
+			f_call_table_add(vc_conn, f_mncc_get_call_id(mncc));
+			/* forward to MNCC socket */
+			MNCC.send(t_SD_MNCC(g_mncc_ud_id, mncc));
+			}
+
 		/* Client -> MNCC Socket: Normal message */
 		[] MNCC_CLIENT.receive(MNCC_PDU:?) -> value mncc sender vc_conn {
 			/* forward to MNCC socket */
diff --git a/library/MNCC_Types.ttcn b/library/MNCC_Types.ttcn
index 884a7c0..258db3f 100644
--- a/library/MNCC_Types.ttcn
+++ b/library/MNCC_Types.ttcn
@@ -665,10 +665,10 @@
 	}
 }
 
-/* MT: MSC <- MNCC: CALL_CONF.req; send CALL CONFIRMED to MS */
-template MNCC_PDU ts_MNCC_CALL_CONF_req(uint32_t call_id, template MNCC_bearer_cap bcap := omit,
-					template MNCC_cause cause := omit,
-					template MNCC_cccap cccap := omit) := {
+/* MT: MSC -> MNCC: CALL_CONF.req; send CALL CONFIRMED to MS */
+template MNCC_PDU tr_MNCC_CALL_CONF_ind(template uint32_t call_id, template MNCC_bearer_cap bcap := *,
+					template MNCC_cause cause := *,
+					template MNCC_cccap cccap := *) := {
 	msg_type := MNCC_CALL_CONF_IND,
 	u := {
 		signal := {	/* See 24.008 9.3.2 */
@@ -691,9 +691,9 @@
 			more := 0,
 			notify := 0,
 			emergency := omit,
-			imsi := "",
-			lchan_type := 0,
-			lchan_mode := 0
+			imsi := ?,
+			lchan_type := ?,
+			lchan_mode := ?
 		}
 	}
 }