我正在使用 MRCPRecog 通过 Asterisk-Java AGI(Asterisk 网关接口)运行一些操作。我在使用 MRCPRecog 的结果时遇到一个问题。
MRCPRecog返回的结果如下:
<result xmlns="http://www.w3.org/2000/xforms">
<interpretation grammar="4791780161253090829" confidence="99">
<input mode="speech">edirne</input>
<instance> Edirne;
</instance>
</interpretation>
</result>
我尝试用此代码检索:
String recogConfidence = channel.getVariable("RECOG_CONFIDENCE()");
String recogInput = channel.getVariable("RECOG_INPUT()");
但是
recogConfidence
是null
。
当我在 dialplan 中打印相同的值时:
same => n,Verbose(Instance: ${RECOG_INSTANCE()})
我可以正确地看到该值。
我也尝试过以下方法:
String recogInstance = channel.getVariable("RECOG_INSTANCE(1/1)")
String recogInstance = channel.getVariable("RECOG_INSTANCE(0/1)")
如何在我的 AGI 代码中获取该值?
在星号上,您可以使用
启用调试asterisk -r
agi set debug on
然后将您看到的内容与规格中的内容进行比较。它可能会发送完整变量或变量,具体取决于库版本。
如果发送正确,请检查库的源代码。