Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var enableSip = config.get(C.SIP_ENABLED);
var sipUri = config.get(C.SIP_URI);
var sipUsername = config.get(C.SIP_USERNAME);
var sipPassword = config.get(C.SIP_PASSWORD);
var sipRequireGoogleAuth = config.get(C.SIP_REQUIRE_GOOGLE_AUTH);
var plivoAuthId = config.get(C.PLIVO_AUTH_ID);
var plivoAuthToken = config.get(C.PLIVO_AUTH_TOKEN);
var googleId = config.get(C.GOOGLE_CLIENT_ID);
var googleHostedDomain = config.get(C.GOOGLE_HOSTED_DOMAIN);
if (sipRequireGoogleAuth) {
googleAuth = new GoogleAuth.EnabledGoogleAuthStrategy(googleId, googleHostedDomain);
} else {
googleAuth = new GoogleAuth.DisabledGoogleAuthStategy();
}
if (enableSip) {
plivoClient = plivo.RestAPI({
authId: plivoAuthId,
authToken: plivoAuthToken,
});
}
// This isn't strictly necessary... but since we're using promises all over the place, it
// makes sense. The _P are just a promisified version of the methods. We could have
// overwritten the original methods but this way we make it explicit. That's also why we're
// breaking camelCase here, to make it patent to the reader that those aren't standard
// methods of the API.
['startArchive', 'stopArchive', 'getArchive', 'listArchives', 'deleteArchive', 'dial',
'forceDisconnect']
.forEach(method => otInstance[method + '_P'] = promisify(otInstance[method])); // eslint-disable-line no-return-assign
var maxSessionAge = config.get(C.OPENTOK_MAX_SESSION_AGE);
var maxSessionAgeMs = maxSessionAge * 24 * 60 * 60 * 1000;
var chromeExtId = config.get(C.CHROME_EXTENSION_ID);
function getPlivo () {
return Plivo.RestAPI({
authId: PLIVO_ID,
authToken: PLIVO_TOKEN
});
}
PlivoBase.prototype.getPlivoAPI = function() {
var api = plivo.RestAPI({
authId: this.config.plivo.authId,
authToken: this.config.plivo.authToken,
});
return api;
};