CallAnalytics

object CallAnalytics : ProguardKeep(source)

The CallAnalytics singleton object provides a unified interface for sending call-related data to Sipfront servers.

Usage: To use CallAnalytics, first invoke the init method and after successful initialization you can use the various send* methods

Android Example:

// In onCreate() of your apps Launcher Activity add this code
override fun onCreate(savedInstanceState: Bundle?) {
if (savedInstanceState == null) {
try {
val initialized = CallAnalytics.init(
// custom Intent arguments provided to app by Sipfront test
SessionParams(intent),
// optional configuration
Config.Builder()
.enableDebugLogs(enable = true)
.build()
)
if(initialized) {
Log.i("CallAnalytics initialized")
}
} catch (e: Exception) {
Log.e("Could not initialise CallAnalytics, cause: ${e.message}")
}
}
}

iOS Example:

// In init() of your SwiftUI.App
struct MyApp: SwiftUI.App {
init() {
do {
let initialized = try CallAnalytics.shared.initialize(
params: SessionParams(),
// optional configuration of Sdk
config: Config.Builder()
.enableDebugLogs(true)
.trustAllCerts(true)
.build()
)
if initialized {
Logger.info("CallAnalytics initialized")
}
} catch {
Logger.notifications.error("CallAnalytics init error: \(error)")
}
}
}

Note: Implementors of the library should ensure proper internet connectivity and necessary permissions before invoking the methods.

Since

1.0.0

Author

Dominik Ridjic

Throws

If any send* methods are used before CallAnalytics has been initialized

If data provided to init methods is invalid

Functions

Link copied to clipboard
@ObjCName(name = "initialize")
fun init(@ObjCName(name = "params") sessionParams: SessionParams, @ObjCName(name = "config") sdkConfig: SdkConfig = SdkConfig.Builder().build()): Boolean

The data is received on Android as Intent and on iOS as environment variable in ProcessInfo

@ObjCName(name = "initialize")
fun init(json: String, @ObjCName(name = "config") sdkConfig: SdkConfig = SdkConfig.Builder().build()): Boolean

CallAnalytics will immediately start parsing app logs for SIP messages and transmit them if found

Link copied to clipboard

Returns true if CallAnalytics has been initialized

Link copied to clipboard
@ObjCName(name = "send")
fun sendRtcp(@ObjCName(name = "rtcp") rtcpMessage: RtcpMessage)

Sends RtcpMessage to Sipfront

Link copied to clipboard
@ObjCName(name = "send")
fun sendSdp(@ObjCName(name = "sdp") sdpMessage: SdpMessage)

Sends SdpMessage to Sipfront

Link copied to clipboard
@ObjCName(name = "send")
fun sendSip(@ObjCName(name = "sip") sipMessage: SipMessage)

Sends SipMessage to Sipfront

Link copied to clipboard
@ObjCName(name = "send")
fun sendState(@ObjCName(name = "state") stateMessage: StateMessage)

Sends StateMessage to Sipfront

Link copied to clipboard
@ObjCName(name = "upload")
fun uploadMedia(@ObjCName(name = "mediaStream") mediaStream: MediaStream)

Uploads MediaStream to Sipfront