// Retrieve telephony device list from telephony controller.
var deviceList = cwic.TelephonyController.telephonyDevices;
var remotephone;
// In this example we'll take first remotephone from telephony device list we encounter
for(var index = 0; index < deviceList.length; ++index)
{
if(deviceList[index].controlMode = "ExtendConnect")
{
remotephone = deviceList[index];
break;
}
}
Connecting RemotePhone with CUCM is done through RemotePhone.connect method. Generally, device can be
connected to CUCM only from single client/machine. Thus, if connecting same device to CUCM from another client/machine,
CUCM will reject connection attempt. However, if connecting device with forced registration, connection attempt will
be accepted by CUCM. In the snippet below force registration will be used to connect softphone with CUCM:
In the snippet below we'll use force registration:
// Remote number that will be use.
var remoteNumber = "1111"
var forceRegistration = true;
remotephone.connect(remoteNumber, true);
After this RemotePhone device will be successfully connected with CUCM. For information on how to track device's connection state with CUCM or if connection fails for some reason please see Handle CUCM Connection State Change tutorial.
Delete Remote Number
While remote phone is in connected state remote number can be deleted, though this will cause device to disconnect from CUCM. In the snippet below it is shown how to do this:
// Remote device we'll be using
var remotePhone;
// ...
// Here we connecto to our remote device
// ...
// Once we are connected let's delete number we used to connect to this device.
// After this we'll be disconnected from this device.
remotePhone.deleteNumber();