|
|
|
@ -7,6 +7,13 @@ if (process.env.TWILIO_SID && process.env.TWILIO_TOKEN) {
|
|
|
|
var client = null
|
|
|
|
var client = null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DEFAULT_ICE_SERVERS = [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
url: 'stun:23.21.150.121', // deprecated, replaced by `urls`
|
|
|
|
|
|
|
|
urls: 'stun:23.21.150.121'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
var CACHE_LIFETIME = 5 * 60 * 1000 // 5 minutes
|
|
|
|
var CACHE_LIFETIME = 5 * 60 * 1000 // 5 minutes
|
|
|
|
var cachedPromise = null
|
|
|
|
var cachedPromise = null
|
|
|
|
|
|
|
|
|
|
|
|
@ -15,7 +22,7 @@ function clearCache() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
exports.getICEServers = function () {
|
|
|
|
exports.getICEServers = function () {
|
|
|
|
if (client == null) return Promise.resolve({})
|
|
|
|
if (client == null) return Promise.resolve(DEFAULT_ICE_SERVERS)
|
|
|
|
if (cachedPromise) return cachedPromise
|
|
|
|
if (cachedPromise) return cachedPromise
|
|
|
|
|
|
|
|
|
|
|
|
cachedPromise = new Promise(function (resolve, reject) {
|
|
|
|
cachedPromise = new Promise(function (resolve, reject) {
|
|
|
|
|