anchor.diff:  				Reply :: #diameter_cc_app_CCA{}.
   %% @doc Send CCA to Diameter client indicating a operation faliure.
   %% @hidden
  -send_error(SId, Subscriber, Balance, ResultCode, OHost, ORealm, AuthAppId, RequestType,
  +send_error(Request, SId, _Subscriber, _Balance, ResultCode, OHost, ORealm, AuthAppId, RequestType,
   		RequestNum, #state{address = Address, port = Port} = State) ->
   	Reply = #diameter_cc_app_CCA{'Session-Id' = SId, 'Result-Code' = ResultCode,
   			'Origin-Host' = OHost, 'Origin-Realm' = ORealm,
   			'Auth-Application-Id' = AuthAppId, 'CC-Request-Type' = RequestType,
   			'CC-Request-Number' = RequestNum},
   	Server = {Address, Port},
  -	ok = ocs_log:acct_log(diameter, Server, OHost, ORealm, accounting_event_type(RequestType),
  -			Subscriber, Balance, ResultCode),
  +	ok = ocs_log:acct_log(diameter, Server, accounting_event_type(RequestType), Request),
   	{reply, Reply, State}.
   
   -spec decrement_balance(Subscriber, Usage) -> Result
  
positive.code: 			{ok, Password, _, Balance, true} ->
  				case ocs:authorize(Subscriber, Password) of
  					{ok, _, _} ->
  						request1(RequestType, Request, SId, RequestNum, Subscriber, Balance, OHost, ORealm, State);
  					{error, _} ->
  						send_error(SId, Subscriber, Balance, ?'DIAMETER_BASE_RESULT-CODE_AUTHORIZATION_REJECTED',
  								OHost, ORealm, ?CC_APPLICATION_ID, RequestType,
  								RequestNum, State)
  				end;
  			{error, _} ->
  				send_error(SId, undefined, undefined, ?'DIAMETER_BASE_RESULT-CODE_AUTHORIZATION_REJECTED',
  					OHost, ORealm, ?CC_APPLICATION_ID, RequestType,
  						RequestNum, State)
  		end
  	catch
  		_:_ ->
  			send_error(SId, undefined, undefined,
  					?'DIAMETER_BASE_RESULT-CODE_UNABLE_TO_COMPLY', OHost, ORealm,
  					?CC_APPLICATION_ID, RequestType, RequestNum, State)
  	end.
  
  %% @hidden
  request1(?'DIAMETER_CC_APP_CC-REQUEST-TYPE_INITIAL_REQUEST' = RequestType,
  		_Request, SId, RequestNum, Subscriber, Balance, OHost, ORealm, State) ->
  	send_answer(SId, Subscriber, Balance, ?'DIAMETER_BASE_RESULT-CODE_SUCCESS',
  			OHost, ORealm, ?CC_APPLICATION_ID, RequestType,
  			RequestNum, State);
  request1(?'DIAMETER_CC_APP_CC-REQUEST-TYPE_UPDATE_REQUEST' = RequestType,
  
negative.code: 		end,
  		case decrement_balance(Subscriber, Usage) of
  			{ok, OverUsed, false} when OverUsed =< 0 ->
  				send_answer(Request, SId, Subscriber, Balance, ?'DIAMETER_BASE_RESULT-CODE_SUCCESS',
  						OHost, ORealm, ?CC_APPLICATION_ID, RequestType,
  						RequestNum, State);
  			{ok, _SufficientBalance, _Flags} ->
  				send_answer(Request, SId, Subscriber, Balance, ?'DIAMETER_BASE_RESULT-CODE_SUCCESS',
  						OHost, ORealm, ?CC_APPLICATION_ID, RequestType,
  						RequestNum, State);
  			{error, not_found} ->
  				error_logger:warning_report(["diameter accounting subscriber not found",
  						{module, ?MODULE}, {subscriber, Subscriber},
  						{origin_host, OHost}]),
  				send_error(Request, SId, Subscriber, Balance, ?'DIAMETER_BASE_RESULT-CODE_UNABLE_TO_COMPLY',
  						OHost, ORealm, ?CC_APPLICATION_ID, RequestType,
  						RequestNum, State)
  		end
  	catch
  		_:_ ->
  			send_error(Request, SId, Subscriber, Balance, ?'DIAMETER_BASE_RESULT-CODE_UNABLE_TO_COMPLY',
  					OHost, ORealm, ?CC_APPLICATION_ID, RequestType,
  					RequestNum, State)
  	end;
  request1(?'DIAMETER_CC_APP_CC-REQUEST-TYPE_TERMINATION_REQUEST' = RequestType,
  		Request, SId, RequestNum, Subscriber, Balance, OHost, ORealm, State) ->
  	F = fun() ->
  		case mnesia:read(subscriber, Subscriber, write) of
  			[#subscriber{disconnect = false} = Entry] ->
  