Manual Sign In
Manual sign in consists of configuring TFTP, CUCM and CTI servers manually. In the snippet below it is shown how to
set those servers through Login Controller:
// Addresses given here only serve as an example.
// You'll have to set server addresses that are configured in your environment.
var cucmServers = [];
var tftpServers = [];
var ctiServers = [];
cucmServers.push("192.168.1.20");
tftpServers.push("192.168.1.21");
ctiSServers.push("192.168.1.22");
// Alternatively host name can be passed as well
// cucmServers.push("cucmTest.jsdk.test");
// tftpServers.push("tftpTest.jsdk.test");
// ctiServers.push("ctiTest.jsdk.test");
// Manual server setup.
cwic.LoginController.setCUCMServer(cucmServers);
cwic.LoginController.setTFTPServer(tftpServers);
cwic.LoginController.setCTIServer(ctiServers)
After manual setup, all it needs to be done is to call LoginController.signIn(). But
before that event handler for "onCredentialsRequired"
event must be set. This event will be fired when user needs to enter his credentials or if the credentials provided
are not valid. To set credentials LoginController.setCredentials() method
needs to be called, as it is shown in the snippet below:
function onCredentialsRequired()
{
var username;
var password
// ...
// Prompt user for credentials here...
// ...
cwic.LoginController.setCredentials(username, password);
}
cwic.LoginController.addEventHandler("onCredentialsRequired", onCredentialsRequired);
cwic.LoginController.signIn();
If the provided credentials are valid, user will be signed in.