Author Message
FrancisMacDonald
Joined: Feb 21, 2014
Messages: 3
Offline
I am attempting to get a list of all device IDs for a particular session.

The documentation seems to suggest the best way to do this is by running:
ServiceProvider.GetDeviceIdList(SessionId);
, subscribing to the event and then using GetDeviceIdListEventArgs.getDeviceIdList.

However this throws an exception:
<exceptionClass>ch.ecma.csta.errors.InvalidDeviceStateException</exceptionClass>
<message>A Device Services monitor or listener is required to receive GetDeviceIdListEvents.</message>
<stackTrace>ch.ecma.csta.errors.InvalidDeviceStateException: A Device Services monitor or listener is required to receive GetDeviceIdListEvents.
at com.avaya.cmapi.extsvc.DeviceServicesImpl.getDeviceIdList(DeviceServicesImpl.java:986)

Further reading suggests that you have to use a DeviceServicesListenerAdapter to resolve this exception, however that class seems to only exist in the Java DMCC libraries.

I am confused as to why the method to query the device id list would exist, but the class used to collect the information from this method is missing.

So, I am just wondering if there something I am missing. Am I correct in my assumptions? If so, is there any other way to do this using the classes we have available in .NET?

Thanks all.
FrancisMacDonald
Joined: Feb 21, 2014
Messages: 3
Offline
Here's a class that will generate the exception on demand.

Register your session using RegisterSession().

class GenerateAesError
{
public void RegisterSession(string ipAddress, int port, string userName, string password, bool secure)
{
var serviceProvider = new ServiceProvider();
var intStatus = serviceProvider.StartApplicationSession(ipAddress, port, "Monitor", userName, password, 5, 180, "3.0", secure, null, true, true, null);
if (intStatus == 1)
serviceProvider.OnStartApplicationSessionResponse += OnStartApplicationSessionResponse;
}

private void OnStartApplicationSessionResponse(object sender, ServiceProvider.StartApplicationSessionResponseArgs e)
{
e.getServiceProvider.getXmlProcessor.OnXmlMessageReceivedEvent += OnGetXmlProcessorOnXmlMessageReceivedEvent;
e.getServiceProvider.OnGetDeviceIdListEvent += OnGetServiceProviderOnGetDeviceIdListEvent;
e.getServiceProvider.GetDeviceIdList(e.getSessionId);
}

void OnGetXmlProcessorOnXmlMessageReceivedEvent(object sender, XmlProcessor.XmlMessageReceivedEventArgs e)
{
Console.WriteLine(e.getMessageNicelyFormatted);
}

private void OnGetServiceProviderOnGetDeviceIdListEvent(object sender, ServiceProvider.GetDeviceIdListEventArgs e)
{
foreach (var deviceID in e.getDeviceIdList)
Console.WriteLine(deviceID);
}
}
AnthonyPritchett
Joined: Feb 12, 2007
Messages: 0
Offline
For .NET you need to start a SessionManagementStartMonitor which is in the ServiceProvider class.
AnthonyPritchett
Joined: Feb 12, 2007
Messages: 0
Offline
In the before mentioned monitor the SessionManagementEvents param is used to specify which events you want to receive (i.e. DeviceIdListEvents)
FrancisMacDonald
Joined: Feb 21, 2014
Messages: 3
Offline
Thanks Anthony.
Go to:   
Mobile view