gpt4 book ai didi

javascript - 在 JavaScript 和 vxml 中使用多个转接号码

转载 作者:行者123 更新时间:2023-11-28 00:32:38 26 4
gpt4 key购买 nike

我正在尝试完成一项有趣的任务。在使用 VoiceXML 时,我想让主叫者调用一个号码,然后转接到号码 #1。如果调用者未接通(无应答),则目标号码将更改,然后尝试将调用者连接到第二个号码。

支持技术人员向我提供了一些信息,内容如下:

The best option would be define a list of numbers in JavaScript, if the transfer is unsuccessful, pop the next of the list, and repeat the transfer (which means the 'dest' for the transfer would be a variable).

但我不知道如何解决这个问题,到目前为止,我无法找到任何引用点可用于此目的。这可以通过使用 PHP 来实现吗?

如何将 JavaScript 添加到 VoiceXML,以允许我在转接标记上设置超时变量,然后在调用者未连接时循环显示号码?

最佳答案

假设您使用 VoiceXML 2.1 兼容平台,则必须使用类似 <transfer type="consultation" destexpr="myDestinationVariable" connecttimeout="20s" /> 的内容。 。

但是,connecttimeout属性不能是 JavaScript 表达式,它必须是时间文字。因此,如果超时不是一个常量,您需要动态生成 VoiceXML(使用 PHP 或其他东西)。

如果你可以有一个恒定的超时,你可以做类似的事情(未测试):

<?xml version="1.0" encoding="utf-8"?>
<vxml version="2.1" xml:lang="en-US" xmlns="http://www.w3.org/2001/vxml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<var name="destinations" expr="['5555551111', '5555551112', '5555551113']" />
<var name="currentDestination" expr="destinations.shift()" />

<form id="myForm">

<transfer name="transferResult" type="consultation" cond="currentDestination!=undefined" destexpr="currentDestination"
connecttimeout="20s">
<filled>
<if cond="transferResult=='noanswer'">
<assign name="currentDestination" expr="destinations.shift()" />
<clear />
</if>
</filled>

<catch event="connection.disconnect.transfer">
<!-- transfer OK -->
</catch>
</transfer>

<block>
<!-- No more numbers to try -->
</block>

</form>
</vxml>

关于javascript - 在 JavaScript 和 vxml 中使用多个转接号码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28834457/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com