LibSip_Templates.ttcn 190 KB
Newer Older
garciay's avatar
garciay committed
            } //* end of group message_send
garciay's avatar
garciay committed

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



garciay's avatar
garciay committed
            } //* end group request_receive
garciay's avatar
garciay committed

            group response_send {

                template(value) Response m_Response_Base(template(value) StatusLine p_statusLine, template(omit) CallId p_callId, template(omit) CSeq p_cSeq,
                                                         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
                }


garciay's avatar
garciay committed
            } //* end group response_send
garciay's avatar
garciay committed

            group response_receive {

garciay's avatar
garciay committed
                template(present) Response mw_Response_Base(
                                                            template(present) StatusLine p_statusLine, 
                                                            template CallId p_callId, 
                                                            template CSeq p_cSeq
                ) modifies mw_Response_Dummy := {
garciay's avatar
garciay committed
                    statusLine := p_statusLine,
garciay's avatar
garciay committed
                    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 := {
                        sipVersion := c_sipNameVersion, 
                        statusCode := p_statusCode, 
                        reasonPhrase := ?
                    },
                    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 := {
                        sipVersion := c_sipNameVersion, 
                        statusCode := (100..199), 
                        reasonPhrase := ?
                    },
                    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
tepelmann's avatar
tepelmann committed
                ) modifies mw_Response_1xx_Base := {
                    statusLine := {
                        sipVersion := c_sipNameVersion, 
                        statusCode := (200..299), 
                        reasonPhrase := ?
                    }
                }

                template(present) Response mw_Response_3xx_Base(
                                                            template CallId p_callId, 
                                                            template CSeq p_cSeq
tepelmann's avatar
tepelmann committed
                ) modifies mw_Response_1xx_Base := {
                    statusLine := {
                        sipVersion := c_sipNameVersion, 
                        statusCode := (300..399), 
                        reasonPhrase := ?
                    }
                }

                template(present) Response mw_Response_4xx_Base(
                                                            template CallId p_callId, 
                                                            template CSeq p_cSeq
tepelmann's avatar
tepelmann committed
                ) modifies mw_Response_1xx_Base := {
                    statusLine := {
                        sipVersion := c_sipNameVersion, 
                        statusCode := (400..499), 
                        reasonPhrase := ?
                    }
                }

                template(present) Response mw_Response_5xx_Base(
                                                            template CallId p_callId, 
                                                            template CSeq p_cSeq
tepelmann's avatar
tepelmann committed
                ) modifies mw_Response_1xx_Base := {
                    statusLine := {
                        sipVersion := c_sipNameVersion, 
                        statusCode := (500..599), 
                        reasonPhrase := ?
                    }
                }

                template(present) Response mw_Response_6xx_Base(
                                                            template CallId p_callId, 
                                                            template CSeq p_cSeq
tepelmann's avatar
tepelmann committed
                ) modifies mw_Response_1xx_Base := {
                    statusLine := {
                        sipVersion := c_sipNameVersion, 
                        statusCode := (600..699), 
                        reasonPhrase := ?
                    }
                }

garciay's avatar
garciay committed
                template(present) Response mw_Response_Algorithm (template(present) StatusLine p_statusLine, 
                                                                  template CallId p_callId,
                                                                  template CSeq p_cSeq, 
                                                                  template CredentialsList p_credentialsList
                ) modifies mw_Response_Base:= {
                    statusLine := {
                        sipVersion := c_sipNameVersion, 
                        statusCode := p_statusLine.statusCode, 
                        reasonPhrase := ?
                    },
                    msgHeader := {
                        authorization:= {
                            fieldName := AUTHORIZATION_E, 
                            body := p_credentialsList 
                        }
                    }
garciay's avatar
garciay committed
            } //* end group message_receive
garciay's avatar
garciay committed
        } //* end group full_templates
garciay's avatar
garciay committed

        group modified_templates {

            group request_send {

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

                template(value) ACK_Request m_ACK_Request_sdp(template(value) SipUrl p_requestUri, template(omit) CallId p_callId, template(omit) CSeq p_cSeq,
                                                              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,
                                                                template(omit) CSeq p_cSeq, 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,
                                                                    template(omit) CSeq p_cSeq, 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,
                                                                             template(omit) CSeq p_cSeq, 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,
                                                                                     //     mediaType
                                                                                     //     :=
                                                                                     //     "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
                }

                //     TODO STF471 added - check occurence
                template(value) REFER_Request m_REFER_Request_route(template(value) SipUrl p_requestUri, template(omit) CallId p_callId,
                                                                    template(omit) CSeq p_cSeq, template(omit) Contact p_contact, 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,
                                                                            template(omit) CSeq p_cSeq, template(value) From p_from, template(value) To p_to,
                                                                            template(value) Via p_via, template(omit) Contact p_contact,
                                                                            template(omit) Authorization p_authorization, 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,
                                                                        template(omit) CSeq p_cSeq, template(value) From p_from, template(value) To p_to,
                                                                        template(value) Via p_via, template(omit) Contact p_contact)
garciay's avatar
garciay committed
                    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,
                                                                        template(omit) CSeq p_cSeq, 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,
                                                                         //     mediaType
                                                                         //     :=
                                                                         //     "message/sipfrag"},
                        subscriptionState := {fieldName := SUBSCRIPTION_STATE_E, subState := p_state, substateParams := omit},
                        event := m_Event_refer
                    },
                    messageBody := {sipfrag := p_sipfrag}
                }

                //     TODO STF471 added - check occurence
                template(value) UPDATE_Request m_UPDATE_Request_route(template(value) SipUrl p_requestUri, template(omit) CallId p_callId,
                                                                      template(omit) CSeq p_cSeq, template(value) From p_from, template(value) To p_to,
                                                                      template(value) Via p_via, template(omit) Contact p_contact,
                                                                      template(value) MessageBody p_mb, template(value) Route p_route)
garciay's avatar
garciay committed
                    modifies m_UPDATE_Request_Base := {
                    msgHeader := {route := p_route}
                }


garciay's avatar
garciay committed
            } //* end group request_send
garciay's avatar
garciay committed


            group request_receive {

                template(present) BYE_Request mw_BYE_Request_Reason(template CallId p_callId, template(value) charstring 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) charstring 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 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_Base := {
                    msgHeader := {pAccessNetworkInfo := omit}
                }

                template(present) INVITE_Request mw_INVITE_Request_PaccessNetworkInfo(template CallId p_callId) modifies mw_INVITE_Request_Base := {
                    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://*" //     FIXME
                                                                        //     Shall
                                                                        //     parse
                                                                        //     msrp
                                                                        //     and
                                                                        //     msrps
                                                                        //     for
                                                                        //     secured
                                                                        //     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_Dummy := {
                    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
                }



garciay's avatar
garciay committed
            } //* end group request_receive
garciay's avatar
garciay committed

            group response_send {

                template(value) Response m_Response_AlertInfo(template(value) StatusLine p_statusLine, template(omit) CallId p_callId,
                                                              template(omit) CSeq p_cSeq, 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,
                                                            template(omit) CSeq p_cSeq, template(value) From p_from, template(value) To p_to,
                                                            template(value) Via p_via, template(omit) Contact p_contact) modifies m_Response_Base := {
garciay's avatar
garciay committed
                    msgHeader := {contact := p_contact}
                }

                template(value) Response m_Response_ext(template(value) StatusLine p_statusLine, template(omit) CallId p_callId, template(omit) CSeq p_cSeq,
                                                        template(value) From p_from, template(value) To p_to, template(value) Via p_via,
                                                        template(omit) Route p_route, template(omit) RecordRoute p_recordroute) 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, template(omit) CSeq p_cSeq,
                                                          template(value) From p_from, template(value) To p_to, template(value) Via p_via,
                                                          template(omit) Route p_route, template(omit) RecordRoute p_recordroute,
                                                          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_PAsserted_Privacy(template(value) StatusLine p_statusLine, template(omit) CallId p_callId,
                                                                      template(omit) CSeq p_cSeq, 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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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,
                                                                            template(omit) CSeq p_cSeq, 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,
                                                                         //     mediaType
                                                                         //     :=
                                                                         //     c_sdpApplication
                                                                         //     },
                        pAssertedID := p_pAssertedID,
                        privacy := p_privacy
                    },
                    messageBody := p_mb
                }



garciay's avatar
garciay committed
            } //* end group response_send
