Using ANI to Recognize Callers
In our last tutorial, we learned how to use the Dialed Number Identification Service (or DNIS) to direct callers to sub-menus in VoiceXML applications. In this follow-up tutorial, we will learn how to use Automatic Number Identification (ANI) to recognize callers.
Like DNIS, ANI is sent by a telephone company along with a request for connection, which rings your phone. ANI is more commonly known as "Caller ID". Many people have Caller ID boxes connected to their telephone line to identify who a caller is. ANI information is usually received by the time you hear the second ring. ANI information includes the phone number of the caller, and sometimes even their name.
Accessing the ANI number in VoiceXML
The VoiceXML example below builds on the example in the previous tutorial, the difference being that it will say the number that you are calling from:
1 <?xml version="1.0" encoding="Cp1252"?> 2 3 <!DOCTYPE vxml PUBLIC '-//Nuance/DTD VoiceXML 1.0//EN' 'http://voicexml.nuance.com/dtd/nuancevoicexml-1-2.dtd'> 4 5 <vxml version="1.0"> 6 <meta name="Generator" content="V-Builder 1.2.30" /> 7 <form id="form1"> 8 <block name="block1">You have dialed 9 <value expr="session.telephone.dnis" class="digits" />. 10 Your phone number is 11 <value expr="session.telephone.ani" class="digits" /> 12 Goodbye. 13 <exit /> 14 <disconnect /> 15 </block> 16 </form> 17 </vxml>
Lines 10 and 11 will play the value of the ANI number IF it was sent to and handled by the VoiceXML gateway. Remember that not all phone companies support ANI and some callers may opt to block this information, so you must be ready to handle this exception. You cannot count on the ANI number being available or accurate 100% of the time.
One way of identifying callers without making them enter some kind of registration number is to lookup their customer record by the ANI number. This technique should not be used when the information that will be given to callers is confidential or sensitive because other people may use the same phone that someone else registered.
In our next example, we will use the ANI number to route a call to a
specific form. If an ANI number was not sent or if the number
doesn't match a caller's profile, then we will ask them for their
Page 1 of 2