anchor.diff:  %%
   init([ServiceName, ServerAddress, ServerPort, ClientAddress,
   		ClientPort, SessionId, OriginHost, OriginRealm,
  -		DestinationHost, DestinationRealm] = _Args) ->
  +		_DestinationHost, _DestinationRealm] = _Args) ->
   	process_flag(trap_exit, true),
   	{ok, idle, #statedata{service = ServiceName, session_id = SessionId,
   			server_address = ServerAddress, server_port = ServerPort,
   			client_address = ClientAddress, client_port = ClientPort,
  -			origin_host = OriginHost, origin_realm = OriginRealm,
  -			hss_realm = DestinationRealm, hss_host = DestinationHost}}.
  +			origin_host = OriginHost, origin_realm = OriginRealm}}.
   
   -spec idle(Event, From, StateData) -> Result
   	when
  
positive.code: %% @@see //stdlib/gen_fsm:StateName/3
  %% @private
  %%
  idle(#'3gpp_swx_RTR'{'User-Name' = [Identity]} = Request,
  		From, #statedata{session_id = SessionId, hss_host = HssHost,
  		hss_realm = HssRealm} = StateData) ->
  	[IMSI | _] = binary:split(Identity, <<$@>>, []),
  	F = fun() ->
  			mnesia:index_read(session, IMSI, #session.imsi)
  	end,
  	case mnesia:transaction(F) of
  		{atomic, [#session{id = AccessSessionId,
  				application = undefined, nas_address = NasAddress}]} ->
  			NewStateData = StateData#statedata{request = Request,
  					session_index = AccessSessionId,
  					imsi = IMSI, identity = Identity,
  					nas_address = NasAddress, from = From},
  			start_radius_disconnect(NewStateData),
  			ResultCode = ?'DIAMETER_BASE_RESULT-CODE_SUCCESS',
  			Reply = response(ResultCode, NewStateData),
  			{stop, shutdown,  Reply, NewStateData};
  		{atomic, [#session{id = AccessSessionId,
  				application = Application, nas_address = undefined,
  				nas_host = NasHost, nas_realm = NasRealm}]} ->
  			NewStateData = StateData#statedata{request = Request,
  					session_index = AccessSessionId,
  					imsi = IMSI, identity = Identity,
  					application = Application, nas_host = NasHost,
  					nas_realm = NasRealm, from = From},
  			send_abort(NewStateData),
  			{next_state, abort, NewStateData, ?TIMEOUT};
  		{atomic, []} ->
  			ResultCode = ?'DIAMETER_BASE_RESULT-CODE_UNKNOWN_SESSION_ID',
  			Reply = response(ResultCode, StateData),
  			{stop, shutdown,  Reply, StateData};
  		{aborted, Reason} ->
  			error_logger:error_report(["Failed user lookup",
  					{hss_host, HssHost}, {hss_realm, HssRealm},
  					{imsi, IMSI}, {identity, Identity},
  					{session, SessionId}, {error, Reason}]),
  			ResultCode = ?'DIAMETER_BASE_RESULT-CODE_UNABLE_TO_COMPLY',
  			Reply = response(ResultCode, StateData),
  			{stop, shutdown,  Reply, StateData}
  
negative.code: 			'Origin-Host' = OriginHost,
  			'Origin-Realm' = OriginRealm,
  			'Vendor-Specific-Application-Id' = #'3gpp_swx_Vendor-Specific-Application-Id'{
  					'Vendor-Id' = ?IANA_PEN_3GPP,
  					'Auth-Application-Id' = [?SWx_APPLICATION_ID]},
  			'Auth-Session-State' = ?'DIAMETER_BASE_AUTH-SESSION-STATE_NO_STATE_MAINTAINED'},
  	ok = ocs_log:auth_log(diameter, Server, Client, Request, Answer),
  	Answer.
  
  -spec send_abort(Sessions, StateData) -> StateData
  	when
  		Sessions :: [#session{}],
  		StateData :: #statedata{}.
  %% @doc Send DIAMETER Abort-Session-Reqest (ASR).
  %% @hidden
  send_abort([#session{id = AccessSessionId, application = ?STa_APPLICATION_ID,
  		identity = Identity, nas_host = NasHost, nas_realm = NasRealm} = H | T],
  		#statedata{origin_host = OriginHost, origin_realm = OriginRealm,
  		service = Service, sessions = Sessions} = StateData) ->
  	Request = #'3gpp_sta_ASR'{'Session-Id' = AccessSessionId,
  			'User-Name' = [Identity],
  			'Origin-Realm' = OriginRealm, 'Origin-Host' = OriginHost,
  			'Destination-Realm' = NasRealm, 'Destination-Host' = NasHost,
  			'Auth-Application-Id' = ?STa_APPLICATION_ID,
  			'Auth-Session-State' = ?'DIAMETER_BASE_AUTH-SESSION-STATE_NO_STATE_MAINTAINED'},
  	diameter:call(Service, ?STa_APPLICATION,
  			Request, [detach, {extra, [self()]}]),
  	NewStateData = StateData#statedata{sessions = [H | Sessions]},
  	send_abort(T, NewStateData);
  send_abort([#session{id = AccessSessionId, application = ?SWm_APPLICATION_ID,
  		identity = Identity, nas_host = NasHost, nas_realm = NasRealm} = H | T],
  		#statedata{origin_host = OriginHost, origin_realm = OriginRealm,
  		service = Service, sessions = Sessions} = StateData) ->
  	Request = #'3gpp_swm_ASR'{'Session-Id' = AccessSessionId,
  			'User-Name' = [Identity],
  			'Origin-Realm' = OriginRealm, 'Origin-Host' = OriginHost,
  			'Destination-Realm' = NasRealm, 'Destination-Host' = NasHost,
  			'Auth-Application-Id' = ?SWm_APPLICATION_ID,
  			'Auth-Session-State' = ?'DIAMETER_BASE_AUTH-SESSION-STATE_NO_STATE_MAINTAINED'},
  	diameter:call(Service, ?STa_APPLICATION,
  			Request, [detach, {extra, [self()]}]),
  	NewStateData = StateData#statedata{sessions = [H | Sessions]},
  	send_abort(T, NewStateData);
  send_abort([#session{id = AccessSessionId,
  		application = undefined, nas_address = NasAddress,
  		imsi = IMSI, identity = Identity} | T], StateData) ->
  	case pg2:get_closest_pid(ocs_radius_acct_port_sup) of
  		{error, Reason} ->
  			error_logger:error_report(["Failed to initiate session disconnect",
  					{module, ?MODULE}, {address, NasAddress},
  					{imsi, IMSI}, {identity, Identity},
  					{session, AccessSessionId}, {error, Reason}]);
  		DiscSup ->
  			DiscArgs = [Identity, AccessSessionId],
  			StartArgs = [DiscArgs, []],
  			supervisor:start_child(DiscSup, StartArgs),
  			send_abort(T, StateData)
  	end;
  send_abort([], StateData) ->
  	{next_state, abort, StateData, ?TIMEOUT}.
  
  