Twilio 试用帐户没有语音转文本功能
Twilio trail account do not have speech-to-text feature
我有一个 twilio trail 帐号。
我想知道trail账号是否关闭了语音识别功能
我尝试使用 Gather 动词来捕捉语音。但它不起作用。
谢谢!
这里是 Twilio 开发人员布道者。
我认为这里的问题是调用的 <Gather>
is not setup to hear the caller if they start speaking during the <Say>
部分。
您共享的代码中的 TwiML 看起来有点像这样:
<Response>
<Say>Welcome to Twilio, please tell us why you're calling</Say>
<Gather input="speech" timeout="5" action="https://f2b4fbc1.ngrok.io/asr/test"></Gather>
</Response>
因此,<Gather>
只有在 <Say>
完成后才开始收听。
相反,您应该 nest the <Say>
within the <Gather>
像这样制作 TwiML:
<Response>
<Gather input="speech" timeout="5" action="https://f2b4fbc1.ngrok.io/asr/test">
<Say>Welcome to Twilio, please tell us why you're calling</Say>
</Gather>
</Response>
此代码应如下所示:
Say say = new Say.Builder("Welcome to Twilio, please tell us why you're calling").build();
Gather gather = new Gather.Builder().input(Gather.Input.SPEECH).timeout(5).action("https://f2b4fbc1.ngrok.io/asr/test").say(say).build();
VoiceResponse response = new VoiceResponse.Builder().gather(gather).build();
如果有帮助请告诉我。
[编辑]
我还认为您在 return XML 时需要设置内容类型。我不是 Spring/Java 开发人员,但我认为您需要更改以下内容
@RequestMapping(method = RequestMethod.POST, value = "/recordTheSpeech", produces = MediaType.APPLICATION_XML_VALUE)
public ResponseEntity<String> recordTheSpeech() throws IOException {
Say say = new Say.Builder("Welcome to Twilio, please tell us why you're calling").build();
Gather gather = new Gather.Builder().input(Gather.Input.SPEECH).timeout(5).action("https://f2b4fbc1.ngrok.io/asr/test").say(say).build();
VoiceResponse response = new VoiceResponse.Builder().gather(gather).build();
return new ResponseEntity.ok().body(response.toXml());
}
我有一个 twilio trail 帐号。 我想知道trail账号是否关闭了语音识别功能
我尝试使用 Gather 动词来捕捉语音。但它不起作用。
谢谢!
这里是 Twilio 开发人员布道者。
我认为这里的问题是调用的 <Gather>
is not setup to hear the caller if they start speaking during the <Say>
部分。
您共享的代码中的 TwiML 看起来有点像这样:
<Response>
<Say>Welcome to Twilio, please tell us why you're calling</Say>
<Gather input="speech" timeout="5" action="https://f2b4fbc1.ngrok.io/asr/test"></Gather>
</Response>
因此,<Gather>
只有在 <Say>
完成后才开始收听。
相反,您应该 nest the <Say>
within the <Gather>
像这样制作 TwiML:
<Response>
<Gather input="speech" timeout="5" action="https://f2b4fbc1.ngrok.io/asr/test">
<Say>Welcome to Twilio, please tell us why you're calling</Say>
</Gather>
</Response>
此代码应如下所示:
Say say = new Say.Builder("Welcome to Twilio, please tell us why you're calling").build();
Gather gather = new Gather.Builder().input(Gather.Input.SPEECH).timeout(5).action("https://f2b4fbc1.ngrok.io/asr/test").say(say).build();
VoiceResponse response = new VoiceResponse.Builder().gather(gather).build();
如果有帮助请告诉我。
[编辑]
我还认为您在 return XML 时需要设置内容类型。我不是 Spring/Java 开发人员,但我认为您需要更改以下内容
@RequestMapping(method = RequestMethod.POST, value = "/recordTheSpeech", produces = MediaType.APPLICATION_XML_VALUE)
public ResponseEntity<String> recordTheSpeech() throws IOException {
Say say = new Say.Builder("Welcome to Twilio, please tell us why you're calling").build();
Gather gather = new Gather.Builder().input(Gather.Input.SPEECH).timeout(5).action("https://f2b4fbc1.ngrok.io/asr/test").say(say).build();
VoiceResponse response = new VoiceResponse.Builder().gather(gather).build();
return new ResponseEntity.ok().body(response.toXml());
}