AtsSccas_Steps.ttcn 32.4 KB
Newer Older
module AtsSccas_Steps {
    // LibCommon
    import from LibCommon_VerdictControl all;
    
    import from LibSip_Common all;
    import from LibSip_SIPTypesAndValues all;
    import from LibSip_SDPTypes all;
    import from LibSip_Steps all;
    import from LibSip_Templates all;
    import from LibSip_Interface all;
    import from LibSip_PIXITS all;
    
    // LibIms
    import from LibIms_SIPTypesAndValues all;
    import from LibIms_Steps all;
    import from LibIms_Templates all;
    import from LibIms_Interface all;
    
    // AtsSccas
    import from AtsSccas_PIXITS all;
    import from AtsSccas_Templates all;

    group Constants {
    
        group SdpUserProfileConstants {
        
            const integer c_userProfile_Vendor1 := 1;
        
        } // End of group SdpUserProfileConstants
    
        group UserProfileConstants {
            // number of user profile (RESERVED: from 1-10 for SIP profile)
            const integer c_userProfile_UE1atSUThome := 11;               // location is SUT domain
            const integer c_userProfile_UE2atSUThome := 12;               // location is SUT domain
            const integer c_userProfile_UE3atSUThome := 13;               // location is SUT domain
            const integer c_userProfile_UE4atSUThome := 14;               // location is SUT domain
            const integer c_userProfile_UE1atSUTvisiting := 21;             // location is SUT domain
            //const integer c_userProfile_UE2atSUTvisiting := 22;            // location is SUT domain
            const integer c_userProfile_IBCFwithUnknownUE := 28;             // location is IMS1 domain
            const integer c_userProfile_IBCFwithHomeUE := 29;             // location is IMS1 domain
            const integer c_userProfile_IBCFwithVisitingUE := 31;         // location is IMS1 domain
            const integer c_userProfile_PCSCFwithHomeUE := 41;            // location is IMS1 domain
            const integer c_userProfile_PCSCFwithVisitingUE := 42;        // location is IMS1 domain
            const integer c_userProfile_PCSCFwithVisitingUE2 := 43;        // location is IMS1 domain
            const integer c_userProfile_PCSCFwithUnknownVisitingUE := 44;    // location is IMS1 domain
            const integer c_userProfile_ICSCFwithHomeUE := 45;             // location is IMS1 domain
            const integer c_userProfile_SCSCFwithHomeUE := 46;             // location is IMS1 domain
            const integer c_userProfile_SCSCFwithHomeUE_domain :=55;
            const integer c_userProfile_ECSCFwithHomeUE := 47;             // location is IMS1 domain
            const integer c_userProfile_ISUP := 49;                       //
            const integer c_userProfile_AS1 := 51;                          // Isc userProfile at AS1
            const integer c_userProfile_AS2 := 52;                       // Isc userProfile at AS2

            const integer c_userProfile_ESINetSubscriber := 53;
            const integer c_userProfile_ESINetPSAP        := 54;
            const integer c_userProfile_ESINetUpstreamElement := 55;

            // number of interface profile
            const integer c_interfaceProfile_IMS_SUT_IBCF1  := 100;        // Ic interface at IBCF1 located in SUT
            const integer c_interfaceProfile_IMS_SUT_IBCF2  := 101;        // Ic interface at IBCF2 located in SUT
            const integer c_interfaceProfile_IMS_SUT_PCSCF1 := 110;         // Gm interface towards UE1 located in SUT
            const integer c_interfaceProfile_IMS_SUT_PCSCF2 := 111;         // Gm interface towards UE2 located in SUT
            const integer c_interfaceProfile_IMS_SUT_PCSCF  := 112;         // Mw interface at P-CSCF located in SUT
            const integer c_interfaceProfile_IMS_SUT_SCSCF  := 113;         // Mw interface at S-CSCF located in SUT
            const integer c_interfaceProfile_IMS_SUT_ICSCF  := 114;         // Mw interface at I-CSCF located in SUT
            const integer c_interfaceProfile_IMS_SUT_MGCF   := 115;         // Mw interface at MGCF located in SUT
            const integer c_interfaceProfile_IMS_SUT_AS     := 116;             // Isc interface at AS located in SUT
            const integer c_interfaceProfile_IMS_SUT_ECSCF  := 117;         // Mw interface at E-CSCF located in SUT
            const integer c_interfaceProfile_IMS_SUT_BCF    := 118;          // SIP interface at BCF located in SUT
            const integer c_interfaceProfile_SUT_LIS        := 119;
            const integer c_interfaceProfile_SUT_ECRF       := 120;
            const integer c_interfaceProfile_SUT_ESRP       := 121;

            // number of conference profile
            const integer c_conferenceProfile_factoryURI := 800;            // conference factory URI

            // number of service profile
            const integer c_serviceProfile_EMERGENCY := 112;
            const integer c_serviceProfile_EMERGENCY_INVALID := 666;
            const integer c_serviceProfile_SUBSCRIBER := 115;
            const integer c_serviceProfile_SUBSCRIPTION_SERVICE := 116;

            // number of SIPURL identifiers
            const integer c_interfaceSIPURL_IMS_SUT_PCSCF1_domain := 1101; // c_interfaceProfile_IMS_SUT_PCSCF1
            const integer c_interfaceSIPURL_IMS_SUT_PCSCF1_ip := 1102;     // c_interfaceProfile_IMS_SUT_PCSCF1

        } // End of group UserProfileConstants

    } // End of group Constants

