Commit 666bb170 authored by pintar's avatar pintar
Browse files

Changes done due to STF467 validation week46 and week47

parent 7c82dece
Loading
Loading
Loading
Loading
+64 −4
Original line number Diff line number Diff line
@@ -3325,6 +3325,7 @@ group SendMessage {
	{
		vc_requestFor407 := valueof(p_request);
		SIPP.send(p_request) to vc_sent_label;
        vc_request := valueof(p_request);
		if(PX_SIP_INVITE_AUTHENTICATION_ENABLED) {a_altstep_401or407();};	
	}

@@ -3593,7 +3594,7 @@ group Registration {
	{
	  if (PX_SIP_REGISTRATION)
	  {
		f_setHeaders_REGISTER(p_cSeq_s);
		f_setHeaders_REGISTER(p_cSeq_s); //TODO need if p_register not set
		p_register := m_REGISTER_Request_Base(vc_requestUri, vc_callId, p_cSeq_s, vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization);	
		f_SendREGISTER(p_register); //LibSip
		
@@ -3637,6 +3638,65 @@ group Registration {
	  };
	}//end function f_Registration
	
	/**
	 * 
	 * @desc  registration and authentication with MD5
	 * @param p_cSeq_s		cseq parameter 
	 * @param p_register	register template
	 * @param p_auth		flag indicating if authentication is needed
	 */
	function f_Registration_withTemplate(inout CSeq p_cSeq_s, inout template REGISTER_Request p_register, in boolean p_auth) runs on SipComponent
	{
	  if (PX_SIP_REGISTRATION)
	  {
		//f_setHeaders_REGISTER(p_cSeq_s); TODO need if p_register not set
		//p_register := m_REGISTER_Request_Base(vc_requestUri, vc_callId, p_cSeq_s, vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization);	
		f_SendREGISTER(p_register); //LibSip
		
		//awaiting of 401 and sending 2nd REGISTER and awaiting 200 OK REGISTER
		if (p_auth)
		{
		  // receiving 401 Unauthorized response.
		  // and Re-send REGISTER request with Authorization header
		  tc_resp.start(PX_SIP_TRESP);
		  alt
		  {
			[] SIPP.receive	(mw_Response_Base(c_statusLine401, vc_callId, p_cSeq_s)) -> value vc_response
			  {
				tc_resp.stop;
				f_setHeadersOnReceiptOfResponse(p_cSeq_s, vc_response);
				// set headers via, cseq and authorization
				f_setHeaders_2ndREGISTER(p_cSeq_s);
				//p_register := m_REGISTER_Request_Base(vc_requestUri, vc_callId, p_cSeq_s, vc_from, vc_to, vc_via_REG, vc_contact, vc_authorization);
				// Re-send protected REGISTER
				p_register.requestLine.requestUri := vc_requestUri;
                p_register.msgHeader.cSeq := vc_cSeq;
                p_register.msgHeader.via := vc_via_REG;
                p_register.msgHeader.authorization := vc_authorization;				
				f_SendREGISTER(p_register);//LibSip
	            
	            // awaiting 200 OK REGISTER
				f_awaitingOkResponse(p_cSeq_s);
				f_getServiceRouteMapIntoRouteInRegistration(p_cSeq_s, vc_response);
			  }
			[] SIPP.receive	(mw_Response_Base(c_statusLine200, vc_callId, p_cSeq_s)) -> value vc_response
			  {
				tc_resp.stop;
				f_setHeadersOnReceiptOfResponse(vc_cSeq, vc_response);
    			f_getServiceRouteMapIntoRouteInRegistration(p_cSeq_s, vc_response);
				log ("Authorization was not requested as expected");
			  }
		  }
		}
		else
		{
		  f_awaitingOkResponse(p_cSeq_s);
		  f_getServiceRouteMapIntoRouteInRegistration(p_cSeq_s, vc_response);
		}      

	  };
	}//end function f_Registration_withTemplate


	/**
	 * 
@@ -3661,7 +3721,7 @@ group Registration {
		f_setHeaders_deREGISTER(p_cSeq);
		v_request := m_REGISTER_Request_expires(vc_requestUri, vc_callIdReg,
		p_cSeq,  vc_from, vc_to, vc_via, vc_contact, vc_authorization, "0");
		v_request.msgHeader.route := f_route();
		//v_request.msgHeader.route := f_route();
		
		f_SendREGISTER(v_request);
		if (PX_SIP_REGISTER_AUTHENTICATION_ENABLED)
@@ -3678,7 +3738,7 @@ group Registration {
				  f_setHeaders_2ndREGISTER(p_cSeq);
					v_request := m_REGISTER_Request_expires(vc_requestUri, vc_callIdReg,
					p_cSeq,  vc_from, vc_to, vc_via, vc_contact, vc_authorization, "0");
					v_request.msgHeader.route := f_route();
					//v_request.msgHeader.route := f_route();
				  // Re-send protected REGISTER
				  f_SendREGISTER(v_request);//LibSip
				  
+22 −3
Original line number Diff line number Diff line
@@ -761,6 +761,25 @@ module LibSip_Templates
						  rrParam := omit}
		}};

        template RouteBody m_routeBody_currIpAddr (in SipUserProfile p_userprofile):=
        {   
            nameAddr := {
                displayName := omit, 
                addrSpec := 	{
                    scheme := c_sipScheme,  			//*  contains "sip"
                    components := { 
                        sip := {
                            userInfo := omit,
                            hostPort := {host:=p_userprofile.homeDomain, portField:= p_userprofile.currPort}
                        }
                    },
                    urlParameters := omit,
                    headers := omit
                }
            },
            rrParam := omit
        };
	
		template ReferredBy m_ReferredBy_SipUrl(template SipUrl p_sipUrl) := 
		{
			fieldName := REFERRED_BY_E,
@@ -937,7 +956,7 @@ module LibSip_Templates
		template Via mw_Via(template ViaBody p_viabody) :=
		{
		  fieldName := VIA_E,
		  viaBody:= ? //*  superset(p_viabody)
		  viaBody:= superset(p_viabody)
		}
		
		template CallId mw_CallId_any :=
@@ -993,7 +1012,7 @@ module LibSip_Templates
		template RecordRoute mw_recordroute (template RouteBody p_routeBody):=
		{   
			fieldName := RECORD_ROUTE_E,
			routeBody := ? //*  superset(p_routeBody)
			routeBody := superset(p_routeBody)
		};
		
		template Route mw_route (template RouteBody_List p_routeBody):=
@@ -2674,7 +2693,7 @@ group SDP_Templates {
    	template SDP_Message m_SDP_encrypted(SDP_media_desc p_media, in SipUserProfile p_userprofile) 
    		modifies m_SDP
    		:= {
    			protocol_version := 1, //*  v=1 unacceptable version of SDP
    			protocol_version := 0,
    			bandwidth := {{PX_SIP_SDP_b_modifier, PX_SIP_SDP_b_bandwidth}}
    		};
    }//* end group modified_templates