garciay's avatar
garciay committed


            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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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) charstring p_cause) modifies mw_Response_Base := {
                    statusLine := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?}, 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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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 Require p_require) modifies mw_Response_Base := {
                    statusLine := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?},
                    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 := {sipVersion := c_sipNameVersion, statusCode := p_statusLine.statusCode, reasonPhrase := ?}, msgHeader := {userToUser := ?}
                }


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

    group SDP_Templates {

        group SDP_Messages {

            group base_templates {

                template(value) SDP_Message m_SDP(template(value) SDP_media_desc p_media, template(value) SipUserProfile p_userprofile) := {
                    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 := p_userprofile.contactIpaddr
                    },
                    //*     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 := {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
                    bandwidth := omit,
                    times := {{time_field := {"0", "0"}, time_repeat := omit}},  //*     t=0 0
                    timezone_adjustments := omit,
                    key := omit,
                    attributes := omit,
                    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) := {
                    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 := p_userprofile.contactIpaddr
                    },
                    //*     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 := {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
                    bandwidth := omit,
                    times := {{time_field := {"0", "0"}, time_repeat := omit}},  //*     t=0 0
                    timezone_adjustments := omit,
                    key := omit,
                    attributes := omit,
                    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 loc_attribute) modifies m_SDP := {
                    attributes := {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 := ?
                }




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

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

garciay's avatar
garciay committed
                template(value) SDP_Message m_SDP_encrypted(template(value) SDP_media_desc p_media, 
                                                            template(value) SipUserProfile p_userprofile
                ) modifies m_SDP := {
                    protocol_version := 0, 
                    bandwidth := {
                        { PX_SIP_SDP_b_modifier, PX_SIP_SDP_b_bandwidth }
                    },
                    key := {
                        method := "base64", //prompt
                        key := "blablabla"
                    }
garciay's avatar
garciay committed
            } //* end group modified_templates
garciay's avatar
garciay 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) := {
                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,
                                                                          template(omit) SDP_attribute_list p_attributes) := {
                media_field := p_mf, information := omit, connections := omit, bandwidth := p_bw_l, key := omit, attributes := p_attributes
            }

garciay's avatar
garciay committed
            template(value) SDP_media_desc m_media_dynPT(template(value) charstring p_PT, 
                                                         template(value) charstring p_encod,
                                                         template(omit) SDP_key p_sdpKey:= omit
            ) := {
garciay's avatar
garciay committed
                media_field := {
                    media := c_audio,  //*     "audio",
garciay's avatar
garciay committed
                    ports := { 
                        port_number := 8500, 
                        num_of_ports := omit
                    },
garciay's avatar
garciay committed
                    transport := c_rtpAvp,  //*     "RTP/AVP",
garciay's avatar
garciay committed
                    fmts := { p_PT }
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 := { 
                            attr_value := p_PT & " " & p_encod 
                        }
                    }
                } //*     a=rtpmap:8 PCMA/8000
garciay's avatar
garciay committed
            }

            template(value) SDP_media_desc m_media_unsupported := {
                media_field := {
                    media := PX_SIP_SDP_media_video,
garciay's avatar
garciay committed
                    ports := {
                        port_number := 11500, 
                        num_of_ports := omit
                    },
garciay's avatar
garciay committed
                    transport := PX_SIP_SDP_media_transport,
garciay's avatar
garciay committed
                    fmts := { "99" }
garciay's avatar
garciay committed
                },  //*     m=audio 8500 RTP/AVP 0
                information := omit,
                connections := omit,
                bandwidth := omit,
                key := omit,
garciay's avatar
garciay committed
                attributes := {
                    { 
                        rtpmap := {
                            attr_value := PX_SIP_SDP_media_attribute_Exp
                        }
                    }
                }
garciay's avatar
garciay committed
            }

            template(value) SDP_bandwidth m_bandwidth(template(value) charstring loc_m, template(value) integer loc_b) := {
                modifier := loc_m, bandwidth := 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_AMR_DPT := {rtpmap := {attr_value := PX_SIP_SDP_dyn & " " & PX_SIP_SDP_media_transport_AMR}}
            template(value) SDP_attribute m_attribute_CLEARMODE_DPT := {rtpmap := {attr_value := PX_SIP_SDP_dyn & " " & PX_SIP_SDP_media_transport_Cle}}
            template(value) SDP_attribute m_attribute_G722 := {rtpmap := {attr_value := PX_SIP_SDP_encoding_attribute_G222}}
            template(value) SDP_attribute m_attribute_PCMU := {rtpmap := {attr_value := PX_SIP_SDP_encoding_attribute_PCMU}}
            template(value) SDP_attribute m_attribute_PCMU_DPT := {rtpmap := {attr_value := PX_SIP_SDP_dyn & " " & PX_SIP_SDP_media_transport_PCMU}}
            template(value) SDP_attribute m_attribute_PCMA := {rtpmap := {attr_value := PX_SIP_SDP_encoding_attribute_PCMA}}
            template(value) SDP_attribute m_attribute_PCMA_DPT := {rtpmap := {attr_value := PX_SIP_SDP_dyn & " " & PX_SIP_SDP_media_transport_PCMA}}
            //     TODO: STF471 template name suggests that this is a send
            //     template, while it contains matching mechanisms
            template(present) SDP_attribute mw_attribute_T38 := {unknown := {name := ?, attr_value := pattern "*t38*"}}
garciay's avatar
garciay 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}
            }

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


garciay's avatar
garciay committed
        } //* end group SDP_Fields
garciay's avatar
garciay committed
    } //* end group SDP_Templates
garciay's avatar
garciay committed

    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 := {
            msg_status_line := mw_msgStatusLine_yes, msg_account := *, msg_summary_line_list := *, opt_msg_headers := *
        }

        template(present) SimpleMsgSummary mw_SMS_yesUri := {
            msg_status_line := mw_msgStatusLine_yes, msg_account := mw_msgAccount, msg_summary_line_list := *, opt_msg_headers := *
        }

        template(present) SimpleMsgSummary mw_SMS_yesVoice := {
            msg_status_line := mw_msgStatusLine_yes, msg_account := *, msg_summary_line_list := {mw_msgSummaryLine(c_voiceMessage)}, opt_msg_headers := *
        }

        template(present) SimpleMsgSummary mw_SMS_yesUriVoice := {
            msg_status_line := mw_msgStatusLine_yes,
            msg_account := mw_msgAccount,
            msg_summary_line_list := {mw_msgSummaryLine(c_voiceMessage)},
            opt_msg_headers := *
        }

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