Twilio Video - “Failed to connect to room with error: SIP error 403”

∥☆過路亽.° 提交于 2019-12-01 06:26:51

问题


I get this error “Failed to connect to room with error: SIP error 403”, when I try to make a call from one iOS client to another while using twilio video sdk for swift.

I am able to make a call (Xcode to mobile & mobile to mobile) when I use manually generated twilio access tokens (obtained from Twilio console) and insert them in the client app. However, I get the above error when I try to get the token programatically from Twilio via NodeJS server using the below server code provided by Twilio. The error persists even when using secure connection (HTTPS) to obtain the token from Twilio.

The below is the log from Xcode,

2017-01-13 07:30:47.625 VideoCall[39299:25726155] Attempting to connect to room Optional("testRoom")
2017-01-13 07:30:47.625 VideoCall[39299:25726155] provider:didActivateAudioSession:
2017-01-13 07:30:51.255 VideoCall[39299:25726155] Failed to connect to room with error: SIP error 403
2017-01-13 07:30:51.272 VideoCall[39299:25726155] provider:didDeactivateAudioSession:
2017-01-13 07:32:52.168 VideoCall[39299:25729470] ERROR:TwilioVideo:[Signaling]:RESIP::TRANSPORT: Got TLS read ret=0 error=6 error:00000006:invalid library (0):OPENSSL_internal:public key routines

NodeJS server code (provided by Twilio)

var express     = require('express');
var router      = express.Router();
var AccessToken = require('twilio').AccessToken;

// Substitute your Twilio AccountSid and ApiKey details
var ACCOUNT_SID = 'accountSid';
var API_KEY_SID = 'apiKeySid';
var API_KEY_SECRET = 'apiKeySecret';
var TWILIO_CONFIGURATION_SID = 'twilioConfigurationSid';

router.get('/getTwilioVideoAccessToken', function(req, res, next) {
    // Create an Access Token
    var accessToken = new AccessToken(
      ACCOUNT_SID,
      API_KEY_SID,
      API_KEY_SECRET
    );

      var identity = 'example-user'; 

    // Set the Identity of this token
    accessToken.identity = identity;

    // Grant access to Conversations
    var grant = new AccessToken.ConversationGrant();
    grant.configurationProfileSid = TWILIO_CONFIGURATION_SID;
    accessToken.addGrant(grant);

    // Serialize the token as a JWT
    var jwt = accessToken.toJwt();
    console.log(jwt);
    res.json({"token": jwt, "statusCode" : 200, "identity":identity})
});

Solution:

Twilio customer support had suggested that I was using an incorrect API_KEY_SECRET, which was causing the error, as also pointed out by @Aubtin Samai. One can generate the API_KEY_SECRET by following the instructions provided here.


回答1:


If I'm correct in assuming these values are not placeholders for the real ones (it's a 403 error), you need to add your API credentials to your NodeJS script...

var ACCOUNT_SID = 'accountSid';
var API_KEY_SID = 'apiKeySid';
var API_KEY_SECRET = 'apiKeySecret';
var TWILIO_CONFIGURATION_SID = 'twilioConfigurationSid';


来源:https://stackoverflow.com/questions/41709800/twilio-video-failed-to-connect-to-room-with-error-sip-error-403

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