2008/10/30
一、概述本文中的信息查詢例子演示了一個簡單的VoiceXML應(yīng)用。該例子VoiceXML腳本中用到的所有的標(biāo)簽如表1所示,表2是該例子的源代碼。圖四是該例子的呼叫流程。首先是用戶發(fā)起呼叫,應(yīng)用程序通過計算機(jī)合成語音(TTS)告訴用戶所有的選擇項并等待用戶的響應(yīng)。用戶的語音將由計算機(jī)根據(jù)語法標(biāo)簽
表 1. 本示例中用到的VoiceXML 標(biāo)簽

圖四:信息查詢例子呼叫流程圖

表 2. 信息查詢例子源代碼
<vxml version = "2.1" >
<form id="Choices">
<field name="choice">
<prompt>
Welcome to the Voice XML journey.
This tutorial demonstrates voice recognition.
Please choose from the followings:
to check the weather, say weather .
to check the stock quotes, say stock .
to get the direction information, say direction.
</prompt>
<grammar>
<![CDATA[ [
[weather dtmf-1]{<choice "weather">}
[stock dtmf-2]{<choice "stock">}
[direction dtmf-3]{<choice "direction">}
]
]]>
</grammar>
<noinput>
I didn't hear you. <reprompt/>
</noinput>
<nomatch>
I didn't quite understand you. <reprompt/>
</nomatch>
<filled>
<if cond="choice=='weather'">
<prompt>OK let's check the weather. Thank you. </prompt>
<elseif cond="choice=='stock'"/>
<prompt>OK let's check the stock quotes. Thank you. </prompt>
<else/>
<prompt>OK let's get the direction information. Thank you. </prompt>
</if>
</filled>
</field>
</form>
</vxml>
該示例程序已經(jīng)部署在http://evolution.voxeo.com。讀者可以下列幾個途徑來執(zhí)行該示例程序:
- 通過Skype客戶端撥打號碼 +99000936 9992001335, 免費呼叫。
- 通過Xlite(一個免費的VoIP軟件)或者任何VoIP終端呼叫 sip:9992001335@sip.voxeo.net
- 通過手機(jī)或者固定電話撥打號碼 +1 407 459 1963(美國電話號碼,收費)。
參考:
[1]http://www.w3.org/TR/voicexml21/
CTI論壇編輯