pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36793?usp=email )
Change subject: SIP_Templates: Allow passing 'Allow' field ......................................................................
SIP_Templates: Allow passing 'Allow' field
Change-Id: I10dd36d8c0ef8dbcbb58016c9684d877a0455b03 --- M library/SIP_Templates.ttcn 1 file changed, 37 insertions(+), 22 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/93/36793/1
diff --git a/library/SIP_Templates.ttcn b/library/SIP_Templates.ttcn index d35813e..c82d36d 100644 --- a/library/SIP_Templates.ttcn +++ b/library/SIP_Templates.ttcn @@ -66,6 +66,30 @@ } }
+// [20.5] +template (present) Allow tr_Allow(template Method_List methods := *) := { + fieldName := ALLOW_E, + methods := methods +} +template (value) Allow ts_Allow(template (omit) Method_List methods := omit) := { + fieldName := ALLOW_E, + methods := methods +} +function tr_AllowMethods(template Method_List allow_methods) return template Allow { + if (istemplatekind(allow_methods, "omit")) { + return omit; + } else if (istemplatekind(allow_methods, "*")) { + return *; + } else if (istemplatekind(allow_methods, "?")) { + return ?; + } + var template (present) Allow ret := { + fieldName := ALLOW_E, + methods := allow_methods + } + return ret +} + template (value) Credentials ts_Credentials_DigestResponse(template (value) CommaParam_List digestResponse) := { digestResponse := digestResponse } @@ -511,7 +535,7 @@ template (value) Via via, template (omit) ContentType content_type := omit, template (omit)Authorization authorization := omit, - template (value) Method_List allow_methods := c_SIP_defaultMethods, + template (omit) Allow allow := ts_Allow(c_SIP_defaultMethods), template (omit) Expires expires := omit, template (omit) Require require := omit, template (omit) Security_client security_client := omit, @@ -519,10 +543,7 @@ template (omit) Supported supported := omit, template (omit) WwwAuthenticate wwwAuthenticate := omit ) modifies ts_SIP_msgHeader_empty := { - allow := { - fieldName := ALLOW_E, - methods := allow_methods - }, + allow := allow, authorization := authorization, callId := { fieldName := CALL_ID_E, @@ -560,21 +581,6 @@ wwwAuthenticate := wwwAuthenticate }
-function tr_AllowMethods(template Method_List allow_methods) return template Allow { - if (istemplatekind(allow_methods, "omit")) { - return omit; - } else if (istemplatekind(allow_methods, "*")) { - return *; - } else if (istemplatekind(allow_methods, "?")) { - return ?; - } - var template (present) Allow ret := { - fieldName := ALLOW_E, - methods := allow_methods - } - return ret -} - template (present) MessageHeader tr_SIP_msgh_std(template CallidString call_id, template SipAddr from_addr, @@ -584,7 +590,7 @@ template charstring method, template ContentType content_type := *, template integer seq_nr := ?, - template Method_List allow_methods := *, + template Allow allow := *, template Expires expires := *, template Require require := *, template Security_client security_client := *, @@ -592,7 +598,7 @@ template Supported supported := *, template WwwAuthenticate wwwAuthenticate := * ) modifies t_SIP_msgHeader_any := { - allow := tr_AllowMethods(allow_methods), + allow := allow, callId := { fieldName := CALL_ID_E, callid := call_id