190 likes | 579 Views
VOICEXML 简介. Voice Extensible Markup Language. VOICEXML 的特点: 是全球的标准,与平台无关 可以在内存中执行,效率很高 为语音门户制定的 可以实现真正意义上的交互. VOICEXML 的构成:. 一个简单的 FORM 例子: HELLO WORLD <?xml version="1.0"?> <vxml version="2.0"> <form> <block>Hello World!</block> </form> </vxml>. MENU 例子一. < menu> <prompt>
E N D
VOICEXML简介 Voice Extensible Markup Language VOICEXML的特点: 是全球的标准,与平台无关 可以在内存中执行,效率很高 为语音门户制定的 可以实现真正意义上的交互
VOICEXML的构成: 一个简单的FORM例子:HELLO WORLD <?xml version="1.0"?> <vxml version="2.0"> <form> <block>Hello World!</block> </form> </vxml>
MENU例子一 <menu> <prompt> Welcome home. Say one of: <enumerate/> </prompt> <choice next="http://www.sports.example.com/vxml/start.vxml"> Sports </choice> <choice next="http://www.weather.example.com/intro.vxml"> Weather </choice> <choice next="http://www.stargazer.example.com/voice/astronews.vxml"> Stargazer astrophysics news </choice> <noinput>Please say one of <enumerate/></noinput> </menu>
MENU例子二 <menu> <property name="inputmodes" value="dtmf"/> <prompt> For sports press 1, For weather press 2, For Stargazer astrophysics press 3. </prompt> <choice dtmf="1" next="http://www.sports.example.com/vxml/start.vxml"/> <choice dtmf="2" next="http://www.weather.example.com/intro.vxml"/> <choice dtmf="3" next="http://www.stargazer.example.com/astronews.vxml"/> </menu>
一个应用可以有多个页面组成 ROOT DOCUMENT LEAF DOCUMENT
Application root document (app-root.vxml) <?xml version="1.0"?> <vxml version="2.0"> <var name="bye" expr="'Ciao'"/> <link next="operator_xfer.vxml"> <grammar> <rule id="root" scope="public">operator</rule> </grammar> </link> </vxml>
Leaf document (leaf.vxml) <?xml version="1.0"?> <vxml version="2.0" application="app-root.vxml"> <form id="say_goodbye"> <field name="answer" type="boolean"> < prompt >Shall we say <value expr="application.bye"/>?</prompt> <filled> <if cond="answer"> <exit/> </if> <clear namelist="answer"/> </filled> </field> </form> </vxml>
一个FIELD的例子 <field name="lo_fat_meal" type="boolean"> <prompt> Do you want a low fat meal on this flight? </prompt> <help> Low fat means less than 10 grams of fat, and under 250 calories </help> <filled> <prompt> I heard <emphasis><value expr="lo_fat_meal"/></emphasis>. </prompt> </filled> </field>
一个OBJECT的例子 <object name="debit" classid="method://credit_card/gather_and_debit" data="http://www.recordings.example.com/prompts/credit/jesse.jar"> <param name="amount" expr="document.amt"/> <param name="vendor" expr="vendor_num"/> </object>
一个RECORD的例子 <record name="greeting" beep="true" maxtime="10s" finalsilence="4000ms" dtmfterm="true" type="audio/wav"> <prompt> At the tone, please say your greeting. </prompt> <noinput> I didn't hear anything, please try again. </noinput> </record>
一个SUBMIT的例子 <submit next="log_request" method="post" namelist="name rank serial_number" fetchtimeout="100s" fetchaudio="audio/brahms2.wav"/>
<transfer name="mycall" dest="tel:+358-555-1234567" transferaudio="elevator_music.wav" connecttimeout="60s" bridge="true"> <filled> <assign name="mydur" expr="mycall$.duration"/> <if cond="mycall == 'busy'"> <prompt> Sorry, our customer support team is busy serving other customers. Please try again later. </prompt> <elseif cond="mycall == 'noanswer'"/> <prompt> Sorry, our customer support team's normal hours are 9 am to 7 pm Monday through Saturday. </prompt> </if> </filled> </transfer>
FIA Form Interpretation Algorithm <form> <field name = “first” cond = “true”> </field> <field name = “second” cond = “false”> </field> <object name =”third” cond = “true”> <filled> <goto next = …/> </filled> </object> <field name = “forth” expr = “value”> </field> <filled> <clear namelist="first"/> </filled> </form>
VOICEXML的不足: 没有呼出的元素 没有会议的元素