Skip to main content

CloudonixSDKClient

The CloudonixSDKClient class is the main API for the Cloudonix Mobile SDK. It is used for initialization, setup and control of the SDK activities.

Methods

getInstance(String licenseKey) [static]

Initialize the Cloudonix SDK license and receive a singleton instance of the Cloudonix SDK object. This method must be called first before any other operation on the Cloudonix SDK.

getInstance() [static]

Retrieve the singleton instance of the SDK object. If the Cloudonix SDK was not initialized by the previous method, this call will return null.

checkLicense()

Checks whether the Cloudonix SDK was successfully licensed. This method will return true if the onLicense() callback event was ever called with status LICENSING_SUCCESS.

bind(Context)

Starts the Cloudonix SDK SIP service and registers it with the application process. When setting up the Cloudonix SDK to use classic registration mode, the application should call this method if the checkBinder() method returned false.

isInitialized()

Checks whether the Cloudonix SDK SIP stack was successfully initialized. This method will return true if the onSipStarted() callback event was ever called.

isBluetoothEnabled()

Checks whether a Bluetooth connected headset is available on the device.

addListener(IVoIPObserver listener)

Register an application callback receiver to receive events from the Cloudonix Mobile SDK.

removeListener(IVoIPObserver listener)

Unregister an application callback receiver that was previously registered.

setConfig(ConfigurationKey, String)

Set a configuration parameter, using one of the configuration flags documented in the Configuration Flags reference.

setConfiguration(RegistrationData account)

Configure the Cloudonix SDK to use the specified account details for SIP communications.

isRegistered()

Checks whether the Cloudonix SDK SIP service is currently registered with the SIP server.

registerAccount()

Start maintaining an active SIP registration with the SIP server.

unregister()

Stop maintaining an active SIP registration with the SIP server.

deleteAccount()

Unset the account configuration (the reverse of the setConfiguration() method above).

destroy()

Stop the SIP service, deinitialize everything and prepare for re-initialization using getInstance(licenseKey). After calling this method, calling any other Cloudonix SDK method - except for re-initializing the SDK - will cause unexpected errors.

setWakeupTime(int seconds)

Sets the frequency of the wake alarm used by the Cloudonix SDK SIP service to refresh the SIP registration. The default value (if this method is never called) is 90 seconds. This setting should not be set higher than the REGISTRATION_TIMEOUT configuration setting and ideally should be kept under half of the REGISTRATION_TIMEOUT configuration value.

setAutoRestart(boolean enable)

Sets whether the Cloudonix SDK SIP service should automatically restart itself if the SIP registration was active and the service was shutdown by the operating system or the device was restarted. The default behavior is to restart automatically, but the application can use this method to disable this behavior and re-enable it later.

dial(String contact)

Start a call to the specified destination.

dial(String contact, List<SIPHeader> headers)

Start a call to the specified destination, with the specified headers added to the SIP INVITE message.

dialRegistrationFree(String contact, String token)

Start a call to the specified destination, with the specified Cloudonix session authorization token.

dialRegistrationFree(String contact, String token, List<SIPHeader> headers)

Start a call to the specified destination, with the specified Cloudonix session authorization token and the specified headers added to the SIP INVITE message.

answer(String callKey)

Answer the active call specified by the call ID. Calling this method with a call ID for which there was no onCallState() event received, or that the last onCallState() event did not have the status CALL_STATE_RINGING, is an error.

reject(String callKey)

Rejects the active call specified by the call ID. Calling this method with a call ID for which there was no onCallState() event received, or that the last onCallState() event did not have the status CALL_STATE_RINGING, is an error.

mute(boolean enable)

Mute or unmute all active calls.

muteByKey(String callKey, boolean mute)

Mute or unmute the active call specified by the call ID.

localHold(String callKey, boolean enable)

Move the active call specified by the call ID to hold or out of hold.

hangup(String callKey)

Hangup a call identified by the specified call id.

hangupByUrl(String contact)

Hangup a call identified by the destination.

DTMF(String callKey, char signal)

Sends the specified DTMF signal to the active call specified by its call ID. It is an error to send a signal parameter that isn't one of the supported DTMF signals, i.e. a decimal digit or the characters “#” and “*”.

getCall(String callKey)

Return a call details object, that contains all the information for a call identified by its call key - as sent in an onCallState() event.

getCalls()

Return a list of active call as VoipCall POJOs, each specifying a call’s ID (key), destination, call state, start time in seconds since the UNIX epoch, whether it is muted or not, and the SIP call identifier.

getAudioRoute()

Return the audio route of the current active call, e.g. speaker, Bluetooth, etc.

setAudioRoute(AudioRoute route)

Change the audio route of the current active call to the specified audio route. The parameter can be any of the AudioRoute enum values from the net.greenfieldtech.cloudonixsdk.api.models.SDKConstants class.

