Channel Resource Deep Dive

A Channel Resource represents a single phone line. It contains all of the methods and properties that you would expect to be able to perform with a phone line. For example, you can answer incoming calls and dial out using an instance of a Channel Resource class.

Detecting What Answers the Phone

Voice Elements provides advanced options and features when dialing out.

Call Progress (Answering Machine vs Human)

It may be helpful to know if your call was connected to a human or an answering machine so that you can tailor your message accordingly. Call Progress analysis allows you to do just that. To enable call progress, you need to set the CallProgress mode to Analyze call before sending the call out:

m_ChannelResource.CallProgress = CallProgress.AnalyzeCall;
DialResult dialResult = ChannelResource.Dial("5551234567");
if(dialResult == DialResult.HumanDetected)
{
 m_VoiceResource.PlayTTS("This is a message for a human");
}
else
{
 m_VoiceResource.PlayTTS("This is a message for a machine");
}

Call progress “Listens” to the first few seconds of audio to determine if what answered was a human or a machine. Once it has determined what answered the call, it will return back a DialResult.

If it “hears” a short greeting (like “Hello”) it can assume that it was a human. If the greeting is longer (“Hello, you’ve reached the voicemail of Inventive Labs”) it assumes that a machine answered the call.

AnalyzeCall mode works well, but doesn’t always work in every scenario. For example, if someone answers the phone with a lot of background noise, it could incorrectly assign that as a human.

Connected Mode

When dialing, you will often want the phone call to return as soon as the phone is answered. To do this, you should set the CallProgress type on the ChannelResource to WaitForConnect. Under this mode, it will return as soon as the call is answered, or when it is rejected (caused by a carrier failure, bad number, etc). Below is an example of usage:

m_ChannelResource.CallProgress = CallProgress.WaitForConnect;
DialResult dialResult = m_ChannelResource.Dial("5551234567");
if(dialResult == DialResult.Connected)
{
 m_VoiceResource.Play("Hello, this call has now been connected");
}

We recommend using a call progress mode of connected, unless your application needs to determine if what answers the phone is a human or machine.

Beep Detector

The Beep Detector is actually used on the Voice Resource class. However, it can be used in conjunction with other call progress modes to provide for a better user experience. Please use this link for more information on the Beep Detector

First, it can be used to time answering machine messages more accurately. When using traditional call progress, you may know that a machine answered, but it’s difficult to know when you should begin playback of a message. By waiting for a “Beep”, you can begin (or restart) playback of your message to make sure the whole message gets left on the voicemail.

Second, it can be used to more accurately detect if a human or machine answers. For example, you can begin playing a message to the party that answers the phone as though it is a human. Once a beep is detected, you will then positively know that a machine answered the phone and can begin playback of the machine message.

During development of the beep detector, we tested tens of thousands of calls and found that we were 98.5% accurate in detecting humans vs machines using it. This is far more accurate than other Call Progress methodologies that at best can accurately detect humans vs machines around 90% of the time.

Dialing out on multiple lines

If you want to place multiple calls at once, you will need to create a thread for each call that you place. If you have never worked with multiple threads before, this may sound difficult, but it’s easy to do when you follow our examples. The trickiest part about creating multi-threaded applications, is synchronizing memory between the different threads. We recommend that each thread run in it’s own instance of a class, that way each thread can only read / modify the memory of it’s class. For example:

Add example:

Routing Calls (Transfers)

Background

Routing allows two different resources to speak and/or hear each other. For example, typically when a call comes in it is routed to a Voice Resource (which is accessible by accessing the VoiceResource property). This means that the Channel Resource can “hear” the files that you play, and the Voice Resource “Listens” to the audio that the Channel Resources sends. This is known as a full route. A half route is when one resource can “hear” another resource only.

Below is an example of routing together two channel resources. You would do this so both sides of a conversation can hear each other.

m_ChannelResource.RouteFull(m_OutboundChannelResource); /* This means that both voice resources can talk to each other and hear each other. */

Below is an example of performing a half route. This way, a Voice Resource can play to the Channel Resource. However, the Voice Resource can’t “hear” the Channel Resource (so entering digits would not work).

m_ChannelResource.RouteHalf(m_VoiceResource); /* This means that the channel resource can hear the voice resource. However, if the channel resource enters digits, it wouldn't detect them. */

Channel Resource Properties

Dnis

The DNIS property contains the number that the user dialed (or dialed number). For example, if a user dialed 555-123-4567 to call your application the DNIS would be 5551234567.

ANI

The ANI property contains the number that the user called in on. For example, if a user called in from the phone number 555-123-4567, the ANI would be 5551234567.

CallerId Name

The CallerIdName property contains the caller id name that is associated with the phone number.

Originating Phone Number

The OriginatingPhoneNumber property allows you to change the number that shows up when you dial a phone number. For example, you would use the following code to set the caller id to 555 123 4567:

m_ChannelResource.OriginatingPhoneNumber = "5551234567";

Drop Time

The drop time tells a Channel Resource when to disconnect a call. It can be useful to make sure that your calls don’t go over a certain time period.

Maximum Time

The Maximum Time is the amount of time that Channel Resource waits for a call to connect on a dial. The default is 30 seconds.

General Cause Code / General Cause Message

These properties contain the cause code and cause message for for why a call was disconnected. They are only populated when available.