Commit 92843155 authored by rennoch's avatar rennoch
Browse files

changes due to mantis issues

extended comments
parent 781e622d
Loading
Loading
Loading
Loading
+74 −63
Original line number Diff line number Diff line
@@ -1917,18 +1917,30 @@ group SDPOperations{
	}

	/**
	*  @desc modify media/attribute direction
	 * 
	 * @desc 	copies SDP message elements from remote to local component variable: 
	 * 				- bandwidth
	 * 				- session version (will be incremented)
	 * 				- media list
	 * 			modify the direction attribute of an SDP media list entry within an SDP message (vc_sdp_local)
	 * @param 	p_medianum 		list position number of the media (if value 0 identifies first media list element)
	 * @param 	p_direction		the new direction attribute to be included in the media entry
	 * @verdict 
	 */
	function f_SIP_modMediaDirection(integer p_medianum, template SDP_attribute p_direction) runs on SipComponent
	{
		var boolean v_set_direction;
		var integer v_mn, v_cn := 0, i, j, k :=0;
		var SDP_attribute_list v_mediaAttributes := {};
		f_copy_SDP(); 
		//increase session version
		var boolean v_set_direction; // flag indicates if direction attribute has been modified
		var integer v_mn := 0; 		 // length of media list (number of entries)
		var integer v_cn := 0; 		 // number of attributes of a media entry
		var integer i, j, k := 0;
		var SDP_attribute_list v_mediaAttributes := {}; // collect the media attributes (to be assigned at end of function)
		
		f_copy_SDP(); // copy SDP session bandwidth and media list from remote to local component variable
		
		// increment session version
		vc_sdp_local.origin.session_version := int2str(str2int(vc_sdp_local.origin.session_version)+1);
		// if more than one codec, select the firs one
		
		// if more than one codec, select the first one
		v_mn:= sizeof(vc_sdp_local.media_list);

		if (p_medianum == 0) //specific media requested
@@ -1937,22 +1949,25 @@ group SDPOperations{
    		};
		if (p_medianum > 0) //specific media requested
    		{
			if (not(p_medianum > v_mn)) {v_mn := p_medianum}
    			if (not(p_medianum > v_mn)) 
    				{v_mn := p_medianum}
    		};
    		
		// handling of media list elements
		for (i :=0;  i < v_mn; i := i+1)
		{
			//for every single media (that is not omit)
			v_cn := 0;
			v_cn := 0; // initialize the number of attributes of the media list entry
		
			if (ispresent(vc_sdp_local.media_list)) //media_list is optional
			{						
						
				log("vc_sdp_local.media_list[i] ",vc_sdp_local.media_list[i]);
//				log("vc_sdp_local.media_list[i] ",vc_sdp_local.media_list[i]);
				if (ispresent(vc_sdp_local.media_list[i].attributes))
				{
					v_cn := sizeof(vc_sdp_local.media_list[i].attributes);
				};
				
				v_set_direction := false;
				
				//if (sizeof(vc_sdp_local.media_list[i].media_field.fmts)>1) 
				// select the first one
				for (j :=0; j<v_cn; j:=j+1)
@@ -1962,20 +1977,20 @@ group SDPOperations{
							or ischosen(vc_sdp_local.media_list[i].attributes[j].inactive)
							or ischosen(vc_sdp_local.media_list[i].attributes[j].sendrecv))
						{
    						v_mediaAttributes[k] := valueof(p_direction); v_set_direction := true;
							v_mediaAttributes[k] := valueof(p_direction); 
							v_set_direction := true;
						}
    				 	else 
				 		else // non-direction attributes will be copied
						{
    						// simple copy of attribute
							v_mediaAttributes[k] := vc_sdp_local.media_list[i].attributes[j];
    						log("axr new attribute index ", k);
							k := k+1;
						}
    				 
				}
				
				if (not v_set_direction) 
					{ v_mediaAttributes[k] := valueof(p_direction)};
				vc_sdp_local.media_list[i].attributes := v_mediaAttributes;
    				
				// }
			}
		}	 
