VoiceUsing DNIS to Direct Calls

Using DNIS to Direct Calls

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Dialed Number Identification Service (or DNIS) is a standard that
most telephone companies in the United States use to identify the
number that was dialed. In this tutorial, we will learn how to use
DNIS information to direct callers to sub-menus in VoiceXML

DNIS Overview

This information is frequently used in call centers where callers
are directed to a particular operator group based on the dialed
number. Call centers that answer calls for many different customers
might also use the number to display the name of the company that
was dialed so that the customer support representative knows how to
answer the phone. In IVR and VoiceXML applications, DNIS information
can be used as an alias to direct callers to a specific sub-menu
rather than having them drill down a menu hierarchy.

Accessing the DNIS number in VoiceXML

VoiceXML includes a number of built-in session variables. One of
those is the DNIS number, which is accessible by specifying session.telephone.dnis
as the expr attribute of the <value> element. To
test this feature, I dragged the corresponding elements into Nuance
V-Builder as seen the example below.

The resulting VoiceXML file is listed and numbered below. If you
don’t have Nuance V-Builder installed, you can create the VoiceXML
dialog by copying the text below into a text editor and removing the
line numbers.

1  <?xml version="1.0" encoding="Cp1252"?>
3  <!DOCTYPE vxml PUBLIC '-//Nuance/DTD VoiceXML 1.0//EN' 
4  'http://voicexml.nuance.com/dtd/nuancevoicexml-1-2.dtd'>
6  <vxml version="1.0">
7    <meta name="Generator" content="V-Builder 1.2.30" />
8    <form id="form1">
9      <block name="block1">
10        You have dialed
11  <value expr="session.telephone.dnis" class="digits" />. 
12        Goodbye.
13        <exit />
14        <disconnect />
15      </block>
16    </form>
17  </vxml>

Lines 9 through 15 in the example above will say the number that you
dialed, exit the application, and disconnect.

Try it now on Voxeo: Call (408) 689-3992

Directing calls based on DNIS

I worked on a proposal for a local government organization
recently who wanted to provide access to schedules and allow
customers to register for services over the telephone and on the
Web. The organization had several facilities that each wanted to
have their own phone number, but still be accessible through the
same gateway. I recommended that they have the telephone company
assign several numbers to the same line so that the DNIS
information could be used to determine which facility was being

I call this technique “call destination routing.” To demonstrate
this functionality, I created an application that might be used in a
typical corporation that has separate departments and needs
separate, but direct phone access into the VoiceXML IVR system.
General requests would come through the main number, where callers
can select a department; or callers can dial a direct number
assigned to each of the departments that directs callers to the
corresponding department menu.

To set up this environment, I added a new application on Voxeo
and assigned four numbers to it:

  • 408-689-5161 for the Main number
  • 408-689-3989 for Customer Support
  • 408-689-3990 for Sales
  • 408-689-3991 for Accounting

Now that I had the numbers for each department in hand, I created
a VoiceXML document that contained one form and four menus. The form
starts on line 8 and directs the call to the menu that corresponds
with the DNIS number. If a number wasn’t matched, it’s assumed that
the caller dialed the main number, and is sent to the main_menu
from line 17 to line 21. 

So for example, if you dial 408-689-3989, you will hear,
"You have reached the customer service department. To connect
to another department, press nine". If you were to dial the
main number, 408-689-5161, you would hear, "Main menu. For
customer service, press one. For sales, press two. For accounting,
press three".

View the source code

If you want to try out this application, you can actually call
the numbers that are listed above and be directed to the main menu
or you will hear a message from the associated departmental menu.


Directing calls based on DNIS numbers can provide many possible
options for directing calls. Utilizing DNIS numbers in conjunction
with targeted marketing and promotional responses can improve
response rates, increase the number of calls that you can answer,
and reduce the number of calls that have to go through your regular
PBX or office phones. We will continue talking about call routing in
the next tutorial where we will discuss ANI or Automatic Number
Identification (also known as Caller ID).

About Jonathan Eisenzopf

Jonathan is a member of the Ferrum Group, LLC  which specializes in Voice Web consulting and training. He
has also written articles for other online and print publications
including WebReference.com
and WDVL.com. Feel free to send an
email to eisen@ferrumgroup.com
regarding questions or comments about the VoiceXML Strategy series,
or for more information about training and consulting

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories