在 Twilio 语音中将参与者添加到会议时访问被拒绝

Access Denied when added participant to conference in Twilio Voice

我的 api 中有 2 个端点,一个用于创建 Voice conference,另一个用于将参与者添加到 conference

第一个是下面的并且工作正常。

module.exports.call = function (req, res) {
    let name = 'conf_' + req.body.CallSid

    const twiml = new twilio.twiml.VoiceResponse()
    const dial = twiml.dial({ callerId: req.configuration.twilio.callerId })

    dial.conference(
        {
            endConferenceOnExit: true,
            statusCallbackEvent: 'join',
            statusCallback: `/api/phone/call/${req.body.CallSid}/add-participant/${encodeURIComponent(req.body.phone)}`
        },
        name
    )

    res.set({
        'Content-Type': 'application/xml',
        'Cache-Control': 'public, max-age=0',
    })

    res.send(twiml.toString())
}

如你所见,statusCallback URL 指向下面的控制器,它应该将参与者添加到会议中。

module.exports.addParticipant = function (req, res) {

    console.log('addParticipant', req.params)

    if (req.body.CallSid === req.params.sid) {
        /* the agent joined, we now call the phone number and add it to the conference */
        conference = client.conferences('conf_' + req.params.sid)
        console.log('conference', conference)
        client
            .conferences('conf_' + req.params.sid)
            .participants.create({
                to: '+34XXXXXXXXX',
                from: req.configuration.twilio.callerId,
                earlyMedia: true,
                endConferenceOnExit: true
            }).then(participant => {
                res.status(200).end()
            })
            .catch(error => {
                console.error(error)
                res.status(500).end()
            })

    } else {
        res.status(200).end()
    }

}

但是,我收到以下错误:

[RestException [Error]: Access Denied] {
  status: 403,
  message: 'Access Denied',
  code: 20006,
  moreInfo: 'https://www.twilio.com/docs/errors/20006',
  detail: undefined
}

我已经为这个号码国家启用了地理权限,但仍然没有成功。

我错过了什么?

您确定在您的帐户中启用代理会议吗?

语音会议设置 https://www.twilio.com/console/voice/conferences/settings