Improves SIP gateway auto configuration by getting feedback from the focus.

This commit is contained in:
paweldomas 2015-01-05 16:31:31 +01:00
parent 78fcc8b72c
commit c76b78eb46
2 changed files with 27 additions and 1 deletions

View File

@ -11,6 +11,10 @@ var Moderator = (function (my) {
var getNextErrorTimeout = Util.createExpBackoffTimer(1000);
// External authentication stuff
var externalAuthEnabled = false;
// Sip gateway can be enabled by configuring Jigasi host in config.js or
// it will be enabled automatically if focus detects the component through
// service discovery.
var sipGatewayEnabled = config.hosts.call_control !== undefined;
my.isModerator = function () {
return connection.emuc.isModerator();
@ -24,6 +28,10 @@ var Moderator = (function (my) {
return externalAuthEnabled;
};
my.isSipGatewayEnabled = function () {
return sipGatewayEnabled;
};
my.onModeratorStatusChanged = function (isModerator) {
Toolbar.showSipCallButton(isModerator);
@ -99,6 +107,14 @@ var Moderator = (function (my) {
{ name: 'bridge', value: config.hosts.bridge})
.up();
}
// Tell the focus we have Jigasi configured
if (config.hosts.call_control !== undefined)
{
elem.c(
'property',
{ name: 'call_control', value: config.hosts.call_control})
.up();
}
if (config.channelLastN !== undefined)
{
elem.c(
@ -148,7 +164,17 @@ var Moderator = (function (my) {
if (extAuthParam.length) {
externalAuthEnabled = extAuthParam.attr('value') === 'true';
}
console.info("External authentication enabled: " + externalAuthEnabled);
// Check if focus has auto-detected Jigasi component(this will be also
// included if we have passed our host from the config)
if ($(resultIq).find(
'>conference>property[name=\'sipGatewayEnabled\']').length) {
sipGatewayEnabled = true;
}
console.info("Sip gateway enabled: " + sipGatewayEnabled);
};
// FIXME: we need to show the fact that we're waiting for the focus

View File

@ -265,7 +265,7 @@ var Toolbar = (function (my) {
// Shows or hides SIP calls button
my.showSipCallButton = function (show) {
if (config.hosts.call_control && show) {
if (Moderator.isSipGatewayEnabled() && show) {
$('#sipCallButton').css({display: "inline"});
} else {
$('#sipCallButton').css({display: "none"});