anchor.diff:  			start = AccessRequest, tls_key = TLSkey, tls_cert = TLScert,
   			tls_cacert = TLScacert},
   	process_flag(trap_exit, true),
  -	{ok, ssl_start, StateData, 0}.
  +	{ok, ssl_start, StateData, 0};
  +init([Sup, diameter, ServerAddress, ServerPort, SessionID, AppId, ReqType, OHost,
  +			ORealm, DiameterRequest, _Options] = _Args) ->
  +	{ok, TLSkey} = application:get_env(ocs, tls_key),
  +	{ok, TLScert} = application:get_env(ocs, tls_cert),
  +	{ok, TLScacert} = application:get_env(ocs, tls_cacert),
  +	{ok, Hostname} = inet:gethostname(),
  +	case global:whereis_name({ocs_diameter_auth, ServerAddress, ServerPort}) of
  +		undefined ->
  +			{stop, ocs_diameter_auth_port_server_not_found};
  +		PortServer ->
  +			StateData = #statedata{sup = Sup, server_address = ServerAddress,
  +					server_port = ServerPort, session_id = SessionID,
  +					server_id = list_to_binary(Hostname), start = DiameterRequest,
  +					tls_key = TLSkey, tls_cert = TLScert, tls_cacert = TLScacert,
  +					app_id = AppId, auth_req_type = ReqType, origin_host = OHost,
  +					origin_realm = ORealm, port_server = PortServer},
  +			process_flag(trap_exit, true),
  +			{ok, ssl_start, StateData, 0}
  +		end.
   
   -spec ssl_start(Event, StateData) -> Result
   	when
  
positive.code: 			{<<0:512>>, <<0:512>>}
  	end.
  
  
negative.code: 			send_response(EapPacket, ?AccessChallenge,
  					RadiusID, [], RequestAuthenticator, Secret, RadiusFsm),
  			{next_state, client_hello, NewStateData, ?TIMEOUT}
  	end;
  eap_start(timeout, #statedata{start = DiameterRequest,
  		eap_id = EapID, session_id = SessionID, auth_req_type = AuthType,
  		origin_host = OH, origin_realm = OR, port_server = PortServer}
  		= StateData) ->
  	EapTtls = #eap_ttls{start = true},
  	EapData = ocs_eap_codec:eap_ttls(EapTtls),
  	case DiameterRequest#diameter_eap_app_DER.'EAP-Payload' of
  		<<>> ->
  			EapPacket = #eap_packet{code = request, type = ?TTLS,
  					identifier = EapID, data = EapData},
  			Answer = generate_diameter_response(SessionID, AuthType,
  					?'DIAMETER_BASE_RESULT-CODE_MULTI_ROUND_AUTH',
  					OH, OR, EapPacket),
  			gen_server:cast(PortServer, {self(), Answer}),
  			{next_state, client_hello, StateData, ?TIMEOUT};
  		EAPMessage ->
  			case catch ocs_eap_codec:eap_packet(EAPMessage) of
  				#eap_packet{code = response,
  						type = ?Identity, identifier = StartEapID} ->
  					NewEapID = (StartEapID rem 255) + 1,
  					NewEapPacket = #eap_packet{code = request, type = ?TTLS,
  							identifier = NewEapID, data = EapData},
  					Answer = generate_diameter_response(SessionID, AuthType,
  							?'DIAMETER_BASE_RESULT-CODE_MULTI_ROUND_AUTH',
  							OH, OR, NewEapPacket),
  					gen_server:cast(PortServer, {self(), Answer}),
  					NextStateData = StateData#statedata{eap_id = NewEapID},
  					{next_state, client_hello, NextStateData, ?TIMEOUT};
  				#eap_packet{code = request, identifier = NewEapID} ->
  					NewEapPacket = #eap_packet{code = response, type = ?LegacyNak,
  							identifier = NewEapID, data = <<0>>},
  					Answer = generate_diameter_response(SessionID, AuthType,
  							?'DIAMETER_BASE_RESULT-CODE_UNABLE_TO_COMPLY',
  							OH, OR, NewEapPacket),
  					gen_server:cast(PortServer, {self(), Answer}),
  					{stop, {shutdown, SessionID}, StateData};
  				#eap_packet{code = Code,
  							type = EapType, identifier = NewEapID, data = Data} ->
  					error_logger:warning_report(["Unknown EAP received",
  							{pid, self()}, {session_id, SessionID},
  							{eap_id, NewEapID}, {code, Code},
  							{type, EapType}, {data, Data}]),
  					NewEapPacket = #eap_packet{code = failure, identifier = NewEapID},
  					Answer = generate_diameter_response(SessionID, AuthType,
  							?'DIAMETER_BASE_RESULT-CODE_UNABLE_TO_COMPLY',
  							OH, OR, NewEapPacket),
  					gen_server:cast(PortServer, {self(), Answer}),
  					{stop, {shutdown, SessionID}, StateData};
  				{'EXIT', _Reason} ->
  					NewEapPacket = #eap_packet{code = failure, identifier = EapID},
  					Answer = generate_diameter_response(SessionID, AuthType,
  							?'DIAMETER_BASE_RESULT-CODE_UNABLE_TO_COMPLY',
  							OH, OR, NewEapPacket),
  					gen_server:cast(PortServer, {self(), Answer}),
  					{stop, {shutdown, SessionID}, StateData}
  			end
  	end.
  
  -spec client_hello(Event, StateData) -> Result
  