Twilio Client JS SDK 不显示拨出电话的振铃状态

Twilio Client JS SDK doesn't show ringing state for outgoing call

我正在按照 Dynamic Call Center with Python and Django 构建一个简单的 Django 呼叫中心。我正在这样处理拨出和拨入的电话:

@csrf_exempt
def CallTaskRouter(request):
    response = VoiceResponse()
    if 'phoneNumber' in request.POST:
        dial = response.dial(caller_id=TWILIO_NUMBER, answer_on_bridge='true')
        dial.number(request.POST['phoneNumber'], 
        status_callback_event='initiated ringing answered completed', 
        status_callback='https://my-url/status', 
        status_callback_method='GET')

    else:
        response = VoiceResponse()
        gather = response.gather(numDigits=1, action='https://my-url/support/enqueue', method="POST")
        gather.say("To speak to support, press one.", language='en-US')
        gather.say("To speak to sales, press two.", language='en-US')
        response.append(gather)

    return HttpResponse(
        str(response), content_type='application/xml; charset=utf-8'
    )

我想在客户的 phone 为 "ringing" 时通知用户,并且我想在来电后启动通话时间计数器得到回答。我使用 js 设置 "device" 并像这样发起调用:

device = new Twilio.Device(data.token, { 
            codecPreferences: ['opus', 'pcmu'],
            fakeLocalDTMF: true,
            enableRingingState: true,
        });

function callCustomer(phoneNumber) {
    numberToCall = phoneNumber;
    var params = { phoneNumber: phoneNumber};
    newConnection = device.connect(params); 
    newConnection.on('ringing', function(){
        initiateCallTime();
        console.log('Ringing')
    });
    };

即使我遵循了文档中的所有查询(answer_on_bridge='true',enableRingingState: true),连接也是从 "open"[=29= 开始的] 状态(我使用 connection.status() 函数找出)并且没有想到预期的状态值("pending", "connecting", "ringing"...)

我错过了什么吗?请帮助

如果您使用的是 Twilio 语音试用帐户,则不能使用“响铃”功能。参见 here

我为它创建了一个问题 here