asterisk: Implement support to handle 2nd REGISTER through ipsec

This patch implements the necessary infra to set up ipsec tunnel towards
the asterisk IMS client, and receive the 2nd REGISTER through the ipsec
tun plus answer it acking the registration successfully.

Change-Id: Ic042422788ee406f5b71ca3878bc5617e5455579
diff --git a/library/SIP_Templates.ttcn b/library/SIP_Templates.ttcn
index 37dee4b..7ef49cf 100644
--- a/library/SIP_Templates.ttcn
+++ b/library/SIP_Templates.ttcn
@@ -76,6 +76,9 @@
 	methods := methods
 }
 
+template (present) Credentials tr_Credentials_DigestResponse(template (present) CommaParam_List digestResponse) := {
+	digestResponse := digestResponse
+}
 template (value) Credentials ts_Credentials_DigestResponse(template (value) CommaParam_List digestResponse) := {
 	digestResponse := digestResponse
 }
@@ -114,6 +117,10 @@
 	otherResponse := otherResponse
 }
 
+template (present) Authorization tr_Authorization(template (present) Credentials body) := {
+	fieldName := AUTHORIZATION_E,
+	body := body
+}
 template (value) Authorization ts_Authorization(template (value) Credentials body) := {
 	fieldName := AUTHORIZATION_E,
 	body := body
@@ -618,6 +625,7 @@
 		template ContentLength content_length := *,
 		template ContentType content_type := *,
 		template Allow allow := *,
+		template Authorization authorization := *,
 		template Expires expires := *,
 		template Require require := *,
 		template Security_client security_client := *,
@@ -628,6 +636,7 @@
 		template WwwAuthenticate wwwAuthenticate := *
 		) modifies t_SIP_msgHeader_any := {
 	allow := allow,
+	authorization := authorization,
 	callId := {
 		fieldName := CALL_ID_E,
 		callid := call_id
@@ -696,6 +705,7 @@
 		template (present) SipAddr to_addr := ?,
 		template (present) Via via := tr_Via_from(f_tr_HostPort_opt_defport(?)),
 		template integer seq_nr := *,
+		template Authorization authorization := *,
 		template Contact contact := *,
 		template Expires expires := *,
 		template Require require := *,
@@ -705,6 +715,7 @@
 	requestLine := tr_SIP_ReqLine(REGISTER_E, sip_url_host_port),
 	msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, contact,
 				     via, "REGISTER", seq_nr,
+				     authorization := authorization,
 				     expires := expires,
 				     require := require,
 				     security_client := security_client,
@@ -835,12 +846,22 @@
 		integer seq_nr,
 		charstring reason,
 		Via via,
+		template (omit) Allow allow := omit,
+		template (omit) Require require := omit,
+		template (omit) Server server := omit,
+		template (omit) Supported supported := omit,
+		template (omit) UserAgent userAgent := omit,
 		template (omit) charstring body := omit) := {
 	statusLine := ts_SIP_StatusLine(status_code, reason),
 	msgHeader := ts_SIP_msgh_std(call_id, from_addr, to_addr, omit, method, seq_nr,
 				     via,
 				     content_length := f_ContentLength(body),
-				     content_type := f_ContentTypeOrOmit(ts_CT_SDP, body)),
+				     content_type := f_ContentTypeOrOmit(ts_CT_SDP, body),
+				     allow := allow,
+				     require := require,
+				     server := server,
+				     supported := supported,
+				     userAgent := userAgent),
 	messageBody := body,
 	payload := omit
 }