我使用 Node v14.19.2 这是我的代码
const accountSid = process.env.ACCOUNT_SID;
const authToken = process.env.AUTH_TOKEN;
const client = twilio(accountSid, authToken);
const callResults = []
// Use the Twilio API client to initiate the call
for (let number of phoneNumbers) {
number = number.toString().trim()
number = number.startsWith('0') ? number.slice(1) : number
number = '+66' + number
const call = await client.calls.create({
url: 'https://demo.twilio.com/docs/classic.mp3',
to: number,
from: process.env.TWILIO_NUMBER, // Twilio phone number from which to make the call
timeout: 120
});
callResults.push(call)
}
当我接电话时,我总是得到相同的语音响应(我认为这是默认语音) 如何修复它以使用 url 语音响应
解决我的问题或找出解决方案
为了播放您声音的另一个 mp3,您必须在请求中指定一个新的 URL 参数。
我建议将您的 mp3 文件上传到 Twilio Assets。当您执行此操作时,您将获得该资产的 URL,然后您可以将其传递到您的请求中。