我正在尝试将我们正在创建的机器人与 api.ai 集成。我已经设法配置了几乎所有东西。我可以拨打电话,并听到我在 XML 文件中输入的文本。但是,当我回答时,没有记录输入。
我创建了一个谷歌语音 API 密钥并将其添加到“识别”中,但没有成功,它不需要我的语音输入。
这是我的 XML 代码示例:
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xml:lang="en-GB">
<property name="confidencelevel" value="0.3"/>
<property name="inputmodes" value="voice dtmf"/>
<form id="menu">
<field name="food">
<grammar xml:lang="en-US" root="food">
<rule id="food">
<one-of>
<item>!pizza
<tag>pizza</tag>
</item>
<item>!cupcake
<tag>cupcake</tag>
</item>
<item>!hamburger
<tag>hamburger</tag>
</item>
</one-of>
</rule>
</grammar>
<grammar mode="dtmf" root="food">
<rule id="food2">
<one-of>
<item>1</item>
<item>2</item>
<item>3</item>
</one-of>
</rule>
</grammar>
<prompt bargein="false">
What do you want?
Say pizza or press 1,
Say cupcake or press 2,
Say hamburger or press 3.
</prompt>
</field>
<filled>
<log label="Section: " expr="food" />
<script>
<![CDATA[ var ordered = "";
switch (food){
case "pizza" : ordered = "#pizza"; break;
case "1" : ordered = "#pizza"; break;
case "cupcake" : ordered = "#cupcake"; break;
case "2" : ordered = "#cupcake"; break;
case "hamburger" : ordered = "#hamburger"; break;
case "3" : ordered = "#hamburger"; break;
default: ordered = "#outOfStock"; break; } ]]>
</script>
<goto expr="ordered"/>
</filled>
</form>
<form id="pizza">
<block>
<!-- Selected pizza -->
<log label="Selection: PIZZA" />
<prompt>You selected: PIZZA</prompt>
<goto next="#menu" />
</block>
</form>
<form id="cupcake">
<block>
<!-- Selected cupcake -->
<log label="Selection: CUPCAKE" />
<prompt>You selected: CUPCAKE</prompt>
<goto next="#menu" />
</block>
</form>
<form id="hamburger">
<block>
<!-- Selected hamburger -->
<log label="Selection: HAMBURGER" />
<prompt>You selected: HAMBURGER</prompt>
<goto next="#menu" />
</block>
</form>
<form id="outOfStock">
<block>
<prompt>This is not a option.</prompt>
<goto next="#menu" />
</block>
</form>
<form id="goodbye">
<block>
<prompt>Goodbye</prompt>
</block>
</form>
</vxml>