Click or drag to resize

ChannelResourceTransferApplication Method

Transfers the Channel Resource to a different application on the same Telephony Server.

Namespace:  VoiceElements.Client
Assembly:  VoiceElementsClient (in VoiceElementsClient.dll) Version:
public void TransferApplication(
	string dnis,
	string transferData


Type: SystemString
The DNIS of the application that you would like to transfer to. Each client application logs into a Telephony Server and registers one or more DNIS's. You specify a DNIS registered to the application to which you would like to transfer the call here.
Type: SystemString
An arbitrary string value that you would like to send to the receiving application. This may be parsed in any way on the other end of the transfer and used to setup the call within the target applications logic accordingly.
The application tarnsfer feature is extremely powerful when used correctly. You may have separate code bases running on separate systems and move calls between them at any time using this method.

Tip: Use the Transfer Data parameter to its fullest

Being an arbitrary string, you can use delimiters to pass many data fields like phone number, caller id, data already received from the caller, or anything to help the target application process the call.

How to get the Transfer Data in the target application

The target application code will receive a New Call event for the DNIS you have specified and for which it is registered. Along with that, comes the data stored in the Transfer Data Property for the call in the target application. Simply get the property, parse and handle it as you would like.

Warning: You Must Dispose the Original Channel Once Transferred

You must call Dispose on the originating channel, preferreably in the finally block to ensure it is processed. If you do not do so, you could end up playing or receiving inputs from both channels at once. See the example below.

The example below shows a some code that dials, then if the Dial Result is connected it transfers to another application with DNIS of 4155551212 and sends a comma delimted list of data.
public void DialAndTransferCall()
  // To get a channel, you must first get a link to a Telephony Server.  You may need to pass a username password here.
  TelephonyServer m_TelephonyServer = new TelephonyServer();

  // Get your channel resource from the server
  ChannelResource m_ChannelResource = m_TelephonyServer.GetChannel();

  // Put the phone number in a variable
  string m_PhoneNumber = "2135551212";

  // Dial the call and put the result in a variable
  DialResult dialResult = m_ChannelResource.Dial(m_PhoneNumber);

  // Branch based on what happens to the call
  switch (dialResult)
    case DialResult.Connected:
        // Call connected, transfer the call
        m_ChannelResource.TransferApplication("4155551212", "2135551212, Outbound, Connected");
    case DialResult.NoAnswer:
      // Put code to move on or do what you want with a No Answer here
    case DialResult.Busy:
      // Put code to move on or do what you want with a Busy here
      // Handle all other dial results
See Also