developer.com
Search EarthWeb
CodeGuru | Gamelan | Jars | Wireless | Discussions
Navigate developer.com
Architecture & Design  
Database  
Java
Languages & Tools
Microsoft & .NET
Open Source  
Project Management  
Security  
Techniques  
Voice  
Web Services  
Wireless/Mobile
XML  
New
 
Technology Jobs  

   Developer.com Webcasts:
  The Impact of Coding Standards and Code Reviews

  Project Management for the Developer

  Defining Your Own Software Development Methodology

  more Webcasts...




Nominate the Best Products or Technologies for Developer.com Product of the Year!




Developer Jobs

Be a Commerce Partner














 


Few IT managers have the luxury of looking ahead more than a year or two.

Nicholas Carr, the author of "Does IT Matter?", takes readers on a trip one decade into the future to see how IT will change and what those changes mean for IT professionals, hardware and software vendors, and corporations of all sizes.

Register now for your free Internet.com membership to download your complimentary eBook. Membership will also give you access to:
eBook library Whitepapers Webcasts
Newsletters WinDrivers

Developer News -
Latest Linux Hits Networking Flaws    October 10, 2008
Metasploit 3.2 Offers More 'Evil Deeds'    October 8, 2008
'Thank You Apple. Seriously.'    October 8, 2008
The Buzz: BlackBerry App Store Seen Next    October 7, 2008
Free Tech Newsletter -

Build powerful business applications with the leading open source CRM platform from SugarCRM. Download SugarCRM Community Edition here.

Using ANI to Recognize Callers
By Jonathan Eisenzopf

Go to page: Prev  1  2  

Recognizing Callers Example

You can interact with this demo directly by calling the Voxeo assigned number, (650) 860-8895.

 Lines 8 through 16 contain the first form that is executed by the VoiceXML interpreter. On line 10, the <if> element checks for a session.telephone.ani number. If the value is null, it means that an ANI number was not sent. If this is the case, then line 13 sends the the caller to the enter_pin form on line 29. If the ANI session variable is not null, then the caller is forwarded to the check_number form on line 18. 

The check_number form on lines 18 through 27 matches the ANI number with an existing customer record. In this case, since we are not working with a dynamic script, we are looking for a specific set of numbers (one number in this example). If the ANI number matches the number on line 20, then the caller is forwarded to the jonathan form, which starts on line 43; otherwise, the caller is forwarded to the enter_pin form.

The enter_pin form is used if a call does not have an ANI number, or if the ANI number does not match an existing record. This second scenario will be common if registered users call from more than one phone number on a regular basis. For example, the user may have registered their home phone number, but they decide to call on their cell phone. In that case, we have the wrong number but a valid, registered caller; so we want to give them an opportunity to log in with their PIN code. When the caller enters the valid PIN number, 1234, they will be directed to the jonathan form.

The jonathan form plays a simple greeting and then exits. There's a special treat on lines 45-56 however, and something that we haven't seen up till now. The <script> element encapsulates ECMA (or Javascript) code, which allows programmers to create more interactive VoiceXML programs. This particular block of ECMA code creates a new instance of the Date class and evaluates the value of the getHour() ECMA Date method to set the timeOfDay variable, which tells the caller whether it is morning, afternoon or evening as part of the greeting.

1  <?xml version="1.0" encoding="Cp1252"?>
2  
3  <!DOCTYPE vxml PUBLIC '-//Nuance/DTD VoiceXML 1.0//EN' 
4  'http://voicexml.nuance.com/dtd/nuancevoicexml-1-2.dtd'>
5  
6  <vxml version="1.0">
7    <meta content="V-Builder 1.2.30" name="Generator" />
8    <form id="main" scope="dialog">
9      <block>
10        <if cond="session.telephone.ani != ''">
11          <goto next="#check_number" />
12          <else />
13          <goto next="#enter_pin" />
14        </if>
15      </block>
16    </form>
17  
18    <form id="check_number" scope="dialog">
19      <block>
20         <if cond="session.telephone.ani == '7034767080'">
21          <goto next="#jonathan" />
22          <else />
23          <goto next="#enter_pin" />
24        </if>
25  
26      </block>
27    </form>
28  
29    <form id="enter_pin" scope="dialog">
30   <field name="pin_number" type="digits?length=4">
31   <prompt>Please enter your four digit PIN number</prompt>
32      </field>
33  
34      <filled>
35        <if cond="pin_number == '1234'">
36          <goto next="#jonathan" />
37          <else />
38          <reprompt />
39        </if>
40      </filled>
41    </form>
42  
43    <form id="jonathan" scope="dialog">
44      <block>
45      <script><![CDATA[
46        var date = new Date;
47        var timeOfDay = '';
48        var hours = date.getHours();
49        if (hours < 12) {
50          timeOfDay = "morning";
51        } else if (date.getHours < 17) {
52          timeOfDay = "afternoon";
53        } else {
54          timeOfDay = "evening";
55        }
56      ]]></script>
57 Good <value expr="timeOfDay"/>, thanks for calling.
58     </block>
59    </form>
60  
61    
62  </vxml>

Conclusion

Now, if this were a dynamic application, I would have passed the ANI number to a backend script to look up the customer record rather than putting the check directly in the VoiceXML document. That might be something that we cover in another tutorial. The example above, however, should give you a good idea of what an ANI number is, how to access it using VoiceXML, and gives you an idea of how to use this information to recognize a caller automatically without asking them for an identification number.

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 services.

Go to page: Prev  1  2  


Tools:
Add www.developer.com to your favorites
Add www.developer.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed


Voice Archives

World's Fastest Object Database.
World's Fastest Object Database.
Generate Complete .NET Web Apps in Minutes . Download Iron Speed Designer today.
Improve How You Manage Information: Becoming a Better Project Manager. Exclusive eBook - Download Now.
Guide to Developing a Web Site. Best Practices, Tips and Strategies. Download Exclusive eBook Now.



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Tripwire Whitepaper: Seven Practical Steps to Mitigate Virtualization Security Risks
Internet.com eBook: The Pros and Cons of Outsourcing
Go Parallel Article: Scalable Parallelism with Intel(R) Threading Building Blocks
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES