技术 - 呼叫中心 - IVR/IVVR技术频道

基于VoiceXML的语音应用系统开发

2008-10-30 00:00:00   作者:   来源:   评论:0 点击:


2008/10/30

一、概述


  本文中的信息查询例子演示了一个简单的VoiceXML应用。该例子VoiceXML脚本中用到的所有的标签如表1所示,表2是该例子的源代码。图四是该例子的呼叫流程。首先是用户发起呼叫,应用程序通过计算机合成语音(TTS)告诉用户所有的选择项并等待用户的响应。用户的语音将由计算机根据语法标签

  中定义的规则进行自动识别。如果识别成功,标签中定义的变量“choice”被赋值。例如,如果用户说出“weather”,则计算机会把字符串“weather” 赋值给“choice”。然后在标签中定义的条件判断语句会根据变量“choice”的值把相应的语音播放给用户。如果用户没有响应,标签被执行并把“I didn’t hear you” 播放给用户,然后提示用户重新输入(标签)。同样,如果用户的语音没有被识别,标签 将被执行并告诉用户“I didn’t quite understand you” ,然后提示用户重新输入(标签)。

表 1. 本示例中用到的VoiceXML 标签

图四:信息查询例子呼叫流程图

表 2. 信息查询例子源代码

<?xml version="1.0" encoding="UTF-8"?>
<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>

  该示例程序已经部署在http://evolution.voxeo.com。读者可以下列几个途径来执行该示例程序:

  1. 通过Skype客户端拨打号码 +99000936 9992001335, 免费呼叫。

  2. 通过Xlite(一个免费的VoIP软件)或者任何VoIP终端呼叫 sip:9992001335@sip.voxeo.net

  3. 通过手机或者固定电话拨打号码 +1 407 459 1963(美国电话号码,收费)。
  读者可以访问 http://docs.voxeo.com/voicexml/2.0/frame.jsp?page=learningvoicexml.htm 获取更详细的VoiceXML示例和教程,该网站也提供免费注册,注册后可以免费发布自己的VoiceXML应用和其他人共享(就象本文中的例子一样)。

参考
[1]http://www.w3.org/TR/voicexml21/

CTI论坛编辑

相关阅读:

分享到: 收藏