callstats WebRTC analytic library for iOS.
pod 'Callstats'
callstats = Callstats(
appID: appID, // Application ID from Callstats
localID: localID, // current user ID
deviceID: deviceID, // unique device ID
jwt: jwt, // jwt from server for authentication
username: username) // (Optional) user alias
When starting the call, call startSession
with room identifier
callstats.startSession(confID: room)
These events need to be forwarded to the library in order to start tracking the call. Add followings into your WebRTC RTCPeerConnectionDelegate
For example:
func peerConnection(_ peerConnection: RTCPeerConnection, didChange newState: RTCIceConnectionState) {
callstats.reportEvent(remoteUserID: peerId, event: CSIceConnectionChangeEvent(state: newState))
}
func peerConnection(_ peerConnection: RTCPeerConnection, didChange newState: RTCIceGatheringState) {
callstats.reportEvent(remoteUserID: peerId, event: CSIceGatheringChangeEvent(state: newState))
}
func peerConnection(_ peerConnection: RTCPeerConnection, didChange stateChanged: RTCSignalingState) {
callstats.reportEvent(remoteUserID: peerId, event: CSSignalingChangeEvent(state: stateChanged))
}
And when call finished
callstats.stopSession()
You can take a look at how to send more events in demo application.