Commit 75393df0 authored by rennoch's avatar rennoch
Browse files

consider session attributes separatly from media list attributes

parent 247495c0
Loading
Loading
Loading
Loading
+51 −3
Original line number Diff line number Diff line
@@ -1879,6 +1879,22 @@ group SDPOperations{
    	return(false);
	}		
	
    /** 
    *  @desc check if message body include SDP (session level) attribute (2nd parameter)
    *        for any media 
    *		 
    */
    function f_check_session_attribute(in SDP_Message p_sdp, in template SDP_attribute p_attribute) runs on SipComponent return boolean {
		
        if (ispresent(p_sdp.attributes)) {
            for (var integer j:=0; j<sizeof(p_sdp.attributes); j:=j+1){			
                if (match(p_sdp.attributes[j],p_attribute)) {return(true);};
                };
        }
    	
        return(false);
    }
	
	/**
	 * 
	 * @desc 	identify an SDP direction attribute (session or first media attribute) in a SDP message and return its answer value
@@ -1899,7 +1915,7 @@ group SDPOperations{
		}

		// check if the selected attribute is included in the SDP offer (any of the media attributes)
		if (ispresent(p_sdp.media_list)) {
		else {if (ispresent(p_sdp.media_list)) {
			for (var integer j:=0; j<sizeof(p_sdp.media_list); j:=j+1){			
				if (ispresent(p_sdp.media_list[j].attributes)) {
					for (var integer i:=0; i<sizeof(p_sdp.media_list[j].attributes); i:=i+1){			
@@ -1908,7 +1924,8 @@ group SDPOperations{
						};
				}
				};
		}
		}};
		
		select (valueof(v_attribute))
		{
			case (mw_attribute_sendonly) {return(valueof(m_attribute_recvonly));}
@@ -2349,7 +2366,9 @@ group SDPOperations{
           { 
               vc_sdp_local.attributes[v_mn] := valueof(p_direction);
           };
		};    
		} 
		else 
		{vc_sdp_local.attributes[0] := valueof(p_direction)};    
    }
 
	/** 
@@ -2388,6 +2407,35 @@ group SDPOperations{
		f_SIP_modSessionDirection(v_direction_out); // handling of attribute in session		
	}
	
    /*
     * 
     * @desc check (from remote) and set (local) the session attribute lines on directions
     * @param p_direction_in incoming SDP attribute that need to be checked
     * @param p_direction_out SDP attribute that should be included in the SDP answer (to be returned to peer)
     * @return 
     * @verdict 
     */	
    function f_SIP_checksetSDPreqDirectionSession(template SDP_attribute p_direction_in, template SDP_attribute p_direction_out) runs on SipComponent
    {	var template SDP_attribute v_direction_out := p_direction_out;
        // check incoming SDP attribute
        if (not (ispresent(vc_request.messageBody) and (f_check_session_attribute(vc_request.messageBody.sdpMessageBody,p_direction_in)
            ))) 
            {if (
                match(mw_attribute_sendrecv,p_direction_in) and
                not(f_check_session_attribute(vc_request.messageBody.sdpMessageBody,mw_attribute_sendrecv) or
                f_check_session_attribute(vc_request.messageBody.sdpMessageBody,mw_attribute_sendonly) or
                f_check_session_attribute(vc_request.messageBody.sdpMessageBody,mw_attribute_recvonly) or
                f_check_session_attribute(vc_request.messageBody.sdpMessageBody,mw_attribute_inactive)
                )
                ){
                log("no direction attributes with expectation: ", p_direction_in)			
                }
                else {setverdict(fail);};};
        if (match(omit,p_direction_out))//not isvalue(v_direction_out))//MRO
            {v_direction_out := f_get_attribute_answer(vc_request.messageBody.sdpMessageBody, p_direction_in);}
        f_SIP_modSessionDirection(v_direction_out); // handling of attribute in session		
    }

	/*
		* 
		* @desc check (from remote) and set (local)the session/media attribute lines on directions