anchor.diff:  		#'3gpp_gx_CCR'{'Session-Id' = SId,
   				'Auth-Application-Id' = ?Gx_APPLICATION_ID,
   				'CC-Request-Type' = RequestType,
  -				'CC-Request-Number' = RequestNum} = Request, {eof, []}) ->
  -	try
  -		#'3gpp_gx_CCA'{'Session-Id' = SId,
  -				'Result-Code' = [?'DIAMETER_BASE_RESULT-CODE_SUCCESS'],
  -				'Origin-Host' = OHost, 'Origin-Realm' = ORealm,
  -				'Auth-Application-Id' = ?Gx_APPLICATION_ID,
  -				'CC-Request-Type' = RequestType,
  -				'CC-Request-Number' = RequestNum}
  -	catch
  -		_:Reason ->
  -			error_logger:warning_report(["Unable to process DIAMETER request",
  -					{origin_host, OHost}, {origin_realm, ORealm},
  -					{session_id, SId}, {request, Request}, {error, Reason}]),
  -			diameter_error(SId, ?'DIAMETER_BASE_RESULT-CODE_UNABLE_TO_COMPLY',
  -					OHost, ORealm, RequestType, RequestNum)
  -	end;
  -process_request2(_Address, _Port, _DiameterCaps, _Request, {error, Reason}) ->
  -	{error, Reason}.
  -
  -%% @hidden
  -parse_policy_char([#resource_char{name = "name", value = Value} | T], Acc)
  -		 when is_list(Value) ->
  -	parse_policy_char(T, Acc#'3gpp_gx_Charging-Rule-Definition'{
  -				'Charging-Rule-Name' = [Value]});
  +				'CC-Request-Number' = RequestNum} = _Request, {eof, []}) ->
  +	#'3gpp_gx_CCA'{'Session-Id' = SId,
  +			'Result-Code' = [?'DIAMETER_BASE_RESULT-CODE_SUCCESS'],
  +			'Origin-Host' = OHost, 'Origin-Realm' = ORealm,
  +			'Auth-Application-Id' = ?Gx_APPLICATION_ID,
  +			'CC-Request-Type' = RequestType,
  +			'CC-Request-Number' = RequestNum};
  +process_request2(_Address, _Port, #diameter_caps{origin_host = {OHost, _DHost},
  +		origin_realm = {ORealm, _DRealm}} = _DiameterCaps,
  +		#'3gpp_gx_CCR'{'Session-Id' = SId,
  +				'Auth-Application-Id' = ?Gx_APPLICATION_ID,
  +				'CC-Request-Type' = RequestType,
  +				'CC-Request-Number' = RequestNum} = Request, {error, Reason}) ->
  +	error_logger:warning_report(["Unable to process DIAMETER request",
  +			{origin_host, OHost}, {origin_realm, ORealm},
  +			{session_id, SId}, {request, Request}, {error, Reason}]),
  +	diameter_error(SId, ?'DIAMETER_BASE_RESULT-CODE_UNABLE_TO_COMPLY',
  +			OHost, ORealm, RequestType, RequestNum).
  +
  +-spec charging_rule(PolicyResList) -> Result
  +	when
  +		PolicyResList :: [#resource{}],
  +		Result :: [#'3gpp_gx_Charging-Rule-Install'{}].
  +%% @doc Pharse a list of PCRF polcies
  +charging_rule(PolicyResList) ->
  +	charging_rule(PolicyResList, []).
  +%% @hidden
  +charging_rule([#resource{name = Name} | T] = PolicyResList, Acc) ->
  +	[Chars] = [Chars || #resource{characteristic = Chars} <- PolicyResList],
  +	ChargingRuleInstall = case lists:keyfind("predefined",
  +			#resource_char.value, Chars) of
  +		false ->
  +			ChargingRuleDefinitions = parse_policy_char(Chars,
  +					#'3gpp_gx_Charging-Rule-Definition'{'Charging-Rule-Name' = Name}),
  +			#'3gpp_gx_Charging-Rule-Install'{
  +					'Charging-Rule-Definition' = ChargingRuleDefinitions};
  +		_ ->
  +			#'3gpp_gx_Charging-Rule-Install'{
  +					'Charging-Rule-Name' = [Name]}
  +	end,
  +	charging_rule(T, [ChargingRuleInstall | Acc]);
  +charging_rule([], Acc) ->
  +	Acc.
  +
  +%% @hidden
   parse_policy_char([#resource_char{name = "chargingKey", value = Value} | T],
   		Acc) when is_integer(Value) ->
   	parse_policy_char(T, Acc#'3gpp_gx_Charging-Rule-Definition'{
  
positive.code: 				'CC-Request-Number' = RequestNum} = Request,
  		{_, [#resource{} | _] = PolicyResList}) ->
  	try
  		ChargingRuleDefinitions = [parse_policy_char(Chars,
  				#'3gpp_gx_Charging-Rule-Definition'{}) ||
  				#resource{characteristic = Chars} <- PolicyResList],
  		ChargingRuleInstall = #'3gpp_gx_Charging-Rule-Install'{
  				'Charging-Rule-Definition' = ChargingRuleDefinitions},
  		#'3gpp_gx_CCA'{'Session-Id' = SId,
  				'Result-Code' = [?'DIAMETER_BASE_RESULT-CODE_SUCCESS'],
  				'Origin-Host' = OHost, 'Origin-Realm' = ORealm,
  
negative.code: 	end,
  	parse_policy_char(T, Acc#'3gpp_gx_Charging-Rule-Definition'{
  				'Flow-Information' = lists:map(F, FlowInfo)});
  parse_policy_char([_H | T], Acc) ->
  	parse_policy_char(T, Acc);
  parse_policy_char([], Acc) ->
  	Acc.
  
  