Programmable Voice

  1. Home
  2. Docs
  3. Programmable Voice
  4. FAQ
  5. What is a code example of ‘GetAllChannels()’?

What is a code example of ‘GetAllChannels()’?

         
List<ChannelResource> ChannelList = null;
try
{
    ChannelList = DialerEngine.TelephonyServer.GetAllChannels();
</pre>
<pre>    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);
</pre>
<pre>            AvailableOutboundCount++;
        }
    }
}
catch (Exception ee)
{
    Log.WriteException(ee, "Initialize Exception");
    if (ChannelList != null)
        DisposeChannels(ChannelList);
    throw ee;
}

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

Was this article helpful to you? Yes 14 No

How can we help?