Automatic Number Identification

If your central office and telephone switches provide ANI information, your VoiceXML application can use the session.connection.remote.uri variable to access the caller's telephone number. You can use the ANI information to personalize the caller's experience or to log when various customers are most likely to call.

Note: If the ANI information is not received from the central office, the session.connection.remote.uri will have a value of “?”. Your application should verify that this value is defined before attempting to use it.

The following example shows an example of a VoiceXML application for a pay-per-use Customer Support line. For each incoming call, the VoiceXML application uses the ANI information to identify which customer to charge for the call.

<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xml:lang="en-US">
 <form id="ChargeCallers">
  <block>
   <!-- Obtaining the phone number from which the user phoned. -->
   <var name="ChargeCallToNum" expr="session.connection.remote.uri"/>
   <var name="TransferDestNum" expr="'tel:+18005551212'"/>
   <prompt>
    The phone number
    <say-as interpret-as="vxml:phone"><value expr="ChargeCallToNum"/></say-as>
    will be charged for this call to our support line.
   </prompt>
   <!-- Submit callers phone number and destination to servlet -->
   <submit namelist="ChargeCallToNum TransferDestNum"
           next="http://SupportLine.com/servlet/ChargeUserForCall"/>
  </block>
 </form>
</vxml>