LibSip_Templates.ttcn 196 KB
Newer Older
tepelmann's avatar
tepelmann committed
                template(present) Response mw_Response_Expires(
                    template(present) StatusLine p_statusLine := ?,
tepelmann's avatar
tepelmann committed
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template(present) DeltaSec p_deltaSec := ?
tepelmann's avatar
tepelmann committed
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
garciay's avatar
garciay committed
                    msgHeader := {expires := mw_Expires(p_deltaSec)}
                }

tepelmann's avatar
tepelmann committed
                template(present) Response mw_Response_PAsserted_Privacy(
                    template(present) StatusLine p_statusLine := ?,
tepelmann's avatar
tepelmann committed
                    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, ?),
tepelmann's avatar
tepelmann committed
                    msgHeader := {
                        pAssertedID := p_pAssertedID,
                        privacy := p_privacy
                    }
tepelmann's avatar
tepelmann committed
                template(present) Response mw_Response_Reason(
                    template(present) StatusLine p_statusLine := ?,
tepelmann's avatar
tepelmann committed
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template(value) GenValue p_cause
tepelmann's avatar
tepelmann committed
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
garciay's avatar
garciay committed
                    msgHeader := {reason := mw_Reason(p_cause)}
                }

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

tepelmann's avatar
tepelmann committed
                template(present) Response mw_Response_Via(
                    template(present) StatusLine p_statusLine := ?,
tepelmann's avatar
tepelmann committed
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template(present) Via p_via := ?
tepelmann's avatar
tepelmann committed
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
tepelmann's avatar
tepelmann committed
                    msgHeader := {via := p_via}
tepelmann's avatar
tepelmann committed
                template(present) Response mw_Response_Contact(
                    template(present) StatusLine p_statusLine := ?,
tepelmann's avatar
tepelmann committed
                    template CallId p_callId,
                    template CSeq p_cSeq,
                    template Contact p_contact
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
garciay's avatar
garciay committed
                    msgHeader := {contact := p_contact}
                }

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

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

tepelmann's avatar
tepelmann committed
                template(present) Response mw_Response_messageBody(
                    template(present) StatusLine p_statusLine := ?,
tepelmann's avatar
tepelmann committed
                    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, ?),
garciay's avatar
garciay committed
                    msgHeader := {require := p_require},
                    messageBody := p_mb
                }

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

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

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

tepelmann's avatar
tepelmann committed
                template(present) Response mw_Response_UserToUser(
                    template(present) StatusLine p_statusLine := ?,
tepelmann's avatar
tepelmann committed
                    template CallId p_callId,
                    template CSeq p_cSeq
                ) modifies mw_Response_Base := {
                    statusLine := mw_statusLine(p_statusLine.statusCode, ?),
tepelmann's avatar
tepelmann committed
                    msgHeader := {userToUser := ?}
tepelmann's avatar
tepelmann committed
            } //*     end group response_receive

tepelmann's avatar
tepelmann committed
        } //*     end group modified_templates
tepelmann's avatar
tepelmann committed
    } //*     end group MessageTemplates
garciay's avatar
garciay committed

    group SDP_Templates {

        group SDP_Messages {

            group base_templates {

                template(value) SDP_Message m_SDP_base := {
garciay's avatar
garciay committed
                    protocol_version := 0,  //*     v=0
                    origin := {
                        user_name := PX_SIP_SDP_USER_NAME,
                        session_id := PX_SIP_SDP_SESSION_ID,
garciay's avatar
garciay committed
                        session_version := "0",
                        net_type := c_in,
                        addr_type := c_ip4,
garciay's avatar
garciay committed
                    },
                    //*     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
tepelmann's avatar
tepelmann committed
                    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
garciay's avatar
garciay committed
                    media_list := {p_media}
                }

tepelmann's avatar
tepelmann committed
                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 := {
garciay's avatar
garciay committed
                    origin := {
                        addr := p_userprofile.contactIpaddr
                    },
                    //*     o=voicesession 12345 12345 IN IP4 172.27.1.219
tepelmann's avatar
tepelmann committed
                    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
garciay's avatar
garciay committed
                    media_list := p_media_list
                }

tepelmann's avatar
tepelmann committed
                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 := {
garciay's avatar
garciay committed
                    media_list := {
                        {
tepelmann's avatar
tepelmann committed
                            media_field := {
                                media := c_audio,
                                ports := {
                                    port_number := 8500,
                                    num_of_ports := omit
                                },
                                transport := c_rtpAvp,
                                fmts := {"0"}
                            },  //*     m=audio
                                //*     8500
                                //*     RTP/AVP
                                //*     0
garciay's avatar
garciay committed
                            information := omit,
                            connections := omit,
                            bandwidth := omit,
                            key := omit,
                            attributes := p_attribute_list
                        }
                    }
                }

tepelmann's avatar
tepelmann committed
                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
tepelmann's avatar
tepelmann committed
                ) modifies m_SDP := {
                    attributes := {p_loc_attribute}
garciay's avatar
garciay committed
                }

                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,
tepelmann's avatar
tepelmann committed
                    times := {
                        {
                            time_field := {"0", "0"},
                            time_repeat := omit
                        }
                    },  //*     t=0 0
garciay's avatar
garciay committed
                    timezone_adjustments := omit,
                    key := omit,
                    attributes := omit,
                    media_list := ?
                }


tepelmann's avatar
tepelmann committed
            } //*     end group base_templates
