Twilio 函数给出无效的内容类型错误

Twilio function giving invalid content-type error

我正在尝试向自动 phone 系统拨出电话,但我 运行 遇到了内容类型错误。我不明白内容类型错误是什么,所以如果有人能帮助我理解那会很棒。这是我现在拥有的代码。

exports.handler = function(context, event, callback) {

    const accountSid = 'AC5ca0acd115283b6d7ed38279';
    const authToken = 'not my real auth token';
    const client = require('twilio')(accountSid, authToken);

    client.calls
          .create({
             to: '+14805402416',
             from: '+18448345500',
             record: 'True',
             transcribe: 'True',
             sendDigits: 'wwww1wwww123#wwww1', // w's are .5 second delays to navigate pauses in the automated system 
                                               // '1' - English, '123#' - PIN #, '1' - Confirm PIN
           });

    callback(null, client);
};

您的构造中缺少 url 或 twiml。

https://www.twilio.com/docs/voice/api/call-resource

url The absolute URL that returns the TwiML instructions for the call. We will call this URL using the method when the call connects. For more information, see the Url Parameter section in Making Calls.

TwiML instructions for the call Twilio will use without fetching Twiml from url parameter. If both twiml and url are provided then twiml parameter will be ignored.