Introduce Asterisk_Tests testsuite

Add initial infrastructure to run tests against an Asterisk process.
An not-yet-finished draft test doing registration is submitted to
validate communication towards Asterisk works.

The testsuite will be improved in follow-up commits, but this way other
people can already start using it and we can set up the dockerized setup
+ jenkins jobs to run it nightly.

Related: SYS#6782
Change-Id: I66f776d5df6fb5dc488d9e589b84a6b2385406e8
diff --git a/library/SIP_Emulation.ttcn b/library/SIP_Emulation.ttcn
index e71c611..41e6975 100644
--- a/library/SIP_Emulation.ttcn
+++ b/library/SIP_Emulation.ttcn
@@ -72,6 +72,13 @@
 	sipVersion := ?
 }
 
+private template PDU_SIP_Request tr_SIP_REGISTER := {
+	requestLine := tr_ReqLine(REGISTER_E),
+	msgHeader := t_SIP_msgHeader_any,
+	messageBody := *,
+	payload := *
+}
+
 private template PDU_SIP_Request tr_SIP_INVITE := {
 	requestLine := tr_ReqLine(INVITE_E),
 	msgHeader := t_SIP_msgHeader_any,
@@ -79,7 +86,6 @@
 	payload := *
 }
 
-
 template SipUrl tr_SIP_Url(template charstring user_or_num,
 			   template charstring host := *,
 			   template integer portField := *) := {
@@ -286,6 +292,19 @@
 			}
 			}
 
+		/* a ConnHdlr is sending us a SIP REGISTER: Forward to SIP port */
+		[] CLIENT.receive(tr_SIP_REGISTER) -> value sip_req sender vc_conn {
+			var CallidString call_id := sip_req.msgHeader.callId.callid;
+			if (f_call_id_known(call_id)) {
+				/* re-register */
+				vc_conn := f_comp_by_call_id(call_id);
+			} else {
+				/* new REGISTER: add to table */
+				f_call_table_add(vc_conn, call_id);
+			}
+			SIP.send(sip_req);
+			}
+
 		/* a ConnHdlr is sending us a SIP INVITE: Forward to SIP port */
 		[] CLIENT.receive(tr_SIP_INVITE) -> value sip_req sender vc_conn {
 			var CallidString call_id := sip_req.msgHeader.callId.callid;