cti
JDitoFunktionen für die Telefonie
Methods
answer
answer(
pJDitoCallID):void
Answers a phone call.
Parameters
string | number | booleanThe ID of the phone call.
Returns
voidThrows
May throw an exception.
Example
cti.answer("1");
call
call(
pPhoneAddress,pAddress?):void
Calls a certain address (i.e. phone number).
Parameters
string | number | booleanThe address (phone number) of the phone to be used.
string | number | booleanThe address (phone number) to be called.
Returns
voidThrows
May throw an exception.
Example
cti.call("00874396640222", "00874396640");
formatPhoneNumber
formatPhoneNumber(
pPhoneNumber,pRawInputOnInvalid,pCountry?):string
Converts a phone number to an intarnational formatted one.
Parameters
string | number | booleanThe phone number to check. Has to contain the country code if pCountry is not set.
booleanIf true you get the input-string back if it is not a valid phone number. If false you get an empty string back if it is not a valid phone number.
string | number | booleanThe country (ISO2-code) for the phone number. Is only needed if the phone number is not provided with a country code (e.g. +49 for germany) Null is possible if you know that the phone number contains a country code. Note: if pCountry does not fit the country code of the phone number, the parameter pCountry is ignored.
Returns
stringFormatted phone number or empty string / input string (based on pRawInputOnInvalid) if input is not a valid phone number
Throws
May throw an exception.
getAvailableAddresses
getAvailableAddresses(
pProvider):string[]
Returns the addresses available within the telephone system (PBX system).
Parameters
string | number | booleanThe telephone system (PBX system) for which the phone addresses are required.
Returns
string[]A string array that contains all addresses found.
Throws
May throw an exception.
Example
// SYS_PREFERENCES (telephony_address.contentProcess)
var provider = vars.getString("$comp.telephony_provider");
if (provider == undefined || provider.length == 0)
result.object(new Array());
else
{
try
{
var addr = cti.getAvailableAddresses(provider);
var resultAddr = new Array();
for (i = 0; i < addr.length; i++)
{
resultAddr[i] = new Array(addr[i]);
}
resultAddr.sort();
result.object(resultAddr);
}
catch (ex)
{
logging.log(ex);
result.object(new Array());
}
}
getAvailablePhoneAddresses
getAvailablePhoneAddresses():
string[]
Returns all valid phone addresses (phone numbers) that can be passed to cti.call().
Returns
string[]The valid phone addresses (phone numbers).
Throws
May throw an exception.
Example
var addresses = cti.getAvailablePhoneAddresses();
getCurrentCallCount
getCurrentCallCount():
number
Returns the current phone call count.
Returns
numberThe number of phone calls.
Throws
May throw an exception.
Example
var callcount = cti.getCurrentCallCount();
getCurrentCalls
getCurrentCalls():
Map<any,any>[]
Returns the current phone calls.
Returns
Map<any, any>[]The active phone calls as a map
Throws
May throw an exception.
Example
var calls = cti.getCurrentCalls();
hangup
hangup(
pJDitoCallID):void
Terminates a phone call.
Parameters
string | number | booleanThe ID of the phone call.
Returns
voidThrows
May throw an exception.
Example
cti.hangup("1");
isValidPhoneNumber
isValidPhoneNumber(
pPhoneNumber,pTestForMatchingCountry?,pCountry?):boolean
Validates whether a phone number format is valid for its region. The validation only checks if the number format is valid - it does not verify if the number is actually assigned or reachable.
Example: The phone number "+49 (0) 30 1234567" is parsed into country code "49" and national significant number "301234567", which represents a valid number format.
Validation is performed using libphonenumber. Refer to the library documentation for more details.
Parameters
string | number | booleanThe phone number to validate. Must include country code if pCountry is not specified.
booleanIf true, verifies that the phone number's country code matches the given country code, otherwise returns false. If false (or null), allows phone numbers with different country codes and uses pCountry only for numbers without an explicit country code.
string | number | booleanThe country's ISO2 code (e.g. "DE" for Germany). Only required for phone numbers without an explicit country code (e.g., leading zero instead of a +49 for Germany). Can be null if the phone number includes a country code.
Returns
booleantrue if valid, false if invalid
Throws
May throw an exception.
join
join(
pFirstJDitoCallID,pSecondJDitoCallID):void
Connects two phone calls to start a conference.
Parameters
string | number | booleanThe ID of the first phone call.
string | number | booleanThe ID of the second phone call.
Returns
voidThrows
May throw an exception.
Example
cti.join("1", "2");
joinFinish
joinFinish(
pFirstJDitoCallID,pSecondJDitoCallID):void
Terminates a phone conference.
Parameters
string | number | booleanThe ID of the first phone call.
string | number | booleandie ID des zweiten Calls
Returns
voidThrows
May throw an exception.
joinSetup
joinSetup(
pJDitoCallID,pAddress):void
Prepares a phone conference.
Parameters
string | number | booleanThe ID of the phone call.
string | number | booleanThe phone number of the new attendee (participant).
Returns
voidThrows
May throw an exception.
Example
cti.joinSetup("1", "323");
sendPrivateData
sendPrivateData(
pJDitoCallID,pData):void
Sends commands specific to the telephone system (PBX system) that are tied to a certain phone call.
Parameters
string | number | booleanThe ID of the phone call.
number[]The command / data.
Returns
voidThrows
May throw an exception.
Example
cti.sendPrivateData("1", 1);
sendStaticPrivateData
sendStaticPrivateData(
pPhoneAddress,pData):void
Sends commands specific to the telephone system (PBX system) that are not tied to a certain phone call, but are static and will be passed to the telephone system.
Parameters
string | number | booleanThe address (phone number) of the phone to be used.
number[]The command / data.
Returns
voidThrows
May throw an exception.
Example
cti.sendStaticPrivateData("234", 1);
setCallEndProcess
setCallEndProcess(
pName):void
Sets the process to be executed when terminating a phone call.
Parameters
string | number | booleanThe name of the process.
Returns
voidExample
cti.setCallEndProcess("callEndProcess");
setCallStartProcess
setCallStartProcess(
pName):void
Sets the process to be executed when initiating a phone call.
Parameters
string | number | booleanThe process to be set.
Returns
voidExample
cti.setCallStartProcess("callStartProcess");
setCallStateChangedProcess
setCallStateChangedProcess(
pName):void
Sets the process to be executed when changing the phone call status.
Parameters
string | number | booleanThe process to be set.
Returns
voidExample
cti.setCallStateChangedProcess("callStateChangedProcess");
setPrivateDataCallbackProcess
setPrivateDataCallbackProcess(
pName):void
Sets the process to be executed when performing a private data callback.
Parameters
string | number | booleanThe process to be set
Returns
voidExample
cti.setPrivateDataCallbackProcess("totallyWeirdProcessName");
switchHold
switchHold(
pJDitoCallID):void
Sets the status of the phone call from "Talking" to "Hold" and vice versa.
Parameters
string | number | booleanThe ID of the phone call.
Returns
voidThrows
May throw an exception.
Example
cti.switchHold("1");
transfer
transfer(
pJDitoCallID,pNewAddress):void
Forwards a phone call.
Parameters
string | number | booleanThe ID of the phone call.
string | number | booleanThe phone number of the new attendee (participant).
Returns
voidThrows
May throw an exception.
Example
cti.transfer("1", "253");
transferFinish
transferFinish(
pFirstJDitoCallID,pSecondJDitoCallID):void
Terminates a forwarded call.
Parameters
string | number | booleanThe ID of the first phone call.
string | number | booleanThe ID of the second phone call.
Returns
voidThrows
May throw an exception.
Example
cti.transferFinish("1", "2");
transferSetup
transferSetup(
pJDitoCallID,pNewAddress):void
Prepares a phone call forwarding action.
Parameters
string | number | booleanThe ID of the phone call.
string | number | booleanThe phone number of the new attendee (participant).
Returns
voidThrows
May throw an exception.
Properties
Example
cti.transferSetup("1", "2");
ADDRESS
stringPhone number of the counterpart (empty string if the phone number was suppressed)
CALLID
stringID of the phone call
CALLSTATE_BUSY
numberConstant for telephony, here busy.
CALLSTATE_CONNECTING
numberConstant for telephony, here connecting.
CALLSTATE_CONNECTION_RINGING
numberConstant for telephony, here connection ringing.
CALLSTATE_CREATED
numberConstant for telephony, here created.
CALLSTATE_DISCONNECTED
numberConstant for telephony, here disconnected.
CALLSTATE_ON_HOLD
numberConstant for telephony, here on hold.
CALLSTATE_RINGING
numberConstant for telephony, here ringing.
CALLSTATE_TALKING
numberConstant for telephony, here talking.
CALLSTATE_UNKNOWN
numberConstant for telephony, here unknown.
ISINCOMING
stringTRUE for incoming phone calls
LOCALADDRESS
stringConstant for retrieving the data from the telephony map, here the address of the telephony device.
LOCALID
stringConstant for retrieving the data from the telephony map, here the ID of the telephony device.
STATE
stringStatus of the phone call.