【发布时间】:2020-12-22 18:35:44
【问题描述】:
我想发送一个带有recordingStatusCallback url 的号码。但是,当我收到 web-hook url 中的参数日志时,我没有看到我在 URL 中传递的参数。我将参数解析为 url-endcoded 格式。 下面的代码,我在url中发送了chunkStartNumber=18,但是在下面的日志中没有chunkStartNumber的痕迹
var recLenDivided=18;
let twiml = new Twilio.twiml.VoiceResponse();
twiml.record({
action:`https://xyz`,
method: 'GET',
finishOnKey: '5',
recordingStatusCallback:`http://xyz/hookFolder?chunkStartNumber=${recLenDivided}`
});
return callback(null, twiml);
}
解析器代码
const express = require ('express')
const bodyParser = require ('body-parser')
const app = express()
const PORT = 3000
app.use(express.static("public"))
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({extended:true}))
app.post("/hookFolder",(req, res) => {
console.log(req.body)
res.status(200).end()
})
日志
{ RecordingSource: 'RecordVerb',RecordingSid: 'RE', RecordingUrl: 'https://api.twilio.com/2010-04-01/', RecordingStatus: 'completed', RecordingChannels: '1', ErrorCode: '0', CallSid: 'CA', RecordingStartTime: 'Tue, 22 Dec 2020 18:09:44 +0000', AccountSid: 'AC', RecordingDuration: '9' }
【问题讨论】:
标签: twilio url-parameters recording