- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要在交互后立即播放“稍等...”消息。我需要这个,因为我必须在返回给用户之前执行一些耗时的任务。应用程序流程是:
1) 播放欢迎消息 (TTS)2)收集用户语音(Rivr语音录制交互)3) 播放“稍等一下”TTS 消息,因为语音和相关业务流程的处理非常耗时(需要几秒钟)4)【耗时任务】5) 播放 (TTS) 过程结果并说再见。
一切正常,但在耗时的任务以及过程的合成结果之后立即播放“稍等一下”消息(我的意思是,用户说话并且必须等待),即使在我的对话框代码中它放置在“耗时任务”之前。由于某种原因,Rivr 或 VoiceXML 引擎正在缓冲同时播放的两条消息(3 和 5)。
如何让 Rivr “刷新”第 3 步并在录制交互后立即播放“稍等一下”消息,以便用户知道他应该稍等一下?
最佳答案
在 VoiceXML 中,每当执行提示时,它实际上都会被放入队列中。 VoiceXML 解释器仅在等待用户输入或退出时才会刷新提示队列(即播放它)。 Prompt Queueing and Input Collection 中详细描述了此行为。 VoiceXML W3C 文档的部分。
就您而言,您的提示在执行长时间操作之前已排队,并且仅在下一次交互期间播放。这是一种典型情况,经典 VoiceXML 解决方案在 Rivr 中具有同等功能。
fetchaudio
强制刷新提示队列VoiceXML 规范规定提示队列将被刷新...
when the interpreter begins fetching a resource (such as a document) for which fetchaudio was specified. In this case the prompts queued before the fetchaudio are played to completion, and then, if the resource actually needs to be fetched (i.e. it is not unexpired in the cache), the fetchaudio is played until the fetch completes.
因此,为了确保播放提示,只需在<submit>
上设置一个fetchaudio即可。用于获取长操作结果的元素。效果是播放“请稍候。”消息,然后循环播放 fetchaudio 中指定的文件,直到服务器返回结果。通常,您会使用声音来表明正在处理某些内容。
如果您不想在 VoiceXML 等待操作完成时听到任何声音,您可以提供一个静音的音频文件。另一个技巧是指定一个不存在的文件。这在某些 VoiceXML 平台下工作。 YMMV。
VoiceXML 可能如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
<form id="form">
<block>
<prompt>Please wait a moment.</prompt>
<submit fetchaudio="/audio/fetch.wav" method="post" next="/long-operation" />
</block>
</form>
</vxml>
使用 Rivr,它是:
context.getFetchConfiguration().getDocumentFetchConfiguration()
.setFetchAudio("/audio/fetch.wav");
Message message = new Message("wait-message",
new SpeechSynthesis("Please wait a moment."));
DialogueUtils.doTurn(message, context);
performLongOperation();
强制播放提示队列的另一个技巧是创建一个超时为 0 的虚拟交互。这会强制解释器播放消息。我们必须小心地在提示上禁用打断,否则 DTMF 输入可能会中断消息。以下是虚拟输入的示例:
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
<form id="form">
<field name="dummy">
<property name="timeout" value="0ms" />
<grammar src="builtin:dtmf/digits" />
<prompt>Please wait a moment.</prompt>
<filled>
<goto nextitem="submit" />
</filled>
<noinput>
<goto nextitem="submit" />
</noinput>
<nomatch>
<goto nextitem="submit" />
</nomatch>
</field>
<block name="submit">
<submit fetchaudio="audio/fetch.wav" method="post" next="/long-operation" />
</block>
</form>
</vxml>
这是 Rivr 的等效项:
DtmfRecognition dummyRecognition = new DtmfRecognition(new GrammarReference("builtin:dtmf/digits"));
SpeechSynthesis message = new SpeechSynthesis("Please wait a moment.");
Interaction interaction = OutputTurns.interaction("wait-message")
.addPrompt(dummyRecognition, message).build();
DialogueUtils.doTurn(interaction, context);
performLongOperation();
如果您想在应用程序中重用此模式,您可以创建一个函数:
private void forcePlayMessage(VoiceXmlDialogueContext context,
String messageName,
AudioItem... audioItems)
throws Timeout, InterruptedException {
DtmfRecognition dummyRecognition = new DtmfRecognition(new GrammarReference("builtin:dtmf/digits"));
Interaction interaction = OutputTurns.interaction(messageName)
.addPrompt(dummyRecognition, audioItems).build();
DialogueUtils.doTurn(interaction, context);
}
如果操作很长,使用Java可能是明智的FutureTask
类在后台处理您的请求,允许您的对话框每 X 秒向调用者发送消息,而不是阻塞 performLongOperation()
关于java - Rivr VoiceXML for Java 中的 "Wait a second"消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32670820/
我正在写一个 VoiceXML我们有语音语法和 DTMF 的应用程序语法。如果调用者是在特别嘈杂的环境中调用,我们需要禁用语音语法。有没有一种方法可以做到这一点而不涉及将整个表单复制到另一个表单并删除
有人联系我说有机会做 VoiceXML——我没有任何经验,但显然这可能没问题。但是,我对该技术进行了一些初步研究,它看起来很旧,从未获得太多关注等。但我无法弄清楚是什么技术(y,ies)取代了它。 V
我正在尝试构建一个接受输入的独立 VoiceXML 解析器,如下例所示 1 2 3 4 5
我正在尝试使用 VoiceXML(在 Nexmo 上)录制整个电话。 我可以分别进行录音或提供菜单提示和转接电话,但我不知道如何同时进行这两项操作。我想从头到尾录制通话,包括转接的通话部分。 我想 V
我正在尝试获取来电者输入的号码和记录文件。录制文件也会有哔声(dtmf)。 现在,我只能录制提示 + 键入,但无法在 voice.php 中输入“w”文本字符串。 在示例 voice.xml 文件中,
我正在尝试创建一个答录机。我正在使用 Nexmo。 我有两个号码:一个法国号码和一个美国号码(加利福尼亚州) 当我调用我的法国号码时,我的音频信息会保存在我的服务器上,我可以收听它。但是当我调用我的美
有谁知道有什么工具可以让我直观地运行和调试 VXML 应用程序?有大量的 VXML 开发工具,但它们都要求您在其中构建应用程序。 我有一个使用 JSP 生成 VXML 的现有应用程序,我正在寻找一种方
我有调用桥的应用程序。连接调用时,我希望我的语音 xml 输入分机号码播放 dtmf 音 3 次。如果可能的话,请问如何做到这一点? 最佳答案 接听电话时,您可以将 dtmf 作为录制的音频播放。一些
我试图找出是否有可能通过将开源项目的部分拼凑在一起来构建一个完整的 IVR 应用程序。是否有人使用非商业 VoiceXML 实现来构建支持语音的系统? 最佳答案 我过去曾尝试过 JVoiceXML 并
使用标签“data”我只能访问静态数据。相反,我想写一些类似的内容: “getElementsByTagName('field').item(0).nodeValue” 以便在插入后检索字段的值。 (
当我分别运行 JavaScript 和 VXML 代码时,它们工作正常。但是当我尝试通过 VXML 代码调用 JavaScript 函数时,它不起作用。请找到下面的 VXML 代码。请帮我解决这个问题
我的任务是研究这两种实现之间的差异,以便更好地理解两者在开发难度和功能集方面的差异,但我没有发现两者之间有任何清晰简洁的比较。 最佳答案 我认为您是在询问 VoiceXML、TwiML 和 Plivo
目前,我正在开发一个 ucma 3.0 vxml 应用程序。在 voicexml 文档中,我使用一个记录元素来获取调用者的录音,然后将录音发送到外部网络服务器并将其保存到 wav 文件中。 保存的 w
我是 voiceXML 的新手,我正在尝试使用 evolution.voxeo.com运行简单的 XML 代码。根据their website ,我们可以以多部分格式发布录制的音频。所以这是我的 XM
我需要在交互后立即播放“稍等...”消息。我需要这个,因为我必须在返回给用户之前执行一些耗时的任务。应用程序流程是: 1) 播放欢迎消息 (TTS)2)收集用户语音(Rivr语音录制交互)3) 播放“
我的 VoiceXML 提供程序 Nexmo 似乎无法处理根 vxml 中的 xml:lang="es-ES" 属性(这是由 Rivr 使用context.setLanguage("es-ES") 在
我目前正在使用 UCMA 4.0 并实现一个基于 IVR 的示例。当我运行示例时,它给出“不支持指定的方法。” 我写了下面的代码来播放 IVR on call。 public void playIVR
我使用 UCMA 3.0 编写了一个基本的 IVR 系统。它接收来电,然后使用以下类执行 VXML 脚本: Microsoft.Rtc.Collaboration.AudioVideo.VoiceXm
我是一名优秀的程序员,十分优秀!