【发布时间】:2018-06-04 12:56:07
【问题描述】:
import com.twilio.twiml.voice.Gather;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Say;
import com.twilio.twiml.TwiMLException;
public class Example {
public static void main(String[] args) {
Say say = new Say
.Builder("Welcome to Twilio, please tell us why you're calling").build();
Gather gather = new Gather.Builder().input("speech")
.action("/completed").say(say).build();
VoiceResponse response = new VoiceResponse.Builder().gather(gather)
.build();
try {
System.out.println(response.toXml());
} catch (TwiMLException e) {
e.printStackTrace();
}
}
}
在上面的代码中我想知道action方法的功能。action方法里面的“/completed”有什么用。
在 twilio 文档中它说这样的话
“此 TwiML 创建一个语音。当 Twilio 执行此 TwiML 时,应用程序将提示用户并接受最多 60 秒的语音。一旦呼叫者停止说话 5 秒钟,Twilio 会将她转录的语音发布到操作 url 。”
我从下面的链接得到了上面的代码
【问题讨论】:
标签: java speech-to-text twilio-api dialogflow-es