anchor.diff:  				calendar:universal_time()
   		end,
   		Amounts = get_mscc(MSCC1),
  -		RfResponse = case rate(ServiceType, ServiceNetwork, Subscribers, Timestamp,
  +		Price = case rate(ServiceType, ServiceNetwork, Subscribers, Timestamp,
   				Address, Direction, interim, SessionId, Amounts) of
  -			{{MSCC2, ResultCode}, [], []} ->
  +			{{MSCC2, ResultCode, undefined}, [], []} ->
   				{ok, MSCC2, ResultCode};
  -			{{MSCC2, _ResultCode}, PLA, Amounts1} ->
  -				{ok, get_ref(SessionId), PLA, Amounts1, MSCC2};
  +			{{MSCC2, _ResultCode, undefined}, PLA, Amounts1} ->
  +				case match_tariff(get_ref(SessionId), Amounts1) of
  +					Prices when is_list(Prices) ->
  +						{ok, PLA, Prices, MSCC2};
  +					{error, missing_tariff} ->
  +						{ok, JSON} = case ServiceType of
  +							32251 ->
  +								post_request_scur(Server, Subscribers, SvcContextId,
  +										SessionId, PLA, Amounts1, [], {initial, a});
  +							Id when Id == 32260; Id == 32274 ->
  +								post_request_ecur(Server, Subscribers, SvcContextId,
  +										SessionId, PLA, Amounts1, [], Destination, {initial, a})
  +						end,
  +						{struct, RatedStruct} = mochijson:decode(JSON),
  +						{_, {_, ServiceElements}} = lists:keyfind("serviceRating", 1, RatedStruct),
  +						{ServiceRating, _} = map_service_rating(ServiceElements, SessionId),
  +						{ok, PLA, match_tariff(ServiceRating, Amounts1), MSCC2}
  +				end;
   			{error, Reason} ->
   				{error, Reason}
   		end,
  -		case RfResponse of
  -			{ok, ServiceRating, PLA1, Amounts2, MSCC3} ->
  -				case charge(Subscribers, ServiceRating, Amounts2, SessionId, interim) of
  +		case Price of
  +			{ok, PLA1, Prices1, MSCC3} ->
  +				case charge(Subscribers, SessionId, interim, Prices1) of
   					{ok, NewMSCC1, ResultCode1} ->
   						Container = build_container(MSCC1),
   						NewMSCC3 = build_mscc(NewMSCC1 ++ MSCC3, Container),
  
positive.code: 		Amounts = get_mscc(MSCC1),
  		RfResponse = case rate(ServiceType, ServiceNetwork, Subscribers, Timestamp,
  				Address, Direction, initial, SessionId, Amounts) of
  			{{MSCC2, ResultCode}, [], []} ->
  				{ok, MSCC2, ResultCode};
  			{{MSCC2, _}, PLA, Amounts1} when is_list(MSCC2), length(PLA) > 0 ->
  				case ServiceType of
  					32251 ->
  						{ok, JSON} = post_request_scur(Server, Subscribers, SvcContextId,
  
negative.code: 	end;
  initial_service_rating(Subscriber, [{SI, RG, _, _} | T], SCID, SInfo, Des, a, Acc) ->
  	Acc1 = case SI of
  		[] ->
  			[];
  		[N1] when is_integer(N1) ->
  			[{"serviceId", N1}]
  		end,
  	Acc2 = case RG of
  		[] ->
  			Acc1;
  		[N2] when is_integer(N2) ->
  			[{"ratingGroup", N2} | Acc1]
  	end,
  