I'm facing a problem when try to registering an DN and logging in an agent in my agent desktop (still in developing). Here's what I've got from my debugging:
'EventRegistered' ('53')
message attributes:
AttributeThisDN [str] = "6145"
AttributeReasons [bstr] = KVList:
'ReasonCode' [int] = 2
AttributeExtensions [bstr] = KVList:
'AgentStatus' [int] = 4
'AgentStatusTimestamp' [int] = 1435626052
'AgentStatusReliability' [int] = 0
'AgentLoginTimestamp' [int] = 1435626052
'AgentLoginReliability' [int] = 0
'AgentSessionID' [str] = "NEMK2P1R2P40DBSGH4T7K87AEK0001C6"
'AgentWorkMode' [int] = 3
'mwl' [int] = 0
'fwd' [str] = "off"
'status' [int] = 0
AttributeEventSequenceNumber [long] = 4615
[color=red]AttributeAgentID [str] = "1826"[/color]
AttributeReferenceID [int] = 1
Time = ComplexClass(TimeStamp):
AttributeTimeinuSecs [int] = 479000
AttributeTimeinSecs [int] = 1435627601
AttributeCustomerID [str] = "Resources"
AttributeAddressType [int] = 2 [Position]
Event registered
'EventError' ('52')
message attributes:
AttributeEventSequenceNumber [long] = 4616
AttributeCustomerID [str] = "Resources"
Time = ComplexClass(TimeStamp):
AttributeTimeinuSecs [int] = 548000
AttributeTimeinSecs [int] = 1435627601
AttributeErrorCode [int] = 620
AttributeThisDN [str] = "6145"
AttributeReferenceID [int] = 2
EventError
Problem 1:
The attribute agent ID for Agent2 is 1826, but when I change to Agent1, it's still 1826 (The result above are generated by using Agent1).
Problem 2:
I'm not sure the DN is registered successfully, but based on the result I got I assumed it is. When come to logging an agent, it failed. Any solution on the problem?

Here's my code and I'm not sure what goes wrong:
#region Registering a DN
RequestRegisterAddress requestRegisterAddress = RequestRegisterAddress.Create(thisDN, RegisterMode.ModeShare,
ControlMode.RegisterDefault, AddressType.DN);
IMessage reqRegAddressResponse = tServerProtocol.Request(requestRegisterAddress);
Console.WriteLine(reqRegAddressResponse.ToString());
switch (reqRegAddressResponse.Id)
{
case EventRegistered.MessageId: Console.WriteLine("Event registered\n"); break;
case EventUnregistered.MessageId: Console.WriteLine("Event unregistered\n"); break;
}
#endregion
#region Logging in an Agent
RequestAgentLogin requestAgentLogin = RequestAgentLogin.Create(thisDN, AgentWorkMode.AfterCallWork);
requestAgentLogin.AgentID = GlobalVariables.spalLoginID;
IMessage reqAgentLoginResponse = tServerProtocol.Request(requestAgentLogin);
Console.WriteLine(reqAgentLoginResponse.ToString());
switch (reqAgentLoginResponse.Id)
{
case EventACK.MessageId: Console.WriteLine("EventACK, Endpoint={0}", reqAgentLoginResponse.Endpoint); break;
case Genesyslab.Platform.Voice.Protocols.TServer.Events.EventError.MessageId: Console.WriteLine("EventError"); break;
}
Or is it because of the endpoint connection?