Twilio webRTC call cuts off after exactly 10 minutes

﹥>﹥吖頭↗ 提交于 2019-12-11 01:45:57

问题


Using Twilio.js to record a call using webRTC. Works fine except at the 10 minute mark (exact!) the call hangs up. Max record time on TwiML is set to 7200secs.

The browser's console shows:
[Twilio.PeerConnection] signalingState is "stable" twilio.js:1843 [Twilio.PeerConnection] iceConnection State is "checking" twilio.js:1843 [Twilio.PeerConnection] iceConnection State is "connected" twilio.js:1843 [Twilio.PeerConnection] iceConnection State is "completed"

[After 10 minutes...]

twilio.js:1843 [Connection] Received HANGUP from gateway twilio.js:1843 [Connection] Disconnecting...

Chrome://webrtc-internals dump is useless: { "time": "11/28/2016, 4:35:48 PM", "type": "iceConnectionStateChange", "value": "ICEConnectionStateCompleted" }, { "time": "11/28/2016, 4:45:51 PM", "type": "stop", "value": "" },

Breaking in the twilio.js library I see that something sends a websocket message with payload: {"payload":{"callsid":"CA18974349269fb9f24977185c5deaa62c"},"type":"hangup","version":""}, which clearly causes the client to hang up the call.

Any ideas of why this may happen? It happens from both desktop and mobile browsers.


回答1:


Turns out Twilio is cutting off webRTC calls after 600 seconds. Not exactly sure why but I am guessing it has something to do --stale-nonce param for Turn Servers which coincidentally have a 600 sec timeout. Maybe?

EDIT with fix.

Eventually Twilio responded to our ticket and provided a workaround to enable WEBRTC 10+ min recording. IMHO it's quite hacky, but it works.

When the caller joins, pump an outbound API call into the conference with a that plays a silent mp3, either a really long one or a looped short one. This outbound leg is necessary to start the conference, and the silent mp3 will send RTP bidirectionally. Another rather similiar is to have the client dial into like this:

<Response>
   <Dial record="true" action="record_action">
    <Conference waitUrl="url_to_nearly_silent_audio_file">record</Conference>
  </Dial>
</Response>

You will need to manufacture a low volume WAV file for a loop in waitURL, in case a completely silent WAV file doesn't generate RTP packets.

https://www.twilio.com/docs/api/twiml/conference




回答2:


I know I am stating the obvious, but your answer is here:

[After 10 minutes...]

twilio.js:1843 [Connection] Received HANGUP from gateway

This may be because something in Twilio is timing out. Do you need to send a heartbeat to keep it alive?



来源:https://stackoverflow.com/questions/40856649/twilio-webrtc-call-cuts-off-after-exactly-10-minutes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!