What is a Code Example of 'GetAllChannels()'?

⌘K
  1. Home
  2. Programmable Voice
  3. FAQ
  4. What is a Code Example of ‘GetAllChannels()’?

What is a Code Example of ‘GetAllChannels()’?

 

In this code example, ManagedChannel is a class that maintains the state of an individual channel.

         
List<ChannelResource> ChannelList = null;
try
{
    ChannelList = DialerEngine.TelephonyServer.GetAllChannels();
    for (int i = 0; i < ChannelList.Count; i++)
    {
        ManagedChannel managedChannel = new ManagedChannel(ChannelList[i]);
        managedChannel.Id = i + 1;
        if (managedChannel.Type == ChannelType.MsiChannel)
        {
            MsiChannelList.Add(managedChannel);
        }
        else if (managedChannel.Type == ChannelType.SipChannel || managedChannel.Type == ChannelType.T1Channel || managedChannel.Type == ChannelType.DigitalChannel)
        {
            OutboundChannelList.Add(managedChannel);
            AvailableOutboundCount++;
        }
    }
}
catch (Exception ee)
{
    Log.WriteException(ee, "Initialize Exception");
    if (ChannelList != null)
        DisposeChannels(ChannelList);
    throw ee;
}

For more information, see GetAllChannels Method in the Voice Elements Developer Help site.

Was this article helpful to you? No Yes 16

How can we help?