LibSip_Templates.ttcn 114 KB
Newer Older
schmitting's avatar
schmitting committed
/*
 *  @author   STF 346, STF366, STF368, STF369, STF450
 *  @version  $Id$
 *	@desc     This module defines SIP Templates for message, header, and 
 *            structured types. <br>
 *            Note that any changes made to the definitions in this module
 *            may be overwritten by future releases of this library
 *            End users are encouraged to contact the distributers of this  
 *            module regarding their modifications or additions.
 *            This module is part of LibSipV2.
 *  @remark   Any additions to the templates shall follow the design rules
 *            and always modify base templates only;
 *            Existing templates shall not be changed or removed -
 *            change requests shall be made to http://t-ort.etsi.org
module LibSip_Templates
{
	//LibSip
	import from LibSip_SIPTypesAndValues all;
	import from LibSip_SDPTypes all;
	import from LibSip_Interface all;
	import from LibSip_PIXITS all;
	import from LibSip_XMLTypes all;
    import from LibSip_SimpleMsgSummaryTypes all;
    import from LibSip_MessageBodyTypes all;    
schmitting's avatar
schmitting committed
    import from NoTargetNamespace language "XSD" all
    with {
        extension "File:../xsd/Ims3gpp.xsd"
    }
    
    import from urn_ietf_params_xml_ns_conference_info language "XSD" all
    with {
        extension "File:../xsd/CONF.xsd"
    }
    
    import from http_uri_etsi_org_ngn_params_xml_simservs_pstn language "XSD" all
    with {
        extension "File:../xsd/PSTN.xsd"
    }
    
    import from http_uri_etsi_org_ngn_params_xml_simservs_xcap language "XSD" all
    with {
        extension "File:../xsd/SupplementaryServices.xsd"
    }
	
    import from http_uri_etsi_org_ngn_params_xml_simservs_mcid language "XSD" all
    with {
        extension "File:../xsd/MCID.xsd"
    }
	
    import from urn_ietf_params_xml_ns_resource_lists language "XSD" all
    with {
        extension "File:../xsd/ResourceList.xsd"
    }
    
    import from http_uri_etsi_org_ngn_params_xml_comm_div_info language "XSD" all
    with {
        extension "File:../xsd/CDIVN.xsd"
    }

    import from urn_3gpp_ns_cw_1_0 language "XSD" all
        with {
            extension "File:../xsd/cw.xsd"
    }
schmitting's avatar
schmitting committed
	
	group ModuleParameters {
	
	    modulepar boolean MB_LENGTH_FROM_ENCVAL:=false; //* to get length of message body from ecoded value
	    modulepar boolean USE_FX_FOR_XML_LENGTH:=false; //* To use external functions for calculation of XML message/body length
	    
	}//* group ModuleParameters
	
	group SubFields
	{

		template Addr_Union m_AddrUnion_NameAddr(template NameAddr p_nameAddr) :=
		{
		  nameAddr := p_nameAddr
		}

		template Addr_Union m_AddrUnion_DisplayAndSipUrl(template charstring p_displayName, template SipUrl p_addrSpec) :=
		{
		  nameAddr := m_CallingAddr(p_displayName, p_addrSpec)
		}
		
		template NameAddr m_CallingAddr(template charstring p_displayName, template SipUrl p_addrSpec) :=
		{
		  displayName := p_displayName,
		  addrSpec := p_addrSpec
		}		

		template CommaParam_List mw_digestResponse(template GenericParam p_genericParam) :=
		  superset(p_genericParam); //* c_Integrity_protected_yes

		template SemicolonParam_List m_cpc :=
		{{"cpc",PX_SIP_ISUP_CPC_VALUE}};

		template SemicolonParam_List m_ReasonParams
			(template charstring p_cause, template charstring p_text) :=
		{m_Cause(p_cause),m_Text(p_text)};
				
		template ReasonValue m_ReasonValue
			(template charstring p_cause, template charstring p_text) :=
		{		  
			token := "Q.850",
			reasonParams := m_ReasonParams(p_cause,p_text)
		};

		template ReasonValue m_ReasonValueSIP
			(template charstring p_cause, template charstring p_text) :=
		{		  
			token := "SIP",
			reasonParams := m_ReasonParams(p_cause,p_text)
		};
		
		template RouteBody mw_routeBody (template SipUrl p_sipurl):=
		{
			nameAddr :=
			{
				displayName := *,
				addrSpec := p_sipurl
			},
			rrParam := *
		}

		template SentProtocol m_SentProtocol (charstring p_protocol) :=
		{protocolName := c_sipName,
		  protocolVersion:= c_sipVersion,
		  transport:= p_protocol};

		template SipUrl m_SipUrl_currDomain(in SipUserProfile p_userprofile) :=  	//*  SIP-URL of the test system on SIP side
		  scheme := c_sipScheme,  		//*  contains "sip"
          components := {sip:={
        		  userInfo := 			//*  optional
        		  {
        			userOrTelephoneSubscriber := p_userprofile.publUsername,//*  charstring
        			password := omit		//*  optional charstring
        		  },
        		  hostPort :=
        		  {
        			host := p_userprofile.homeDomain,	//*  hostname, IPv4 or IPv6 as a charstring
        			portField := omit	//* p_userprofile.currPort	//* optional integer
        		  }}},
		  urlParameters := omit,
		  headers := omit
		}

		template SipUrl m_SipUrl_contactIpaddr(in SipUserProfile p_userprofile) :=  	//*  SIP-URL of the test system on SIP side
		  scheme := c_sipScheme,  		//*  contains "sip"
          components := {sip:={
            		  userInfo := 			//*  optional
            		  {
            			userOrTelephoneSubscriber := p_userprofile.publUsername,//*  charstring
            			password := omit		//*  optional charstring
            		  },
            		  hostPort :=
            		  {
            			host := p_userprofile.contactIpaddr,	//*  hostname, IPv4 or IPv6 as a charstring
            			portField := p_userprofile.contactPort	//* optional integer
            		  }}},
		  urlParameters := omit,
		  headers := omit
		}

		template SipUrl m_SipUrl_contactIpaddrAndCpc(in SipUserProfile p_userprofile) :=  	//*  SIP-URL of the test system on SIP side
				scheme := c_sipScheme,  		//*  contains "sip"
            	components := {sip:={
                				userInfo := 			//*  optional
                				{
                			userOrTelephoneSubscriber := p_userprofile.publUsername & "; cpc=" & PX_SIP_ISUP_CPC_VALUE,//*  charstring
                			password := omit		//*  optional charstring
                				},
                				hostPort :=
                				{
                			host := p_userprofile.contactIpaddr,	//*  hostname, IPv4 or IPv6 as a charstring
                			portField := p_userprofile.contactPort	//* optional integer
                				}}},
				urlParameters := omit,
				headers := omit
		}

		template SipUrl m_SipUrl_currIpaddr(in SipUserProfile p_userprofile) :=  	//*  SIP-URL of the test system on SIP side
		  scheme := c_sipScheme,  		//*  contains "sip"
          components := {sip:={
            		  userInfo := 			//*  optional
            		  {
            			userOrTelephoneSubscriber := p_userprofile.publUsername,//*  charstring
            			password := omit		//*  optional charstring
            		  },
            		  hostPort :=
            		  {
            			host := p_userprofile.currIpaddr,	//*  hostname, IPv4 or IPv6 as a charstring
            			portField := p_userprofile.currPort	//* optional integer
            		  }}},
		  urlParameters := omit,
		  headers := omit
		} 
   
		template SipUrl m_SipUrl_Anonymous :=  	//*  SIP-URL with a calles party number
		  scheme := c_sipScheme,  		//*  contains "sip"
          components := {sip:={
                		  userInfo := 			//*  optional
                		  {
                			userOrTelephoneSubscriber := "Anonymous",//*  charstring
                			password := omit		//*  optional charstring
                		  },
                		  hostPort :=
                		  {
                			host := "Anonymous.invalid",	//*  hostname, IPv4 or IPv6 as a charstring
                			portField := omit	//* optional integer
                		  }}},
		  urlParameters := omit,
		  headers := omit
		};
		
		template SipUrl m_TelUrl_publUser(in SipUserProfile p_userprofile) :=  	//*  SIP-URL of the test system on SIP side
		  scheme := c_telScheme,  		//*  contains "tel"
          components := {tel:={
    			          subscriber := p_userprofile.publUsername//*  charstring
            		  }},
		  urlParameters := omit,
		  headers := omit
		}
poglitsch's avatar
poglitsch committed
		
		template SipUrl mw_TelUrl :=
		{
    		scheme  := c_telScheme,
            components := {tel:={
                			subscriber := ?}},
poglitsch's avatar
poglitsch committed
    		urlParameters := *,
    		headers := *
		};
		
		template SipUrl mw_SipUrl :=
		{
			scheme  := c_sipScheme,
            components := {sip:={
        			userInfo := *,
        			hostPort := ?}},
poglitsch's avatar
poglitsch committed
			urlParameters := *,
			headers := *
		};
		template SipUrl mw_TelSip_unavailableInvalidUri := (mw_TelSip_unavailableInvalidUri1,mw_TelSip_unavailableInvalidUri2);
        template SipUrl mw_TelSip_unavailableInvalidUri1 :=
        {
                scheme  := c_sipScheme,
                components := {sip:={
                        userInfo := {userOrTelephoneSubscriber:="unavailable", password:=omit},
                        hostPort := {host:="anonymous.invalid", portField:=c_defaultSipPort}
                }},
                urlParameters := omit,
                headers := omit
        };	
        template SipUrl mw_TelSip_unavailableInvalidUri2 :=
        {
                scheme  := c_telScheme,
                components := {tel:={
                    	subscriber := "unavailable"
               		 }},
                urlParameters := omit,
                headers := omit
        };	        
		template SipUrl mw_TelSip_unavailableUri (charstring p_host):= (mw_TelSip_unavailableUri1 (p_host),mw_TelSip_unavailableUri2 (p_host));

        template SipUrl mw_TelSip_unavailableUri1 (charstring p_host):=
        {
                scheme  := (c_telScheme),
                components := {tel:={
                    subscriber := "unavailable"}},
                urlParameters := omit,
                headers := omit
        };	
        template SipUrl mw_TelSip_unavailableUri2 (charstring p_host):=
        {
                scheme  := (c_sipScheme),
                components := {sip:={
                        userInfo := {userOrTelephoneSubscriber:="unavailable", password:=omit},
                        hostPort := {host:=p_host, portField:=c_defaultSipPort}}},
                urlParameters := omit,
                headers := omit
        };			
		template SipUrl mw_SipUrl_Number(charstring p_number) :=  	//*  SIP-URL with a calling party number
		  scheme := c_sipScheme,  		//*  contains "sip"
          components := {sip:={
        		  userInfo:= {userOrTelephoneSubscriber:=p_number, password:=*},
        		  hostPort := ?}},
		  urlParameters := *,
		  headers := *
		};

		template SipUrl mw_TelSipUrl_Number(template charstring p_number) := (mw_TelSipUrl_Number1(p_number),mw_TelSipUrl_Number2(p_number));
		
        template SipUrl mw_TelSipUrl_Number1(template charstring p_number) :=  	//*  SIP-URL with a calling party number
        {
                scheme := (c_sipScheme), //*  contains "sip" or "tel"
                components := {
            	    
                    sip:={
                        userInfo:= {userOrTelephoneSubscriber:=p_number, password:=*}, //*  nat or int format
                        hostPort := ?}
            	
                },
                urlParameters := *,
                headers := *
        };       		
        template SipUrl mw_TelSipUrl_Number2(template charstring p_number) :=  	//*  SIP-URL with a calling party number
        {
                scheme := (c_telScheme), //*  contains "sip" or "tel"
                components := {
            	    
                    tel:={
                        subscriber:= p_number}            	
                },
                urlParameters := *,
                headers := *
        };
		template SipUrl mw_SipUrl_Host(template charstring p_host) :=  	//*  SIP-URL with a calling party number
				scheme := c_sipScheme,  		//*  contains "sip"
            	components := {sip:={
    				userInfo:= *,
    				hostPort := {host:=p_host, portField:=*}}},
				urlParameters := *,
				headers := *
		};

          template SipUrl mw_SipUrl_NumberHost(charstring p_number, charstring p_host) :=  	//*  SIP-URL with a calling party number
            scheme := c_sipScheme,  		//*  contains "sip"
            components := {sip:={
                userInfo:= {userOrTelephoneSubscriber:=p_number, password:=*},
                hostPort := {host:=p_host, portField:=*}}},
            urlParameters := *,
            headers := *
          };
rennoch's avatar
rennoch committed
          
		template SipUrl mw_SipUrl_NumberHostParam(charstring p_number, charstring p_host, template SemicolonParam_List p_urlParameters) :=  	//*  SIP-URL with a calling party number
		{
				scheme := c_sipScheme,  		//*  contains "sip"
            	components := {sip:={
    				userInfo:= {userOrTelephoneSubscriber:=p_number, password:=*},
    				hostPort := {host:=p_host, portField:=*}}},
				urlParameters := p_urlParameters,
				headers := *
rennoch's avatar
rennoch committed
		};
        template SipUrl m_SipUrl_NumberHostHeader(charstring p_number, charstring p_host, template AmpersandParam_List p_urlParameters) :=  	//*  SIP-URL with a calling party number
        {
                scheme := c_sipScheme,  		//*  contains "sip"
            	components := {sip:={
                    userInfo:= {userOrTelephoneSubscriber:=p_number, password:=omit},
                    hostPort := {host:=p_host, portField:=omit}}},
                urlParameters := omit,
                headers := p_urlParameters
        };
		
        template SipUrl mw_SipUrl_NumberHostHeader(charstring p_number, charstring p_host, template AmpersandParam_List p_urlParameters) :=  	//*  SIP-URL with a calling party number
        {
                scheme := c_sipScheme,  		//*  contains "sip"
           	    components := {sip:={
                    userInfo:= {userOrTelephoneSubscriber:=p_number, password:=*},
                    hostPort := {host:=p_host, portField:=*}}},
                urlParameters := *,
                headers := p_urlParameters
        };
		
		template SipUrl m_SipUrl_NumberHostParam(charstring p_number, charstring p_host, template SemicolonParam_List p_urlParameters) :=  	//*  SIP-URL with a calling party number
		{
				scheme := c_sipScheme,  		//*  contains "sip"
            	components := {sip:={
    				userInfo:= {userOrTelephoneSubscriber:=p_number, password:=omit},
    				hostPort := {host:=p_host, portField:=c_defaultSipPort}}},
				urlParameters := p_urlParameters,
				headers := omit
		};
		
        template SipUrl m_SipUrl_NumberHostParam_woPort(charstring p_number, charstring p_host, template SemicolonParam_List p_urlParameters) :=  	//*  SIP-URL with a calling party number
        {
                scheme := c_sipScheme,  		//*  contains "sip"
                components := {sip:={                
                    userInfo:= {userOrTelephoneSubscriber:=p_number, password:=omit},
                    hostPort := {host:=p_host, portField:=omit}}},
                urlParameters := p_urlParameters,
                headers := omit
        };
		
		template SipUrl mw_SipUrl_Anonymous :=  	//*  SIP-URL with a calles party number
		  scheme := c_sipScheme,  		//*  contains "sip"
          components := {sip:={
    		  userInfo := 			//*  optional
    		  {
    			userOrTelephoneSubscriber := pattern "[a,A][n,N][o,O][n,N][y,Y][m,M][o,O][u,U][s,s]",//*  charstring
    			password := omit		//*  optional charstring
    		  },
    		  hostPort :=
    		  {
    			host := pattern "[a,A]nonymous.invalid",	//*  hostname, IPv4 or IPv6 as a charstring
    			portField := *	//* optional integer
    		  }}},
		  urlParameters := *,
		  headers := *
		};

		template SipUrl mw_SipUrl_urlParam(template SemicolonParam_List p_urlParameters) :=  	//*  SIP-URL with a calling party number
				scheme := c_sipScheme,  		//*  contains "sip"
                components := {sip:={
    				userInfo:= *,
    				hostPort := ?}},
				urlParameters := p_urlParameters,
				headers := *
		};
		
		template ContactAddress mw_ContactAddress :=
		{
		  addressField  := ?,
		  contactParams := *
		};

		template HostPort mw_hostPort(template charstring p_host, template integer p_portField) :=
		  portField := p_portField
		};
		
		template StatusLine mw_statusLine1xx   := {sipVersion := c_sipNameVersion, statusCode := (100..199), reasonPhrase := ?};
		template StatusLine mw_statusLine4xx   := {sipVersion := c_sipNameVersion, statusCode := (400..499), reasonPhrase := ?};
		template StatusLine mw_statusLine5xx   := {sipVersion := c_sipNameVersion, statusCode := (500..599), reasonPhrase := ?};
		template StatusLine mw_statusLineFinal := {sipVersion := c_sipNameVersion, statusCode := (200..699), reasonPhrase := ?};

		template NameAddr mw_NameAddr_DispName_User_Host(template charstring p_dn, template charstring p_user, template charstring p_host) := 
		{
			displayName := p_dn,
			addrSpec :=
			{
				scheme := c_sipScheme,  //*  contains "sip"
                components := { sip := {
            				userInfo := {userOrTelephoneSubscriber :=p_user,	password := *},
            				hostPort :=
            				{
            					host := p_host,		//*  hostname, IPv4 or IPv6 as a charstring
            					portField := *	//* optional integer
            				}}
                },
			urlParameters := {m_UserPhone},
			headers := *
			}
		}
		
		template Addr_Union mw_AddrUnion_Nameaddr(template charstring p_dn, template charstring p_user, template charstring p_host):=
		{
			nameAddr:=mw_NameAddr_DispName_User_Host(p_dn,p_user,p_host)
		}
		
		template SipUrl mw_SipUrl_User_Host(template charstring p_user, template charstring p_host) :=
		{
			scheme := c_sipScheme,  //*  contains "sip"
            components := {sip:={
    			userInfo := {userOrTelephoneSubscriber :=p_user,	password := *},
    			hostPort :=
    			{
    				host := p_host,		//*  hostname, IPv4 or IPv6 as a charstring
    				portField := *	//* optional integer
    			}}},
			urlParameters := {m_UserPhone},
			headers := *
		}
		template Addr_Union mw_AddrUnion_SipUrl(template charstring p_user, template charstring p_host):=
		{
			addrSpecUnion:=mw_SipUrl_User_Host(p_user,p_host)
		}
		

juvancic's avatar
juvancic committed
		template LibSip_SIPTypesAndValues.Allow m_Allow (template Method_List p_methods) := {
poglitsch's avatar
poglitsch committed
			fieldName := ALLOW_E,
			methods := p_methods
		}
		
juvancic's avatar
juvancic committed
		template LibSip_SIPTypesAndValues.Allow mw_Allow (charstring p_method) := {
poglitsch's avatar
poglitsch committed
			fieldName := ALLOW_E,
			methods := superset(p_method)
		}

		template GenericParam m_Cause (template charstring p_cause):=
			{id:="cause", paramValue:=p_cause}
			
        template GenericParam mw_Cause (template charstring p_cause):=
            // {id:=?, paramValue:= p_cause} 
            {id:=?, paramValue:= pattern "*{p_cause}*"} // TODO - Expression does not work for all TTCN tools

		template Authorization m_Authorization (template Credentials p_Credentials):=
		{
		  fieldName := AUTHORIZATION_E,
		  body := {p_Credentials}
		}
		
		template Authorization m_Authorization_digest (template CommaParam_List p_CommaParam_List):=
		{
		  fieldName := AUTHORIZATION_E,
		  body := {{digestResponse := p_CommaParam_List}}
		}

		template Authorization m_add_Authorization_digest (in Authorization p_auth, template CommaParam_List p_CommaParam_List):=
		{
		  fieldName := AUTHORIZATION_E,
		  body := {{digestResponse := f_merge_CommaParam_List(p_auth.body[0].digestResponse,valueof(p_CommaParam_List))}}
		}

		template Authorization m_Authorization_other :=
		{
		  fieldName := AUTHORIZATION_E,
		  body := {{otherResponse := ?}}
		}

		template Contact m_Contact(template SipUrl p_sipUrl) :=
		{
		  fieldName := CONTACT_E,
		  contactBody :=
		  {
			contactAddresses :=
			{
			  {
				addressField := { addrSpecUnion := p_sipUrl},
				contactParams := omit
			  }
			}
		  } //* end contactBody
		}//* end m_Contact

		template Contact m_Contact_profile(in SipUserProfile p_userprofile) :=
		{
		  fieldName := CONTACT_E,
		  contactBody :=
		  {
			contactAddresses :=
			{
			  {
				addressField := { addrSpecUnion := m_SipUrl_contactIpaddr(p_userprofile)},
				contactParams := omit
			  }
			}
		  } //* end contactBody
		}//* end m_Contact


		template Contact m_Contact_profile_expires(in SipUserProfile p_userprofile, in charstring p_expires) :=
		{
		  fieldName := CONTACT_E,
		  contactBody :=
		  {
			contactAddresses :=
			{
			  {
				addressField := { addrSpecUnion := m_SipUrl_contactIpaddr(p_userprofile)},
				contactParams := {{"expires",p_expires}}
			  }
			}
		  } //* end contactBody
		}//* end m_Contact
		
		template From m_From(template NameAddr p_nameAddr, charstring p_tag_str) :=
		{
		  fieldName := FROM_E,
		  addressField :=
		  {nameAddr := p_nameAddr},//* end addressField
		  fromParams := {{id := c_tagId, paramValue := p_tag_str}}
		};
		
pintar's avatar
pintar committed
		template From m_From_Anonymous(charstring p_tag_str) :=
		{
				fieldName := FROM_E,
				addressField :=
				{nameAddr := {
						displayName := "Anonymous",	 	 	//*  optional charstring
						addrSpec := m_SipUrl_Anonymous		//*  SipUrl
				}},//* end addressField
				fromParams := {{id := c_tagId, paramValue := p_tag_str}}
		};
		
		template From m_From_SipUrl(template SipUrl p_sipUrl) :=
		{
				fieldName := FROM_E,
				addressField :=
				{nameAddr := {
						displayName := omit, 	 			//*  optional charstring
						addrSpec := p_sipUrl		//*  SipUrl
				}},//* end addressField
				fromParams := omit
		};
		
		template Event m_Event_refer := 
		{
			fieldName := EVENT_E,
			eventType := "refer",
			eventParams := omit
		};

		template Event m_Event_conference := 
		{
			fieldName := EVENT_E,
			eventType := "conference",
			eventParams := omit
		};

		template Event m_Event_presence := 
		{
			fieldName := EVENT_E,
			eventType := "presence",
			eventParams := omit
		};

		template Event m_Event_reg := 
		{
			fieldName := EVENT_E,
			eventType := "reg",
			eventParams := omit
		};
		
        template Event m_Event_cdiv := 
        {
            fieldName := EVENT_E,
            eventType := "comm-div-info",
            eventParams := omit
        };
        
        template Event m_Event_mcid := 
        {
            fieldName := EVENT_E,
            eventType := "comm-div-info",
            eventParams := omit
        };

		template Expires m_Expires_600000 := 
		{
			fieldName := EXPIRES_E,
			deltaSec := "600000"
		};

		template Expires m_Expires (charstring p_deltaSec):= 
		{
			fieldName := EXPIRES_E,
			deltaSec := p_deltaSec
		};

		template PAssertedID m_PAssertedID(template Addr_Union p_pAssertedIDValue) := 
		{
			fieldName := P_ASSERTED_ID_E,
			pAssertedIDValueList := {p_pAssertedIDValue}
		};

rennoch's avatar
rennoch committed
		template HistoryInfo mw_HistoryInfo(template HistoryInfo_List p_HistoryInfo_List) := 
		{
			fieldName := HISTORY_INFO_E,
			historyInfoList := p_HistoryInfo_List
		};

		template HistoryInfoEntry mw_HistoryInfoEntry(template SipUrl p_Url, template StringList p_index, template SemicolonParam_List p_paramlist) :=
rennoch's avatar
rennoch committed
		{
			nameAddr := {displayName:=*, addrSpec:= p_Url},
			hiIndex := p_index,
			hiExtention := p_paramlist
		}
		
      	template HistoryInfo m_HistoryInfo(template HistoryInfo_List p_HistoryInfo_List) := 
      	{
       		fieldName := HISTORY_INFO_E,
       		historyInfoList := p_HistoryInfo_List
      	};
    
     	template HistoryInfoEntry m_HistoryInfoEntry(template SipUrl p_Url, template StringList p_index, template SemicolonParam_List p_paramlist) :=
      	{
       		nameAddr := {displayName:=omit, addrSpec:= p_Url},
       		hiIndex := p_index,
      		hiExtention := p_paramlist
      	}
  
		template PAssertedID m_PAssertedID_2x(template Addr_Union p_pAssertedIDValue1, template Addr_Union p_pAssertedIDValue2) := 
		{
			fieldName := P_ASSERTED_ID_E,
			pAssertedIDValueList := {p_pAssertedIDValue1, p_pAssertedIDValue2}
		};
	
		template PAssertedID mw_PAssertedID(template PAssertedIDValue p_pAssertedIDValue) := 
		{
			fieldName := P_ASSERTED_ID_E,
			pAssertedIDValueList := {p_pAssertedIDValue}
		};

		template PAssertedIDValue mw_PAssertedIDValue(template SipUrl p_SipUrl) := 
		{
poglitsch's avatar
poglitsch committed
			nameAddr :={displayName := *, addrSpec:=p_SipUrl}
		};
		
		template PPreferredID m_PPreferredID(template Addr_Union p_pPreferredIDValue) := 
		{
			fieldName := P_PREFERRED_ID_E,
			pPreferredIDValueList := {p_pPreferredIDValue}
		};

		template Privacy m_Privacy(PrivacyValue p_privacy) := 
		{
			fieldName := PRIVACY_E,
			privValueList := {p_privacy}
		};
		template RAck m_RAck(integer p_responseNum, integer p_seqNumber, charstring p_method) :=
		{
		  	fieldName := RACK_E,
		  	responseNum := p_responseNum,
		  	seqNumber := p_seqNumber,
		  	method  := p_method
	  	};

		template Reason m_Reason(integer p_cause) :=
		{		  
			fieldName := REASON_E,
			reasonValues := {m_ReasonValue(int2str(p_cause),"dummy")}
		};

		template Reason m_Reason21 :=
		{		  
			fieldName := REASON_E,
			reasonValues := {m_ReasonValue(int2str(21),"call reject")}
		};

		template RecordRoute m_recordRoute_currIpAddr (in SipUserProfile p_userprofile):=
		{   
			fieldName := RECORD_ROUTE_E,
			routeBody := {{nameAddr := {displayName := omit, 
									   addrSpec := 	{scheme := c_sipScheme,  			//*  contains "sip"
                                           			 components := { sip := {
            													userInfo := omit,
            													hostPort := {host:=p_userprofile.currIpaddr, portField:= p_userprofile.currPort}}},
													urlParameters := {{id:="lr", paramValue := omit}},
													headers := omit}
									   },
						  rrParam := omit}
		}};

        template RouteBody m_routeBody_currIpAddr (in SipUserProfile p_userprofile):=
        {   
            nameAddr := {
                displayName := omit, 
                addrSpec := 	{
                    scheme := c_sipScheme,  			//*  contains "sip"
                    components := { 
                        sip := {
                            userInfo := omit,
                            hostPort := {host:=p_userprofile.homeDomain, portField:= p_userprofile.currPort}
                        }
                    },
                    urlParameters := {{id:="lr", paramValue := omit}},
                    headers := omit
                }
            },
            rrParam := omit
        };
	
		template ReferredBy m_ReferredBy_SipUrl(template SipUrl p_sipUrl) := 
		{
			fieldName := REFERRED_BY_E,
			nameAddr :={displayName := omit, addrSpec:=p_sipUrl},
			referredbyIdParams := omit
		}

		template ReferTo m_ReferTo_SipUrl(template SipUrl p_sipUrl, charstring p_method) := 
		{
			fieldName := REFER_TO_E,
			nameAddr :={displayName := omit, addrSpec:=p_sipUrl},
			referToParams := {{id:="method",paramValue :=p_method}}
		template ReferSub m_ReferSub(in boolean p_value) := 
		{
			fieldName := REFER_SUB_E,
			referSubValue :=p_value,
			referSubParams := omit
		}

		template Replaces m_Replaces(
			charstring p_callId, 
			charstring p_toTag,
			charstring p_fromTag
		) := {
			fieldName := REPLACES_E,
			replacesParams := {
				{id := p_callId, paramValue := omit},
				{id := "to-tag", paramValue := p_toTag},
				{id := "from-tag", paramValue := p_fromTag}
			}
		}

		template Require m_Require_replaces :=
		{		  
			fieldName := REQUIRE_E,
			optionsTags := {c_replaces}
		};
pintar's avatar
pintar committed

        template Require m_Require_empty :=
        {		  
           fieldName := REQUIRE_E,
           optionsTags := {""}
        };
  
  		template Require m_Require_100rel :=
		{		  
			fieldName := REQUIRE_E,
			optionsTags := {c_tag100rel}
		};
		
		template Require m_Require_prec :=
		{		  
			fieldName := REQUIRE_E,
			optionsTags := {c_tagPrecond}
		}
		
		template SubscriptionState m_SubscriptionState_active :=
		{
			fieldName := SUBSCRIPTION_STATE_E,
			subState := "active",
			substateParams := {{id:="expires",paramValue:="60000"}}	
		}
pintar's avatar
pintar committed
        template Supported m_Supported_fromChange :=
        {
       		fieldName:=SUPPORTED_E, 
       		optionsTags:={c_tagFromChange}
      	}
		
		template Supported m_Supported_prec :=
		{
			fieldName:=SUPPORTED_E, 
			optionsTags:={c_tagPrecond}
		}
		
poglitsch's avatar
poglitsch committed
		template Supported m_Supported_100rel :=
		{
			fieldName:=SUPPORTED_E, 
			optionsTags:={c_tag100rel}
		}
		
		template Supported m_Supported_100rel_prec :=
		{
			fieldName:=SUPPORTED_E, 
			optionsTags:={c_tag100rel, c_tagPrecond}
		}

		template GenericParam m_Text (template charstring p_text):=
			{id:="text", paramValue:=p_text}
		
		template GenericParam m_UserPhone :=
		{
			id := "user",
			paramValue := "phone"
		}
rennoch's avatar
rennoch committed
  		
  		template GenericParam m_UserToUserEncodingHex :=
        {
          id := "encoding",
     	  paramValue := "hex"
        }
        
        template UserToUser m_UserToUserData(template charstring p_U2UData):=
        {
          fieldName := USER_TO_USER_E,
          uuiData := p_U2UData,
          uuiParam := m_UserToUserEncodingHex
        }
        
		template To m_To(template SipUrl p_sipUrl) :=
		{
		  fieldName := TO_E,
		  addressField :=
		  {nameAddr := {
			  displayName := "ETSI Tester", //*  optional charstring
			  addrSpec :=	p_sipUrl		//*  SipUrl
			}},//* end addressField
		  toParams := omit
		};

		template To m_To_SipUrl(SipUrl p_sipUrl) :=
		{
		  fieldName := TO_E,
		  addressField :=
		  {nameAddr := {
			  displayName := omit, 	 			//*  optional charstring
			  addrSpec := p_sipUrl		//*  SipUrl
			}},//* end addressField
		  toParams := omit
		};

		template To mw_To_NameAddr_SipUrl(template charstring p_dn, template charstring p_user, template charstring p_host) :=
		{
			fieldName := TO_E,
			addressField := (mw_AddrUnion_Nameaddr(p_dn,p_user,p_host),mw_AddrUnion_SipUrl(p_user,p_host)),
rennoch's avatar
rennoch committed
			toParams := *
        template To mw_To(template SipUrl p_sipUrl) := {
        	fieldName := TO_E,
        	addressField := { nameAddr := {displayName := *, addrSpec := p_sipUrl}},
        	toParams:= *
      	}

		template From mw_From(template SipUrl p_sipUrl) := {
		  fieldName := FROM_E,
poglitsch's avatar
poglitsch committed
		  addressField := { nameAddr := {displayName := *, addrSpec := p_sipUrl}},
rennoch's avatar
rennoch committed
		template From mw_From_NameAddr_SipUrl(template charstring p_dn, template charstring p_user, template charstring p_host) :=
		{
			fieldName := FROM_E,
			addressField := (mw_AddrUnion_Nameaddr(p_dn,p_user,p_host),mw_AddrUnion_SipUrl(p_user,p_host)),
			fromParams := *
		}
		template ViaBody m_ViaBody_currIpaddr(charstring branch_val,in SipUserProfile p_userprofile) :=
		{
		  sentProtocol := m_SentProtocol(PX_SIP_TRANSPORT),
		  sentBy:={host:=p_userprofile.currIpaddr, portField:= p_userprofile.currPort},
		  viaParams:={{id :=c_branchId,paramValue :=branch_val}}
		}
		
		template ViaBody mw_ViaBody_interface(template HostPort p_hostport) :=
		{
		  sentProtocol := m_SentProtocol(PX_SIP_TRANSPORT),
		  sentBy:={host:=p_hostport.host, portField:= p_hostport.portField},
		  viaParams:=*
		}

		template Via mw_Via(template ViaBody p_viabody) :=
		{
		  fieldName := VIA_E,
		  viaBody:= superset(p_viabody)
		}
		
		template CallId mw_CallId_any :=
		{
		  fieldName := CALL_ID_E,
		  callid := ?
		}

		template Privacy mw_Privacy_id := 
		{
			fieldName := PRIVACY_E,
			privValueList := {*,"id",*}
		};
		

poglitsch's avatar
poglitsch committed
        template Privacy mw_Privacy(template charstring p_value) := 
        {
            fieldName := PRIVACY_E,
            privValueList := {*,p_value,*}
        };
		

		template Privacy mw_Privacy_user := 
		{
			fieldName := PRIVACY_E,
			privValueList := {*,"user",*}
		};
		
		template Reason mw_Reason(template charstring p_cause) :=
		{		  
			fieldName := REASON_E,
		template Reason mw_ReasonSIP(template charstring p_cause) :=
		{		  
			fieldName := REASON_E,
		template Require mw_Require_not_100rel :=