当我尝试从一个iOS客户端打电话到另一个视频sdk时,使用twilio 视频sdk进行快速操作时,我得到了这个错误“未能用错误连接到房间: SIP错误403”。
当我使用手动生成的twilio访问令牌(从Twilio控制台获得)并将它们插入客户端应用程序时,我可以打个电话(Xcode到mobile和mobile)。但是,当我试图使用Twilio提供的以下服务器代码通过NodeJS服务器编程地从Twilio获取令牌时,会出现上述错误。即使在使用安全连接(HTTPS)从Twilio获取令牌时,错误仍然存在。
下面是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 routinesNodeJS服务器代码(由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})
});解决方案:
正如@Aubtin Samai所指出的,Twilio客户支持部门曾暗示我使用了一个不正确的API_KEY_SECRET,这是导致错误的原因。可以按照提供的API_KEY_SECRET指令生成这里。
发布于 2017-01-19 08:38:15
如果我正确地假设这些值不是真实值的占位符(这是一个403错误),则需要将API凭据添加到NodeJS脚本中.
var ACCOUNT_SID = 'accountSid';
var API_KEY_SID = 'apiKeySid';
var API_KEY_SECRET = 'apiKeySecret';
var TWILIO_CONFIGURATION_SID = 'twilioConfigurationSid';https://stackoverflow.com/questions/41709800
复制相似问题