kandy

3.1.0

create

The SDK creation factory. Create an instance of the SDK by calling this factory with the the desired configurations.

create(config: config)
Parameters
config (config) The configuration object.
Example
// Instantiate the SDK.
import { create } from 'kandy'
const client = create({
    authentication: { ... },
    logs: { ... },
    ...
});
// Use the SDK's API.
client.on( ... );

Events

The Events feature allows an application to listen for events that the SDK emits. Each other feature has a set of event types that can be subscribed to using the Event APIs.

Events
API Functions
on(type, listener)
off(type, listener)
subscribe(listener)
unsubscribe(listener)

Authentication

The authentication feature handles connecting and disconnecting from any backend services that the SDK deals with. As well, it handles and stores authentication information on the behalf of the user. This allows the user to interact with the server without worrying about authenticating.

Authentication
API Functions
connect(credentials)
disconnect()
updateConnection(connection)
getUserInfo()
getConnection()
getServices()
subscriptionStates
Events
auth:change
auth:error
auth:resub

Calls

The call feature is used to make audio and video calls to and from SIP users and PSTN phones.

Call functions are all part of the 'call' namespace.

Whenever 'user' is mentioned as input parameter within this API, it needs to be provided in the user@domain format.

Calls
API Functions
getAll()
getById(callId)
changeInputDevices(callId)
changeSpeaker(speakerId)
states
mediaStates
make(callee, options?)
answer(callId, options?)
ignore(callId)
reject(callId)
end(callId)
mute(callId)
unmute(callId)
silence(callId)
unsilence(callId)
getCustomParameters(callId)
setCustomParameters(callId, customParameters)
startVideo(callId, options?)
stopVideo(callId)
hold(callId)
unhold(callId)
startScreenshare(callId, options)
stopScreenshare(callId)
sendDTMF(callId, tone)
sendCustomParameters(callId)
forwardCall(callId, destination)
directTransfer(callId, destination)
consultativeTransfer(callId, destinationCallId)
join(callId, destinationCallId)
Events
call:start
call:receive
call:join
call:forward
call:stateChange
call:mediaStateChange
call:screenshareChange
call:error

Media

The SDK's media features are used to control WebRTC Media Devices.

Media functions are all part of the 'media' namespace.

Media
API Functions
setDefaultDevices(devices)
getDevices()
startPreviewVideo(videoContainer?)
stopPreviewVideo()
promptUserMedia(options?)
Events
videoPreview:change
videoPreview:error
devices:defaultsChange
devices:change
media:initialize

CallHistory

The call history feature is used to retrieve and inspect the authenticated users call logs.

CallHistory functions are all part of the 'call.history' namespace.

CallHistory
API Functions
fetch(amount, offset)
remove(recordId)
clear()
get()
getCache()
setCache(data)
Events
callHistory:change
callHistory:error
callHistoryCache:change

Messaging

The messaging feature revolves around a "conversation" structure. It is responsible to store the conversations and its messages, and return conversation objects when requested.

See the "Conversation" and "Message" sections of the documentation for more details.

Messaging functions are all part of the 'conversation' namespace. Ex: client.conversation.get('id').

Messaging
API Functions
get(destination)
Events
conversations:new
conversations:change
messages:change
messages:error

Conversation

A Conversation object represents a conversation between either two users, or a user and a group. A Conversation can create messages via the conversation's createMessage() function.

Conversation
Properties
destination (string) : The id of the remote user with which the current user is having a conversation.
API Functions
createMessage(part)
clearMessages()
getMessages()
getMessage(messageId)
subscribe(subscriber)
fetchMessages(amount)

Message

A Message object represents an individual message. Messages have parts which represent pieces of a message, such as a text part or a file part. Once all the desired parts have been added, a message can be sent with the send() function.

Message
API Functions
send()

Presence

The presence features are used to update the authenticated users presence on the server, as well as retrieve other users presence information.

Presence functions are all part of the 'presence' namespace.

Presence
API Functions
update(status, activity, note?)
get(users)
fetch(users)
subscribe(user)
unsubscribe(user)
Events
presence:change
presence:error

Voicemail

The voicemail features are used to retrieve and view voicemail indicators.

Voicemail functions are all part of the 'voicemail' namespace.

Voicemail
API Functions
fetch()
get()
Events
voicemail:change
voicemail:error

SipEvents

Allows a user to subscribe to, and receive notifications for, sip events.

SipEvents functions are all part of the 'sip' namespace.

SipEvents
API Functions
subscribe(eventType, subscribeUserList, clientCorrelator, customParameters?)
update(eventType, userLists, customParameters?)
unsubscribe(eventType)
getDetails(eventType?)
Events
sip:subscriptionChange
sip:error
sip:eventsChange

Connectivity

The connection feature is used to connect and maintain connections between the SDK and one or more backend servers.

Connectivity functions are all part of the 'connection' namespace.

Connectivity
API Functions
getSocketState(platform)
enableConnectivityChecking(enable)
Events
ws:change

Users

The Users feature allows access to user information for users within the same domain.

These functions are namespaced beneath 'user' on the API.

Users
API Functions
fetch(primaryContact)
fetchSelfInfo()
get(primaryContact)
getAll()
search(filters, options?)
Events
directory:change
directory:error

Contacts

The Contacts feature allows users to store personal contacts to their account.

These functions are namespaced beneath 'contacts' on the API.

Contacts
API Functions
add(contact)
get(contactId)
getAll()
refresh()
remove(id)
update(contactId, contact)
fetch(contactId)
Events
contacts:new
contacts:error
contacts:change

config

The configuration object. This object defines what different configuration values you can use when instantiating the SDK.

config
Configurations By Feature
config.logs
config.authentication
config.call
config.connectivity
config.notifications

sdpHandlers

A set of handlers for manipulating SDP information. These handlers are used to customize low-level call behaviour for very specific environments and/or scenarios. They can be provided during SDK instantiation to be used for all calls.

sdpHandlers
API Functions
createCodecRemover()

Logger

The internal logger used to provide information about the SDK's behaviour. The logger can provide two types of logs: basic logs and action logs. Basic logs are simple lines of information about what the SDK is doing during operations. Action logs are complete information about a specific action that occurred within the SDK, prodiving debug information describing it. The amount of information logged can be configured as part of the SDK (see configs.logs) configuration.

Logger
API Functions
levels

Config

An interface for getting and updating the configuration Object.

Config
API Functions
getConfig()
updateConfig(newConfigValues)

BasicError

The Basic error object. Provides information about an error that occurred in the SDK.

BasicError
Properties
code (string) : The code of the error. If no code is known, this will be a string 'NO_CODE'.
message (string) : A human-readable message to describe the error. If no message is known, this will be a string 'An error occured'.

AudioBridge

The audio bridge feature allows multiple audio calls to be bridged together for a local three-way call.

Audio bridge functions are all part of the 'audioBridge' namespace.

AudioBridge
API Functions
create()
close(bridgeId)
addCall(bridgeId, callId)
removeCall(bridgeId, callId)
mute(bridgeId)
unmute(bridgeId)
silence(bridgeId)
unsilence(bridgeId)
getAll()
getBridgeCalls(bridgeId)
Events
audioBridge:change
audioBridge:error

ClickToCall

The clickToCall feature is used to bridge a call between two specified devices

ClickToCall
API Functions
clickToCall(caller, callee)
get()
Events
clickToCall:start
clickToCall:error