Click or drag to resize

ChannelResourceDnis Property

This is the DNIS or the inbound number dialed of the last inbound call.

Namespace:  VoiceElements.Client
Assembly:  VoiceElementsClient (in VoiceElementsClient.dll) Version: 8.6.1.1
Syntax
public string Dnis { get; }

Property Value

Type: String
Remarks
If provided by the carrier or network, this is essentially the inbound number dialed by the party who placed the last inbound call. For more detail, see What is a DNIS. This is typically used for assigning blocks of inbound numbers to different scripts or call flows. in essence, you can write several applications and combine them into one, assigning different inbound numbers or blocks of numbers to each one in a single code base. you may also want to use DNIS for logging call activity in a database or even applying routing or script rules based on the number, area code, prefix that has been called. Also helpful for this type of call filtering and available on an inbound call are the ANI and the Caller ID Name.

DNIS's Come in Many Forms

You may find that carriers will only pass the last four or seven numbers as the DNIS. Also, in a SIP deployment, the DNIS will contain the originating SIP URI. It is always a good idea to run a test in your production environment, log the exact DNIS format coming in and adjust your code accordingly.

Examples
static void s_TelephonyServer_NewCall(object sender, VoiceElements.Client.NewCallEventArgs callArgs)
{
  // Get the DNIS and put in a variable
  string m_Dnis = callArgs.ChannelResource.Dnis;

  // Log the DNIS
  Log.Write("NewCall Arrival to {0}.", m_Dnis);

  // Here is how to use different call processing for DNIS's ro blocks
  switch (m_Dnis)
  {
    case "2135551212":
      RunScriptOne();
      break;
    case "4155551212":
    case "9165551212":
      RunScriptTwo();
      break;
    default:
      RunScriptThree();
      break;
  }
}
See Also