garciay's avatar
garciay committed

            group modified_templates {
tepelmann's avatar
tepelmann committed
                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
tepelmann's avatar
tepelmann committed
                        }
                    }
tepelmann's avatar
tepelmann committed
                template(value) SDP_Message m_SDP_unacceptable(
                    template(value) SDP_media_desc p_media,
                    template(value) SipUserProfile p_userprofile
                ) modifies m_SDP := {
garciay's avatar
garciay committed
                    protocol_version := 1,  //*     v=1 unacceptable version of
                                            //*     SDP
tepelmann's avatar
tepelmann committed
                    bandwidth := {
                        {
                            PX_SIP_SDP_B_MODIFIER,
                            PX_SIP_SDP_B_BANDWIDTH
tepelmann's avatar
tepelmann committed
                        }
                    }
tepelmann's avatar
tepelmann committed
                template(value) SDP_Message m_SDP_encrypted(
                    template(value) SDP_media_desc p_media,
                    template(value) SipUserProfile p_userprofile
garciay's avatar
garciay committed
                ) modifies m_SDP := {
                    bandwidth := {
tepelmann's avatar
tepelmann committed
                        {
                            PX_SIP_SDP_B_MODIFIER,
                            PX_SIP_SDP_B_BANDWIDTH
tepelmann's avatar
tepelmann committed
                        }
garciay's avatar
garciay committed
                    },
                    key := {
tepelmann's avatar
tepelmann committed
                        method := "base64",  // prompt
garciay's avatar
garciay committed
                        key := "blablabla"
                    }
tepelmann's avatar
tepelmann committed
            } //*     end group modified_templates
tepelmann's avatar
tepelmann committed
        } //*     end group SDP_Messages
garciay's avatar
garciay committed

        group SDP_Fields {

            template(value) SDP_media_desc m_media(template(value) SDP_media_field p_mf) := {
tepelmann's avatar
tepelmann committed
                media_field := p_mf,
                information := omit,
                connections := omit,
                bandwidth := omit,
                key := omit,
                attributes := omit
tepelmann's avatar
tepelmann committed
            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
tepelmann's avatar
tepelmann committed
            ) := {
                media_field := p_mf,
                information := omit,
                connections := omit,
                bandwidth := p_bw_l,
                key := omit,
                attributes := p_attributes
tepelmann's avatar
tepelmann committed
            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,
tepelmann's avatar
tepelmann committed
                template(omit) SDP_key p_sdpKey := omit
garciay's avatar
garciay committed
            ) := {
garciay's avatar
garciay committed
                media_field := {
                    media := c_audio,  //*     "audio",
tepelmann's avatar
tepelmann committed
                    ports := {
                        port_number := 8500,
garciay's avatar
garciay committed
                        num_of_ports := omit
                    },
garciay's avatar
garciay committed
                    transport := c_rtpAvp,  //*     "RTP/AVP",
                    fmts := { p_payloadType }
garciay's avatar
garciay committed
                },  //*     m=audio 8500 RTP/AVP 8
                information := omit,
                connections := omit,
                bandwidth := omit,
garciay's avatar
garciay committed
                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"
garciay's avatar
garciay committed
                media_field := {
                    media := p_mTypeSubtype,
garciay's avatar
garciay committed
                    ports := {
tepelmann's avatar
tepelmann committed
                        port_number := 11500,
garciay's avatar
garciay committed
                        num_of_ports := omit
                    },
                    transport := p_mediaTransport,
tepelmann's avatar
tepelmann committed
                    fmts := {"99"}
garciay's avatar
garciay committed
                },  //*     m=audio 8500 RTP/AVP 0
                information := omit,
                connections := omit,
                bandwidth := omit,
                key := omit,
                attributes := {{rtpmap := p_mediaAttribute}}
tepelmann's avatar
tepelmann committed
            template(value) SDP_bandwidth m_bandwidth(
                template(value) charstring p_loc_m,
                template(value) integer p_loc_b
tepelmann's avatar
tepelmann committed
            ) := {
                modifier := p_loc_m,
                bandwidth := p_loc_b
tepelmann's avatar
tepelmann committed
            template(value) SDP_bandwidth m_bandwidth_as_64 := {
                modifier := "AS",
                bandwidth := 64
            }
tepelmann's avatar
tepelmann committed
            template(present) SDP_bandwidth mw_bandwidth_rs := {
                modifier := "RS",
                bandwidth := ?
            }
tepelmann's avatar
tepelmann committed
            template(present) SDP_bandwidth mw_bandwidth_rr := {
                modifier := "RR",
                bandwidth := ?
            }
tepelmann's avatar
tepelmann committed
            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}
garciay's avatar
garciay committed
            }

            template(present) SDP_media_field mw_media_PCMU := {
tepelmann's avatar
tepelmann committed
                media := c_audio,
                ports := {
                    port_number := ?,
                    num_of_ports := *
                },
                transport := c_rtpAvp,
                fmts := {"0"}
garciay's avatar
garciay committed
            }

            template(present) SDP_media_field mw_media_PCMA := {
tepelmann's avatar
tepelmann committed
                media := c_audio,
                ports := {
                    port_number := 8500,
                    num_of_ports := omit
                },
                transport := c_rtpAvp,
                fmts := {"8"}
garciay's avatar
garciay committed
            }

            template(present) SDP_media_field mw_media_PCMA_U_DPT := {
tepelmann's avatar
tepelmann committed
                media := c_audio,
                ports := {
                    port_number := ?,
                    num_of_ports := *
                },
                transport := c_rtpAvp,
                fmts := {*}
garciay's avatar
garciay committed
            }

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

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

            template(present) SDP_media_field mw_media_AMR_DPT := {
tepelmann's avatar
tepelmann committed
                media := c_audio,
                ports := {
                    port_number := ?,
                    num_of_ports := *
                },
                transport := c_rtpAvp,
                fmts := {*}
garciay's avatar
garciay committed
            }

            template(present) SDP_media_field mw_media_MSRP := {
tepelmann's avatar
tepelmann committed
                media := c_msrp,
                ports := {
                    port_number := ?,
                    num_of_ports := omit
                },
                transport := c_msrpTcp,
                fmts := {*}
garciay's avatar
garciay committed
            }

            template(value) SDP_attribute m_attribute_sendonly := {sendonly := {}}
            template(present) SDP_attribute mw_attribute_sendonly := {sendonly := {}}
tepelmann's avatar
tepelmann committed
            // MRO
garciay's avatar
garciay committed
            template(value) SDP_attribute m_attribute_recvonly := {recvonly := {}}
            template(present) SDP_attribute mw_attribute_recvonly := {recvonly := {}}
tepelmann's avatar
tepelmann committed
            // MRO
garciay's avatar
garciay committed
            template(value) SDP_attribute m_attribute_sendrecv := {sendrecv := {}}
            template(present) SDP_attribute mw_attribute_sendrecv := {sendrecv := {}}
tepelmann's avatar
tepelmann committed
            // MRO
garciay's avatar
garciay committed
            template(value) SDP_attribute m_attribute_inactive := {inactive := {}}
            template(present) SDP_attribute mw_attribute_inactive := {inactive := {}}
tepelmann's avatar
tepelmann committed
            // MRO
garciay's avatar
garciay committed
            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);
nikolajev's avatar
nikolajev committed

tepelmann's avatar
tepelmann committed
            template(present) SDP_attribute mw_attribute_T38 := {
                unknown := {
                    name := ?,
                    attr_value := pattern "*t38*"
                }
            }
tepelmann's avatar
tepelmann committed
            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
                }
garciay's avatar
garciay committed
            }

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

tepelmann's avatar
tepelmann committed
            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
                }
garciay's avatar
garciay committed
            }

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

tepelmann's avatar
tepelmann committed
            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
                }
tepelmann's avatar
tepelmann committed
        } //*     end group SDP_Fields
tepelmann's avatar
tepelmann committed
    } //*     end group SDP_Templates
garciay's avatar
garciay committed

    group SimpleMsgSummary_Templates {

tepelmann's avatar
tepelmann committed
        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
tepelmann's avatar
tepelmann committed
        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)}
tepelmann's avatar
tepelmann committed
        template(value) Msg_status_line m_msgStatusLine_yes := {
            msg_type := c_messageWaiting,
            msg_status := "yes"
        }
tepelmann's avatar
tepelmann committed
        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
        ) := {
garciay's avatar
garciay committed
            msg_type_account := c_messageAccount,
            account_URI :=
tepelmann's avatar
tepelmann committed
                p_uri // m_SipUrl_NumberHostParam(PX_IMS_SUT_UE2_PUBLIC_USER,PX_IMS_SUT_UE2_HOME_DOMAIN,omit)
tepelmann's avatar
tepelmann committed
        template(present) Msg_account mw_msgAccount := {
            msg_type_account := c_messageAccount,
            account_URI := ?
        }
tepelmann's avatar
tepelmann committed
        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 := ?
        ) := {
tepelmann's avatar
tepelmann committed
            msg_context_class := p_msgContexClass,
            msgs := ?,
            urgent_msgs := *
tepelmann's avatar
tepelmann committed
    } // end group Templates_SMS
garciay's avatar
garciay committed

    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
        }
garciay's avatar
garciay committed

        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
        }
