客户端挂断时使用answerOnBridge的Twilio JavaScript错误

时间:2019-04-25 17:55:24

标签: javascript twilio

我正在实施来自FE的呼出电话。

JS:

  return token().then(response => {
    Twilio.Device.setup(response.data.token, {enableRingingState: true, debug: true)
  })

Twilio.Device.connect({some params})

然后从BE开始,我正在这样做:

res = Twilio::TwiML::VoiceResponse.new do |response|
          dial = Twilio::TwiML::Dial.new(
            caller_id: call_resource.from_phone,
            action: action_url,
            answerOnBridge: true,
            timeout: 18
        )
          dial.number(call_resource.phone)
          response.append(dial)
        end

        res.to_s

并且action_url响应:

Twilio::TwiML::VoiceResponse.new(&:hangup).to_s

我也尝试了一个空的响应或拒绝,但它们不起作用

然后,当客户端挂断电话而没有接机时,我在JS控制台上收到此错误:

Setting up VSP
tslog.js:127 WSTransport.open() called...
tslog.js:127 Attempting to connect...
tslog.js:127 Closing and cleaning up WebSocket...
tslog.js:127 No WebSocket to clean up.
tslog.js:127 WebSocket opened successfully.
log.js:89 [PStream] Setting token and publishing listen
tslog.js:127 Stream is ready
twilioService.js:24 Ready
log.js:89 [Twilio.PeerConnection] signalingState is "have-local-offer"
log.js:89 [Twilio.PeerConnection] signalingState is "stable"
log.js:89 [Twilio.PeerConnection] iceConnectionState is "checking"
log.js:89 [Twilio.PeerConnection] iceConnectionState is "completed"
tslog.js:127 Received HANGUP from gateway
index.js:1446 Received an error from the gateway: {code: 31000, connection: Connection, message: "General Error"}
console.(anonymous function) @ index.js:1446
Log.log @ tslog.js:127
Log.error @ tslog.js:91
Connection._this._onHangup @ connection.js:225
emit @ events.js:136
PStream._handleTransportMessage @ pstream.js:128
emit @ events.js:136
WSTransport._this._onSocketMessage @ wstransport.js:132
tslog.js:127 Disconnecting...

0 个答案:

没有答案