isControlAudioRoute()

Checks whether the behavior to switch to the Bluetooth audio route automatically when dialing is disabled. (default: enabled).

setControlAudioRoute(boolean)

Sets whether to disable the behavior to switch to the Bluetooth audio route automatically when dialing.

getStatistics(String callKey)

Get media statistics for an active call identified by the call id. See the StatisticsData class documentation below for a description of the data made available by this method.

dumpStatisticsToLog(boolean enable)

Sets whether the Cloudonix SDK will periodically send a media statistics report to the log, during an active call. The default behavior is to not perform periodic statistics reporting.

setMediaResources(Context context, int busyTone, int ringingTone, int alertTone, int endCallTone, int holdTone, int beginHoldTone, int endHoldTone)

Set up the Cloudonix SDK to handle various user interaction events by playing back specific audio. The audio resource parameters should be references to Android application resources, or -1 to specify that the Cloudonix SDK should not handle a specific event by playing audio from a resource.

setForegroundInitRes(int iconId, String ticker, String title, String text)

Set the configuration of the persistent notification used by the Cloudonix SDK SIP service.

setCustomNotification(Notification notification)

Sets a custom android.app.Notification object to be used for the persistent notification used by the Cloudonix SDK SIP service.

setNotificationResources(Intent intent, int reqId, int smallIcon, Bitmap largeIcon, String title, String text)

Sets the resources to be used for the persistent notification used by the Cloudonix SDK SIP service. The Intent provided will be activated when the user activates the notification.

setNotificationResources(Intent intent, int smallIcon, String title, String text)

Sets the resources to be used for the persistent notification used by the Cloudonix SDK SIP service. The Intent provided will be activated when the user activates the notification.

setNotificationAutoDisplay(boolean enable)

Enables or disables the automatic display of a persistent notification for the Cloudonix SDK SIP service when a call is in progress. The default behavior is to automatically display the persistent notification. If the application disables the automatic persistent notification display, the Cloudonix SDK SIP service might be shutdown by the operating system if the application is put to the background or the screen is closed, which will cause the call to be dropped. To prevent the calls from dropping after disabling automatic persistent notification, the application should call addToForeground() and removeFromForeground() as appropriate.

addToForeground()

Shows the Cloudonix SDK SIP service persistent notification.

removeFromForeground()

Hides the Cloudonix SDK SIP service persistent notification.

setLogLevel(int level)

Set the verbosity level of the Cloudonix SDK. The higher the level, the more events will be sent to the onLog() callback. The parameter should be one of the LOG_LEVEL_* constants declared in the CloudonixSDKClient class, see the Additional Constants Reference for more information.

restart()

Stops the active SIP registration Cloudonix SDK SIP service and schedule it to restart.

unbind()

Unbind the Cloudonix SDK SIP service and stop it.

stop()

Stop maintaining the active SIP registration (if any). Call restart() to reactivate the SIP registration.

shutdown()

Closes the Cloudonix Mobile SDK by stopping the Cloudonix Mobile SDK service and releasing all the resources it holds. This method call is asynchronous and it will return while running the shutdown process in the background. After calling this method, the CloudonixSDKClient instance held by the application is considered invalid and should be released - any other method call on that instance will cause undefined behavior. If any event handler was registered before calling shutdown(), they will receive the event onShutdown when the Cloudonix Mobile SDK has finished shutting down. Event handlers will automatically be unregistered when shutting down and will only receive the onSipStopped and onShutdown events during the shutdown process.

getSDKVersion()

Return the SDK version and build numbers for the current build, as a 4-part version string.

Deprecated Methods

checkBinder() [deprecated]

Was used to speed up initialization by allowing the application to skip initialization steps when resuming, if the service is still running, but the result was a complicated initialization sequence with optional asynchronous steps. This method now always returns false, and the application should just call bind(). The bind() method now only does the minimum necessary steps and will always cause the onLicense event to be sent.

getCallKeyForIndex(int index) [deprecated]

Return the call ID (key) of the call by its 0-based index in the list of active calls. It is an error to send an index that is equal to or larger than the number of active calls. Use getCalls() instead.

getNumberOfCalls() [deprecated]

Return the number of current active calls. Use getCalls() instead.

getCallState(String callKey) [deprecated]

Return the current call state for the specified call. Use getCall(String callKey) instead.

getCallUrl(String callKey)

Return the contact for the specified call. Use getCall(String callKey) instead.

getCallStartTime(String callKey)

Return the start time for the specified call. Use getCall(String callKey) instead.

reregister() [deprecated]

Instructs the Cloudonix SDK SIP service to register with the SIP server if not currently registered. Use setConfiguration() instead.

setEcFixedDelay(int) [deprecated]

This method does not do anything. Do not use.