Rev

Rev 636 | Blame | Compare with Previous | Last modification | View Log | Download | SVN | Bug Tracker

/**
 * @author STF 346, STF366, STF368, STF369, STF450, STF471
 * @version $Id: LibSip_Templates.ttcn 656 2018-02-16 08:32:25Z genoudoli $
 * @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 LibSipV3.
 * @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;
    import from LibSip_Common all;

    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";
    }

    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) DisplayName p_displayName,
            template(value) SipUrl p_addrSpec
        ) := {
            nameAddr := m_CallingAddr(p_displayName, p_addrSpec)
        }

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

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

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

        template(present) CommaParam_List mw_digestResponse(
            template(present) GenericParam p_genericParam := ?
        ) := superset(p_genericParam);
       
        //*     c_Integrity_protected_yes
        /**
         * @desc send template for parameter list with CPC set to a specific value
         * @param p_ISUP_CPC_value CPC parameter value
         *             former PX_SIP_ISUP_CPC_VALUE
         */

        template(value) SemicolonParam_List m_cpc(
            template(value) charstring p_ISUP_CPC_value := "prison"
        ) := {
            {
                "cpc",
                {tokenOrHost := p_ISUP_CPC_value}
            }
        }

        template(value) SemicolonParam_List m_ReasonParams(
            template(omit) GenValue p_cause := omit,
            template(value) GenValue p_text
        ) := {
            m_Cause(p_cause), m_Text(p_text)
        }

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

        template(value) ReasonValue m_ReasonValue_Base := {
            token := "",
            reasonParams := omit
        }

        template(present) ReasonValue mw_ReasonValue_Base := {
            token := ?,
            reasonParams := *
        }

        template(value) ReasonValue m_ReasonValue_param(
            template(value) GenValue p_cause,
            template(value) GenValue p_text
        ) modifies m_ReasonValue_Base := {
            reasonParams := m_ReasonParams(p_cause, p_text)
        }

        template(present) ReasonValue mw_ReasonValue_param(
            template GenValue p_cause,
            template GenValue p_text
        ) modifies mw_ReasonValue_Base := {
            reasonParams := mw_ReasonParams(p_cause, p_text)
        }

        template(value) ReasonValue m_ReasonValue(
            template(value) GenValue p_cause,
            template(value) GenValue p_text
        ) modifies m_ReasonValue_param := {
            token := "Q.850"
        }

        template(present) ReasonValue mw_ReasonValue(
            template GenValue p_cause,
            template GenValue p_text
        ) modifies mw_ReasonValue_param := {
            token := "Q.850"
        }

        template(value) ReasonValue m_ReasonValueSIP(
            template(value) GenValue p_cause,
            template(value) GenValue p_text
        ) modifies m_ReasonValue_param := {
            token := "SIP"
        }

        template(present) ReasonValue mw_ReasonValueSIP(
            template GenValue p_cause,
            template GenValue 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_BasicSipUrl := {
            scheme := (c_sipScheme),
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber := "",  //*     charstring
                        password :=
                            omit //*     optional charstring
                    },
                    hostPort := {
                        host := omit,  //*     hostname, IPv4 or IPv6 as a charstring
                        portField :=
                            omit //*     p_userprofile.currPort - optional integer
                    }
                }
            },
            urlParameters := omit,
            headers := omit
        }

        template(value) SipUrl m_SipUrl_currDomain_Base(
            template(value) SipUserProfile p_userprofile
        ) modifies m_BasicSipUrl := {
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber := p_userprofile.publUsername
                    }
                }
            }
        }

        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
                    }
                }
            }
        }

        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
                    }
                }
            }
        }
        /**
         * @desc send template with SIP userinfo
         * @param p_userprofile SIP user profile values
         * @param p_ISUP_CPC_value CPC parameter value
         *             former PX_SIP_ISUP_CPC_VALUE
         */

        template(value) SipUrl m_SipUrl_contactIpaddrAndCpc(
            template(value) SipUserProfile p_userprofile,
            template(value) charstring p_ISUP_CPC_value := "prison"
        ) modifies m_SipUrl_contactIpaddr := {
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber :=
                            p_userprofile.publUsername & "; cpc=" &
                            p_ISUP_CPC_value
                    }
                }
            }
        }

        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 modifies m_BasicSipUrl := {
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber :=
                            "Anonymous" //*     charstring
                    },
                    hostPort := {
                        host :=
                            "Anonymous.invalid" //*     hostname, IPv4 or IPv6 as a charstring
                    }
                }
            }
        }

        template(value) SipUrl m_SipUrl_NumberHostHeader(
            template(value) charstring p_number,
            template(value) charstring p_host,
            template(omit) AmpersandParam_List p_urlParameters := omit
        ) modifies m_BasicSipUrl := {
            components := {
                sip := {
                    userInfo := {userOrTelephoneSubscriber := p_number},
                    hostPort := {host := p_host}
                }
            },
            urlParameters := p_urlParameters
        }

        template(value) SipUrl m_SipUrl_NumberHostParam(
            template(value) charstring p_number,
            template(value) charstring p_host,
            template(omit) AmpersandParam_List p_urlParameters := omit
        ) modifies m_SipUrl_NumberHostHeader := {
            components := {sip := {hostPort := {portField := c_defaultSipPort}}}
        }

        template(value) SipUrl m_SipUrl_NumberHostParam_woPort(
            template(value) charstring p_number,
            template(value) charstring p_host,
            template(omit) AmpersandParam_List p_urlParameters := omit
        ) modifies m_SipUrl_NumberHostParam := {
            components := {sip := {hostPort := {portField := omit}}}
        }

        template(present) SipUrl m_BasicTelUrl := {
            scheme := (c_telScheme),
            components := {tel := {subscriber := ""}},
            urlParameters := omit,
            headers := omit
        }

        template(value) SipUrl m_TelUrl_publUser(
            template(value) SipUserProfile p_userprofile
        ) modifies m_BasicTelUrl := {
            components := {
                tel := {
                    subscriber :=
                        p_userprofile
                        .publUsername //*     charstring
                }
            }
        }

        template(present) SipUrl mw_TelUrl := {
            scheme := c_telScheme,
            components := {tel := {subscriber := ?}},
            urlParameters := *,
            headers := *
        }

        template(present) SipUrl mw_SipUrl := {
            scheme := c_sipScheme,
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber := ?,
                        password := *
                    },
                    hostPort := {
                        host := *,
                        portField := *
                    }
                }
            },
            urlParameters := *,
            headers := *
        }

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

        template(present) SipUrl mw_TelSip_unavailableInvalidUri1 modifies mw_SipUrl := {
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber := "unavailable"
                    },
                    hostPort := {
                        host := "anonymous.invalid",
                        portField := c_defaultSipPort
                    }
                }
            }
        }
        template(present) SipUrl mw_TelSip_unavailableInvalidUri2 modifies mw_TelUrl := {
            components := {tel := {subscriber := "unavailable"}}
        }

        template(present) SipUrl mw_TelSip_unavailableUri(
            template(value) charstring p_host
        ) := (mw_TelSip_unavailableUri1, mw_TelSip_unavailableUri2(p_host));

        template(present) SipUrl mw_TelSip_unavailableUri1 modifies mw_TelUrl := {
            components := {tel := {subscriber := "unavailable"}}
        }

        template(present) SipUrl mw_TelSip_unavailableUri2(
            template(value) charstring p_host
        ) modifies mw_SipUrl := {
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber := "unavailable"
                    },
                    hostPort := {
                        host := p_host,
                        portField := c_defaultSipPort
                    }
                }
            }
        }

        template(present) SipUrl mw_SipUrl_Number(
            template(present) charstring p_number := ?
        ) modifies mw_SipUrl := {
            components := {
                sip := {
                    userInfo := {userOrTelephoneSubscriber := p_number},
                    hostPort := ?
                }
            }
        }

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

        template(present) SipUrl mw_TelSipUrl_Number1(
            template(present) charstring p_number := ?
        ) := mw_SipUrl_Number(p_number);

        template(present) SipUrl mw_TelSipUrl_Number2(
            template(present) charstring p_number := ?
        ) modifies mw_TelUrl := {
            components := {
                tel := {
                    subscriber := p_number
                }
            }
        }

        template(present) SipUrl mw_SipUrl_Host(
            template charstring p_host
        ) modifies mw_SipUrl := {
            components := {
                sip := {
                    userInfo := *,
                    hostPort := {host := p_host}
                }
            }
        }

        template(present) SipUrl mw_SipUrl_User_Host(
            template(present) charstring p_user := ?,
            template charstring p_host
        ) modifies mw_SipUrl := {
            components := {
                sip := {
                    userInfo := {userOrTelephoneSubscriber := p_user},
                    hostPort := {
                        host :=
                            p_host //*     hostname, IPv4 or IPv6 as a charstring
                    }
                }
            },
            urlParameters := {m_UserPhone}
        }

        template(present) SipUrl mw_SipUrl_Anonymous modifies mw_SipUrl := {
            components := {
                sip := {
                    userInfo := {
                        userOrTelephoneSubscriber := pattern "[a,A][n,N][o,O][n,N][y,Y][m,M][o,O][u,U][s,s]"  //*     charstring
                    },
                    hostPort := {
                        host :=
                            pattern
                                "[a,A]nonymous.invalid" //*     hostname, IPv4 or IPv6 as a charstring
                    }
                }
            }
        }

        template(present) SipUrl mw_SipUrl_urlParam(
            template SemicolonParam_List p_urlParameters
        ) modifies mw_SipUrl := {
            urlParameters := p_urlParameters
        }

        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_statusLine_any := {
            sipVersion := c_sipNameVersion,
            statusCode := ?,
            reasonPhrase := ?
        }

        template(present) StatusLine mw_statusLine(
            in template(present) integer p_statusCode := ?,
            in template(present) charstring p_reasonPhrase := ?
        ) modifies mw_statusLine_any := {
            statusCode := p_statusCode,
            reasonPhrase := p_reasonPhrase
        }

        template(present) StatusLine mw_statusLine1xx modifies mw_statusLine_any := {statusCode := (100 .. 199)}
       
        template(present) StatusLine mw_statusLine2xx modifies mw_statusLine_any := {statusCode := (200 .. 299)}
       
        template(present) StatusLine mw_statusLine3xx modifies mw_statusLine_any := {statusCode := (300 .. 399)}

        template(present) StatusLine mw_statusLine4xx modifies mw_statusLine_any := {statusCode := (400 .. 499)}

        template(present) StatusLine mw_statusLine5xx modifies mw_statusLine_any := {statusCode := (500 .. 599)}
       
        template(present) StatusLine mw_statusLine6xx modifies mw_statusLine_any := {statusCode := (600 .. 699)}

        template(present) StatusLine mw_statusLineFinal modifies mw_statusLine_any := {statusCode := (200 .. 699)}

        template(present) NameAddr mw_NameAddr_DispName_User_Host(
            template DisplayName p_dn,
            template(present) 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(present) Addr_Union mw_AddrUnion_Nameaddr(
            template DisplayName 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) 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
        }

        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) GenValue p_cause := omit
        ) := {
            id := "cause",
            paramValue := p_cause
        }

        template(present) GenericParam mw_Cause_base(
            template GenValue p_cause
        ) := {
            id := "cause",
            paramValue := p_cause
        }

        template(present) GenericParam mw_Cause(
            template(value) charstring p_cause
        ) := {
            id := ?,
            paramValue := { tokenOrHost := pattern "*{p_cause}*" }
        }

        template(value) Authorization m_Authorization(
            template(value) Credentials p_credentials
        ) := {
            fieldName := AUTHORIZATION_E,
            body := {p_credentials}
        }

        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)}}
        }

        template(present) Authorization mw_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) GenValue 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) GenValue 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) GenValue p_tag_str
        ) := {
            fieldName := FROM_E,
            addressField := {
                nameAddr :=
                    m_NameAddr(
                        {token:="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 := omit,
            template(omit) SemicolonParam_List p_paramlist := omit
        ) := {
            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
        ) := {
            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({tokenOrHost := int2str(valueof(p_cause))}, { tokenOrHost := "dummy"})}
        }

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

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

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

        template(present) Reason mw_ReasonSIP(
            template(value) GenValue 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
                }
            }
        }

        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(
                    // STF471 {displayName
                    omit,
                    // := omit,
                    p_sipUrl // addrSpec:=p_sipUrl}
                ),
            referredbyIdParams := omit
        }

        template(value) ReferTo m_ReferTo_SipUrl(
            template(value) SipUrl p_sipUrl,
            template(value) GenValue p_method
        ) := {
            fieldName := REFER_TO_E,
            nameAddr :=
                m_NameAddr(
                    // STF471 {displayName
                    omit,
                    // := omit,
                    p_sipUrl // 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) GenValue p_toTag,
            template(value) GenValue p_fromTag
        ) := {
            fieldName := REPLACES_E,
            callid := p_callId,
            replacesParams := {
                {
                    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 := {tokenOrHost := "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) GenValue p_text
        ) := {
            id := "text",
            paramValue := p_text
        }

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

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

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

        template(value) UserToUser m_UserToUserData(
            template(value) UserToUser.uuiData p_U2UData
        ) := {
            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(
                        {token:="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 DisplayName 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 DisplayName 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 p_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 := {
                        tokenOrHost := p_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 := *
        }

        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)}

        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) 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 := ?
        ) := {
            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,
                    featureCaps := 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,
                    proxyAuthorization := omit,
                    proxyRequire := omit,
                    pVisitedNetworkID := omit,  //*     RFC3455
                    rAck := omit,
                    rSeq := omit,
                    reason := omit,
                    recordRoute := omit,
                    requestDisposition := omit,
                    referredBy := omit,  //*     RFC3892 - REFER method
                    referTo := omit,  //*     RFC3515 - REFER method
                    referSub := omit,  //*     RFC4488 - REFER method
                    replaces := omit,  //*     RFC3891
                    replyTo := omit,
                    require := omit,
                    retryAfter := omit,
                    route := omit,
                    securityClient := omit,  //*     RFC3329
                    securityServer := omit,  //*     RFC3329
                    securityVerify := omit,  //*     RFC3329
                    server := omit,
                    serviceRoute := omit,  //*     RFC3608
                    sessionExpires := omit,  //*     RFC4028
                    sessionId := omit,
                    sipETag := omit,
                    sipIfMatch := omit,
                    subject := omit,
                    subscriptionState := omit,  //*     RFC3265
                    supported := omit,
                    timestamp := omit,
                    toField := c_empty_To,
                    unsupported := omit,
                    userToUser := omit,
                    userAgent := omit,
                    via := c_empty_Via,
                    warning := omit,
                    wwwAuthenticate := omit,
                    undefinedHeader_List := omit
                }


            } //*     group dummy_parameter_send

            group dummy_parameter_receive {

                template(present) RequestLine mw_requestLine_dummy(
                    Method p_method
                ) := {
                    method := p_method,
                    requestUri := ?,
                    sipVersion := c_sipNameVersion
                }

                template(present) MessageHeader mw_msgHeader_dummy := {
                    accept := *,
                    acceptContact := *,
                    acceptEncoding := *,
                    acceptLanguage := *,
                    alertInfo := *,
                    allow := *,
                    allowEvents := *,  //*     RFC3265
                    authenticationInfo := *,
                    authorization := *,
                    callId := ?,
                    callInfo := *,
                    contact := *,
                    contentDisposition := *,
                    contentEncoding := *,
                    contentLanguage := *,
                    contentLength := ?,
                    contentType := *,
                    cSeq := ?,
                    date := *,
                    errorInfo := *,
                    event := *,  //*     RFC3265
                    expires := *,
                    featureCaps := *,
                    fromField := ?,
                    geolocation := *,
                    geolocationRouting := *,
                    historyInfo := *,  //*     RFC4244
                    inReplyTo := *,
                    maxForwards := *,
                    mimeVersion := *,
                    minExpires := *,
                    minSE := *,  //*     RFC4028
                    organization := *,
                    pAccessNetworkInfo := *,  //*     RFC3455
                    pAssertedID := *,
                    pAssertedService := *,
                    pAssociatedURI := *,
                    path := *,  //*     RFC3327
                    pCalledPartyID := *,  //*     RFC3455
                    pChargingFunctionAddresses := *,  //*     RFC3455
                    pChargingVector := *,  //*     RFC3455
                    pEarlyMedia := *,  //*     RFC5009
                    pMediaAuthorization := *,  //*     RFC3313
                    pPreferredID := *,
                    pPreferredService := *,
                    priority := *,
                    privacy := *,
                    proxyAuthenticate := *,
                    proxyAuthorization := *,
                    proxyRequire := *,
                    pVisitedNetworkID := *,  //*     RFC3455
                    rAck := *,
                    rSeq := *,
                    reason := *,
                    recordRoute := *,
                    requestDisposition := *,
                    referredBy := *,  //*     RFC3892 - REFER method
                    referTo := *,  //*     RFC3515 - REFER method
                    referSub := *,  //*     RFC4488 - REFER method
                    replaces := *,  //*     RFC 3891
                    replyTo := *,
                    require := *,
                    retryAfter := *,
                    route := *,
                    securityClient := *,  //*     RFC3329
                    securityServer := *,  //*     RFC3329
                    securityVerify := *,  //*     RFC3329
                    server := *,
                    serviceRoute := *,  //*     RFC3608
                    sessionExpires := *,  //*     RFC4028
                    sessionId := *,
                    sipETag := *,
                    sipIfMatch := *,
                    subject := *,
                    subscriptionState := *,  //*     RFC3265
                    supported := *,
                    timestamp := *,
                    toField := ?,
                    unsupported := *,
                    userToUser := *,
                    userAgent := *,
                    via := ?,
                    warning := *,
                    wwwAuthenticate := *,
                    undefinedHeader_List := *
                }


            } //*     end group dummy_parameter_receive

            group dummy_request_templates_send {

                template(value) ACK_Request m_ACK_Dummy := {
                    requestLine := m_requestLine_dummy(ACK_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) BYE_Request m_BYE_Dummy := {
                    requestLine := m_requestLine_dummy(BYE_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) CANCEL_Request m_CANCEL_Dummy := {
                    requestLine := m_requestLine_dummy(CANCEL_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) INFO_Request m_INFO_Dummy := {
                    requestLine := m_requestLine_dummy(INFO_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) INVITE_Request m_INVITE_Dummy := {
                    requestLine := m_requestLine_dummy(INVITE_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) MESSAGE_Request m_MESSAGE_Dummy := {
                    requestLine := m_requestLine_dummy(MESSAGE_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) NOTIFY_Request m_NOTIFY_Dummy := {
                    requestLine := m_requestLine_dummy(NOTIFY_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) OPTIONS_Request m_OPTIONS_Dummy := {
                    requestLine := m_requestLine_dummy(OPTIONS_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) PRACK_Request m_PRACK_Dummy := {
                    requestLine := m_requestLine_dummy(PRACK_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) PUBLISH_Request m_PUBLISH_Dummy := {
                    requestLine := m_requestLine_dummy(PUBLISH_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) REGISTER_Request m_REGISTER_Dummy := {
                    requestLine := m_requestLine_dummy(REGISTER_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) REFER_Request m_REFER_Dummy := {
                    requestLine := m_requestLine_dummy(REFER_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) SUBSCRIBE_Request m_SUBSCRIBE_Dummy := {
                    requestLine := m_requestLine_dummy(SUBSCRIBE_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }

                template(value) UPDATE_Request m_UPDATE_Dummy := {
                    requestLine := m_requestLine_dummy(UPDATE_E),
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }


            } //*     end group dummy_request_templates_send
            group dummy_request_templates_receive {

                template(present) ACK_Request mw_ACK_Dummy := {
                    requestLine := mw_requestLine_dummy(ACK_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) BYE_Request mw_BYE_Dummy := {
                    requestLine := mw_requestLine_dummy(BYE_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) CANCEL_Request mw_CANCEL_Dummy := {
                    requestLine := mw_requestLine_dummy(CANCEL_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) INFO_Request mw_INFO_Dummy := {
                    requestLine := mw_requestLine_dummy(INFO_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) INVITE_Request mw_INVITE_Dummy := {
                    requestLine := mw_requestLine_dummy(INVITE_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) MESSAGE_Request mw_MESSAGE_Dummy := {
                    requestLine := mw_requestLine_dummy(MESSAGE_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) OPTIONS_Request mw_OPTIONS_Dummy := {
                    requestLine := mw_requestLine_dummy(OPTIONS_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) NOTIFY_Request mw_NOTIFY_Dummy := {
                    requestLine := mw_requestLine_dummy(NOTIFY_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) PRACK_Request mw_PRACK_Dummy := {
                    requestLine := mw_requestLine_dummy(PRACK_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) PUBLISH_Request mw_PUBLISH_Dummy := {
                    requestLine := mw_requestLine_dummy(PUBLISH_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) REFER_Request mw_REFER_Dummy := {
                    requestLine := mw_requestLine_dummy(REFER_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) REGISTER_Request mw_REGISTER_Dummy := {
                    requestLine := mw_requestLine_dummy(REGISTER_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) SUBSCRIBE_Request mw_SUBSCRIBE_Dummy := {
                    requestLine := mw_requestLine_dummy(SUBSCRIBE_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

                template(present) UPDATE_Request mw_UPDATE_Dummy := {
                    requestLine := mw_requestLine_dummy(UPDATE_E),
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }

               
            } //*     end group dummy_request_templates_receive

            group dummy_response_templates_send {

                template(value) Response m_Response_Dummy := {
                    statusLine := c_statusLine100,
                    msgHeader := m_msgHeader_dummy,
                    messageBody := omit,
                    payload := omit
                }


            } //*     group dummy_response_templates_send

            group dummy_response_templates_receive {

                template(present) Response mw_Response_Dummy := {
                    statusLine := ?,
                    msgHeader := mw_msgHeader_dummy,
                    messageBody := *,
                    payload := *
                }


            } //*     group dummy_response_templates_receive
        }

        group base_templates {

            template(value) CSeq m_cSeq(
                template(value) integer p_seqNumber,
                template(value) charstring p_method
            ) := {
                fieldName := CSEQ_E,
                seqNumber := p_seqNumber,
                method := p_method
            }

            template(value) ContentLength m_contentLength(
                template(value) integer p_len
            ) := {
                fieldName := CONTENT_LENGTH_E,
                len := p_len
            }

            template(value) ContentType m_contentType(
                template(value) charstring p_mTypeSubtype
            ) := {
                fieldName := CONTENT_TYPE_E,
                mTypeSubtype := p_mTypeSubtype
            }

            template(present) ContentType mw_contentType(
                in template(present) charstring p_mTypeSubtype := ?
            ) := {
                fieldName := CONTENT_TYPE_E,
                mTypeSubtype := p_mTypeSubtype
            }

            group request_send {

                template(value) ACK_Request m_ACK_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via
                ) modifies m_ACK_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        cSeq := m_cSeq(p_cSeq.seqNumber, "ACK"),  // STF471
                                                                  // {fieldName:=CSEQ_E,
                                                                  // seqNumber:=
                                                                  // p_cSeq.seqNumber,
                                                                  // method:=
                                                                  // "ACK"},
                        fromField := p_from,
                        toField := p_to,
                        via := p_via
                    }
                }

                template(value) ACK_Request m_ACK_Request_withRecordRoute(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) Route p_route
                ) modifies m_ACK_Request_Base := {
                    msgHeader := {
                        route := p_route,
                        contentLength := m_contentLength(0)
                    }
                }

                template(value) BYE_Request m_BYE_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via
                ) modifies m_BYE_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        cSeq := p_cSeq,
                        fromField := p_from,
                        toField := p_to,
                        via := p_via
                    }
                }

                template(value) CANCEL_Request m_CANCEL_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via
                ) modifies m_CANCEL_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        cSeq := p_cSeq,
                        fromField := p_from,
                        toField := p_to,
                        via := p_via
                    }
                }

                template(value) INFO_Request m_INFO_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via
                ) modifies m_INFO_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        cSeq := p_cSeq,
                        fromField := p_from,
                        toField := p_to,
                        via := p_via
                    }
                }

                template(value) INVITE_Request m_INVITE_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) Contact p_contact
                ) modifies m_INVITE_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        contact := p_contact,
                        cSeq := p_cSeq,
                        fromField := p_from,
                        toField := p_to,
                        via := p_via
                    }
                }

                template(value) MESSAGE_Request m_MESSAGE_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via
                ) modifies m_MESSAGE_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        cSeq := p_cSeq,
                        fromField := p_from,
                        toField := p_to,
                        via := p_via
                    }
                }

                template(value) NOTIFY_Request m_NOTIFY_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via
                ) modifies m_NOTIFY_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        cSeq := m_cSeq(p_cSeq.seqNumber, "NOTIFY"),  // STF471
                                                                     // {fieldName:=CSEQ_E,
                                                                     // seqNumber:=
                                                                     // p_cSeq.seqNumber,
                                                                     // method:=
                                                                     // "NOTIFY"},
                        fromField := p_from,
                        toField := p_to,
                        via := p_via
                    }
                }

                template(value) OPTIONS_Request m_OPTIONS_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via
                ) modifies m_OPTIONS_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        cSeq := m_cSeq(p_cSeq.seqNumber, "OPTIONS"),  // STF471
                                                                      // {fieldName:=CSEQ_E,
                                                                      // seqNumber:=
                                                                      // p_cSeq.seqNumber,
                                                                      // method:=
                                                                      // "OPTIONS"},
                        fromField := p_from,
                        toField := p_to,
                        via := p_via
                    }
                }

                template(value) PRACK_Request m_PRACK_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) RAck p_RAck
                ) modifies m_PRACK_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        cSeq := m_cSeq(p_cSeq.seqNumber, "PRACK"),  // STF471
                                                                    // {fieldName:=CSEQ_E,
                                                                    // seqNumber:=
                                                                    // p_cSeq.seqNumber,
                                                                    // method:=
                                                                    // "PRACK"},
                        fromField := p_from,
                        rAck := p_RAck,
                        toField := p_to,
                        via := p_via
                    },
                    messageBody := omit
                }

                template(value) PUBLISH_Request m_PUBLISH_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) Event p_event := omit,
                    template(omit) RAck p_RAck := omit,
                    template(value) MessageBody p_mb
                ) modifies m_PUBLISH_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        contentLength := m_contentLength(f_MessageBodyLength(p_mb)),  // STF471
                                                                                      // {fieldName
                                                                                      // :=
                                                                                      // CONTENT_LENGTH_E,
                                                                                      // len:=
                                                                                      // f_MessageBodyLength(valueof(p_mb))},
                        contentType := m_contentType(c_plainText),  // STF471
                                                                    // {fieldName
                                                                    // :=
                                                                    // CONTENT_TYPE_E,
                                                                    // mTypeSubType
                                                                    // :=
                                                                    // c_plainText/*c_sdp*/},
                        cSeq := m_cSeq(p_cSeq.seqNumber, "PUBLISH"),  // STF471
                                                                      // {fieldName:=CSEQ_E,
                                                                      // seqNumber:=
                                                                      // p_cSeq.seqNumber,
                                                                      // method:=
                                                                      // "PUBLISH"},
                        event := p_event,
                        rAck := p_RAck,
                        fromField := p_from,
                        toField := p_to,
                        via := p_via
                    },
                    messageBody := p_mb
                }

                template(value) REFER_Request m_REFER_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(omit) Contact p_contact := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) ReferTo p_referTo := omit,
                    template(omit) ReferredBy p_referredBy := omit
                ) modifies m_REFER_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        contact := p_contact,
                        cSeq := m_cSeq(p_cSeq.seqNumber, "REFER"),  // STF471
                                                                    // {fieldName:=CSEQ_E,
                                                                    // seqNumber:=
                                                                    // p_cSeq.seqNumber,
                                                                    // method:=
                                                                    // "REFER"},
                        fromField := p_from,
                        referTo := p_referTo,
                        referredBy := p_referredBy,
                        toField := p_to,
                        via := p_via
                    }
                }

                template(value) REFER_Request m_REFER_Request_replaces(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(omit) Contact p_contact := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) ReferTo p_referTo,
                    template(value) ReferredBy p_referredBy,
                    template(value) Replaces p_replaces,
                    template(omit) Require p_require := omit
                ) modifies m_REFER_Request_Base := {
                    msgHeader := {
                        replaces := p_replaces,
                        require := p_require
                    }
                }

                template(value) REGISTER_Request m_REGISTER_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) Contact p_contact := omit,
                    template(omit) Authorization p_authorization := omit
                ) modifies m_REGISTER_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        authorization := p_authorization,
                        callId := p_callId,
                        contact := p_contact,
                        cSeq := p_cSeq,
                        fromField := p_from,
                        toField := p_to,
                        supported := {
                            fieldName := SUPPORTED_E,
                            optionsTags := {"path"}
                        },
                        via := p_via
                    }
                }

                template(value) SUBSCRIBE_Request m_SUBSCRIBE_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via
                ) modifies m_SUBSCRIBE_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        cSeq := m_cSeq(p_cSeq.seqNumber, "SUBSCRIBE"),  // STF471
                                                                        // {fieldName:=CSEQ_E,
                                                                        // seqNumber:=
                                                                        // p_cSeq.seqNumber,
                                                                        // method:=
                                                                        // "SUBSCRIBE"},
                        fromField := p_from,
                        toField := p_to,
                        via := p_via
                    }
                }

                template(value) UPDATE_Request m_UPDATE_Request_Base(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) Contact p_contact := omit,
                    template(value) MessageBody p_mb
                ) modifies m_UPDATE_Dummy := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        contact := p_contact,
                        contentLength := m_contentLength(f_MessageBodyLength(p_mb)),  // STF471
                                                                                      // {fieldName
                                                                                      // :=
                                                                                      // CONTENT_LENGTH_E,
                                                                                      // len:=
                                                                                      // f_MessageBodyLength(valueof(p_mb))},
                        contentType := m_contentType(c_sdpApplication),  // STF471
                                                                         // {fieldName
                                                                         // :=
                                                                         // CONTENT_TYPE_E,
                                                                         // mTypeSubtype
                                                                         // :=
                                                                         // c_sdp},
                        cSeq := m_cSeq(p_cSeq.seqNumber, "UPDATE"),  // STF471
                                                                     // {fieldName:=CSEQ_E,
                                                                     // seqNumber:=
                                                                     // p_cSeq.seqNumber,
                                                                     // method:=
                                                                     // "UPDATE"},
                        fromField := p_from,
                        toField := p_to,
                        via := p_via
                    },
                    messageBody := p_mb
                }


            } //*     end of group message_send

            group request_receive {

                template(present) ACK_Request mw_ACK_Request_Base(
                    template CallId p_callId
                ) modifies mw_ACK_Dummy := {
                    msgHeader := {callId := p_callId}
                }

                template(present) BYE_Request mw_BYE_Request_Base(
                    template CallId p_callId
                ) modifies mw_BYE_Dummy := {
                    msgHeader := {callId := p_callId}
                }

                template(present) CANCEL_Request mw_CANCEL_Request_Base(
                    template CallId p_callId
                ) modifies mw_CANCEL_Dummy := {
                    msgHeader := {callId := p_callId}
                }

                template(present) INFO_Request mw_INFO_Request_Base(
                    template CallId p_callId
                ) modifies mw_INFO_Dummy := {
                    msgHeader := {callId := p_callId}
                }

                template(present) INVITE_Request mw_INVITE_Request_Base modifies mw_INVITE_Dummy := {requestLine := {method := INVITE_E}}

                template(present) MESSAGE_Request mw_MESSAGE_Request_Base modifies mw_MESSAGE_Dummy := {msgHeader := {contact := *}}

                template(present) NOTIFY_Request mw_NOTIFY_Request_Base(
                    template CallId p_callId
                ) modifies mw_NOTIFY_Dummy := {
                    msgHeader := {callId := p_callId}
                }

                template(present) OPTIONS_Request mw_OPTIONS_Request_Base(
                    template CallId p_callId
                ) modifies mw_OPTIONS_Dummy := {
                    msgHeader := {callId := p_callId}
                }

                template(present) PRACK_Request mw_PRACK_Request_Base(
                    template CallId p_callId
                ) modifies mw_PRACK_Dummy := {
                    msgHeader := {callId := p_callId}
                }

                template(present) PUBLISH_Request mw_PUBLISH_Request_Base(
                    template CallId p_callId
                ) modifies mw_PUBLISH_Dummy := {
                    msgHeader := {callId := p_callId}
                }

                template(present) REFER_Request mw_REFER_Request_Base(
                    template CallId p_callId
                ) modifies mw_REFER_Dummy := {
                    msgHeader := {callId := p_callId}
                }

                template(present) REFER_Request mw_REFER_Request(
                    template CallId p_callId,
                    template(value) SipUrl p_requestUri,
                    template(value) SipUrl p_referredBy
                ) modifies mw_REFER_Request_Base := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        referredBy := {
                            fieldName := REFERRED_BY_E,
                            nameAddr := mw_NameAddr(*, p_referredBy),  // STF471
                                                                       // {displayName
                                                                       // :=
                                                                       // *,
                                                                       // addrSpec
                                                                       // :=
                                                                       // p_referredBy},
                            referredbyIdParams := *
                        }
                    }
                }

                template(present) INVITE_Request mw_INVITE_Request(
                    template Require p_require,
                    template(value) SipUrl p_referredBy
                ) modifies mw_INVITE_Request_Base := {
                    msgHeader := {
                        require := p_require,
                        referredBy := {
                            fieldName := REFERRED_BY_E,
                            nameAddr := mw_NameAddr(*, p_referredBy),  // STF471
                                                                       // {displayName
                                                                       // :=
                                                                       // *,
                                                                       // addrSpec
                                                                       // :=
                                                                       // p_referredBy},
                            referredbyIdParams := *
                        }
                    }
                }

                template(present) REGISTER_Request mw_REGISTER_Request_Base modifies mw_REGISTER_Dummy := {requestLine := {method := REGISTER_E}}

                template(present) SUBSCRIBE_Request mw_SUBSCRIBE_Request_Base modifies mw_SUBSCRIBE_Dummy := {requestLine := {method := SUBSCRIBE_E}}

                template(present) UPDATE_Request mw_UPDATE_Request_Base(template CallId p_callId) modifies mw_UPDATE_Dummy := {msgHeader := {callId := p_callId}}


            } //*     end group request_receive

            group response_send {

                template(value) Response m_Response_Base(
                    template(value) StatusLine p_statusLine,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via
                ) modifies m_Response_Dummy := {
                    statusLine := p_statusLine,
                    msgHeader := {
                        callId := p_callId,
                        cSeq := p_cSeq,
                        fromField := p_from,
                        maxForwards := omit,
                        toField := p_to,
                        via := p_via
                    },
                    messageBody := omit,
                    payload := omit
                }


            } //*     end group response_send

            group response_receive {

                template(present) Response mw_Response_Base(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq
                ) modifies mw_Response_Dummy := {
                    statusLine := p_statusLine,
                    msgHeader := {
                        callId := p_callId,
                        contentLength := *,
                        cSeq := p_cSeq,
                        fromField := ?,
                        maxForwards := *,
                        toField := ?,
                        via := ?
                    }
                }

                template(present) Response mw_Response_StatusCode_Base(
                    template(present) StatusLine.statusCode p_statusCode := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq
                ) modifies mw_Response_Dummy := {
                    statusLine := mw_statusLine(p_statusCode, ?),
                    msgHeader := {
                        callId := p_callId,
                        contentLength := *,
                        cSeq := p_cSeq,
                        fromField := ?,
                        maxForwards := *,
                        toField := ?,
                        via := ?
                    }
                }

                template(present) Response mw_Response_1xx_Base(
                    template CallId p_callId,
                    template CSeq p_cSeq
                ) modifies mw_Response_Dummy := {
                    statusLine := mw_statusLine1xx,
                    msgHeader := {
                        callId := p_callId,
                        contentLength := *,
                        cSeq := p_cSeq,
                        fromField := ?,
                        maxForwards := *,
                        toField := ?,
                        via := ?
                    }
                }

                template(present) Response mw_Response_2xx_Base(
                    template CallId p_callId,
                    template CSeq p_cSeq
                ) modifies mw_Response_1xx_Base := {
                    statusLine := mw_statusLine2xx
                }

                template(present) Response mw_Response_3xx_Base(
                    template CallId p_callId,
                    template CSeq p_cSeq
                ) modifies mw_Response_1xx_Base := {
                    statusLine := mw_statusLine3xx
                }

                template(present) Response mw_Response_4xx_Base(
                    template CallId p_callId,
                    template CSeq p_cSeq
                ) modifies mw_Response_1xx_Base := {
                    statusLine := mw_statusLine4xx
                }

                template(present) Response mw_Response_5xx_Base(
                    template CallId p_callId,
                    template CSeq p_cSeq
                ) modifies mw_Response_1xx_Base := {
                    statusLine := mw_statusLine5xx
                }

                template(present) Response mw_Response_6xx_Base(
                    template CallId p_callId,
                    template CSeq p_cSeq
                ) modifies mw_Response_1xx_Base := {
                    statusLine := mw_statusLine6xx
                }

                template(present) Response mw_Response_Algorithm(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template(present) CredentialsList p_credentialsList
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {
                        authorization := {
                            fieldName := AUTHORIZATION_E,
                            body := p_credentialsList
                        }
                    }
                }


            } //*     end group message_receive

       
        } //*     end group full_templates

        group modified_templates {

            group request_send {

                template(value) ACK_Request m_ACK_Request_route(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) Route p_route := omit
                ) modifies m_ACK_Request_Base := {
                    msgHeader := {route := p_route}
                }

                template(value) ACK_Request m_ACK_Request_sdp(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) MessageBody p_mb
                ) modifies m_ACK_Request_Base := {
                    msgHeader := {
                        contentLength := m_contentLength(f_MessageBodyLength(p_mb)),  // STF471
                                                                                      // {fieldName
                                                                                      // :=
                                                                                      // CONTENT_LENGTH_E,
                                                                                      // len:=
                                                                                      // f_MessageBodyLength(valueof(p_mb))},
                        contentType := m_contentType(c_sdpApplication)
                    },
                    messageBody := p_mb
                }

                template(value) BYE_Request m_BYE_Request_cause(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) integer p_cause
                ) modifies m_BYE_Request_Base := {
                    msgHeader := {reason := m_Reason(p_cause)}
                }

                template(value) INVITE_Request m_INVITE_Request_sdp(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) Contact p_contact,
                    template(value) MessageBody p_mb
                ) modifies m_INVITE_Request_Base := {
                    msgHeader := {
                        contentLength := m_contentLength(f_MessageBodyLength(p_mb)),  // STF471
                                                                                      // {fieldName
                                                                                      // :=
                                                                                      // CONTENT_LENGTH_E,
                                                                                      // len:=
                                                                                      // f_MessageBodyLength(valueof(p_mb))},
                        contentType := m_contentType(c_sdpApplication)
                    },
                    messageBody := p_mb
                }

                template(value) INVITE_Request m_INVITE_Request_ResourceList(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) Contact p_contact,
                    template(value) MessageBody p_mb
                ) modifies m_INVITE_Request_Base := {
                    msgHeader := {
                        contentLength := m_contentLength(f_MessageBodyLength(p_mb)),  // STF471
                                                                                      // {fieldName
                                                                                      // :=
                                                                                      // CONTENT_LENGTH_E,
                                                                                      // len:=
                                                                                      // f_MessageBodyLength(p_mb)},
                        contentType := m_contentType(c_xmlresourcelistApplication),  // STF471
                                                                                     // {fieldName
                                                                                     // :=
                                                                                     // CONTENT_TYPE_E,
                                                                                     // mTypeSubtype
                                                                                     // :=
                                                                                     // "application/resource-lists+xml"},
                        contentDisposition := {
                            fieldName := CONTENT_DISPOSITION_E,
                            dispositionType := "recipient-list",
                            dispositionParams := omit
                        },
                        require := {
                            fieldName := REQUIRE_E,
                            optionsTags := {"recipient-list-invite"}
                        }
                    },
                    messageBody := p_mb
                }

                template(value) REFER_Request m_REFER_Request_route(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(omit) Contact p_contact := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) ReferTo p_referTo,
                    template(value) ReferredBy p_referredBy,
                    template(value) Route p_route
                ) modifies m_REFER_Request_Base := {
                    msgHeader := {route := p_route}
                }

                template(value) REGISTER_Request m_REGISTER_Request_expires(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) Contact p_contact := omit,
                    template(omit) Authorization p_authorization := omit,
                    template(value) charstring p_expires
                ) modifies m_REGISTER_Request_Base := {
                    msgHeader := {
                        authorization := p_authorization,
                        expires := m_Expires(p_expires)
                    }
                }

                template(value) NOTIFY_Request m_NOTIFY_Request_contact(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) Contact p_contact := omit
                ) modifies m_NOTIFY_Request_Base := {
                    msgHeader := {
                        contact := p_contact,
                        event := m_Event_reg,
                        subscriptionState := m_SubscriptionState_active
                    }
                }

                template(value) NOTIFY_Request m_NOTIFY_Request_sipfrag(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) charstring p_state,
                    template(value) charstring p_sipfrag
                ) modifies m_NOTIFY_Request_Base := {
                    requestLine := {
                        method := NOTIFY_E,
                        requestUri := {
                            scheme := ?,
                            components := {
                                sip := {
                                    userInfo := *,
                                    hostPort := p_requestUri.components.sip.hostPort
                                }
                            }
                        }
                    },
                    msgHeader := {
                        contentLength := m_contentLength(lengthof(p_sipfrag)),  // STF471
                                                                                // {fieldName
                                                                                // :=
                                                                                // CONTENT_LENGTH_E,
                                                                                // len:=
                                                                                // lengthof(p_sipfrag)},
                        contentType := m_contentType(c_sipfragMessage),  // STF471
                                                                         // {fieldName
                                                                         // :=
                                                                         // CONTENT_TYPE_E,
                                                                         // mTypeSubtype
                                                                         // :=
                                                                         // "message/sipfrag"},
                        subscriptionState := {
                            fieldName := SUBSCRIPTION_STATE_E,
                            subState := p_state,
                            substateParams := omit
                        },
                        event := m_Event_refer
                    },
                    messageBody := {sipfrag := p_sipfrag}
                }

                template(value) UPDATE_Request m_UPDATE_Request_route(
                    template(value) SipUrl p_requestUri,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) Contact p_contact := omit,
                    template(value) MessageBody p_mb,
                    template(value) Route p_route
                ) modifies m_UPDATE_Request_Base := {
                    msgHeader := {route := p_route}
                }


            } //*     end group request_send


            group request_receive {

                template(present) BYE_Request mw_BYE_Request_Reason(
                    template CallId p_callId,
                    template(value) GenValue p_cause
                ) modifies mw_BYE_Request_Base := {
                    msgHeader := {reason := mw_Reason(p_cause)}
                }

                template(present) BYE_Request mw_BYE_Request_ReasonSIP(
                    template CallId p_callId,
                    template(value) GenValue p_cause
                ) modifies mw_BYE_Request_Base := {
                    msgHeader := {reason := mw_ReasonSIP(p_cause)}
                }

                template(present) BYE_Request mw_BYE_Request_headerfieldlist(
                    template CallId p_callId,
                    template(present) SipUrl p_requestUri,
                    template(present) To p_to := ?,
                    template(present) From p_from := ?,
                    template CSeq p_cSeq,
                    template Route p_route,
                    template RecordRoute p_recordRoute,
                    template Reason p_reason
                ) modifies mw_BYE_Request_Base := {
                    requestLine := {requestUri := p_requestUri},
                    msgHeader := {
                        callId := p_callId,
                        toField := p_to,
                        fromField := p_from,
                        cSeq := p_cSeq,
                        route := p_route,
                        recordRoute := p_recordRoute,
                        reason := p_reason
                    }
                }

                template(present) BYE_Request mw_BYE_Request_UserToUser(
                    template CallId p_callId
                ) modifies mw_BYE_Request_Base := {
                    msgHeader := {userToUser := ?}
                }


                template(present) INVITE_Request mw_INVITE_Request_RequestURI(
                    template(present) SipUrl p_sipUrl := ?
                ) modifies mw_INVITE_Dummy := {
                    requestLine := {
                        requestUri := p_sipUrl,
                        sipVersion := c_sipNameVersion
                    }
                }

                template(present) INFO_Request mw_INFO_Request_MB(
                    template CallId p_callId,
                    template MessageBody p_mb
                ) modifies mw_INFO_Request_Base := {
                    messageBody := p_mb
                }

                template(present) INVITE_Request mw_INVITE_Request_expires modifies mw_INVITE_Request_Base := {msgHeader := {expires := ?}}

                template(present) INVITE_Request mw_INVITE_Request_callid(
                    template CallId p_callId
                ) modifies mw_INVITE_Request_Base := {
                    msgHeader := {callId := p_callId}
                }

                template(present) INVITE_Request mw_INVITE_Request_MB(
                    template CallId p_callId,
                    template MessageBody p_mb
                ) modifies mw_INVITE_Request_callid := {
                    messageBody := p_mb
                }

                template(present) INVITE_Request mw_INVITE_Request_noPaccessNetworkInfo(
                    template CallId p_callId
                ) modifies mw_INVITE_Request_callid := {
                    msgHeader := {pAccessNetworkInfo := omit}
                }

                template(present) INVITE_Request mw_INVITE_Request_PaccessNetworkInfo(
                    template CallId p_callId
                ) modifies mw_INVITE_Request_callid := {
                    msgHeader := {pAccessNetworkInfo := ?}
                }

                template(present) INVITE_Request mw_INVITE_MSRP_Session(
                    template(present) SDP_media_field p_media_MSRP := ?
                ) modifies mw_INVITE_Request_Base := {
                    messageBody := {
                        sdpMessageBody := {
                            protocol_version := ?,
                            origin := ?,
                            session_name := ?,
                            information := *,
                            uri := *,
                            emails := *,
                            phone_numbers := *,
                            connection := *,
                            bandwidth := *,
                            times := ?,
                            timezone_adjustments := *,
                            key := *,
                            attributes := *,
                            media_list := {
                                {
                                    media_field := p_media_MSRP,
                                    information := *,
                                    connections := *,
                                    bandwidth := *,
                                    key := *,
                                    attributes := {
                                        {
                                            msrp := {
                                                attr_value :=
                                                    pattern
                                                        "path:msrp://*"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                template(present) REGISTER_Request mw_REGISTER_Request_ISC(
                    template PAccessNetworkInfo p_access,
                    template PVisitedNetworkID p_visited
                ) modifies mw_REGISTER_Request_Base := {
                    msgHeader := {
                        pAccessNetworkInfo := p_access,
                        pVisitedNetworkID := p_visited
                    }
                }

                template(present) UPDATE_Request mw_UPDATE_Request_SDP(
                    template CallId p_callId,
                    template MessageBody p_mb
                ) modifies mw_UPDATE_Request_Base := {
                    messageBody := p_mb
                }

                template(present) NOTIFY_Request mw_NOTIFY_Request_MB(
                    template CallId p_callId,
                    template MessageBody p_mb
                ) modifies mw_NOTIFY_Request_Base := {
                    messageBody := p_mb
                }

           
            } //*     end group request_receive

            group response_send {

                template(value) Response m_Response_AlertInfo(
                    template(value) StatusLine p_statusLine,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) Contact p_contact,
                    template(value) AlertInfo p_alertInfo
                ) modifies m_Response_Contact := {
                    msgHeader := {alertInfo := p_alertInfo}
                }

                template(value) Response m_Response_Contact(
                    template(value) StatusLine p_statusLine,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) Contact p_contact := omit
                ) modifies m_Response_Base := {
                    msgHeader := {contact := p_contact}
                }

                template(value) Response m_Response_ext(
                    template(value) StatusLine p_statusLine,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) Route p_route := omit,
                    template(omit) RecordRoute p_recordroute := omit
                ) modifies m_Response_Base := {
                    msgHeader := {
                        route := p_route,  // f_route(),
                        recordRoute :=
                            p_recordroute // f_recordroute()
                    }
                }

                template(value) Response m_Response_mbody(
                    template(value) StatusLine p_statusLine,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) Route p_route := omit,
                    template(omit) RecordRoute p_recordroute := omit,
                    template(value) MessageBody p_mb
                ) modifies m_Response_ext := {
                    msgHeader := {
                        contentLength := m_contentLength(f_MessageBodyLength(p_mb)),  // STF471
                                                                                      // {fieldName
                                                                                      // :=
                                                                                      // CONTENT_LENGTH_E,
                                                                                      // len:=
                                                                                      // f_MessageBodyLength(valueof(p_mb))},
                        contentType := m_contentType(c_sdpApplication)
                    },
                    messageBody := p_mb
                }

                template(value) Response m_Response_mbody_contact (
                    template(value) StatusLine p_statusLine,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(omit) Route p_route := omit,
                    template(omit) RecordRoute p_recordroute := omit,
                    template(value) MessageBody p_mb,
                    template(value) Contact p_contact
                ) modifies m_Response_mbody := {
                    msgHeader := {
                        contact := p_contact
                    }
                }


                template(value) Response m_Response_PAsserted_Privacy(
                    template(value) StatusLine p_statusLine,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) Route p_route,
                    template(value) RecordRoute p_recordroute,
                    template(value) PAssertedID p_pAssertedID,
                    template(value) Privacy p_privacy
                ) modifies m_Response_ext := {
                    msgHeader := {
                        pAssertedID := p_pAssertedID,
                        privacy := p_privacy
                    }
                }

                template(present) Response mw_Response_PAsserted_Privacy_Supported(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template PAssertedID p_pAssertedID,
                    template Privacy p_privacy,
                    template Supported p_supported
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {
                        pAssertedID := p_pAssertedID,
                        privacy := p_privacy,
                        supported := p_supported
                    }
                }

                template(value) Response m_Response_PAsserted_Privacy_mbody(
                    template(value) StatusLine p_statusLine,
                    template(omit) CallId p_callId := omit,
                    template(omit) CSeq p_cSeq := omit,
                    template(value) From p_from,
                    template(value) To p_to,
                    template(value) Via p_via,
                    template(value) Route p_route,
                    template(value) RecordRoute p_recordroute,
                    template(value) PAssertedID p_pAssertedID,
                    template(value) Privacy p_privacy,
                    template(value) MessageBody p_mb
                ) modifies m_Response_ext := {
                    msgHeader := {
                        contentLength := m_contentLength(f_MessageBodyLength(p_mb)),  // STF471
                                                                                      // {fieldName
                                                                                      // :=
                                                                                      // CONTENT_LENGTH_E,
                                                                                      // len:=
                                                                                      // f_MessageBodyLength(valueof(p_mb))},
                        contentType := m_contentType(c_sdpApplication),  // STF471
                                                                         // {fieldName
                                                                         // :=
                                                                         // CONTENT_TYPE_E,
                                                                         // mTypeSubtype
                                                                         // :=
                                                                         // c_sdpApplication
                                                                         // },
                        pAssertedID := p_pAssertedID,
                        privacy := p_privacy
                    },
                    messageBody := p_mb
                }

           
            } //*     end group response_send


            group response_receive {

                template(present) Response mw_Response_Expires(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template(present) DeltaSec p_deltaSec := ?
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {expires := mw_Expires(p_deltaSec)}
                }

                template(present) Response mw_Response_PAsserted_Privacy(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template PAssertedID p_pAssertedID,
                    template Privacy p_privacy
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {
                        pAssertedID := p_pAssertedID,
                        privacy := p_privacy
                    }
                }

                template(present) Response mw_Response_Reason(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template(value) GenValue p_cause
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {reason := mw_Reason(p_cause)}
                }

                template(present) Response mw_Response_RecordRoute(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template RecordRoute p_recordRoute
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {recordRoute := p_recordRoute}
                }

                template(present) Response mw_Response_Via(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template(present) Via p_via := ?
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {via := p_via}
                }

                template(present) Response mw_Response_Contact(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template Contact p_contact
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {contact := p_contact}
                }

                template(present) Response mw_Response_AlertInfo(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template AlertInfo p_alertInfo
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {alertInfo := p_alertInfo}
                }

                template(present) Response mw_Response_HistoryInfo(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template HistoryInfo p_historyInfo
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {historyInfo := p_historyInfo}
                }

                template(present) Response mw_Response_messageBody(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template Require p_require,
                    template MessageBody p_mb
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {require := p_require},
                    messageBody := p_mb
                }

                template(present) Response mw_Response_Require(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template Require p_require
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {require := p_require}
                }

                template(present) Response mw_Response_Require_ifpresent(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template(present) Require p_require
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {require := p_require  ifpresent}
                }

                template(present) Response mw_Response_Supported(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template Supported p_supported
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {supported := p_supported}
                }

                template(present) Response mw_Response_UserToUser(
                    template(present) StatusLine p_statusLine := ?,
                    template CallId p_callId,
                    template CSeq p_cSeq
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
                    msgHeader := {userToUser := ?}
                }

           
            } //*     end group response_receive

       
        } //*     end group modified_templates

   
    } //*     end group MessageTemplates

    group SDP_Templates {

        group SDP_Messages {

            group base_templates {

                template(value) SDP_Message m_SDP_base := {
                    protocol_version := 0,  //*     v=0
                    origin := {
                        user_name := PX_SIP_SDP_USER_NAME,
                        session_id := PX_SIP_SDP_SESSION_ID,
                        session_version := "0",
                        net_type := c_in,
                        addr_type := c_ip4,
                        addr := ""
                    },
                    //*     o=voicesession 12345 12345 IN IP4 172.27.1.219
                    session_name := "Voice Session",  //*     s=Voice Session
                    information := omit,
                    uri := omit,
                    emails := omit,
                    phone_numbers := omit,
                    connection := omit,
                    bandwidth := omit,
                    times := {
                        {
                            time_field := {"0", "0"},
                            time_repeat := omit
                        }
                    },  //*     t=0 0
                    timezone_adjustments := omit,
                    key := omit,
                    attributes := omit,
                    media_list := omit
                }

                template(value) SDP_Message m_SDP(
                    template(value) SDP_media_desc p_media,
                    template(value) SipUserProfile p_userprofile
                ) modifies m_SDP_base := {
                    origin := {
                        addr := p_userprofile.contactIpaddr
                    },
                    //*     o=voicesession 12345 12345 IN IP4 172.27.1.219
                    connection := {
                        net_type := c_in,
                        addr_type := c_ip4,
                        conn_addr := {
                            addr := p_userprofile.bearerIpaddr,
                            ttl := omit,
                            num_of_addr := omit
                        }
                    },  //*     c=IN
                        //*     IP4
                        //*     172.27.1.219
                    media_list := {p_media}
                }

                template(value) SDP_Message m_SDP_mediaList(
                    template(value) SDP_media_desc_list p_media_list,
                    template(value) SipUserProfile p_userprofile
                ) modifies m_SDP_base := {
                    origin := {
                        addr := p_userprofile.contactIpaddr
                    },
                    //*     o=voicesession 12345 12345 IN IP4 172.27.1.219
                    connection := {
                        net_type := c_in,
                        addr_type := c_ip4,
                        conn_addr := {
                            addr := p_userprofile.bearerIpaddr,
                            ttl := omit,
                            num_of_addr := omit
                        }
                    },  //*     c=IN
                        //*     IP4
                        //*     172.27.1.219
                    media_list := p_media_list
                }

                template(value) SDP_Message m_SDP_media_attr_preconditions(
                    template(value) SDP_media_desc p_media,
                    template(value) SipUserProfile p_userprofile,
                    template(value) SDP_attribute_list p_attribute_list
                ) modifies m_SDP := {
                    media_list := {
                        {
                            media_field := {
                                media := c_audio,
                                ports := {
                                    port_number := 8500,
                                    num_of_ports := omit
                                },
                                transport := c_rtpAvp,
                                fmts := {"0"}
                            },  //*     m=audio
                                //*     8500
                                //*     RTP/AVP
                                //*     0
                            information := omit,
                            connections := omit,
                            bandwidth := omit,
                            key := omit,
                            attributes := p_attribute_list
                        }
                    }
                }

                template(value) SDP_Message m_SDP_attribute(
                    template(value) SDP_media_desc p_media,
                    template(value) SipUserProfile p_userprofile,
                    template(value) SDP_attribute p_loc_attribute
                ) modifies m_SDP := {
                    attributes := {p_loc_attribute}
                }

                template(present) SDP_Message mw_SDP := {
                    protocol_version := 0,  //*     v=0
                    origin := ?,
                    session_name := ?,
                    information := omit,
                    uri := omit,
                    emails := omit,
                    phone_numbers := omit,
                    connection := ?,
                    bandwidth := omit,
                    times := {
                        {
                            time_field := {"0", "0"},
                            time_repeat := omit
                        }
                    },  //*     t=0 0
                    timezone_adjustments := omit,
                    key := omit,
                    attributes := omit,
                    media_list := ?
                }


            } //*     end group base_templates

            group modified_templates {
                template(value) SDP_Message m_SDP_bandwidth(
                    template(value) SDP_media_desc p_media,
                    template(value) SipUserProfile p_userprofile
                ) modifies m_SDP := {
                    bandwidth := {
                        {
                            PX_SIP_SDP_B_MODIFIER,
                            PX_SIP_SDP_B_BANDWIDTH
                        }
                    }
                }

                template(value) SDP_Message m_SDP_unacceptable(
                    template(value) SDP_media_desc p_media,
                    template(value) SipUserProfile p_userprofile
                ) modifies m_SDP := {
                    protocol_version := 1,  //*     v=1 unacceptable version of
                                            //*     SDP
                    bandwidth := {
                        {
                            PX_SIP_SDP_B_MODIFIER,
                            PX_SIP_SDP_B_BANDWIDTH
                        }
                    }
                }

                template(value) SDP_Message m_SDP_encrypted(
                    template(value) SDP_media_desc p_media,
                    template(value) SipUserProfile p_userprofile
                ) modifies m_SDP := {
                    bandwidth := {
                        {
                            PX_SIP_SDP_B_MODIFIER,
                            PX_SIP_SDP_B_BANDWIDTH
                        }
                    },
                    key := {
                        method := "base64",  // prompt
                        key := "blablabla"
                    }
                }

           
            } //*     end group modified_templates

       
        } //*     end group SDP_Messages

        group SDP_Fields {

            template(value) SDP_media_desc m_media(template(value) SDP_media_field p_mf) := {
                media_field := p_mf,
                information := omit,
                connections := omit,
                bandwidth := omit,
                key := omit,
                attributes := omit
            }

            template(value) SDP_media_desc m_mediaFieldBandwdthAttributes(
                template(value) SDP_media_field p_mf,
                template(omit) SDP_bandwidth_list p_bw_l := omit,
                template(omit) SDP_attribute_list p_attributes := omit
            ) := {
                media_field := p_mf,
                information := omit,
                connections := omit,
                bandwidth := p_bw_l,
                key := omit,
                attributes := p_attributes
            }

            template(value) SDP_media_desc m_media_dynPT(
                template(value) charstring p_payloadType,
                template(value) charstring p_encoding,
                template(value) charstring p_clockrate,
                template(omit) charstring p_parameters := omit,
                template(omit) SDP_key p_sdpKey := omit
            ) := {
                media_field := {
                    media := c_audio,  //*     "audio",
                    ports := {
                        port_number := 8500,
                        num_of_ports := omit
                    },
                    transport := c_rtpAvp,  //*     "RTP/AVP",
                    fmts := { p_payloadType }
                },  //*     m=audio 8500 RTP/AVP 8
                information := omit,
                connections := omit,
                bandwidth := omit,
                key := p_sdpKey,
                attributes := {{rtpmap := {
                        payload_type := p_payloadType,
                        codec := {
                            encoding := p_encoding,
                            clockrate := p_clockrate,
                            parameters := p_parameters
                        }
                    }
                }} //*     a=rtpmap:8 PCMA/8000
            }

            /**
             * @desc send template with specific media transport and attribute values
             * @param p_mediaAttribute parameter for SDP media transport supported by the IUT
             *        former PX_SIP_SDP_media_transport
             * @param p_mediaAttribute parameter for SDP media attribute supported by the IUT,
             *        former PX_SIP_SDP_media_attribute_Exp & PX_SIP_SDP_media_transport_Exp
             * @param p_mTypeSubtype parameter for SDP media type supported by the IUT,
             *        former PX_SIP_SDP_MEDIA_VIDEO
             */

            template(value) SDP_media_desc m_media_unsupported(
                template(value) charstring p_mediaTransport,
                template(value) SDP_attribute_rtpmap p_mediaAttribute,
                template(value) charstring p_mTypeSubtype := "video"
            ) := {
                media_field := {
                    media := p_mTypeSubtype,
                    ports := {
                        port_number := 11500,
                        num_of_ports := omit
                    },
                    transport := p_mediaTransport,
                    fmts := {"99"}
                },  //*     m=audio 8500 RTP/AVP 0
                information := omit,
                connections := omit,
                bandwidth := omit,
                key := omit,
                attributes := {{rtpmap := p_mediaAttribute}}
            }

            template(value) SDP_bandwidth m_bandwidth(
                template(value) charstring p_loc_m,
                template(value) integer p_loc_b
            ) := {
                modifier := p_loc_m,
                bandwidth := p_loc_b
            }

            template(value) SDP_bandwidth m_bandwidth_as_64 := {
                modifier := "AS",
                bandwidth := 64
            }

            template(present) SDP_bandwidth mw_bandwidth_rs := {
                modifier := "RS",
                bandwidth := ?
            }

            template(present) SDP_bandwidth mw_bandwidth_rr := {
                modifier := "RR",
                bandwidth := ?
            }

            template(value) SDP_media_field m_media_field(
                template(value) charstring p_media,
                template(value) integer p_portNum,
                template(value) charstring p_transport,
                template(value) charstring p_fmts
            ) := {
                media := p_media,
                ports := {
                    port_number := p_portNum,
                    num_of_ports := omit
                },
                transport := p_transport,
                fmts := {p_fmts}
            }

            template(present) SDP_media_field mw_media_PCMU := {
                media := c_audio,
                ports := {
                    port_number := ?,
                    num_of_ports := *
                },
                transport := c_rtpAvp,
                fmts := {"0"}
            }

            template(present) SDP_media_field mw_media_PCMA := {
                media := c_audio,
                ports := {
                    port_number := 8500,
                    num_of_ports := omit
                },
                transport := c_rtpAvp,
                fmts := {"8"}
            }

            template(present) SDP_media_field mw_media_PCMA_U_DPT := {
                media := c_audio,
                ports := {
                    port_number := ?,
                    num_of_ports := *
                },
                transport := c_rtpAvp,
                fmts := {*}
            }

            template(present) SDP_media_field mw_media_T38 := {
                media := c_image,
                ports := {
                    port_number := ?,
                    num_of_ports := *
                },
                transport := pattern "*ptl",  //*     udptl,tcptl
                fmts := {"t38"}
            }

            template(present) SDP_media_field mw_media_G722 := {
                media := c_audio,
                ports := {
                    port_number := ?,
                    num_of_ports := *
                },
                transport := "RTP/AVP",
                fmts := {"9"}
            }

            template(present) SDP_media_field mw_media_AMR_DPT := {
                media := c_audio,
                ports := {
                    port_number := ?,
                    num_of_ports := *
                },
                transport := c_rtpAvp,
                fmts := {*}
            }

            template(present) SDP_media_field mw_media_MSRP := {
                media := c_msrp,
                ports := {
                    port_number := ?,
                    num_of_ports := omit
                },
                transport := c_msrpTcp,
                fmts := {*}
            }

            template(value) SDP_attribute m_attribute_sendonly := {sendonly := {}}
            template(present) SDP_attribute mw_attribute_sendonly := {sendonly := {}}
            // MRO
            template(value) SDP_attribute m_attribute_recvonly := {recvonly := {}}
            template(present) SDP_attribute mw_attribute_recvonly := {recvonly := {}}
            // MRO
            template(value) SDP_attribute m_attribute_sendrecv := {sendrecv := {}}
            template(present) SDP_attribute mw_attribute_sendrecv := {sendrecv := {}}
            // MRO
            template(value) SDP_attribute m_attribute_inactive := {inactive := {}}
            template(present) SDP_attribute mw_attribute_inactive := {inactive := {}}
            // MRO
            template(present) SDP_attribute mw_attribute_sendonly_inactive := (mw_attribute_sendonly, mw_attribute_inactive);
            template SDP_attribute mw_attribute_sendrecv_recvonly_omit := (mw_attribute_sendrecv, mw_attribute_recvonly, omit);
            template(value) SDP_attribute m_attribute_base(
                template(value) SDP_attribute_rtpmap p_attr_value
            ) := {
                rtpmap := p_attr_value
            }
            /**
             * @desc send template for a specific media attribute
             * @param attribte value, former PX_SIP_SDP_DYN & " " & PX_SIP_SDP_MEDIA_TRANSPORT_AMR
             */

            template(value) SDP_attribute m_attribute_AMR_DPT(//"0 AMR"
                template(value) SDP_attribute_rtpmap p_attr_value := {"0", {"AMR", "8000", omit}}
            ) := m_attribute_base(p_attr_value);
            /**
             * @desc send template for a specific media attribute
             * @param attribte value, former PX_SIP_SDP_DYN & " " & PX_SIP_SDP_MEDIA_TRANSPORT_CLE
             */

            template(value) SDP_attribute m_attribute_CLEARMODE_DPT(//"0 CLEARMODE/8000"
                template(value) SDP_attribute_rtpmap p_attr_value := {"0", {"CLEARMODE", "8000", omit}}
            ) := m_attribute_base(p_attr_value);
            /**
             * @desc send template for a specific media attribute
             * @param attribte value, former PX_SIP_SDP_ENCODING_ATTRIBUTE_G222
             */

            template(value) SDP_attribute m_attribute_G722(//"9 G722/8000"
                template(value) SDP_attribute_rtpmap p_attr_value := {"9", {"G722", "8000", omit}}
            ) := m_attribute_base(p_attr_value);
            /**
             * @desc send template for a specific media attribute
             * @param attribte value, former PX_SIP_SDP_ENCODING_ATTRIBUTE_PCMU
             */

            template(value) SDP_attribute m_attribute_PCMU(//"0 PCMU/8000"
                template(value) SDP_attribute_rtpmap p_attr_value := {"0", {"PCMU", "8000", omit}}
            ) := m_attribute_base(p_attr_value);
            /**
             * @desc send template for a specific media attribute
             * @param attribte value, former PX_SIP_SDP_DYN & " " & PX_SIP_SDP_MEDIA_TRANSPORT_PCMU
             */

            template(value) SDP_attribute m_attribute_PCMU_DPT(//"0 PCMU/8000"
                template(value) SDP_attribute_rtpmap p_attr_value := {"0", {"PCMU", "8000", omit}}
            ) := m_attribute_base(p_attr_value);
            /**
             * @desc send template for a specific media attribute
             * @param attribte value, former PX_SIP_SDP_ENCODING_ATTRIBUTE_PCMA
             */

            template(value) SDP_attribute m_attribute_PCMA(//"8 PCMA/8000"
                template(value) SDP_attribute_rtpmap p_attr_value := {"8", {"PCMA", "8000", omit}}
            ) := m_attribute_base(p_attr_value);
            /**
             * @desc send template for a specific media attribute
             * @param attribte value, former PX_SIP_SDP_DYN & " " & PX_SIP_SDP_MEDIA_TRANSPORT_PCMA
             */

            template(value) SDP_attribute m_attribute_PCMA_DPT(//"0 PCMA/8000"
                template(value) SDP_attribute_rtpmap p_attr_value := {"0", {"PCMA", "8000", omit}}
            ) := m_attribute_base(p_attr_value);

            template(present) SDP_attribute mw_attribute_T38 := {
                unknown := {
                    name := ?,
                    attr_value := pattern "*t38*"
                }
            }

            template(value) SDP_attribute m_attribute_curr(
                template(value) charstring p_preconditionType,
                template(value) charstring p_statusType,
                template(value) charstring p_direction
            ) := {
                curr := {
                    preconditionType := p_preconditionType,
                    statusType := p_statusType,
                    direction := p_direction
                }
            }

            template(present) SDP_attribute mw_attribute_curr := {curr := ?}

            template(value) SDP_attribute m_attribute_des(
                template(value) charstring p_preconditionType,
                template(value) charstring p_strength,
                template(value) charstring p_statusType,
                template(value) charstring p_direction
            ) := {
                des := {
                    preconditionType := p_preconditionType,
                    strength := p_strength,
                    statusType := p_statusType,
                    direction := p_direction
                }
            }

            template(present) SDP_attribute mw_attribute_des := {des := ?}

            template(value) SDP_attribute m_attribute_conf(
                template(value) charstring p_preconditionType,
                template(value) charstring p_statusType,
                template(value) charstring p_direction
            ) := {
                conf := {
                    preconditionType := p_preconditionType,
                    statusType := p_statusType,
                    direction := p_direction
                }
            }

       
        } //*     end group SDP_Fields

   
    } //*     end group SDP_Templates

    group SimpleMsgSummary_Templates {

        template(value) SimpleMsgSummary m_SMS(
            template(value) Msg_summary_line_list p_summaryLineList,
            template(value) charstring p_uri
        ) := {
            msg_status_line := m_msgStatusLine_yes,
            msg_account := m_msgAccount(p_uri),
            msg_summary_line_list := p_summaryLineList,
            opt_msg_headers := omit
        }

        template(present) SimpleMsgSummary mw_SMS := {
            msg_status_line := ?,
            msg_account := *,
            msg_summary_line_list := *,
            opt_msg_headers := *
        }

        template(present) SimpleMsgSummary mw_SMS_yes modifies mw_SMS := {
            msg_status_line := mw_msgStatusLine_yes
        }

        template(present) SimpleMsgSummary mw_SMS_yesUri modifies mw_SMS_yes := {
            msg_account := mw_msgAccount
        }

        template(present) SimpleMsgSummary mw_SMS_yesVoice modifies mw_SMS_yes := {
            msg_summary_line_list := {mw_msgSummaryLine(c_voiceMessage)}
        }

        template(present) SimpleMsgSummary mw_SMS_yesUriVoice modifies mw_SMS_yesUri := {
            msg_summary_line_list := {mw_msgSummaryLine(c_voiceMessage)}
        }

        template(value) Msg_status_line m_msgStatusLine_yes := {
            msg_type := c_messageWaiting,
            msg_status := "yes"
        }

        template(present) Msg_status_line mw_msgStatusLine_yes := {
            msg_type := c_messageWaiting,
            msg_status := "yes"
        }

        template(value) Msg_account m_msgAccount(
            template(value) charstring p_uri
        ) := {
            msg_type_account := c_messageAccount,
            account_URI :=
                p_uri // m_SipUrl_NumberHostParam(PX_IMS_SUT_UE2_PUBLIC_USER,PX_IMS_SUT_UE2_HOME_DOMAIN,omit)
        }

        template(present) Msg_account mw_msgAccount := {
            msg_type_account := c_messageAccount,
            account_URI := ?
        }

        template(value) Msg_summary_line m_msgSummaryLine(
            template(value) charstring p_msgContexClass,
            template(value) charstring p_msgs,
            template(value) charstring p_urgent_msgs
        ) := {
            msg_context_class := p_msgContexClass,
            msgs := p_msgs,
            urgent_msgs := p_urgent_msgs
        }

        template(present) Msg_summary_line mw_msgSummaryLine(
            template(present) charstring p_msgContexClass := ?
        ) := {
            msg_context_class := p_msgContexClass,
            msgs := ?,
            urgent_msgs := *
        }


    } // end group Templates_SMS

    group MessageBodies {

        template(value) MessageBody m_MBody_SDP(
            template(value) SDP_Message p_SDP
        ) := {
            sdpMessageBody := p_SDP
        }

        template(value) MessageBody m_MBody_XML(
            template(value) XmlBody p_xmlBody
        ) := {
            xmlBody := p_xmlBody
        }

        template(value) MessageBody m_mBody_SMS(
            template(value) SimpleMsgSummary p_SMS
        ) := {
            simpleMsgSummary := p_SMS
        }

        template(value) MessageBody m_MBody_longPlainText := {textplain := c_longMessageContent_1300Bytes}

        template(value) MessageBody m_mBody_plainText(
            template(value) charstring p_plaitext
        ) := {
            textplain := p_plaitext
        }

        template(value) MessageBody m_MBody_sipfrag(
            template(value) charstring p_sipfrag
        ) := {
            sipfrag := p_sipfrag
        }

        template(value) MessageBody m_MBody_MIMESdpXml(
            template(value) SDP_Message p_sdp,
            template(value) XmlBody p_xmlBody
        ) := {
            mimeMessageBody := {
                boundary := "--" & PX_SIP_MIME_BOUNDARY,
                mimeEncapsulatedList := {
                    {
                        content_type := c_sdpApplication,
                        content_disposition := omit,
                        mime_encapsulated_part := {sdpMessageBody := p_sdp}
                    },
                    {
                        content_type := c_ims3gppCwApplication,
                        content_disposition := omit,
                        mime_encapsulated_part := {xmlBody := p_xmlBody}
                    }
                }
            }
        }

        template(value) MessageBody m_MBody_MIMESdpEncrypted(
            template(value) SDP_Message p_sdp
        ) := {
            mimeMessageBody := {
                boundary := "--" & PX_SIP_MIME_BOUNDARY,
                mimeEncapsulatedList := {
                    {
                        content_type := "application/sdp",
                        content_disposition := "attachment;handling=required;filename=smime.p7",
                        mime_encapsulated_part := {sdpMessageBody := p_sdp}
                    }
                }
            }
        }

        template(present) MessageBody mw_MBody_SDP(
            template(present) SDP_Message p_SDP := ?
        ) := {
            sdpMessageBody := p_SDP
        }

        template(present) MessageBody mw_MBody_XML(
            template(present) XmlBody p_xmlBody := ?
        ) := {
            xmlBody := p_xmlBody
        }

        template(present) MessageBody mw_mBody_SMS(
            template(present) SimpleMsgSummary p_SMS := ?
        ) := {
            simpleMsgSummary := p_SMS
        }

        template(present) MessageBody mw_MBody_MIMESdpXml(
            template(present) SDP_Message p_sdp := ?,
            template(present) XmlBody p_xmlBody := ?
        ) := {
            mimeMessageBody := {
                boundary := ?,
                mimeEncapsulatedList := {
                    {
                        content_type := ?,
                        content_disposition := *,
                        mime_encapsulated_part := {sdpMessageBody := p_sdp}
                    },
                    {
                        content_type := ?,
                        content_disposition := *,
                        mime_encapsulated_part := {xmlBody := p_xmlBody}
                    }
                }
            }
        }

        template(present) MessageBody mw_MBody_MIME_Ims3gpp(
            template charstring p_disposition,
            template(present) Ims_3gpp p_ims3gpp := ?
        ) := {
            mimeMessageBody := {
                boundary := ?,
                mimeEncapsulatedList := {
                    *,
                    {
                        content_type := c_ims3gppApplication,
                        content_disposition := p_disposition,
                        mime_encapsulated_part := {xmlBody := {ims3gpp := p_ims3gpp}}
                    },
                    *
                }
            }
        }

        template(present) MessageBody mw_MBody_MIME_Ims3gppCW(
            template charstring p_disposition,
            template(present) Ims_3gpp p_ims3gpp := ?
        ) := {
            mimeMessageBody := {
                boundary := ?,
                mimeEncapsulatedList := {
                    *,
                    {
                        content_type := c_ims3gppCwApplication,
                        content_disposition := p_disposition,
                        mime_encapsulated_part := {xmlBody := {ims3gpp := p_ims3gpp}}
                    },
                    *
                }
            }
        }

    }
    /*
     *
     * @desc group TemplatePreparationFunctions contain functions which are used for templates
     */

    group TemplatePreparationFunctions {

        group MessageBody_Calculation {

            /**
             * @desc Calculation of Message Body length
             * @param p_mb_par contain message body part
             * @return message body length
             */

            function f_MessageBodyLength(
                template(value) MessageBody p_mb_par
            ) return integer  {

                var integer v_result := 0;
                if (PX_MB_LENGTH_FROM_ENCVAL) {
                    // by default it is set to true
                    // in case the codec encodes the variant selector, this
                    // needs to be changed to ischosen...
                    v_result := lengthof(encvalue(p_mb_par)) / 8; // length
                                                                  // in
                                                                  // bytes,
                                                                  // let get
                                                                  // length
                                                                  // of
                                                                  // encoded
                                                                  // value
                }
                else {

                    // assume SDP_Message ONLY in the message body
                    if (ischosen(p_mb_par.sdpMessageBody)) {
                        v_result := f_SDPlength(valueof(p_mb_par.sdpMessageBody));
                    }

                    // assume XML_Body ONLY in the message body
                    if (ischosen(p_mb_par.xmlBody)) {
                        v_result := f_XMLBody_Length(valueof(p_mb_par.xmlBody), PX_USE_FX_FOR_XML_LENGTH);
                    }

                    // assume simpleMsgSummary_Body ONLY in the message body
                    if (ischosen(p_mb_par.simpleMsgSummary)) {
                        v_result := f_simpleMsgSummaryBody_Length(valueof(p_mb_par.simpleMsgSummary));
                    }

                    // assume MIME_Message in the message body
                    if (ischosen(p_mb_par.mimeMessageBody)) {
                        v_result := f_MIMElength(valueof(p_mb_par.mimeMessageBody));
                    }

                    // assume sipfrag in the message body
                    if (ischosen(p_mb_par.sipfrag)) {
                        v_result := f_TextPlainLength(p_mb_par); // same
                                                                 // function
                                                                 // due to
                                                                 // same
                                                                 // type
                                                                 // with
                                                                 // textplain
                    }

                    // assume textplain in the message body
                    if (ischosen(p_mb_par.textplain)) {
                        v_result := f_TextPlainLength(p_mb_par);
                    }
                }

                return v_result;
            }


            group SDP_Len_calculation {
                /**
                 * @desc Calculation of SDP length
                 * @param p_mb contain sdp message
                 * @return sdp_lenght
                 */

                function f_SDPlength(
                    SDP_Message p_mb
                ) return integer  {
                    var integer i, j, k, v_len_con0, v_len_con1, v_len_con2, v_len_attr;
                    var integer v_result := 2;
                    //*     due to empty line beginning of message body
                    var charstring v_auxstring;

                    v_result := 2 + c_CRlen + lengthof(int2str(p_mb.protocol_version)); //*     "v="
                    v_auxstring := p_mb.origin.user_name & " " & p_mb.origin.session_id & " " & p_mb.origin.session_version & " " & p_mb.origin.net_type & " " & p_mb.origin.addr_type & " " & p_mb.origin.addr;
                    v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring); //*     "o="
                    v_result := v_result + 2 + c_CRlen + lengthof(p_mb.session_name); //*     "s="
                    if (isvalue(p_mb.information)) {
                        v_auxstring := valueof(p_mb.information);
                        v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring);
                    } //*     "i= "
                    if (isvalue(p_mb.uri)) {
                        v_auxstring := valueof(p_mb.uri);
                        v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring);
                    } //*     "u="
                    if (isvalue(p_mb.emails)) {
                        for (i := 0; i < lengthof(p_mb.emails); i := i + 1) {
                            v_result := v_result + 2 + c_CRlen + lengthof(p_mb.emails[i].addr_or_phone); //*     "e="
                            if (isvalue(p_mb.emails[i].disp_name)) {
                                v_auxstring := valueof(p_mb.emails[i].disp_name);
                                v_result := v_result + 1 + lengthof(v_auxstring);
                            }
                        }
                    }

                    if (isvalue(p_mb.phone_numbers)) {
                        for (i := 0; i < lengthof(p_mb.phone_numbers); i := i + 1) {
                            v_result := v_result + 2 + c_CRlen + lengthof(p_mb.phone_numbers[i].addr_or_phone); //*     "p=
                                                                                                                //*     "
                            if (isvalue(p_mb.phone_numbers[i].disp_name)) {
                                v_auxstring := valueof(p_mb.phone_numbers[i].disp_name);
                                v_result := v_result + 1 + lengthof(v_auxstring);
                            }
                        }
                    }

                    if (isvalue(p_mb.connection)) {
                        v_len_con0 := f_SDPlength_connection(valueof(p_mb.connection));
                        v_result := v_result + v_len_con0;
                    } //*     "c="
                    if (isvalue(p_mb.bandwidth)) {
                        for (i := 0; i < lengthof(p_mb.bandwidth); i := i + 1) {
                            //*     "b= "
                            v_auxstring := p_mb.bandwidth[i].modifier & " ";
                            v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring) + lengthof(int2str(p_mb.bandwidth[i].bandwidth));
                        }
                    }

                    for (i := 0; i < lengthof(p_mb.times); i := i + 1) {
                        v_auxstring := p_mb.times[i].time_field.start_time & " " & p_mb.times[i].time_field.stop_time;
                        v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring); //*     "t="
                        if (isvalue(p_mb.times[i].time_repeat)) {
                            for (j := 0; j < lengthof(p_mb.times[i].time_repeat); j := j + 1) {
                                v_result := v_result + 2 + c_CRlen + lengthof(int2str(p_mb.times[i].time_repeat[j].repeat_interval.time)); //*     "r="
                                if (isvalue(p_mb.times[i].time_repeat[j].repeat_interval.unit)) {
                                    v_auxstring := valueof(p_mb.times[i].time_repeat[j].repeat_interval.unit);
                                    v_result := v_result + 1 + lengthof(v_auxstring);
                                }

                                v_result := v_result + 1 + lengthof(int2str(p_mb.times[i].time_repeat[j].active.time));
                                if (isvalue(p_mb.times[i].time_repeat[j].active.unit)) {
                                    v_auxstring := valueof(p_mb.times[i].time_repeat[j].active.unit);
                                    v_result := v_result + 1 + lengthof(v_auxstring);
                                }

                                for (k := 0; k < lengthof(p_mb.times[i].time_repeat[j].offsets); k := k + 1) {
                                    v_result := v_result + 1 + lengthof(int2str(p_mb.times[i].time_repeat[j].offsets[k].time));
                                    if (isvalue(p_mb.times[i].time_repeat[j].offsets[k].unit)) {
                                        v_auxstring := valueof(p_mb.times[i].time_repeat[j].offsets[k].unit);
                                        v_result := v_result + 1 + lengthof(v_auxstring);
                                    }
                                }
                            }
                        }
                    }

                    if (isvalue(p_mb.timezone_adjustments)) {
                        log("*** " & __SCOPE__ & ": INFO: timezone adjustments have not been considered in SDP length calculation yet ***");
                    } //*     "z="
                    if (isvalue(p_mb.key)) {
                        v_result := v_result + 2 + c_CRlen + lengthof(p_mb.key.method); //*     "k=
                                                                                        //*     "
                        if (isvalue(p_mb.key.key)) {
                            v_auxstring := valueof(p_mb.key.key);
                            v_result := v_result + 1 + lengthof(v_auxstring);
                        }
                    }
                    if (isvalue(p_mb.attributes)) {
                        for (i := 0; i < lengthof(p_mb.attributes); i := i + 1) {


                            //*     "a= "
                            v_len_con1 := f_SDPlength_attribute(p_mb.attributes[i]);
                            v_result := v_result + v_len_con1;
                        }
                    } //*     "a="
                    if (isvalue(p_mb.media_list)) {
                        for (i := 0; i < lengthof(p_mb.media_list); i := i + 1) {
                            //*     "m= "
                            //*     for each media_field
                            //*     log("p_mb.media_list[i ] ",p_mb.media_list[i
                            //*     ] );
                            v_result := v_result + 2 + c_CRlen + lengthof(p_mb.media_list[i].media_field.media) + 1 + lengthof(int2str(p_mb.media_list[i].media_field.ports.port_number));


                            if (isvalue(p_mb.media_list[i].media_field.ports.num_of_ports)) {
                                v_result := v_result + 1 + lengthof(int2str(valueof(p_mb.media_list[i].media_field.ports.num_of_ports)));
                            }
                            v_result := v_result + 1 + lengthof(p_mb.media_list[i].media_field.transport);
                            for (j := 0; j < lengthof(p_mb.media_list[i].media_field.fmts); j := j + 1) {
                                v_result := v_result + 1 + lengthof(p_mb.media_list[i].media_field.fmts[j]);
                            }

                            if (isvalue(p_mb.media_list[i].information)) {
                                v_auxstring := valueof(p_mb.media_list[i].information);
                                v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring); //*     "i= "
                            }
                            if (isvalue(p_mb.media_list[i].connections)) {
                                for (j := 0; j < lengthof(p_mb.media_list[i].connections); j := j + 1) {
                                    v_len_con2 := f_SDPlength_connection(p_mb.media_list[i].connections[j]);
                                    v_result := v_result + v_len_con2;
                                } //*     end for
                            }
                            if (isvalue(p_mb.media_list[i].bandwidth)) {
                                //*     "b= "
                                for (j := 0; j < lengthof(p_mb.media_list[i].bandwidth); j := j + 1) {
                                    v_result := v_result + 2 + c_CRlen + lengthof(p_mb.media_list[i].bandwidth[j].modifier) + 1 + lengthof(int2str(p_mb.media_list[i].bandwidth[j].bandwidth));
                                } //*     end for
                            }
                            if (isvalue(p_mb.media_list[i].key)) {
                                //*     "k= "
                                v_result := v_result + 1 + lengthof(p_mb.media_list[i].key.method);
                                if (isvalue(p_mb.media_list[i].key.key)) {
                                    v_auxstring := valueof(p_mb.media_list[i].key.key);
                                    v_result := v_result + 1 + lengthof(v_auxstring);
                                }
                            }
                            if (isvalue(p_mb.media_list[i].attributes)) {
                                for (j := 0; j < lengthof(p_mb.media_list[i].attributes); j := j + 1) {

                                    //*     "a= "
                                    v_len_attr := f_SDPlength_attribute(p_mb.media_list[i].attributes[j]);
                                    v_result := v_result + v_len_attr;
                                } //*     end for j
                            }
                        } //*     end for i
                    } //*     end if media_list
                    return v_result;
                }
                //*     end function f_SDPlength
                function f_SDPlength_connection(
                    SDP_connection p_element
                ) return integer  {
                //*     "c="
                    var integer v_result := 0;
                    v_result := v_result + 2 + c_CRlen + lengthof(p_element.net_type & " " & p_element.addr_type & " " & p_element.conn_addr.addr);
                    if (isvalue(p_element.conn_addr.ttl) and p_element.conn_addr.ttl > 0) {
                        v_result := v_result + 1 + lengthof(int2str(valueof(p_element.conn_addr.ttl)));
                    }
                    if (isvalue(p_element.conn_addr.num_of_addr) and p_element.conn_addr.num_of_addr > 0) {
                        v_result := v_result + 1 + lengthof(int2str(valueof(p_element.conn_addr.num_of_addr)));
                    }
                    return v_result;
                } //*     f_SDPlength_connection

                function f_SDPlength_attribute(
                    SDP_attribute p_element
                ) return integer  {
                //*     "a="
                    var integer v_result := 0;
                    if (ischosen(p_element.cat)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("cat:" & p_element.cat.attr_value);
                    }
                    if (ischosen(p_element.keywds)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("keywds:" & p_element.keywds.attr_value);
                    }
                    if (ischosen(p_element.tool)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("tool:" & p_element.tool.attr_value);
                    }
                    if (ischosen(p_element.ptime)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("ptime:" & p_element.ptime.attr_value);
                    }
                    if (ischosen(p_element.recvonly)) {
                        v_result := v_result + c_CRlen + lengthof("recvonly");
                    }
                    if (ischosen(p_element.sendrecv)) {
                        v_result := v_result + c_CRlen + lengthof("sendrecv");
                    }
                    if (ischosen(p_element.sendonly)) {
                        v_result := v_result + c_CRlen + lengthof("sendonly");
                    }
                    if (ischosen(p_element.inactive)) {
                        v_result := v_result + c_CRlen + lengthof("inactive");
                    }
                    if (ischosen(p_element.orient)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("orient:" & p_element.orient.attr_value);
                    }
                    if (ischosen(p_element.sdp_type)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("type:" & p_element.sdp_type.attr_value);
                    }
                    if (ischosen(p_element.charset)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("charset" & p_element.charset.attr_value);
                    }
                    if (ischosen(p_element.sdplang)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("sdplang:" & p_element.sdplang.attr_value);
                    }
                    if (ischosen(p_element.lang)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("lang:" & p_element.lang.attr_value);
                    }
                    if (ischosen(p_element.framerate)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("framerate:" & p_element.framerate.attr_value);
                    }
                    if (ischosen(p_element.quality)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("quality:" & p_element.quality.attr_value);
                    }
                    if (ischosen(p_element.fmtp)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("fmtp:" & p_element.fmtp.format & " " & f_fmtpparams_to_charstring(p_element.fmtp.params));
                    }
                    if (ischosen(p_element.curr)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("curr:" & p_element.curr.preconditionType & " " & p_element.curr.statusType & " " & p_element.curr.direction);
                    }
                    if (ischosen(p_element.des)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("des:" & p_element.des.preconditionType & " " & p_element.des.strength & " " & p_element.des.statusType & " " & p_element.des.direction);
                    }
                    if (ischosen(p_element.conf)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("conf:" & p_element.conf.preconditionType & " " & p_element.conf.statusType & " " & p_element.conf.direction);
                    }
                    if (ischosen(p_element.rtpmap)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("rtpmap:" & f_rtpmap_to_charstring(p_element.rtpmap));
                    }
                    if (ischosen(p_element.rtcp)) {
                        v_result := v_result + 2 + c_CRlen + lengthof("rtcp:" & f_rtcp_to_charstring(p_element.rtcp));
                    }
                    if (ischosen(p_element.unknown)) {
                        v_result := v_result + 2 + c_CRlen + lengthof(p_element.unknown.name);
                        if (isvalue(p_element.unknown.attr_value)) {
                            v_result := v_result + lengthof(":" & p_element.unknown.attr_value);
                        }
                    }
                    //*     log("axr: length attribute=", v_result);
                    return v_result;
                } //*     f_SDPlength_attribute

                function f_fmtpparams_to_charstring(
                    SDP_attribute_fmtp_format_specific_params p_params
                ) return charstring  {
                    var charstring v_result := "";
                    if(ischosen(p_params.unstructured)){
                        v_result := p_params.unstructured;
                    }
                    else
                    {
                        for(var integer v_idx := 0; v_idx < lengthof(p_params.paramList); v_idx := v_idx + 1) {
                            if(v_idx != 0)
                            {
                                v_result := v_result & "; "
                            }
                            v_result := v_result & p_params.paramList[v_idx].id;
                            if(ispresent(p_params.paramList[v_idx].paramValue)){
                                if(ischosen(p_params.paramList[v_idx].paramValue.tokenOrHost))
                                {
                                    v_result := v_result & "=" & p_params.paramList[v_idx].paramValue.tokenOrHost;
                                }
                                else
                                {
                                    v_result := v_result & "=""" & p_params.paramList[v_idx].paramValue.quotedString & """";
                                }
                            }
                        }
                    }
                    return v_result;
                }

                function f_rtpmap_to_charstring(
                    SDP_attribute_rtpmap p_rtpmap
                ) return charstring  {
                    var charstring v_result := "";
                    v_result := p_rtpmap.payload_type & " " & p_rtpmap.codec.encoding & "/" & p_rtpmap.codec.clockrate;
                    if(ispresent(p_rtpmap.codec.parameters))
                    {
                        v_result := v_result & "/" & p_rtpmap.codec.parameters;
                    }
                    return v_result;
                }

                function f_rtcp_to_charstring(
                    SDP_attribute_rtcp p_rtcp
                ) return charstring  {
                    var charstring v_result := int2str(p_rtcp.portnumber);
                    if(ispresent(p_rtcp.connection))
                    {
                        v_result := v_result & " " & p_rtcp.connection.net_type & " " & p_rtcp.connection.addr_type & " " & p_rtcp.connection.conn_addr.addr;
                        if(ispresent(p_rtcp.connection.conn_addr.ttl))
                        {
                            v_result := v_result & "/" & int2str(p_rtcp.connection.conn_addr.ttl);
                            if(ispresent(p_rtcp.connection.conn_addr.num_of_addr))
                            {
                                v_result := v_result & "/" & int2str(p_rtcp.connection.conn_addr.num_of_addr);
                            }
                        }
                    }
                    return v_result;
                }

            } //*     group SDPlen_calculation

            group XML_Len_calculation {

                /**
                 * @desc Declaration of external functions to calculate length of message bodies switching of internal or external functions are made by boolean module parameter/PIXIT USE_FX_FOR_XML_LENGTH declared at top of this module
                 */

                external function fx_calculateXMLBodyLen(
                    XmlBody p_mb
                ) return integer;

                /**
                 * @desc Calculation of XML body length
                 * @param p_mb contain XML body
                 * @return xml_length
                 */

                function f_XMLBody_Length(
                    XmlBody p_mb,
                    boolean p_ext_func
                ) return integer  {
                    var integer v_result := 0;

                    if (p_ext_func) {
                        v_result := fx_calculateXMLBodyLen(p_mb);
                    }
                    else {
                        // assume ConferenceInfo ONLY in the XML message
                        // body
                        if (ischosen(p_mb.conference)) {
                            v_result := f_XMLBody_ConferenceInfo_Length(p_mb.conference);
                        }

                        // assume CUG ONLY in the XML message body
                        if (ischosen(p_mb.cug)) {
                            v_result := f_XMLBody_Cug_Length(p_mb.cug);
                        }

                        // assume MCID ONLY in the XML message body
                        if (ischosen(p_mb.mcid)) {
                            v_result := f_XMLBody_Mcid_Length(p_mb.mcid);
                        }

                        // assume CW ONLY in the XML message body
                        if (ischosen(p_mb.cw)) {
                            v_result := f_XMLBody_Cw_Length(p_mb.cw);
                        }

                        // assume CDIV ONLY in the XML message body
                        if (ischosen(p_mb.cdivn)) {
                            v_result := f_XMLBody_Cdivn_Length(p_mb.cdivn);
                        }

                        // assume PSTNTransit ONLY in the XML message body
                        if (ischosen(p_mb.pstnTransit)) {
                            v_result := f_XMLBody_PSTNTransit_Length(p_mb.pstnTransit);
                        }

                        // assume Simservs ONLY in the XML message body
                        if (ischosen(p_mb.simservs)) {
                            v_result := f_XMLBody_Simservs_Length(p_mb.simservs);
                        }

                        // assume ResourceLists ONLY in the XML message body
                        if (ischosen(p_mb.resourceLists)) {
                            v_result := f_XMLBody_ResourceList_Length(p_mb.resourceLists);
                        }

                        // assume Ims3GPP ONLY in the XML message body
                        if (ischosen(p_mb.ims3gpp)) {
                            v_result := f_XMLBody_Ims3GPP_Length(p_mb.ims3gpp);
                        }
                        /**
                         *     Add aditional checks regarding to new variants, also implement appropriate function for calculation
                         */

                    }
                    return v_result;
                } //*     f_XMLBodyLength

                group XMLBodies_calculation {

                    /**
                     * @desc Calculation of XML ConferenceInfo element length
                     * @param p_mb contain XML ConfInfo body
                     * @return xml_length
                     */

                    function f_XMLBody_ConferenceInfo_Length(
                        template(value) Conference_type p_mb
                    ) return integer  {
                        var integer v_result := lengthof(encvalue(p_mb)) / 8;
                        return v_result;
                    } //*     f_XMLBody_ConferenceInfo_Length

                    /**
                     * @desc Calculation of XML CUG element length
                     * @param p_mb contain XML CUG body
                     * @return xml_length
                     */

                    function f_XMLBody_Cug_Length(
                        template(value) Cug p_mb
                    ) return integer  {
                        var integer v_result := lengthof(encvalue(p_mb)) / 8;
                        return v_result;
                    } //*     f_XMLBody_Cug_Length

                    /**
                     * @desc Calculation of XML MCID element length
                     * @param p_mb contain XML MCID body
                     * @return xml_length
                     */

                    function f_XMLBody_Mcid_Length(
                        template(value) Mcid p_mb
                    ) return integer  {
                        var integer v_result := lengthof(encvalue(p_mb)) / 8;

                        return v_result;
                    } //*     f_XMLBody_Mcid_Length

                    /**
                     * @desc Calculation of XML CW element length
                     * @param p_mb contain XML CW body
                     * @return xml_length
                     */

                    function f_XMLBody_Cw_Length(
                        template(value) Ims_cw p_mb
                    ) return integer  {
                        var integer v_result := lengthof(encvalue(p_mb)) / 8;

                        return v_result;
                    } //*     f_XMLBody_Cw_Length

                    /**
                     * @desc Calculation of XML CDIVN element length
                     * @param p_mb contain XML CDIVN body
                     * @return xml_length
                     */

                    function f_XMLBody_Cdivn_Length(
                        template(value) Comm_div_info_type p_mb
                    ) return integer  {
                        var integer v_result := lengthof(encvalue(p_mb)) / 8;

                        return v_result;
                    } //*     f_XMLBody_Cdivn_Length

                    /**
                     * @desc Calculation of XML PSTNTransit element length
                     * @param p_mb contain XML PSTNTransit body
                     * @return xml_length
                     */

                    function f_XMLBody_PSTNTransit_Length(
                        template(value) PSTN_transit p_mb
                    ) return integer  {
                        var integer v_result := lengthof(encvalue(p_mb)) / 8;
                        return v_result;
                    } //*     f_XMLBody_PSTNTransit_Length

                    /**
                     * @desc Calculation of XML Simservs element length
                     * @param p_mb contain XML Simservs body
                     * @return xml_length
                     */

                    function f_XMLBody_Simservs_Length(
                        template(value) Simservs p_mb
                    ) return integer  {
                        var integer v_result := lengthof(encvalue(p_mb)) / 8;
                        return v_result;
                    } //*     f_XMLBody_Simservs_Length

                    /**
                     * @desc Calculation of XML ResourceList length
                     * @param p_mb contain XML ResourceList body
                     * @return xml_length
                     */

                    function f_XMLBody_ResourceList_Length(
                        template(value) Resource_lists p_mb
                    ) return integer  {
                        var integer v_result := lengthof(encvalue(p_mb)) / 8;
                        return v_result;
                    } //*     f_XMLBody_ResourceList_Length

                    /**
                     * @desc Calculation of XML Ims3GPP length
                     * @param p_mb contain XML Ims3GPP body
                     * @return xml_length
                     */

                    function f_XMLBody_Ims3GPP_Length(
                        template(value) TIMS3GPP p_mb
                    ) return integer  {
                        var integer v_result := lengthof(encvalue(p_mb)) / 8;
                        return v_result;
                    } //*     f_XMLBody_Ims3GPP_Length


                } //*     XMLBodies_calculation


            } //*     group XMLlen_calculation

            group simpleMsgSummaryBody_Length {

                function f_simpleMsgSummaryBody_Length(
                    SimpleMsgSummary p_mb
                ) return integer  {
                    var integer i;
                    var integer v_result := 2;


                    //*     due to empty line beginning of message body
                    var charstring v_auxstring;

                    v_result := 2 + lengthof(p_mb.msg_status_line.msg_type) + 2 + lengthof(p_mb.msg_status_line.msg_status) + c_CRlen; //*     "Message-Waiting:
                                                                                                                                       //*     yes"
                    if (isvalue(p_mb.msg_account))
                    //*     "Message-Account"
                    {
                        v_result := v_result + 2 + lengthof(p_mb.msg_account.msg_type_account) + 2 + lengthof(p_mb.msg_account.account_URI) + c_CRlen;
                    }
                    if (isvalue(p_mb.msg_summary_line_list)) {
                        for (i := 0; i < lengthof(p_mb.msg_summary_line_list); i := i + 1) {
                            v_result := v_result + 2 + c_CRlen + lengthof(p_mb.msg_summary_line_list[i].msg_context_class) + 2 + lengthof(p_mb.msg_summary_line_list[i].msgs);
                            if (isvalue(p_mb.msg_summary_line_list[i].urgent_msgs)) {
                                v_auxstring := valueof(p_mb.msg_summary_line_list[i].urgent_msgs);
                                v_result := v_result + 1 + lengthof(v_auxstring);
                            }
                        }
                    }
                    if (isvalue(p_mb.opt_msg_headers)) {
                        for (i := 0; i < lengthof(p_mb.opt_msg_headers); i := i + 1) {
                            v_result := v_result + 2 + c_CRlen + lengthof(p_mb.opt_msg_headers[i]);
                        }
                    }
                    return v_result;
                }
            }

            group MIME_Len_calculation {
                /**
                 * @desc Calculation of MIME length
                 * @param p_mb contain MIME message
                 * @return xml_length
                 */

                function f_MIMElength(
                    MIME_Message p_mb
                ) return integer  {
                    var integer i;
                    var integer v_result := 2;
                    // 0d0a
                    v_result := v_result + lengthof(p_mb.boundary) + 2 /*0d0a*/;

                    for (i := 0; i < lengthof(p_mb.mimeEncapsulatedList); i := i + 1) {

                        v_result := v_result + lengthof("Content-Type: ") + lengthof(p_mb.mimeEncapsulatedList[i].content_type) + 2 /*0d0a*/;

                        if (isvalue(p_mb.mimeEncapsulatedList[i].content_disposition)) {
                            v_result := v_result + lengthof("Content-Disposition: ") + lengthof(p_mb.mimeEncapsulatedList[i].content_disposition) + 2 /*0d0a*/;
                        }

                        // v_result := v_result +2/*0d0a*/; ??? to check
                        // assume SDP_Message ONLY in the message body
                        if (ischosen(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.sdpMessageBody)) {
                            v_result := v_result + f_SDPlength(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.sdpMessageBody);
                        }

                        // assume XML_Body ONLY in the message body
                        if (ischosen(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlBody)) {
                            v_result := v_result + f_XMLBody_Length(p_mb.mimeEncapsulatedList[i].mime_encapsulated_part.xmlBody, PX_USE_FX_FOR_XML_LENGTH);
                        }
                    // //assume XML_Message ONLY in the message body
                    // if (ischosen(p_mb.mimeEncapsulatedList[i ]
                    // .mime_encapsulated_part.xmlMessage))
                    // {
                    // v_result := v_result +
                    // f_XMLlength(p_mb.mimeEncapsulatedList[i ]
                    // .mime_encapsulated_part.xmlMessage,
                    // USE_FX_FOR_XML_LENGTH );
                    // };
                    // v_result := v_result +2/*0d0a*/; ??? to check
                    }

                    // v_result := v_result +2/*0d0a*/; ??? to check
                    return v_result;
                } //*     f_MIMElength


            } //*     group MIMElen_calculation

            group TextPlain_Len_calculation {
                /**
                 * @desc Calculation of messagebody-textplain type length
                 * @param p_mb contain textplain message
                 * @return lenght
                 */

                function f_TextPlainLength(
                    template(value) MessageBody p_mb
                ) return integer  {
                    var integer v_result := 0;

                    v_result := v_result + lengthof(p_mb.textplain);

                    return v_result;
                } //*     end function f_TextPlainLength

           
            } //*     end group TextPlainLen_calculation

       
        } //*     group MessageBody_Calculation


        group GiveHeaders {
            /**
             * @desc Return component variable of recordRoute header if vc_boo_recordRoute is true
             * @return component variable of recordRoute header
             */

            function f_recordroute(
            ) runs on SipComponent
            return template(omit) RecordRoute {
                var template(omit) RecordRoute v_recordRoute := omit;
                if (vc_boo_recordRoute) {
                    return vc_recordRoute;
                }
                else {
                    return (v_recordRoute);
                }
            }

            /**
             * @desc Return component variable of Route header if vc_boo_route is true
             * @return component variable of recordRoute header
             */

            function f_route(
            ) runs on SipComponent
            return template(omit) Route  {
                var template(omit) Route v_route := omit;
                if (vc_boo_route) {
                    return vc_route;
                }
                else {
                    return (v_route);
                }
            }

       
        } //*     end group GiveHeaders

        group others {

            /*
             *
             * @desc function combines two comma parameter lists
             * @param p_list1 first list
             * @param p_list2 second list
             * @return comma parameter list that contains parameters from both input lists
             * @verdict
             */

            function f_merge_CommaParam_List(
                template(value) CommaParam_List p_list1,
                template(value) CommaParam_List p_list2
            ) return template(value) CommaParam_List  {
                var template(value) CommaParam_List p_result;
                var integer i, v_limit1 := lengthof(p_list1);
                for (i := 0; i < v_limit1; i := i + 1) {
                    p_result[i] := p_list1[i];
                }
                for (i := 0; i < lengthof(p_list2); i := i + 1) {
                    p_result[i + v_limit1] := p_list2[i];
                }
                return p_result;
            }

           
        } //*     end group others

       
    } //*     group TemplatePreparationFunctions
} //*     end module LibSip_Templates