    group globalSteps {
    
        /*
        * 
        * @desc sets user parameters with PIXIT values
        * @param p_user identifies the selected user configuration and location
        * @verdict 
        */
        function f_init_sdp_userprofile(
                                        inout SDP_Message p_loc_SDP,
                                        in integer p_user, // TODO To be removed
                                        in integer p_sdp_user
                                        ) runs on ImsComponent {
        
        select(p_sdp_user){
            case (c_userProfile_UE1atSUThome) { // variant c_userProfile_UE1atSUThome
            p_loc_SDP := valueof(
                                m_SDP_mediaList(
                                                {
                                                    { { c_audio, { 20000, omit}, "RTP/AVP", {"0"} }, omit, omit, omit, omit, omit },
                                                    { { c_video, { 20002, omit}, "RTP/AVP", {"31"} }, omit, omit, omit, omit, omit }
                                                },
                                                vc_userprofile
                                                )
                                );
Bostjan Pintar's avatar
Bostjan Pintar committed
            vc_sdp_local.origin.user_name := PX_IMS_TS_UE1_PUBLIC_USER;
            vc_sdp_local.origin.session_id := "2890844526";
            vc_sdp_local.origin.session_version := "2890842807";
            vc_sdp_local.origin.addr := "atlanta.example.com";
            vc_sdp_local.session_name := "c_userProfile_UE1atSUThome";
            f_append_media_attribute(vc_sdp_local, { rtpmap := {"0", {"PCMU", "8000", omit} } } );
            f_append_media_attribute(vc_sdp_local, { rtpmap := {"31", {"H261", "90000", omit} } } );
            f_append_media_attribute(vc_sdp_local, { sendrecv := { } } );
            } // c_userProfile_UE1atSUThome
            case (c_userProfile_Vendor1) { //variant c_userProfile_Vendor1
            p_loc_SDP := valueof(
                                m_SDP_mediaList(
                                                {
                                                    { { c_audio, { 10500, omit}, "RTP/AVP", {"8", "0", "18", "4", "96", "97"} }, omit, omit, omit, omit, omit }
                                                },
                                                vc_userprofile
                                                )
                                );
            vc_sdp_local.origin.user_name := "FAST_V2R1";
            vc_sdp_local.origin.session_id := "2006";
            vc_sdp_local.origin.session_version := "2007";
            vc_sdp_local.origin.addr := "155.11.49.64";
            vc_sdp_local.session_name := "-";
            f_append_media_attribute(vc_sdp_local, { rtpmap := {"0", {"PCMU", "8000", omit} } } );
            f_append_media_attribute(vc_sdp_local, { rtpmap := {"18", {"G729", "8000", omit} } } );
            f_append_media_attribute(vc_sdp_local, { rtpmap := {"4", {"G723", "8000", omit} } } );
            f_append_media_attribute(vc_sdp_local, { rtpmap := {"96", {"AMR", "8000", omit} } } );
            f_append_media_attribute(vc_sdp_local, { rtpmap := {"97", {"telephone-event", "8000", omit} } } );
            f_append_media_attribute(vc_sdp_local, { fmtp := { "97", { unstructured := "0-15" } } } );
            f_append_media_attribute(vc_sdp_local, { sendrecv := { } } );
            } // c_userProfile_Huawei
        } // End of 'select' statement

        log("<<< f_init_sdp_userprofile: p_loc_SDP= ", p_loc_SDP);
        } // End of function f_init_sdp_userprofile
        
        /*
        *
        * @desc sets user parameters with PIXIT values
        * @param p_user identifies the selected user configuration and location
        * @verdict
        */
        function f_init_userprofile(
                                    in integer p_user
                                    ) runs on ImsComponent {

        select(p_user){
            case (c_userProfile_UE1atSUThome) { //variant c_userProfile_UE1atSUThome
            vc_userprofile.id := p_user;
            vc_userprofile.currPort := PX_IMS_TS_UE1_PORT;
            vc_userprofile.currIpaddr := PX_IMS_TS_UE1_IPADDR;
            vc_userprofile.contactPort := PX_IMS_TS_UE1_PORT;
            vc_userprofile.contactIpaddr := PX_IMS_TS_UE1_IPADDR;
Bostjan Pintar's avatar
Bostjan Pintar committed
            vc_userprofile.bearerIpaddr := PX_IMS_TS_UE1_BEARER_IPADDR;
            vc_userprofile.homeDomain := PX_IMS_TS_UE1_HOME_DOMAIN;
            vc_userprofile.publUsername := PX_IMS_TS_UE1_PUBLIC_USER;
            vc_userprofile.qop := PX_IMS_TS_UE1_QOP;
            vc_userprofile.privUsername := PX_IMS_TS_UE1_PRIVAT_USERNAME;
            vc_userprofile.passwd := PX_IMS_TS_UE1_PRIVAT_PASSWD;
            vc_userprofile.registrarDomain := PX_IMS_TS_UE1_REGISTRAR;
            case (c_userProfile_PCSCFwithHomeUE) { //variant c_userProfile_PCSCFwithHomeUE 
            //for MIME REGISTER to SCCAS(message originaly exchanged between PCSCF and SCSCF)
            vc_userprofile.id := p_user;
            vc_userprofile.currPort := PX_IMS_TS_UE1_PORT;
            vc_userprofile.currIpaddr := PX_IMS_TS_UE1_IPADDR;
            vc_userprofile.contactPort := PX_IMS_TS_UE1_PORT;
            vc_userprofile.contactIpaddr := PX_IMS_TS_UE1_IPADDR;
            vc_userprofile.bearerIpaddr := PX_IMS_TS_UE1_BEARER_IPADDR;
            vc_userprofile.homeDomain := PX_IMS_TS_UE1_HOME_DOMAIN;
            vc_userprofile.publUsername := PX_IMS_TS_UE1_PUBLIC_USER;
            vc_userprofile.qop := PX_IMS_TS_UE1_QOP;
            vc_userprofile.privUsername := PX_IMS_TS_UE1_PRIVAT_USERNAME;
            vc_userprofile.passwd := PX_IMS_TS_UE1_PRIVAT_PASSWD;
            vc_userprofile.registrarDomain := PX_IMS_TS_UE1_REGISTRAR;
            }
            case (c_userProfile_SCSCFwithHomeUE) { //variant c_userProfile_SCSCFwithHomeUE
            //for messages exchanged between S-CSCF and SCC-AS
            vc_userprofile.id := p_user;
            vc_userprofile.currPort := PX_IMS_TS_SCSCF_PORT;
            vc_userprofile.currIpaddr := PX_IMS_TS_SCSCF_HOME_DOMAIN;
            vc_userprofile.contactPort := PX_IMS_TS_SCSCF_PORT;
            vc_userprofile.contactIpaddr := PX_IMS_TS_SCSCF_HOME_DOMAIN; //ip address or domain
Bostjan Pintar's avatar
Bostjan Pintar committed
            vc_userprofile.bearerIpaddr := PX_IMS_TS_UE1_BEARER_IPADDR;
            vc_userprofile.homeDomain := PX_IMS_TS_UE1_HOME_DOMAIN;
            vc_userprofile.publUsername := PX_IMS_TS_UE1_PUBLIC_USER;
            vc_userprofile.qop := PX_IMS_TS_UE1_QOP;
            vc_userprofile.privUsername := PX_IMS_TS_UE1_PRIVAT_USERNAME;
            vc_userprofile.passwd := PX_IMS_TS_UE1_PRIVAT_PASSWD;
            vc_userprofile.registrarDomain := PX_IMS_TS_UE1_REGISTRAR;
        } // End of 'select' statement

        } // End of function f_init_userprofile

        function f_initSipUrlFromCharstring(charstring p_uri) return SipUrl {
        var charstring v_scheme     := regexp(p_uri, charstring:"(sip[s]#(0,1)):([^@\\s]+)@?+", 0);
        var charstring v_user       := regexp(p_uri, charstring:"(sip[s]#(0,1)):([^@\\s]+)@?+", 1);
        var charstring v_host_port  := regexp(p_uri, charstring:"(sip[s]#(0,1)):([^@\\s]+)@(?+)", 2);
        var charstring v_host       := "";
        var charstring v_port       := "";

        template charstring t_has_port := pattern "?+:?+";
        if (match(v_host_port,t_has_port)) {
            v_host := regexp(v_host_port, charstring:"(?+):(?+)",0);
            v_port := regexp(v_host_port, charstring:"(?+):(?+)",1);
        } else {
            v_host := v_host_port;
            v_port := "5060";
        }

        var SipUrl p_sipUrl := {
                            scheme := v_scheme,              // contains "sip"
                            components := {
                                            sip := {
                                                    userInfo := {userOrTelephoneSubscriber:=v_user, password:=omit},
                                                    hostPort := {
                                                                host := v_host,          // hostname, IPv4 or IPv6
                                                                portField := str2int(v_port)      // represented as an integer
                                                    }
                                            }
                                        },
                            urlParameters := omit,
                            headers := omit
                            };

        return(p_sipUrl)
        }

        function f_initSipUrl(
                            in integer p_user
                            )  return SipUrl {
        var SipUrl p_sipUrl := {
                                scheme := c_sipScheme,              // contains "sip"
                                components := {
                                                sip := {
                                                        userInfo := omit,
                                                        hostPort := {
                                                                    host := omit,          // hostname, IPv4 or IPv6
                                                                    portField := omit      // represented as an integer
                                                        }
                                                }
                                                },
                                urlParameters := omit,
                                headers := omit
                                };

        select(p_user) {
            case (c_userProfile_UE1atSUThome) {
Bostjan Pintar's avatar
Bostjan Pintar committed
                    p_sipUrl.components.sip.userInfo := {userOrTelephoneSubscriber:=PX_IMS_TS_UE1_PUBLIC_USER, password:=omit};
                    p_sipUrl.components.sip.hostPort := {host := PX_IMS_TS_UE1_HOME_DOMAIN, portField :=omit}
//            case (c_userProfile_UE2atSUThome) {
//                    p_sipUrl.components.sip.userInfo := {userOrTelephoneSubscriber:=PX_IMS_SUT_UE2_PUBLIC_USER, password:=omit};
//                    p_sipUrl.components.sip.hostPort := {host := PX_IMS_SUT_UE2_HOME_DOMAIN, portField :=omit}
//                    }
//            case (c_serviceProfile_EMERGENCY) {
//                    p_sipUrl.components.sip.userInfo := {userOrTelephoneSubscriber:=PX_IMS_SUT_EMERGENCY_SERVICE, password:=omit};
//                    p_sipUrl.components.sip.hostPort := {host := PX_IMS_SUT_EMERGENCY_HOME_DOMAIN, portField :=omit}
//                    }
            case (c_serviceProfile_SUBSCRIBER) {
Bostjan Pintar's avatar
Bostjan Pintar committed
                    p_sipUrl.components.sip.userInfo := { userOrTelephoneSubscriber := PX_IMS_TS_UE1_PUBLIC_USER, password := omit};
                    p_sipUrl.components.sip.hostPort := {host := PX_IMS_TS_UE1_HOME_DOMAIN, portField :=omit}
                    }

        }; // End of 'select' statement

        return(p_sipUrl)
        } // End of function f_initSipUrl


        function f_initTelUrl(
                            in charstring p_subscriber
                            )  return SipUrl {
        var SipUrl p_sipUrl := {
                                scheme := c_telScheme,              // contains "tel"
                                components := {
                                                tel := {
                                                        subscriber := p_subscriber
                                                }
                                                },
                                urlParameters := omit,
                                headers := omit
                                };

        return(p_sipUrl)
        } // End of function f_initTelUrl

        function f_initUrnUrl(
                            in charstring p_namespaceId,
                            in charstring p_namespaceSpecificString
                            )  return SipUrl {
        var SipUrl p_sipUrl := {
                                scheme := c_urnScheme,              // contains "urn"
                                components := {
                                                urn := {
                                                        namespaceId := p_namespaceId,
                                                        namespaceSpecificString := p_namespaceSpecificString
                                                }
                                                },
                                urlParameters := omit,
                                headers := omit
                                };

        return(p_sipUrl)
        } // End of function f_initUrnUrl

        /*
        * @desc sets user parameters with PIXIT values
        * @param p_user identifies the selected user configuration and location
        * @verdict
        */
        function f_init_interfaceprofile(
                                        in integer p_interface
                                        ) runs on ImsComponent {

        vc_sent_label := { host := PX_IMS_SUT_AS_IPADDR, portField := PX_IMS_SUT_AS_PORT };
                //used for AS, TAS, SCC-AS
                case (c_interfaceProfile_IMS_SUT_AS) { //variant c_interfaceProfile_IMS_SUT_AS
                vc_interfaceprofile.SUTPort := PX_IMS_SUT_AS_PORT;
                vc_interfaceprofile.SUTIpaddr := PX_IMS_SUT_AS_IPADDR;
                vc_interfaceprofile.SUTHomeDomain := PX_IMS_SUT_AS_HOME_DOMAIN;
                }
            }
        } // End of function f_init_interfaceprofile

    } // End of group globalSteps
    group SetHeaders{
        /**
         * @desc function sets header field for the next outgoing REGISTER message
         * @param p_cSeq_s CSeq parameter to be applied
         * @param p_emergency Set to true in case of emergency
         */
        function f_setHeaders_REGISTER_AS( //TODO review and repair params due to isc interface
            inout CSeq p_cSeq_s,
            boolean p_emergency := false
        ) runs on SipComponent  {
            var SemicolonParam_List v_params := {};

            f_setHeadersGeneral(p_cSeq_s, "REGISTER"); // cseq, contact, branch, via
            vc_requestUri := {
                scheme := c_sipScheme,
                components := {
                    sip := {
                        userInfo := omit,
                        hostPort := {
                            host := vc_userprofile.registrarDomain,
                            portField := omit
                        }
                    }
                },
                urlParameters := omit,
                headers := omit
            };

            vc_reqHostPort := vc_requestUri.components.sip.hostPort;

            vc_callId := {
                fieldName := CALL_ID_E,
                callid := f_getRndCallId() & c_AT & vc_userprofile.currIpaddr
            };
            vc_callIdReg := vc_callId; // remember callId for de-registration
            vc_to := valueof(m_To(m_SipUrl_currDomain(vc_userprofile)));
            vc_cancel_To := vc_to;
            v_params := f_addParameter(v_params,
                {
                    id := c_tagId,
                    paramValue := { 
                        tokenOrHost := f_getRndTag()
                    }
                });
            vc_from := {
                fieldName := FROM_E,
                addressField := vc_to.addressField,
                fromParams := v_params
            };

            if (not vc_firstREGISTER_sent) {
                if (p_emergency) {
                    v_params := {
                        {
                            "sos",
                            omit
                        }
                    };
                    vc_contact.contactBody.contactAddresses[0].addressField.addrSpecUnion.urlParameters := v_params;
                }
                else {
                    v_params := {
                        {
                            id := c_expiresId,
                            paramValue := { 
                                tokenOrHost := c_shortRegistration
                            }
                        }
                    };
                    vc_contact.contactBody.contactAddresses[0].contactParams := v_params;
                }
            }

            vc_firstREGISTER_sent := true; // f_setHeaders_Register is called in deREGISTER function
            vc_authorization := {
                fieldName := AUTHORIZATION_E,
                body := {f_calculatecCredentials_empty(vc_userprofile)}
            };

            vc_via_REG := vc_via;
        } // end function setHeaders_REGISTER_AS
		
		
		/**
	   * @desc function sets header field for the next outgoing REFER message
	   * @param p_cSeq_s CSeq parameter to be applied
	   */
	  function f_setHeaders_REFER_AS( //TODO review and repair params due to isc interface
		  inout CSeq p_cSeq_s,
		  in SipUrl p_to_user,
		  in SipUrl p_from_user
	  ) runs on ImsComponent  {
		  var SemicolonParam_List v_params := {};

		  //f_setHeadersGeneral(p_cSeq_s, "REFER"); // cseq, contact, branch, via
		  vc_to := f_initToHeader(p_to_user); // init of vc_to using userProfile identifier
		  vc_from := f_initFromHeader(p_from_user, f_getRndTag()); // init of vc_from using userProfile identifier
		  vc_requestUri := p_to_user; // Request URI of Invite is identical with To header
		  if (vc_boo_route) {
			  vc_route := m_route_interface(vc_interfaceprofile);
		  }
		  if (vc_boo_recordRoute) {
			  vc_recordRoute := m_recordRoute_currIpAddr(vc_userprofile);
		  }
		  LibSip_Steps.f_setHeadersREFER(p_cSeq_s);
	  } // end function setHeaders_REFER_AS    
		  
        /**
         * @desc Sets Invite header fields (IMS addresses) extension of general settings from LibSip basic function
         * @param p_cSeq_s The current cSeq
         * @param p_to_user The selected user's SIP URL
         */
        function f_setHeaders_INVITE_AS(
            inout CSeq p_cSeq_s,
            in SipUrl p_to_user,
            in SipUrl p_from_user
        ) runs on ImsComponent  {
            vc_to := f_initToHeader(p_to_user); // init of vc_to using userProfile identifier
            vc_from := f_initFromHeader(p_from_user, f_getRndTag()); // init of vc_from using userProfile identifier
            vc_requestUri := p_to_user; // Request URI of Invite is identical with To header
            if (vc_boo_route) {
                vc_route := m_route_interface(vc_interfaceprofile);
            }
            if (vc_boo_recordRoute) {
                vc_recordRoute := m_recordRoute_currIpAddr(vc_userprofile);
            }

            LibSip_Steps.f_setHeadersINVITE(p_cSeq_s);
        } // end f_setHeadersINVITE_AS

Iztok Juvancic's avatar
Iztok Juvancic committed
		/**
		 * @desc Sets BYE header fields (IMS addresses) extension of general settings from LibSip basic function
		 * @param p_cSeq_s The current cSeq
		 * @param p_to_user The selected user's SIP URL
		 */
		function f_setHeaders_BYE_AS(
			inout CSeq p_cSeq_s,
			in SipUrl p_to_user,
			in SipUrl p_from_user
		) runs on ImsComponent  {
			vc_to := f_initToHeader(p_to_user); // init of vc_to using userProfile identifier
			vc_from := f_initFromHeader(p_from_user, f_getRndTag()); // init of vc_from using userProfile identifier
			vc_requestUri := p_to_user; // Request URI of Invite is identical with To header
			if (vc_boo_route) {
				vc_route := m_route_interface(vc_interfaceprofile);
			}
			if (vc_boo_recordRoute) {
				vc_recordRoute := m_recordRoute_currIpAddr(vc_userprofile);
			}

			LibSip_Steps.f_setHeadersBYE(p_cSeq_s);
		} // end f_setHeadersBYE_AS

Axel Rennoch's avatar
Axel Rennoch committed
			/**
			 * @desc setting of general and basic OPTIONS header fields in additon to the addresses (To, From, ReqUri)
			 * @param p_cSeq_s
			 */
			function f_setHeadersOPTIONS(
				inout CSeq p_cSeq_s
			) runs on SipComponent  {
				f_setHeadersGeneral(p_cSeq_s, "OPTIONS"); // cseq, contact, branch, via
				vc_callId := {
					fieldName := CALL_ID_E,
					callid := f_getRndCallId() & c_AT & vc_userprofile.currIpaddr
				};

				vc_cancel_To := vc_to;
				vc_caller_To := vc_to;

				vc_caller_From := vc_from;

				if (ischosen(vc_requestUri.components.sip)) {
					// sip/sips call
					vc_reqHostPort := vc_requestUri.components.sip.hostPort;
				}
				else if (ischosen(vc_requestUri.components.urn)) {
					// Emergency call
					vc_reqUrnUri := vc_requestUri.components.urn;
				}
				else {
					log("*** " & __SCOPE__ &": INFO:f_setHeadersOPTIONS: unsupported field: ", vc_requestUri," ***");
					setverdict(fail);
				}
			}

    } // End of group SetHeaders
    
    group CommonProcedures {
    
        function f_registrationAS(in CSeq p_cSeq_s)
            runs on ImsComponent {
                var CSeq v_cSeq_s := p_cSeq_s;
                var template(value) REGISTER_Request m_register3ptyUe;
                var template(value) RequestUnion m_req;
                var template(value) Response m_ResponseReg_3ptyUe;
                

                // Preamble
                f_init_userprofile(c_userProfile_PCSCFwithHomeUE);
                f_init_interfaceprofile(c_interfaceProfile_IMS_SUT_PCSCF1);
                f_initSipUrl(c_userProfile_PCSCFwithHomeUE);

                //Registration
                f_setHeaders_REGISTER(v_cSeq_s);//UE REGISTER
                m_register3ptyUe :=  m_register_ue_srvcc(
                                                    vc_requestUri, 
                                                    vc_callId, 
                                                    vc_cSeq, 
                                                    vc_from, 
                                                    vc_to, 
                                                    vc_via_REG, 
                                                    vc_contact, 
                                                    m_add_Authorization_digest(
                                                                                vc_authorization, 
                                                                                {c_Integrity_protected_no}
                                                                                ), 
                                                    PX_IMS_SUT_SCSCF_IPADDR, // TODO To be refined during validation
                                                    PX_IMS_SUT_SCSCF_PORT, // TODO To be refined during validation
                                                    "600000",
                                                    omit,
                                                    omit,
                                                    omit
                                                    );
                m_req:= {Register:=valueof(m_register3ptyUe)};

                m_ResponseReg_3ptyUe :=  m_Response_2xxonREGISTER_IMS(
                                                                c_statusLine200,
                                                                vc_callId,
                                                                p_cSeq_s,
                                                                vc_from,
                                                                vc_to,
                                                                vc_via_REG,
                                                                vc_contact,
                                                                m_SipUrl_currDomain(vc_userprofile),
                                                                vc_from.addressField.nameAddr.addrSpec
                                                                );

                f_init_userprofile(c_userProfile_SCSCFwithHomeUE);
                f_init_interfaceprofile(c_interfaceProfile_IMS_SUT_AS); //AS as SCCAS
                f_initSipUrl(c_userProfile_SCSCFwithHomeUE);

                f_setHeaders_REGISTER_AS(v_cSeq_s);//AS INTERFACE REGISTER
                f_SendREGISTER(
                             m_REGISTER_Request_AS(
                                              vc_requestUri, 
                                              vc_callId, 
                                              vc_cSeq, 
                                              vc_from, 
                                              vc_to, 
                                              vc_via_REG, 
                                              vc_contact, 
                                              -,
                                              "600000",
YannGarcia's avatar
YannGarcia committed
                                              m_contentType_sccas("multipart/mixed",{m_contentTypeBoundary(c_boundary)}) ,
                                              m_MBody_MIME_SipReqResp(c_boundary,m_req,m_ResponseReg_3ptyUe)
                              ));
                              
                tc_ack.start;
                alt {
                    [] SIPP.receive(mw_Response_2xxonREGISTER_AS(vc_callId, vc_cSeq, vc_from, vc_to, vc_via_REG, vc_contact)) {
                        tc_ack.stop;

                    }
                    [] tc_ack.timeout {
                    	f_setVerdict(e_timeout);
 
                    }
                }
        } //end function f_registrationAS
        
    
        function f_deregistrationAS(in CSeq p_cSeq_s)
            runs on ImsComponent {
            // Local variables
            var CSeq v_cSeq_s := p_cSeq_s;

            // Preamble
            f_init_userprofile(c_userProfile_SCSCFwithHomeUE);
            f_init_interfaceprofile(c_interfaceProfile_IMS_SUT_AS); //AS as SCCAS
            f_initSipUrl(c_userProfile_SCSCFwithHomeUE);
            

            f_setHeaders_REGISTER_AS(v_cSeq_s);//AS INTERFACE REGISTER
            f_SendREGISTER(
                           m_REGISTER_Request_AS(
                                            vc_requestUri, 
                                            vc_callId, 
                                            vc_cSeq, 
                                            vc_from, 
                                            vc_to, 
                                            vc_via_REG, 
                                            vc_contact, 
                                            -,
                                            "0",
                                            - ,
                                            -)
                            );
            tc_ack.start;
            alt {
                [] SIPP.receive(mw_Response_2xxonREGISTER_AS(vc_callId, vc_cSeq, vc_from, vc_to, vc_via_REG, vc_contact)) {
                    tc_ack.stop;
                }
                [] tc_ack.timeout {
                    f_setVerdict(e_timeout);
                }
            }
        } //end function f_deregistrationAS
        
		function f_EstablishDialogAS(in CSeq p_cSeq_s)
			runs on ImsComponent {
			var CSeq v_cSeq_s := p_cSeq_s;
		} //end function f_EstablishDialogAS
		
		function f_ReleaseDialogAS(in CSeq p_cSeq_s)
			runs on ImsComponent {
			var CSeq v_cSeq_s := p_cSeq_s;
		} //end function f_ReleaseDialogAS
Iztok Juvancic's avatar
Iztok Juvancic committed
		function f_PS2CSTransfer(in CSeq p_cSeq_s)
		    runs on ImsComponent {
            var CSeq v_cSeq_s := p_cSeq_s;
        } //end function f_PS2CSTransfer
		
Axel Rennoch's avatar
Axel Rennoch committed

        /**
         * @desc function send OPTIONS message
         * @param p_request template of the message to be sent
         */
        function f_SendOPTIONS(
            template(value) OPTIONS_Request p_request
        ) runs on SipComponent  {
            SIPP.send(p_request) to vc_sent_label;
        }

    } //end group CommonProcedures

} // End of module AtsSccas_Steps