@@ -2114,12 +2129,11 @@ group SDPOperations{
	*		 
	*/
	function f_copy_SDP() runs on SipComponent
	{//log("axr:begin  copySDP");
	{
		if (ispresent(vc_sdp_remote.bandwidth))
			{//log("axr:session bandwidth present");
				vc_sdp_local.bandwidth := vc_sdp_remote.bandwidth}
		else{//log("axr:session bandwidth not present");
			vc_sdp_local.bandwidth := {}};
				{vc_sdp_local.bandwidth := vc_sdp_remote.bandwidth}
			else {vc_sdp_local.bandwidth := {}};
			
		if (ispresent(vc_sdp_remote.media_list))
		{
                //			// cleaning of media before assignment	
@@ -2130,10 +2144,7 @@ group SDPOperations{
                //					vc_sdp_local.media_list[i] := omit ; 						  
                //				}			
                //			};		

//			log("axr:vc_sdp_local.media_list before assignment",vc_sdp_local.media_list);				
			vc_sdp_local.media_list := vc_sdp_remote.media_list;
//			log("axr:vc_sdp_local.media_list after assignment",vc_sdp_local.media_list);
		}
	}
}//end group SDPOperations
+46 −13
Original line number Diff line number Diff line
@@ -536,10 +536,10 @@ module LibSip_Templates language "TTCN-3:2005"//MRO
			privValueList := {p_privacy}
		};

		template Privacy m_Privacy_without(PrivacyValue p_privacy) := 
		template Privacy mw_Privacy_without(PrivacyValue p_privacy) := 
		{
			fieldName := PRIVACY_E,
			privValueList := ? //complement({*,p_privacy,*})//MRO
			privValueList := superset(complement(p_privacy))
		};
				
		template RAck m_RAck(integer p_responseNum, integer p_seqNumber, charstring p_method) :=
@@ -704,7 +704,7 @@ module LibSip_Templates language "TTCN-3:2005"//MRO
		template Privacy mw_Privacy_notId := 
		{
			fieldName := PRIVACY_E,
			privValueList := ?//complement({*,"id",*})//MRO
			privValueList := superset(complement("id"))
		};

		template Privacy mw_Privacy_user := 
@@ -722,7 +722,7 @@ module LibSip_Templates language "TTCN-3:2005"//MRO
		template Require mw_Require_not_100rel :=
		{		  
			fieldName := REQUIRE_E,
			optionsTags := ?//superset(complement(c_tag100rel))
			optionsTags := superset(complement(c_tag100rel))
		};
		
		template Require mw_require_100rel :=
@@ -2656,11 +2656,16 @@ group TemplatePreparationFunctions {
	 * @desc Return component variable of recordRoute header if vc_boo_recordRoute is true
	 * @return component variable of recordRoute header
	 */
	function f_recordroute() runs on SipComponent return template RecordRoute
//TODO: clarify if function defined on SipComponent can be used in templates
//	function f_recordroute() runs on SipComponent return template RecordRoute
//	{
//	  if (vc_boo_recordRoute)
//		  {return vc_recordRoute}
//	  else {return(omit)}
//	}
	function f_recordroute() return template RecordRoute
	{
	  if (vc_boo_recordRoute)
		  {return vc_recordRoute}
	  else {return(omit)}
		return(omit)
	}	
	
	/**
@@ -2668,10 +2673,38 @@ group TemplatePreparationFunctions {
	 * @desc Return component variable of Route header if vc_boo_route is true
	 * @return component variable of recordRoute header
	 */	
	function f_route() runs on SipComponent return template RecordRoute
//TODO: clarify if function defined on SipComponent can be used in templates
//	function f_route() runs on SipComponent return template RecordRoute
//	{
//	  if (vc_boo_route)
//		  {return vc_route} //*  TODO: Route header need to be in reverse order than RecordRoute, question of return value - RecordRoute 
//	  else {return(omit)}
//	}
	function f_route() return template RecordRoute
	{
		return(omit)
	}	
	/**
		* 
		* @desc Return RecordRoute (2nd parameter) if recordRoute indicator (1st parameter) is true
		* @return recordRoute header
		*/
	function f_recordroute_par(in boolean p_boo_recordRoute, in RecordRoute p_RecordRoute) return template RecordRoute
	{
			if (p_boo_recordRoute)
				{return p_RecordRoute}
			else {return(omit)}
	}
	
	/**
		* 
		* @desc Return Route (2nd parameter) if recordRoute indicator (1st parameter) is true
		* @return Route header
		*/	
	function f_route_par(in boolean p_boo_recordRoute, in Route p_Route) return template Route
	{
	  if (vc_boo_route)
		  {return vc_route} //*  TODO: Route header need to be in reverse order than RecordRoute, question of return value - RecordRoute 
			if (p_boo_recordRoute)
				{return p_Route} //*  TODO: Route header need to be in reverse order than RecordRoute, question of return value - RecordRoute 
			else {return(omit)}
	}