LibSip_Templates.ttcn 174 KB
Newer Older
/**
garciay's avatar
garciay committed
 * @author STF 346, STF366, STF368, STF369, STF450, STF471
 * @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.
 * @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
garciay's avatar
garciay committed
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;
garciay's avatar
garciay committed
    import from LibSip_MessageBodyTypes all;

schmitting's avatar
schmitting committed
    import from NoTargetNamespace language "XSD" all
    with {
garciay's avatar
garciay committed
        extension "File:../xsd/Ims3gpp.xsd";
schmitting's avatar
schmitting committed
    }
schmitting's avatar
schmitting committed
    import from urn_ietf_params_xml_ns_conference_info language "XSD" all
    with {
garciay's avatar
garciay committed
        extension "File:../xsd/CONF.xsd";
schmitting's avatar
schmitting committed
    }
schmitting's avatar
schmitting committed
    import from http_uri_etsi_org_ngn_params_xml_simservs_pstn language "XSD" all
    with {
garciay's avatar
garciay committed
        extension "File:../xsd/PSTN.xsd";
schmitting's avatar
schmitting committed
    }
schmitting's avatar
schmitting committed
    import from http_uri_etsi_org_ngn_params_xml_simservs_xcap language "XSD" all
    with {
garciay's avatar
garciay committed
        extension "File:../xsd/SupplementaryServices.xsd";
schmitting's avatar
schmitting committed
    }
schmitting's avatar
schmitting committed
    import from http_uri_etsi_org_ngn_params_xml_simservs_mcid language "XSD" all
    with {
garciay's avatar
garciay committed
        extension "File:../xsd/MCID.xsd";
schmitting's avatar
schmitting committed
    }
schmitting's avatar
schmitting committed
    import from urn_ietf_params_xml_ns_resource_lists language "XSD" all
    with {
garciay's avatar
garciay committed
        extension "File:../xsd/ResourceList.xsd";
schmitting's avatar
schmitting committed
    }
    import from http_uri_etsi_org_ngn_params_xml_comm_div_info language "XSD" all
    with {
garciay's avatar
garciay committed
        extension "File:../xsd/CDIVN.xsd";
    }

    import from urn_3gpp_ns_cw_1_0 language "XSD" all
garciay's avatar
garciay committed
    with {
        extension "File:../xsd/cw.xsd";
garciay's avatar
garciay committed
    group ModuleParameters {
garciay's avatar
garciay committed
        modulepar boolean MB_LENGTH_FROM_ENCVAL := true;
        //*     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(value) Addr_Union m_AddrUnion_NameAddr(
                                                        template(value) NameAddr p_nameAddr) := {
            nameAddr := p_nameAddr
        }

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

        template(value) NameAddr m_NameAddr(
                                            template(omit) charstring p_displayName, 
                                            template(value) SipUrl p_addrSpec) := {
            displayName := p_displayName, addrSpec := p_addrSpec
        }

        template(value) NameAddr m_CallingAddr(
                                               template(value) charstring p_displayName, 
                                               template(value) SipUrl p_addrSpec) := m_NameAddr(p_displayName, p_addrSpec);

        template(present) NameAddr mw_NameAddr(
                                               template charstring p_displayName, 
                                               template(present) SipUrl p_addrSpec) := {
            displayName := p_displayName, addrSpec := p_addrSpec
        }

        template CommaParam_List mw_digestResponse(template GenericParam p_genericParam) := superset(p_genericParam);
garciay's avatar
garciay committed
        //*     c_Integrity_protected_yes
        template(value) SemicolonParam_List m_cpc := {{"cpc", PX_SIP_ISUP_CPC_VALUE}}
garciay's avatar
garciay committed
        template(value) SemicolonParam_List m_ReasonParams(
                                                           template(omit) charstring p_cause, 
                                                           template(value) charstring p_text) := {
            m_Cause(p_cause), m_Text(p_text)
        }

        template(present) SemicolonParam_List mw_ReasonParams(
                                                              template charstring p_cause, 
                                                              template charstring p_text) := {
            mw_Cause_base(p_cause), mw_Text(p_text)
        }

        template(value) ReasonValue m_ReasonValue_Base := {
            token := "", 
            reasonParams := omit
        }
garciay's avatar
garciay committed
        template(present) ReasonValue mw_ReasonValue_Base := {
            token := ?, 
            reasonParams := *
        }
garciay's avatar
garciay committed
        template(value) ReasonValue m_ReasonValue_param(
                                                        template(value) charstring p_cause, 
                                                        template(value) charstring p_text
        ) modifies m_ReasonValue_Base := {
            reasonParams := m_ReasonParams(p_cause, p_text)
garciay's avatar
garciay committed
        template(present) ReasonValue mw_ReasonValue_param(
                                                           template charstring p_cause, 
                                                           template charstring p_text 
        ) modifies mw_ReasonValue_Base := {
            reasonParams := mw_ReasonParams(p_cause, p_text)
garciay's avatar
garciay committed
        template(value) ReasonValue m_ReasonValue(
                                                  template(value) charstring p_cause, 
                                                  template(value) charstring p_text 
        ) modifies m_ReasonValue_param := {
            token := "Q.850"
garciay's avatar
garciay committed
        template(present) ReasonValue mw_ReasonValue(
                                                     template charstring p_cause, 
                                                     template charstring p_text 
        ) modifies mw_ReasonValue_param := {
            token := "Q.850"
        }
        
        template(value) ReasonValue m_ReasonValueSIP(
                                                     template(value) charstring p_cause, 
                                                     template(value) charstring p_text
        ) modifies m_ReasonValue_param := {
            token := "SIP"
        }
        
        template(present) ReasonValue mw_ReasonValueSIP(
                                                        template charstring p_cause, 
                                                        template charstring p_text
        ) modifies mw_ReasonValue_param := {
            token := "SIP"
        }

        template(present) RouteBody mw_routeBody(template(present) SipUrl p_sipurl) := {
            nameAddr := mw_NameAddr(*, p_sipurl), 
            rrParam := *
        }

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

        template(value) SipUrl m_SipUrl_currDomain_Base(template(value) SipUserProfile p_userprofile) := {
            scheme := c_sipScheme,  //*     contains "sip"
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber := p_userprofile.publUsername,  //*     charstring
                        password :=
                            omit //*     optional charstring
garciay's avatar
garciay committed
                    hostPort := {
                        host := omit,  //*     hostname, IPv4 or IPv6 as a
                                       //*     charstring
                        portField :=
                            omit //*     p_userprofile.currPort //* optional
                                 //*     integer
                    }
garciay's avatar
garciay committed
            urlParameters := omit,
            headers := omit
garciay's avatar
garciay committed
        template(value) SipUrl m_SipUrl_currDomain(template(value) SipUserProfile p_userprofile) modifies m_SipUrl_currDomain_Base := {
            components := {
                sip := {
                    hostPort := {
                        host :=
                            p_userprofile
                            .homeDomain //*     hostname, IPv4 or IPv6 as a
                                        //*     charstring
                    }
                }
            }
garciay's avatar
garciay committed
        template(value) SipUrl m_SipUrl_contactIpaddr(template(value) SipUserProfile p_userprofile) modifies m_SipUrl_currDomain_Base := {
            components := {
                sip := {
                    hostPort := {
                        host := p_userprofile.contactIpaddr,  //*     hostname,
                                                              //*     IPv4 or
                                                              //*     IPv6 as a
                                                              //*     charstring
                        portField :=
                            p_userprofile
                            .contactPort //*     optional integer
garciay's avatar
garciay committed
        template(value) SipUrl m_SipUrl_contactIpaddrAndCpc(template(value) SipUserProfile p_userprofile) modifies m_SipUrl_contactIpaddr := {
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber :=
                            p_userprofile.publUsername & "; cpc=" &
                            PX_SIP_ISUP_CPC_VALUE //*     charstring
                    }
                }
            }
        }
garciay's avatar
garciay committed
        template(value) SipUrl m_SipUrl_currIpaddr(template(value) SipUserProfile p_userprofile) modifies m_SipUrl_currDomain_Base := {
            components := {
                sip := {
                    hostPort := {
                        host := p_userprofile.currIpaddr,  //*     hostname,
                                                           //*     IPv4 or IPv6
                                                           //*     as a
                                                           //*     charstring
                        portField :=
                            p_userprofile
                            .currPort //*     optional integer
                    }
                }
            }
        }

        template(value) SipUrl m_SipUrl_Anonymous := {
            scheme := c_sipScheme,  //*     contains "sip"
            components := {
                sip := {
                    userInfo := {
                        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(value) SipUrl m_TelUrl_publUser(template(value) SipUserProfile p_userprofile) := {
            scheme := c_telScheme,  //*     contains "tel"
            components := {
                tel := {
                    subscriber :=
                        p_userprofile
                        .publUsername //*     charstring
                }
            },
            urlParameters := omit,
            headers := omit
        }

        template(present) SipUrl mw_BasicUrl := {
            scheme := c_telScheme, 
            components := {
                tel := ? 
garciay's avatar
garciay committed
            urlParameters := *, 
            headers := *
        }

        template(present) SipUrl mw_TelUrl modifies mw_BasicUrl := {
            components := {
                tel := {
                    subscriber := ?
                }
garciay's avatar
garciay committed

        template(present) SipUrl mw_SipUrl modifies mw_BasicUrl := {
            components := {
                sip := {
                    userInfo := *, 
                    hostPort := ?
                }
garciay's avatar
garciay committed

        template(present) SipUrl mw_TelSip_unavailableInvalidUri := (mw_TelSip_unavailableInvalidUri1, mw_TelSip_unavailableInvalidUri2);

        template(present) SipUrl mw_TelSip_unavailableInvalidUri1 modifies mw_BasicUrl := {
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber := "unavailable", 
                        password := omit
                    },
                    hostPort := {
                        host := "anonymous.invalid", 
                        portField := c_defaultSipPort
                    }
                }
            },
            urlParameters := omit,
            headers := omit
        }
        template(present) SipUrl mw_TelSip_unavailableInvalidUri2 modifies mw_BasicUrl := {
            components := {
                tel := {
                    subscriber := "unavailable"
                }
            },
            urlParameters := omit,
            headers := omit
pintar's avatar
pintar committed

garciay's avatar
garciay committed
        template(present) SipUrl mw_TelSip_unavailableUri(template(value) charstring p_host) := (mw_TelSip_unavailableUri1(p_host), mw_TelSip_unavailableUri2(p_host));

        template(present) SipUrl mw_TelSip_unavailableUri1(template(value) charstring p_host) modifies mw_BasicUrl := {
            components := {
                tel := {
                    subscriber := "unavailable"
                }
            },
            urlParameters := omit,
            headers := omit
        }
        
        template(present) SipUrl mw_TelSip_unavailableUri2(template(value) charstring p_host) modifies mw_TelSip_unavailableInvalidUri1 := {
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber := "unavailable", 
                        password := omit
                    }, 
                    hostPort := {
                        host := p_host, 
                        portField := c_defaultSipPort
garciay's avatar
garciay committed
                    }
                }
            }
garciay's avatar
garciay committed
        }
garciay's avatar
garciay committed
        template(present) SipUrl mw_SipUrl_Number(template(value) charstring p_number) := {
            scheme := c_sipScheme,  //*     contains "sip"
            components := {sip := {userInfo := {userOrTelephoneSubscriber := p_number, password := *}, hostPort := ?}},
            urlParameters := *,
            headers := *
        }

        template(present) SipUrl mw_TelSipUrl_Number(template(present) charstring p_number) := (mw_TelSipUrl_Number1(p_number), mw_TelSipUrl_Number2(p_number));

        template(present) SipUrl mw_TelSipUrl_Number1(template(present) charstring p_number) := {
            scheme := (c_sipScheme),  //*     contains "sip" or "tel"
            components := {
                sip := {
                    userInfo := {userOrTelephoneSubscriber := p_number, password := *},  //*     nat or int format
                    hostPort := ?
                }
            },
            urlParameters := *,
            headers := *
        }
        template(present) SipUrl mw_TelSipUrl_Number2(template(present) charstring p_number) := {
            scheme := (c_telScheme),  //*     contains "sip" or "tel"
            components := {tel := {subscriber := p_number}},
            urlParameters := *,
            headers := *
        }

        template(present) SipUrl mw_SipUrl_Host(template charstring p_host) := {
            scheme := c_sipScheme,  //*     contains "sip"
            components := {sip := {userInfo := *, hostPort := {host := p_host, portField := *}}},
            urlParameters := *,
            headers := *
        }


        template(present) SipUrl mw_SipUrl_NumberHost(template(value) charstring p_number, template(value) charstring p_host) := {
            scheme := c_sipScheme,  //*     contains "sip"
            components := {sip := {userInfo := {userOrTelephoneSubscriber := p_number, password := *}, hostPort := {host := p_host, portField := *}}},
            urlParameters := *,
            headers := *
        }

        template(present) SipUrl mw_SipUrl_NumberHostParam(template(value) charstring p_number, template(value) charstring p_host,
                                                           template SemicolonParam_List p_urlParameters) := {
            scheme := c_sipScheme,  //*     contains "sip"
            components := {sip := {userInfo := {userOrTelephoneSubscriber := p_number, password := *}, hostPort := {host := p_host, portField := *}}},
            urlParameters := p_urlParameters,
            headers := *
        }

        //     TODO: this temlate is possibly incorrectly defined, or
        //     "p_urlParameters" parameter name is incorrect, since it is
        //     assigned to "headers"
        template(value) SipUrl m_SipUrl_NumberHostHeader(template(value) charstring p_number, template(value) charstring p_host,
                                                         template(omit) AmpersandParam_List p_urlParameters) := {
            scheme := c_sipScheme,  //*     contains "sip"
            components := {sip := {userInfo := {userOrTelephoneSubscriber := p_number, password := omit}, hostPort := {host := p_host, portField := omit}}},
            urlParameters := p_urlParameters,
            headers := omit
        }

        //     TODO: this temlate is possibly incorrectly defined, or
        //     "p_urlParameters" parameter name is incorrect, since it is
        //     assigned to "headers"
        template(present) SipUrl mw_SipUrl_NumberHostHeader(template(value) charstring p_number, template(value) charstring p_host,
                                                            template AmpersandParam_List p_urlParameters) := {
            scheme := c_sipScheme,  //*     contains "sip"
            components := {sip := {userInfo := {userOrTelephoneSubscriber := p_number, password := *}, hostPort := {host := p_host, portField := *}}},
            urlParameters := p_urlParameters,
            headers := omit
        }

        template(value) SipUrl m_SipUrl_NumberHostParam(template(value) charstring p_number, template(value) charstring p_host,
                                                        template(omit) SemicolonParam_List p_urlParameters) := {
            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(value) SipUrl m_SipUrl_NumberHostParam_woPort(template(value) charstring p_number, template(value) charstring p_host,
                                                               template(omit) SemicolonParam_List p_urlParameters) := {
            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(present) SipUrl mw_SipUrl_Anonymous := {
            scheme := c_sipScheme,  //*     contains "sip"
            components := {
                sip := {
                    userInfo := {
                        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(present) SipUrl mw_SipUrl_urlParam(template SemicolonParam_List p_urlParameters) := {
            scheme := c_sipScheme,  //*     contains "sip"
            components := {sip := {userInfo := *, hostPort := ?}},
            urlParameters := p_urlParameters,
            headers := *
        }

        template(present) ContactAddress mw_ContactAddress := {addressField := ?, contactParams := *}

        template(present) HostPort mw_hostPort(template charstring p_host, template integer p_portField) := {host := p_host, portField := p_portField}

        template(present) StatusLine mw_statusLine1xx := {sipVersion := c_sipNameVersion, statusCode := (100 .. 199), reasonPhrase := ?}
        template(present) StatusLine mw_statusLine4xx := {sipVersion := c_sipNameVersion, statusCode := (400 .. 499), reasonPhrase := ?}
        template(present) StatusLine mw_statusLine5xx := {sipVersion := c_sipNameVersion, statusCode := (500 .. 599), reasonPhrase := ?}
        template(present) StatusLine mw_statusLineFinal := {sipVersion := c_sipNameVersion, statusCode := (200 .. 699), reasonPhrase := ?}

        template(present) NameAddr mw_NameAddr_DispName_User_Host(template charstring p_dn, template(present) charstring p_user, template charstring p_host) :=
garciay's avatar
garciay committed
            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(present) Addr_Union mw_AddrUnion_Nameaddr(template charstring p_dn, template(present) charstring p_user, template charstring p_host) := {
            nameAddr := mw_NameAddr_DispName_User_Host(p_dn, p_user, p_host)
        }

        template(present) SipUrl mw_SipUrl_User_Host(template(present) 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(present) Addr_Union mw_AddrUnion_SipUrl(template(present) charstring p_user, template charstring p_host) := {
            addrSpecUnion := mw_SipUrl_User_Host(p_user, p_host)
        }




    } //*     end group Subfields





    group HeaderFieldTemplates {
        template(value) LibSip_SIPTypesAndValues.Allow m_Allow(template(value) Method_List p_methods) := {fieldName := ALLOW_E, methods := p_methods}
garciay's avatar
garciay committed

        template(present) LibSip_SIPTypesAndValues.Allow mw_Allow(template(value) charstring p_method) := {fieldName := ALLOW_E, methods := superset(p_method)}

        template(value) GenericParam m_Cause(template(omit) charstring p_cause) := {id := "cause", paramValue := p_cause}
        template(present) GenericParam mw_Cause_base(template charstring p_cause) := {id := "cause", paramValue := p_cause}


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

        template(value) Authorization m_Authorization(template(value) Credentials p_Credentials) := {fieldName := AUTHORIZATION_E, body := {p_Credentials}}
garciay's avatar
garciay committed
        //     TODO: CR
        template(value) Authorization m_Authorization_digest(template(value) CommaParam_List p_CommaParam_List) := {
            fieldName := AUTHORIZATION_E, body := {{digestResponse := p_CommaParam_List}}
        }

        template(present) Authorization mw_Authorization_digest(template(present) CommaParam_List p_CommaParam_List) := {
            fieldName := AUTHORIZATION_E, body := {{digestResponse := p_CommaParam_List}}
        }

        template(value) Authorization m_add_Authorization_digest(template(value) Authorization p_auth, template(value) CommaParam_List p_CommaParam_List) := {
            fieldName := AUTHORIZATION_E, body := {{digestResponse := f_merge_CommaParam_List(p_auth.body[0].digestResponse, p_CommaParam_List)}}
        }
        //     TODO: STF471 this template contains matching symbol, but name
        //     suggests it is send template
        template(present) Authorization m_Authorization_other := {fieldName := AUTHORIZATION_E, body := {{otherResponse := ?}}}

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

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


        template(value) Contact m_Contact_profile_expires(template(value) SipUserProfile p_userprofile, template(value) 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(value) From m_From(template(value) NameAddr p_nameAddr, template(value) charstring p_tag_str) := {
            fieldName := FROM_E,
            addressField := {nameAddr := p_nameAddr},  //*     end addressField
            fromParams := {{id := c_tagId, paramValue := p_tag_str}}
        }

        template(value) From m_From_Anonymous(template(value) charstring p_tag_str) := {
            fieldName := FROM_E,
            addressField := {
                nameAddr :=
                    m_NameAddr("Anonymous",
                               //*     optional charstring
                               m_SipUrl_Anonymous //*     SipUrl
                                                  )
            },  //*     end addressField
            fromParams := {{id := c_tagId, paramValue := p_tag_str}}
        }

        template(value) From m_From_SipUrl(template(value) SipUrl p_sipUrl) := {
            fieldName := FROM_E,
            addressField := {
                nameAddr :=
                    m_NameAddr(omit,
                               //*     optional charstring
                               p_sipUrl //*     SipUrl
                                        )
            },  //*     end addressField
            fromParams := omit
        }

        template(value) Event m_Event_base := {fieldName := EVENT_E, eventType := "", eventParams := omit}

        template(value) Event m_Event_refer modifies m_Event_base := {eventType := "refer"}

        template(value) Event m_Event_conference modifies m_Event_base := {eventType := "conference"}

        template(value) Event m_Event_presence modifies m_Event_base := {eventType := "presence"}

        template(value) Event m_Event_reg modifies m_Event_base := {eventType := "reg"}

        template(value) Event m_Event_cdiv modifies m_Event_base := {eventType := "comm-div-info"}

        template(value) Event m_Event_mcid := m_Event_cdiv;

        template(value) Expires m_Expires_base := {fieldName := EXPIRES_E, deltaSec := ""}

        template(value) Expires m_Expires_600000 modifies m_Expires_base := {deltaSec := "600000"}

        template(value) Expires m_Expires(template(value) charstring p_deltaSec) modifies m_Expires_base := {deltaSec := p_deltaSec}

        template(present) Expires mw_Expires(template(present) charstring p_deltaSec) := {fieldName := EXPIRES_E, deltaSec := p_deltaSec}

        template(value) HistoryInfo m_HistoryInfo(template(value) HistoryInfo_List p_HistoryInfo_List) := {
            fieldName := HISTORY_INFO_E, historyInfoList := p_HistoryInfo_List
        }

        template(present) HistoryInfo mw_HistoryInfo(template(present) HistoryInfo_List p_HistoryInfo_List) := {
            fieldName := HISTORY_INFO_E, historyInfoList := p_HistoryInfo_List
        }

        template(value) HistoryInfoEntry m_HistoryInfoEntry(template(value) SipUrl p_Url, template(omit) IntegerList p_index,
                                                            template(omit) SemicolonParam_List p_paramlist) := {
            nameAddr := m_NameAddr(omit, p_Url), hiIndex := p_index, hiExtention := p_paramlist
        }

        template(present) HistoryInfoEntry mw_HistoryInfoEntry(template(present) SipUrl p_Url, template IntegerList p_index,
                                                               template SemicolonParam_List p_paramlist) := {
            nameAddr := mw_NameAddr(*, p_Url), hiIndex := p_index, hiExtention := p_paramlist
        }

        template(value) PAssertedID m_PAssertedID(template(value) Addr_Union p_pAssertedIDValue) := {
garciay's avatar
garciay committed
            fieldName := P_ASSERTED_ID_E, pAssertedIDValueList := {p_pAssertedIDValue}
        }

        template(value) PAssertedID m_PAssertedID_2x(template(value) Addr_Union p_pAssertedIDValue, template(value) Addr_Union p_pAssertedIDValue2)
            modifies m_PAssertedID := {
            pAssertedIDValueList := {p_pAssertedIDValue, p_pAssertedIDValue2}
        }

        template(present) PAssertedID mw_PAssertedID(template(present) PAssertedIDValue p_pAssertedIDValue) := {
            fieldName := P_ASSERTED_ID_E, pAssertedIDValueList := {p_pAssertedIDValue}
        }

        template(present) PAssertedIDValue mw_PAssertedIDValue(template(present) SipUrl p_SipUrl) := {nameAddr := {displayName := *, addrSpec := p_SipUrl}}

        template(value) PPreferredID m_PPreferredID(template(value) Addr_Union p_pPreferredIDValue) := {
            fieldName := P_PREFERRED_ID_E, pPreferredIDValueList := {p_pPreferredIDValue}
        }

        template(value) Privacy m_Privacy(template(value) PrivacyValue p_privacy) := {fieldName := PRIVACY_E, privValueList := {p_privacy}}

        template(present) Privacy mw_Privacy_Base(template(present) charstring p_value) := {fieldName := PRIVACY_E, privValueList := {*, p_value, *}}
        template(present) Privacy mw_Privacy_id := mw_Privacy_Base("id");

        template(present) Privacy mw_Privacy_user := mw_Privacy_Base("user");

        template(value) 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(value) Reason m_Reason(template(value) integer p_cause) := {
            fieldName := REASON_E, reasonValues := {m_ReasonValue(int2str(valueof(p_cause)), "dummy")}
        }

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

        template(present) Reason mw_Reason_Base := {fieldName := REASON_E, reasonValues := {}}

        template(present) Reason mw_Reason(template(value) charstring p_cause) modifies mw_Reason_Base := {reasonValues := {mw_ReasonValue(p_cause, ?)}}

        template(present) Reason mw_ReasonSIP(template(value) charstring p_cause) modifies mw_Reason_Base := {reasonValues := {mw_ReasonValueSIP(p_cause, ?)}}

        template(value) RecordRoute m_recordRoute_currIpAddr(template(value) 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 := omit,
                            headers := omit
                        }
                    },
                    rrParam := omit
                }
            }
        }

        //     TODO STF471 addition
        template(value) RecordRoute m_recordRoute_currIpAddr_params(template(value) SipUserProfile p_userprofile,
                                                                    template(value) SemicolonParam_List p_urlParameters) := {
            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 := p_urlParameters,
                            headers := omit
                        }
                    },
                    rrParam := omit
                }
            }
        }

        template(value) RouteBody m_routeBody_currIpAddr(template(value) 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 := omit,
                    headers := omit
                }
            },
            rrParam := omit
        }

        template(value) ReferredBy m_ReferredBy_SipUrl(template(value) SipUrl p_sipUrl) := {
            fieldName := REFERRED_BY_E,
            nameAddr := m_NameAddr(omit, p_sipUrl),  //     STF471 {displayName
                                                     //     := omit,
                                                     //     addrSpec:=p_sipUrl},
            referredbyIdParams := omit
        }

        template(value) ReferTo m_ReferTo_SipUrl(template(value) SipUrl p_sipUrl, template(value) charstring p_method) := {
            fieldName := REFER_TO_E,
            nameAddr := m_NameAddr(omit, p_sipUrl),  //     STF471 {displayName
                                                     //     := omit,
                                                     //     addrSpec:=p_sipUrl},
            referToParams := {{id := "method", paramValue := p_method}}
        }

        template(value) ReferSub m_ReferSub(template(value) boolean p_value) := {fieldName := REFER_SUB_E, referSubValue := p_value, referSubParams := omit}

        template(value) Replaces m_Replaces(template(value) charstring p_callId, template(value) charstring p_toTag, template(value) 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(value) Require m_Require_empty := {fieldName := REQUIRE_E, optionsTags := {""}}

        template(value) Require m_Require_replaces modifies m_Require_empty := {optionsTags := {c_replaces}}


        template(value) Require m_Require_100rel modifies m_Require_empty := {optionsTags := {c_tag100rel}}

        template(value) Require m_Require_prec modifies m_Require_empty := {optionsTags := {c_tagPrecond}}

        template(value) SubscriptionState m_SubscriptionState_active := {
            fieldName := SUBSCRIPTION_STATE_E, subState := "active", substateParams := {{id := "expires", paramValue := "60000"}}
        }

        template(value) Supported m_Supported_empty := {fieldName := SUPPORTED_E, optionsTags := {""}}

        template(value) Supported m_Supported_fromChange modifies m_Supported_empty := {optionsTags := {c_tagFromChange}}

        template(value) Supported m_Supported_prec modifies m_Supported_empty := {optionsTags := {c_tagPrecond}}

        template(value) Supported m_Supported_100rel modifies m_Supported_empty := {optionsTags := {c_tag100rel}}

        template(value) Supported m_Supported_100rel_prec modifies m_Supported_empty := {optionsTags := {c_tag100rel, c_tagPrecond}}

        template(value) GenericParam m_Text(template(value) charstring p_text) := {id := "text", paramValue := p_text}

        template(present) GenericParam mw_Text(template charstring p_text) := {id := "text", paramValue := p_text}

        template(value) GenericParam m_UserPhone := {id := "user", paramValue := "phone"}

        template(value) GenericParam m_UserToUserEncodingHex := {id := "encoding", paramValue := "hex"}

        template(value) UserToUser m_UserToUserData(template(value) UserToUser.uuiData p_U2UData) := {
garciay's avatar
garciay committed
            fieldName := USER_TO_USER_E, uuiData := p_U2UData, uuiParam := m_UserToUserEncodingHex
        }

        template(value) To m_To(template(value) SipUrl p_sipUrl) := {
            fieldName := TO_E,
            addressField := {
                nameAddr :=
                    m_NameAddr("ETSI Tester",
                               //*     optional charstring
                               p_sipUrl //*     SipUrl
                                        )
            },  //*     end addressField
            toParams := omit
        }

        template(value) To m_To_SipUrl(template(value) SipUrl p_sipUrl) modifies m_To := {
            addressField := {
                nameAddr := {
                    displayName :=
                        omit //*     optional charstring
                }
            } //*     end addressField
        }

        template(present) To mw_To_NameAddr_SipUrl(template charstring p_dn, template(present) 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)), toParams := *
        }

        template(present) To mw_To(template(present) SipUrl p_sipUrl) := {
            fieldName := TO_E, addressField := {nameAddr := mw_NameAddr(*, p_sipUrl)}, toParams := *
        }

        template(present) From mw_From(template(present) SipUrl p_sipUrl) := {
            fieldName := FROM_E, addressField := {nameAddr := mw_NameAddr(*, p_sipUrl)}, fromParams := *
        }

        template(present) From mw_From_NameAddr_SipUrl(template charstring p_dn, template(present) 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(value) ViaBody m_ViaBody_currIpaddr(template(value) charstring branch_val, template(value) 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(present) ViaBody mw_ViaBody_interface(template(present) HostPort p_hostport) := {
            sentProtocol := m_SentProtocol(PX_SIP_TRANSPORT), sentBy := {host := p_hostport.host, portField := p_hostport.portField}, viaParams := *
        }

        //     TODO STF471 check superset, can it be applied to ViaBody (record
        //     of)
        template(present) Via mw_Via(template(present) ViaBody p_viabody) := {
            fieldName := VIA_E,
            viaBody := {*, p_viabody, *} //     superset(p_viabody)
        }

        template(present) CallId mw_CallId_any := {fieldName := CALL_ID_E, callid := ?}

        template(present) Require mw_Require_Base := {fieldName := REQUIRE_E, optionsTags := {}}
        template(present) Require mw_Require_not_100rel modifies mw_Require_Base := {optionsTags := superset(complement(c_tag100rel))}

        template(present) Require mw_require_100rel modifies mw_Require_Base := {optionsTags := superset(c_tag100rel)}

        //     TODO STF471 check superset, can it be applied to RouteBody
        //     (record of)
        template(present) RecordRoute mw_recordroute(template(present) RouteBody p_routeBody) := {
            fieldName := RECORD_ROUTE_E,
            routeBody := {*, p_routeBody, *} //     superset(p_routeBody)
        }

        template(present) Route mw_route(template(present) RouteBody_List p_routeBody) := {fieldName := ROUTE_E, routeBody := p_routeBody}

        template(present) StatusLine mw_statusLine(template(present) integer p_statusCode) := {
            sipVersion := c_sipNameVersion, statusCode := p_statusCode, reasonPhrase := ?
        }

        template(present) Supported mw_Supported_Base := {fieldName := SUPPORTED_E, optionsTags := {}}

        template(present) Supported mw_Supported_100rel_prec modifies mw_Supported_Base := {optionsTags := superset(c_tag100rel, c_tagPrecond)}

        template(present) Supported mw_Supported_100rel modifies mw_Supported_Base := {optionsTags := superset(c_tag100rel)}

        template(present) Supported mw_Supported_fromChange modifies mw_Supported_Base := {optionsTags := superset(c_tagFromChange)}

        template(present) UserToUser mw_UserToUserData(template(present) UserToUser.uuiData p_U2UData) := {
garciay's avatar
garciay committed
            fieldName := USER_TO_USER_E, uuiData := p_U2UData, uuiParam := ?
        }

        template(present) Contact mw_Contact_conference := {
            fieldName := CONTACT_E,
            contactBody := {
                contactAddresses := {
                    {
                        addressField := {
                            nameAddr := {displayName := *, addrSpec := {scheme := ?, components := ?, urlParameters := {{"isfocus", *}, *}, headers := *}}
                        },
                        contactParams := *
                    }
                }
            }
        }

        template(value) AlertInfo m_AlertInfo_Base := {fieldName := ALERT_INFO_E, alertInfoBody := {}}

        template(value) AlertInfo m_AlertInfo(template(value) charstring p_urn) modifies m_AlertInfo_Base := {alertInfoBody := {{p_urn, omit}}}

        template(present) AlertInfo mw_AlertInfo(template(present) charstring p_urn) modifies m_AlertInfo_Base := {alertInfoBody := superset({p_urn, omit})}


    } //*     end of group HeaderFieldTemplates


    group MessageTemplates {
        group dummy_templates {
            group dummy_parameter_send {

                template(value) RequestLine m_requestLine_dummy(template(value) Method p_method) := {
                    method := p_method, requestUri := c_unavailableUri, sipVersion := c_sipNameVersion
                }

                template(value) MessageHeader m_msgHeader_dummy := {
                    accept := omit,
                    acceptContact := omit,
                    acceptEncoding := omit,
                    acceptLanguage := omit,
                    alertInfo := omit,
                    allow := omit,
                    allowEvents := omit,  //*     RFC3265
                    authenticationInfo := omit,
                    authorization := omit,
                    callId := c_empty_CallId,
                    callInfo := omit,
                    contact := omit,
                    contentDisposition := omit,
                    contentEncoding := omit,
                    contentLanguage := omit,
                    contentLength := {fieldName := CONTENT_LENGTH_E, len := 0},
                    contentType := omit,  //*     if message body present m,
                                          //*     else not present
                    cSeq := c_empty_cSeq,
                    date := omit,
                    errorInfo := omit,
                    event := omit,  //*     RFC3265
                    expires := omit,
                    fromField := c_empty_From,
                    geolocation := omit,
                    geolocationRouting := omit,
                    historyInfo := omit,  //*     RFC4244
                    inReplyTo := omit,
                    maxForwards := c_maxForwards70,
                    mimeVersion := omit,
                    minExpires := omit,
                    minSE := omit,  //*     RFC4028
                    organization := omit,
                    pAccessNetworkInfo := omit,  //*     RFC3455
                    pAssertedID := omit,
                    pAssertedService := omit,
                    pAssociatedURI := omit,
                    path := omit,  //*     RFC3327
                    pCalledPartyID := omit,  //*     RFC3455
                    pChargingFunctionAddresses := omit,  //*     RFC3455
                    pChargingVector := omit,  //*     RFC3455
                    pEarlyMedia := omit,  //*     RFC5009
                    pMediaAuthorization := omit,  //*     RFC3313
                    pPreferredID := omit,
                    pPreferredService := omit,
                    priority := omit,
                    privacy := omit,
                    proxyAuthenticate := omit,