return default ice servers when not using twilio

These are Google's STUN servers. The same defaults are used in
the simple-peer module.

fixes #24
pull/23/head
Girish Ramakrishnan 10 years ago
parent 125c51d622
commit 1b4dd0a965

@ -7,6 +7,13 @@ if (process.env.TWILIO_SID && process.env.TWILIO_TOKEN) {
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 cachedPromise = null
@ -15,7 +22,7 @@ function clearCache() {
}
exports.getICEServers = function () {
if (client == null) return Promise.resolve({})
if (client == null) return Promise.resolve(DEFAULT_ICE_SERVERS)
if (cachedPromise) return cachedPromise
cachedPromise = new Promise(function (resolve, reject) {

Loading…
Cancel
Save