tepelmann's avatar
tepelmann committed
        template(value) MessageBody m_MBody_MIMESdpXml(
            template(value) SDP_Message p_sdp,
            template(value) XmlBody p_xmlBody
        ) := {
garciay's avatar
garciay committed
            mimeMessageBody := {
                boundary := "--" & PX_SIP_MIME_BOUNDARY,
garciay's avatar
garciay committed
                mimeEncapsulatedList := {
                    {
                        content_type := c_sdpApplication,
garciay's avatar
garciay committed
                        content_disposition := omit,
Rennoch's avatar
Rennoch committed
						content_id := omit,
garciay's avatar
garciay committed
                        mime_encapsulated_part := {sdpMessageBody := p_sdp}
                    },
                    {
                        content_type := c_ims3gppCwApplication,
garciay's avatar
garciay committed
                        content_disposition := omit,
Rennoch's avatar
Rennoch committed
                        content_id := omit,
garciay's avatar
garciay committed
                        mime_encapsulated_part := {xmlBody := p_xmlBody}
                    }
                }
            }
        }

        template(value) MessageBody m_MBody_MIMESdpEncrypted(
            template(value) SDP_Message p_sdp
        ) := {
tepelmann's avatar
tepelmann committed
            mimeMessageBody := {
                boundary := "--" & PX_SIP_MIME_BOUNDARY,
tepelmann's avatar
tepelmann committed
                mimeEncapsulatedList := {
garciay's avatar
garciay committed
                    {
                        content_type := "application/sdp",
rennoch's avatar
rennoch committed
                        content_disposition := "attachment;handling=required;filename=smime.p7",
Rennoch's avatar
Rennoch committed
                        content_id := omit,
tepelmann's avatar
tepelmann committed
                        mime_encapsulated_part := {sdpMessageBody := p_sdp}
tepelmann's avatar
tepelmann committed

        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
        }
tepelmann's avatar
tepelmann committed
        template(present) MessageBody mw_MBody_MIMESdpXml(
            template(present) SDP_Message p_sdp := ?,
            template(present) XmlBody p_xmlBody := ?
tepelmann's avatar
tepelmann committed
        ) := {
garciay's avatar
garciay committed
            mimeMessageBody := {
                boundary := ?,
                mimeEncapsulatedList := {
tepelmann's avatar
tepelmann committed
                    {
                        content_type := ?,
                        content_disposition := *,
Rennoch's avatar
Rennoch committed
						content_id := *,
tepelmann's avatar
tepelmann committed
                        mime_encapsulated_part := {sdpMessageBody := p_sdp}
                    },
                    {
                        content_type := ?,
                        content_disposition := *,
Rennoch's avatar
Rennoch committed
                        content_id := *,
tepelmann's avatar
tepelmann committed
                        mime_encapsulated_part := {xmlBody := p_xmlBody}
                    }
tepelmann's avatar
tepelmann committed
        template(present) MessageBody mw_MBody_MIME_Ims3gpp(
            template charstring p_disposition,
            template(present) Ims_3gpp p_ims3gpp := ?
tepelmann's avatar
tepelmann committed
        ) := {
garciay's avatar
garciay committed
            mimeMessageBody := {
                boundary := ?,
                mimeEncapsulatedList := {
                    *,
                    {
                        content_type := c_ims3gppApplication,
                        content_disposition := p_disposition,
Rennoch's avatar
Rennoch committed
						content_id := *,
garciay's avatar
garciay committed
                        mime_encapsulated_part := {xmlBody := {ims3gpp := p_ims3gpp}}
                    },
                    *
                }
            }
        }

tepelmann's avatar
tepelmann committed
        template(present) MessageBody mw_MBody_MIME_Ims3gppCW(
            template charstring p_disposition,
            template(present) Ims_3gpp p_ims3gpp := ?
tepelmann's avatar
tepelmann committed
        ) := {
garciay's avatar
garciay committed
            mimeMessageBody := {
                boundary := ?,
                mimeEncapsulatedList := {
                    *,
                    {
                        content_type := c_ims3gppCwApplication,
                        content_disposition := p_disposition,
Rennoch's avatar
Rennoch committed
                        content_id := *,
garciay's avatar
garciay committed
                        mime_encapsulated_part := {xmlBody := {ims3gpp := p_ims3gpp}}
                    },
                    *
                }
            }
        }

    }
    /*
     *
     * @desc group TemplatePreparationFunctions contain functions which are used for templates
     */
garciay's avatar
garciay committed
    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  {
garciay's avatar
garciay committed

                var integer v_result := 0;
                if (PX_MB_LENGTH_FROM_ENCVAL) {
tepelmann's avatar
tepelmann committed
                    // 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
garciay's avatar
garciay committed
                    if (ischosen(p_mb_par.sdpMessageBody)) {
                        v_result := f_SDPlength(valueof(p_mb_par.sdpMessageBody));
                    }

tepelmann's avatar
tepelmann committed
                    // assume XML_Body ONLY in the message body
garciay's avatar
garciay committed
                    if (ischosen(p_mb_par.xmlBody)) {
                        v_result := f_XMLBody_Length(valueof(p_mb_par.xmlBody), PX_USE_FX_FOR_XML_LENGTH);
tepelmann's avatar
tepelmann committed
                    // assume simpleMsgSummary_Body ONLY in the message body
garciay's avatar
garciay committed
                    if (ischosen(p_mb_par.simpleMsgSummary)) {
                        v_result := f_simpleMsgSummaryBody_Length(valueof(p_mb_par.simpleMsgSummary));
                    }

tepelmann's avatar
tepelmann committed
                    // assume MIME_Message in the message body
garciay's avatar
garciay committed
                    if (ischosen(p_mb_par.mimeMessageBody)) {
                        v_result := f_MIMElength(valueof(p_mb_par.mimeMessageBody));
                    }

tepelmann's avatar
tepelmann committed
                    // assume sipfrag in the message body
garciay's avatar
garciay committed
                    if (ischosen(p_mb_par.sipfrag)) {
tepelmann's avatar
tepelmann committed
                        v_result := f_TextPlainLength(p_mb_par); // same
                                                                 // function
                                                                 // due to
                                                                 // same
                                                                 // type
                                                                 // with
                                                                 // textplain
tepelmann's avatar
tepelmann committed
                    // assume textplain in the message body
garciay's avatar
garciay committed
                    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;
garciay's avatar
garciay committed
                    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="
tepelmann's avatar
tepelmann committed
                    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;
garciay's avatar
garciay committed
                    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);
garciay's avatar
garciay committed
                        v_result := v_result + 2 + c_CRlen + lengthof(v_auxstring);
                    } //*     "i= "
                    if (isvalue(p_mb.uri)) {
                        v_auxstring := valueof(p_mb.uri);
garciay's avatar
garciay committed
                        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) {
garciay's avatar
garciay committed
                            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);
garciay's avatar
garciay committed
                                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) {
garciay's avatar
garciay committed
                            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);