- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我想访问我的 Twilio 帐户中的转录下的转录生成的转录文本,因为我想将用户记录的响应作为文本进行比较
twiml.say('Hi there! Please speak your response after the beep,-Get ready!')
.record({
transcribe:true,
timeout:5,
maxLength:30,
transcribeCallback:'/recording',
action:'/recording'
});
app.post('/recording', (request,response) => {
if(transcriptionText=='yes'){
twiml.say('thank you for positive response');
}
response.type('text/xml');
response.send(twiml.toString());
});
最佳答案
这里是 Twilio 开发者布道者。
当使用transcription时与 <Record>
,一旦录音完成,调用将继续向 action
发出请求。同步属性。无论您从action
返回什么属性 URL 将控制调用。
然而,当您获得 transcribeCallback
的 Webhook 时,实际转录需要更多时间。 URL 它是在调用上下文之外异步完成的。因此,返回 TwiML 根本不会影响调用。
您将通过检查请求正文来获取转录文本。有很多parameters sent to the transcribeCallback
,但您正在寻找的是 TranscriptionText
。在你的 Node.js 应用程序中(对我来说它看起来像 Express),你可以通过调用 request.body.TranscriptionText
来获取它。 .
如果您确实想在收到转录回调时影响通话,则需要 use the REST API to modify the call and redirect it to some new TwiML .
请告诉我这是否有帮助。
[编辑]
从评论中我可以看到您正在尝试通过口头回复来插入部分通话。 transcribeCallback
由于需要完成转录,因此不会立即调用 URL,因此您需要 action
您在等待时可以将调用者转到的 URL。
因此,调整您的录音路线,为action
设置不同的端点。和transcribeCallback
:
app.post("/voice", (request, response) => {
var twiml = new twilio.TwimlResponse();
twiml.say('Hi there! Please speak your response after the beep,-Get ready!')
.record({
transcribe:true,
timeout:5,
maxLength:30,
transcribeCallback:'/transcribe',
action:'/recording'
});
response.type('text/xml');
response.send(twiml.toString());
})
然后,您的录制端点将需要在 Twilio 转录文本时让用户等待。
app.post('/recording', (request,response) => {
var twiml = new twilio.TwimlResponse();
// A message for the user
twiml.say('Please wait while we transcribe your answer.');
twiml.pause();
// Then redirect around again while we wait
twiml.redirect('/recording');
response.type('text/xml');
response.send(twiml.toString());
});
最后,当您收到转录回调时,您可以以某种方式从转录文本中找出路线,然后将实时调用重定向到一个新端点,该端点使用新信息进行调用。
app.post('/transcribe', (request, response) => {
var text = request.body.TranscriptionText;
var callSid = require.body.CallSid;
// Do something with the text
var courseId = getCourseFromText(text);
var accountSid = '{{ account_sid }}'; // Your Account SID from www.twilio.com/console
var authToken = '{{ auth_token }}'; // Your Auth Token from www.twilio.com/console
var client = new twilio.RestClient(accountSid, authToken);
// Redirect the call
client.calls(callSid).update({
url: '/course?courseId=' + courseId,
method: 'POST'
}, (err, res) => {
response.sendStatus(200);
})
});
关于node.js - 从 twilio 访问转录文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41195569/
有谁知道是否有可能将俄语输入转录为拉丁语? 有什么框架支持吗?我正在搜索字符集,但它不支持这种情况 提前致谢。 最佳答案 Map translit = new HashMap<>(); stati
我已经为一些包含希腊字母的字段建立了索引(例如Στεφαν)。就像在谷歌中一样,当我搜索 Stefan 时,我想找到这些文档。是否支持希腊语单词的音译/转录? 到目前为止,我已经尝试过 solr.AS
我想使用 pyspeech API 转录 mp3(语音到文本)。不过,我不知道这是否可行。 是吗?怎么办? 最佳答案 pyspeech 似乎只是常规 Windows 语音 API 的 python 接
我正在考虑设计一个软件平台,以帮助语言学家和人类学家研究以前未研究过的语言。统计数据显示,大约有 1,000 种语言从未被各自语言群体之外的人研究过。 我的目标是利用 TensorFlow 创建一个平
我抬头发现了这个 - https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/captioning-conc
我正在尝试在 Swift 中返回给定 DNA 链(字符串)的 RNA 互补序列。基本上,如果 DNA 有一个“T”,我会用“U”代替它。 我的代码是: func toRNA(DNA: String)
我可以像这样通过 AWS CLI 使用 AWS S3 服务: aws s3 cp FileToUpload.txt s3://MyBucketName/file.txt 如何使用 AWS 转录服务?通
在我的 iOS 应用程序中,我尝试使用 iOS 10 的最新功能 Speech API 来转录预先录制的音频。 多个来源,包括 documentation已声明语音 API(更具体地说是 SFSpee
我正在尝试使用 Microsoft Azure 的批量转录。关注官方documentation我想应该是这样的: 我将音频发送到服务 (POST) 获取结果。 (使用帖子的参数获取) 但我什么也没得到
我正在尝试使用 Microsoft Azure 的批量转录。关注官方documentation我想应该是这样的: 我将音频发送到服务 (POST) 获取结果。 (使用帖子的参数获取) 但我什么也没得到
我有一个 MP3 格式的长录音(小时以上)。以下是我设法从 FFMPEG 获得的关于音频文件的信息: [mp3 @ 000001fe666da320] Skipping 0 bytes of junk
我是一名优秀的程序员,十分优秀!