850 likes | 937 Views
Student Pages. http://www.clsp.jhu.edu/~anni/roster.html. Last Time: HTML Forms and Javascript If you haven’t finished the survey assignment, email us or come to office hours. 2/14: Programming Phones. This script says “hello world”. <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml">
E N D
Student Pages http://www.clsp.jhu.edu/~anni/roster.html
Last Time: HTML Forms and JavascriptIf you haven’t finished the survey assignment, email us or come to office hours
This script says “hello world” <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <exit/> </block> </form> </vxml>
This script says “hello world” <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <exit/> </block> </form> </vxml> Call 877-500-VXML and use my developer ID (540460366) and pin (0123) to preview it When you’re done, put this text into your Scratchpad and call VXML again and use your developer ID and pin to preview your own code
XML Disclaimer: This is an introduction to how an XML format works in general, this is not the particular syntax of a VoiceXML program or any other specific XML format
XML Opening and closing tags <myTellmeProgram> </myTellmeProgram>
XML Nested hierarchy of tags <myTellmeProgram> <introduction> <welcome>Hello World</welcome> <welcome>Hi, What’s up?</welcome> </introduction> <mainSection> … </mainSection> </myTellmeProgram>
XML Nested hierarchy of tags <myTellmeProgram> <introduction> <welcome>Hello World</welcome> <welcome>Hi, What’s up?</welcome> </introduction> <mainSection> … </mainSection> </myTellmeProgram> Level 1 (Document Root)
XML Nested hierarchy of tags <myTellmeProgram> <introduction> <welcome>Hello World</welcome> <welcome>Hi, What’s up?</welcome> </introduction> <mainSection> … </mainSection> </myTellmeProgram> Level 1 (Document Root) Level 2
XML Nested hierarchy of tags <myTellmeProgram> <introduction> <welcome>Hello World</welcome> <welcome>Hi, What’s up?</welcome> </introduction> <mainSection> … </mainSection> </myTellmeProgram> Level 1 (Document Root) Level 2 Level 3
XML Tag Attributes <myTellmeProgram> <introduction> <welcome type=“veryFirst”>Hello World</welcome> <welcome type=“casual”>Hi, What’s up?</welcome> </introduction> <mainSection> … </mainSection> </myTellmeProgram> Attribute Value
XML Comments <myTellmeProgram> <!-- this is the beginning of the introduction --> <introduction> <welcome type=“veryFirst”>Hello World</welcome> <welcome type=“casual”>Hi, What’s up?</welcome> </introduction> <mainSection> … </mainSection> </myTellmeProgram>
This script says “hello world” <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <exit/> </block> </form> </vxml>
VoiceXML (Programming Phones) <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> </vxml>
VoiceXML (Programming Phones) <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> </form> </vxml>
VoiceXML (Programming Phones) <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field> </field> </form> </vxml>
VoiceXML (Programming Phones) <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> </block> </form> </vxml>
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <exit/> </block> </form> </vxml> Audio (“Text to Speech”) Exit the application
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <exit/> </block> </form> </vxml> Note beginning and end tags
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <exit/> </block> </form> </vxml> This should be what’s in your Scratchpad now
Back to Javascript Just like you can embed Javascript into HTML, you can embed Javascript into VoiceXML https://studio.tellme.com/vxml2/ovw/javascript.html
Back to Javascript Just like you can embed Javascript into HTML, you can embed Javascript into VoiceXML https://studio.tellme.com/vxml2/ovw/javascript.html But we won’t do that in this class…
VoiceXML: <goto> tag <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <goto next=“#secondGreeting”/> </block> </form> </vxml>
VoiceXML: <goto> tag <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <goto next=“#secondGreeting”/> </block> </form> </vxml> Tag
VoiceXML: <goto> tag <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <goto next=“#secondGreeting”/> </block> </form> </vxml> Tag Attribute
VoiceXML: <goto> tag <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <goto next=“#secondGreeting”/> </block> </form> </vxml> Tag Attribute Value: Name of another form
VoiceXML: <goto> tag <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <goto next=“#secondGreeting”/> </block> </form> <form id=“secondGreeting”> <block> I found my second form. <exit/> </block> </form> </vxml>
VoiceXML: <goto> tag <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <goto next=“#secondGreeting”/> </block> </form> <form id=“secondGreeting”> <block> I found my second form. <exit/> </block> </form> </vxml> Attribute
VoiceXML: <goto> tag <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <goto next=“#secondGreeting”/> </block> </form> <form id=“secondGreeting”> <block> I found my second form. <exit/> </block> </form> </vxml> Value Attribute
VoiceXML: <goto> tag <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! <goto next=“#secondGreeting”/> </block> </form> <form id=“secondGreeting”> <block> I found my second form. <exit/> </block> </form> </vxml> Sounds like…: “Hello World I found my second form.”
Try this in your Scratchpad <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <block> Hello World! This dialogue goes on <goto next=“#secondGreeting”/> </block> </form> <form id=“secondGreeting”> <block> and on <goto next=“#secondGreeting”/> </block> </form> </vxml> 1. Guess what this script will do. 2. Edit Scratchpad 3. Call 1-877-500-8965
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field> </field> </form> </vxml>
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers”> </field> </form> </vxml>
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers”> </field> </form> </vxml> Attribute
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers”> </field> </form> </vxml> Value Attribute
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers” type=“boolean”> </field> </form> </vxml> Value Attribute
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers” type=“boolean”> <prompt> Do you like computers? </prompt> </field> </form> </vxml> New “prompt” tag: child of “field”
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers” type=“boolean”> <prompt> Do you like computers? </prompt> </field> </form> </vxml> Text to Speech: “Do you like computers?”
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers” type=“boolean”> <prompt> Do you like computers? </prompt> <filled> </filled> </field> </form> </vxml> New “filled” tag: child of “field”
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers” type=“boolean”> <prompt> Do you like computers? </prompt> <filled> Great, I got your answer. </filled> </field> </form> </vxml> Text to Speech: “Great, I got your answer”
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers” type=“boolean”> <prompt> Do you like computers? </prompt> <filled> Great, I got your answer. </filled> </field> </form> </vxml> Broken!
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers” type=“boolean”> <prompt> Do you like computers? </prompt> <filled> Great, I heard your answer. </filled> </field> </form> </vxml> Broken!
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers” type=“boolean”> <prompt> Do you like computers? </prompt> <filled> Great, I got your answer. </filled> </field> </form> </vxml> Broken!
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers”> <prompt> Do you like computers? </prompt> <filled> Great, I got your answer. </filled> </field> </form> </vxml> Since the predefined boolean grammar isn’t working, we’ll add one ourselves
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers”> <prompt> Do you like computers? </prompt> <grammar mode="dtmf" root="top” version="1.0" tag-format="semantics/1.0" type="application/srgs+xml"> <rule id="top"> <one-of> <item>1</item> <item>2</item> </one-of> </rule> </grammar> <filled> Great, I got your answer. </filled> </field> </form> </vxml> Press 1 or 2, record the answer Copy and paste this to receive any “1 or 2” input
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers”> <prompt> Do you like computers? </prompt> <grammar mode="dtmf" root="top” version="1.0" tag-format="semantics/1.0" type="application/srgs+xml"> <rule id="top"> <one-of> <item>1</item> <item>2</item> </one-of> </rule> </grammar> <filled> Great, I got your answer. </filled> </field> </form> </vxml>
VoiceXML: Form Blocks <vxml version="2.1” xmlns="http://www.w3.org/2001/vxml"> <form> <field name=“likeComputers”> <prompt> Do you like computers? </prompt> <grammar mode="dtmf" root="top” version="1.0" tag-format="semantics/1.0" type="application/srgs+xml"> <rule id="top"> <one-of> <item>1</item> <item>2</item> </one-of> </rule> </grammar> <filled> Great, I got your answer. </filled> </field> </form> </vxml> Input type will be a touch tone keyboard