Platform

Platform

  • Getting Started
  • API

›IOS SDK

Getting Started

  • Create Your App

Quick Starts

  • 555 Samples

Mobile SDK (v1.0)

  • Overview
  • IOS SDK

    • Getting started
    • Installation Guide
    • How to do user authentication
    • How to subscribe for notifications
    • How to initiate or accept PSTN call
    • How to initiate or accept video call
    • How to set log level for SDK
    • Release Notes

    Android SDK

    • Getting started
    • Installation Guide
    • How to do user authentication
    • How to subscribe for notifications
    • How to initiate or accept PSTN call
    • How to initiate or accept video call
    • How to set log level for SDK
    • Release Notes

Mobile SDK (v2.0)

  • Overview
  • IOS SDK

    • Getting started
    • Installation Guide
    • How to do user authentication
    • How to subscribe for notifications
    • How to initiate or accept PSTN call
    • How to initiate or accept VIDEO call
    • How to initiate or join ANONYMOUS VIDEO call
    • Release Notes
    • Reference code - How to initiate or accept PSTN Call
    • Reference code - How to initiate or accept Video Call
    • Reference code - How to initiate or join Anonymous Video Call

    Android SDK

    • Getting started
    • Installation Guide
    • How to do user authentication
    • How to subscribe for notifications
    • How to initiate or accept PSTN call
    • How to intiate or accept Video Call
    • How to intiate or accept ANONYMOUS VIDEO Call
    • Release Notes
    • Reference code - How to initiate or accept PSTN Call
    • Reference code - How to initiate or accept Video Call
    • Reference code - How to initiate or join Anonymous Video Call

    React Native SDK

    • Getting started
    • Installation Guide
    • How to do user authentication
    • How to subscribe for notifications
    • How to initiate or accept PSTN call
    • Release Notes

WebRTC JS SDK

  • Overview
  • Getting Started
  • How to do user authentication
  • How to subscribe for notifications
  • How to initialize SDK
  • How to initiate or accept PSTN call
  • How to initiate or accept video call
  • How to create a screen share session
  • Release Notes

VIDEO Call

RTC 555 iOS SDK supports VIDEO calls between its users. It also supports on-call features such as mute/unmute audio/video, and flip camera.

Before initiating or accepting a VIDEO call, make sure to have logged in.

SDK initialization

Below API initializes and sets the context for the SDK. It is advisable to call this API at the launch of the application.

Rtc555Sdk.initializeLibrary()

Adding SDK configuration.

To make video related API call, SDK should have below mentioned mandatory configuration data to establish a connection with the 555 platform backend.

let config:Rtc555Config = Rtc555Sdk.sharedInstance.getConfig()
config.routingId = "a2685b26-5ef0-11ea-83a9-fa163e547f24@uc-prod.comcast.com"  // Unique id for the user logged in 555 platform. (Identity manager response) 
config.url = "https://evm.iris.comcast.net" // Event manager URL
config.token = "<555 JWT token>" // JWT token for accessing the 555 SDK/backend APIs. Token can be accessed from the 555 login response. 
config.domain = "uciris12.comcast.net" // *Optional 
config.notificationManagerUrl =  "https://ntm.iris.comcast.net/" //(Optional) For mobile notifications from 555 Platform
config.isAnonymous = false // Set it to true for anonymous video call.

Rtc555Sdk.setConfig(config: config)

Create Stream

To make a video related API call, you need to create a stream that will provide you with the local stream id required for video call APIs. To create stream, pass callType & Rtc555VideoDelegate to createStream API.

Rtc555Video.createStream(callType: callType, rtcVideoDelegate: self)
ParametersTypeDescription
callTypestring"outgoing" or "incoming"
rtcVideoDelegateRtc555VideoDelegateDelegate object for getting local stream Id

Initiating an Outgoing Video Call

To make outgoing video calls, pass destination email ID , notification payload, local stream ID, & Rtc555VideoDelegate to call API. Notification payload contains two fields called data and notification. The client can make use of data to send any custom key/value pair to the remote (callee) end as part of the push notification payload. The below code shows some examples to send caller Id (cid) & caller name (cname). The notification key contains the notification type and federation type as mentioned in the below code snippet.

call API returns enum Result. Success case of result will return call id and failure case return error code and reason for the error.

    Rtc555Video.call(targetEmailID: "<Destination EmailID>", notificationPayload: buildNotificationPayload(), streamId: localStreamId, rtcVideoDelegate: self) { result in
                switch(result){
                case .success(let callId):
                    print("Video call was success and callid is = \(callId)")
                case .failure(let error):
                    print("Video call failed with error \(error)")
                }   
    }
    //build notification  payload   
    private func buildVideoNotificationPayload() -> [AnyHashable : Any] {
        
        let data:[String: Any] = ["cname" : "Caller Name",
                                  "cid" : "Caller Username",
                                  "isVideoOnly" : true]
        let notification = ["type" : "video",
                               "topic": "federation/video"]
        
        let userData = ["data": data, "notification" : notification]
        
        return userData
    }
       
ParametersTypeDescription
targetEmailIDstringTarget(callee) email ID
notificationPayloaddictionarynotification & custom user data
streamIdstringlocal stream ID received from onLocalStream delegate
rtcVideoDelegateRtc555VideoDelegateDelegate object for getting remote stream Id, call status and error callback

Below is the Notification payload need to be build for outgoing VIDEO call:

ParametersTypeDescription
data (Optional)dictionarye.g.
  • cname
  • cid
notificationdictionary
  • type:"video"
  • topic :"federation/video"

Note:Please make sure to add a mandatory microphone and camera permission in your info.plist file before accessing call/Accept call APIs to allow SDK to create local audio and video streams.

Accept Incoming Video Call

If the user wants to accept the incoming video call request, use accept API and pass the notification payload received from the incoming APNS push notification & Rtc555VideoDelegate. accept API returns enum result. Success case of result will return call id and failure case return error code and reason for the error.

Rtc555Video.accept(notificationData: buildNotificationData(), streamId: localStreamId, rtcVideoDelegate: self) { result in
    switch(result){
        case .success(let callId):
            print("Join video call Success. \(callId)")
        case .failure(let error):
            print("Join video call Failed with error \(error)")
        }
    }


//Note : Here userInfo is the dictionary payload received in didReceiveIncomingPushWith callback for push notification or notificationData received from onNotification for XMPP notification.

private func buildNotificationData() -> Dictionary{
     let notificationdata = ["trace_id" : (userInfo["trace_id""] as? String) ?? "",
                         "room_id" : (userInfo["room_id"] as? String) ?? ""y,
                         "rtc_server" : n(userInfo["rtc_server"] as? String) ?? "",
                         "to_routing_id" : (userInfo["routing_id"] as? String) ?? "",
                         "room_token" : (userInfo["room_token"] as? String) ?? "",
                         "room_token_expiry_time" : (userInfo["room_token_expiry_time"] as? Int64) ?? 0
     ] as [String : Any]       
     return notificationdata
}

Pass notification payload received at incoming notification.

ParametersTypeDescription
notificationdatadictionaryContains key/value pair for the data received from incoming APNs/XMPP payload
rtcVideoDelegateRtc555VideoDelegateDelegate object for getting remote stream Id, call status and error callback

Notification data is constructed from the values received from the incoming notification payload :

ParametersDescription
trace_idtrace id
room_idRoom name that needs to be joined which is received in notification payload.
room_tokenRoom token which is received in notification payload.
room_token_expiry_timeRoom token expiry time retrieved from notification payload.
to_routing_idCaller's routing Id
rtc_serverRTC server URL extracted from notification payload.

End an Active Video Call

Users need to call hangup API to end the active call.

Rtc555Video.hangup(callId: callId)
ParametersDescription
callIdcallId is a unique id for the call which was returned from call/accept API

Clean up the session.

Call the below API in Rtc555Sdk to release all the resources used by SDK. This call also allows the client to disconnect from the 555 platform backend. The app developer should call this API if the app goes to the background or kill state to release the SDK resource. Client need to call setConfig API again before attempting to initiate/accept the call.

Rtc555Sdk.cleanup()

Callkit Support

Callkit in client requires below API calls from SDK

Initialize Audio Unit

This API call allows users to manually initialize Audio Unit while using CallKit. The user needs to call this before starting/joining the call.

Rtc555Voice.initilizeManualAudio(audioManual: Bool)
ParametersTypeDescription
audioManualBoolPass Yes to initilize Audio unit Manually

Activate/Deactive Audio Unit

This API is only effective if initilizeManualAudio is YES. This API call allows users to activate/deactivate audio while using callkit. Need to call this API in provider(:didActivate:) delegate and provider(:didDeactivate:) delegate.

Rtc555Voice.enableAudio(enableAudio: Bool)

//Usage :: Callkit delegates
func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) {
    Rtc555Voice.enableAudio(enableAudio: false)
}

func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
    Rtc555Voice.enableAudio(enableAudio: true)
}
ParametersTypeDescription
enableAudioBoolPass Yes or No to start /stop the Audio unit

Video On-call Features

Features offered by iOS SDK for Video call are:

  • Toggle Audio Mute
  • Toggle Video Mute
  • Flip Camera

Toggle Audio Mute

This API call allows the users to mute and unmute its audio in the call.

Rtc555Video.audioMuteToggle(callId: callId)
Parameters
callIdcallId is a unique id for this call which was returned from call/accept API

Toggle Video Mute

This API call allows the user to mute and unmute its video in the call.

Rtc555Video.videoMuteToggle(callId: callId)
ParametersDescription
callIdcallId is a unique id for this call which was returned from call/accept API

Flip Camera

This API call allows users to flip between the front and rear camera of the device. ​

Rtc555Video.flipCamera()

Video Call Delegates

To get local stream Id, remote stream Id, and call status or error report during the call, Rtc555VideoDelegate is passed to the call/accept API call. This delegate provides the below callbacks.

onLocalStream

This callback gets invoked when we receive the local stream id which is required to make/accept the call. This local stream can be used to render local video on the device screen using RtcRenderer.

    func onLocalStream(streamId mediastreamId: String) {
    }
ParametersDescription
streamIdLocal Stream Id

onRemoteStream

This callback gets invoked when we receive the stream Id of the remote participant that can be used to render remote video on the device screen using RtcRenderer.

    func onRemoteStream(streamId mediastreamId: String) {
    }
ParametersDescription
streamIdRemote Stream Id

onStatus

This callback gets invoked when we receive the status of the ongoing call.

    func onStatus(status callStatus: CallStatus,id callId:String) {
         
     }
ParametersDescription
callStatusstatus of ongoing call
callIdCall id for the ongoing call

Call Status:

  • initializing   -   When the call is initializing
  • connecting   -   When the call is connecting i.e. when remote party is ringing.
  • connected    -   When the call is connected and media(video) started transferring.
  • disconnected  -   When the call is disconnected i.e. when remote side hang up the call.

onError

This callback gets invoked when we receive an error from an ongoing video call.

    func onError(error errorInfo: Error,id callId:String) {
         
     }
ParametersDescription
errorInfoerror object consists of error code and error message
callIdcallId received from backend

onNotification

Use this delegate to receive notify and cancel XMPP notifications or the cancel notification when subscribed to APNs. The client needs to be connected to 555 backend to avail of this notification callback.

    @objc func onNotification(notification notificationData: [AnyHashable : Any]) {

    }
ParametersDescription
notificationDatanotification payload for incoming notification

Video Call Renderer

The video call renderer referred to as RtcRenderer provided by the Rtc555Sdk is used to render the video on the UI using stream id from Local Stream and Remote Stream.

Initilize RtcRenderer

To initialize, you need to pass the size of the View which needs to render the video stream. After that, you need to add the videoView variable of RtcRenderer to the UIView.

//Local
var localRenderer = RtcRenderer(frameSize: self.localView.bounds)
self.localView.insertSubview(localRenderer.videoView)

//Remote
var remoteRenderer = RtcRenderer(frameSize: self.remoteView.bounds)
self.remoteView.insertSubview(remoteRenderer.videoView)
ParametersDescription
frameSizesize of the rendering UIView

Add Stream

This API adds the Stream id received from Local Stream and Remote Stream to local/remote RtcRenderer.

self.localRenderer.addStream(streamId: localStreamId)
self.remoteRenderer.addStream(streamId: remoteStreamId)
ParametersDescription
streamIdStream Id received from onLocalStream/onRemoteStream
← How to initiate or accept PSTN callHow to initiate or join ANONYMOUS VIDEO call →
  • SDK initialization
  • Adding SDK configuration.
  • Create Stream
  • Initiating an Outgoing Video Call
  • Accept Incoming Video Call
  • End an Active Video Call
  • Clean up the session.
  • Callkit Support
    • Initialize Audio Unit
    • Activate/Deactive Audio Unit
  • Video On-call Features
    • Toggle Audio Mute
    • Toggle Video Mute
    • Flip Camera
  • Video Call Delegates
    • onLocalStream
    • onRemoteStream
    • onStatus
    • onError
    • onNotification
  • Video Call Renderer
    • Initilize RtcRenderer
    • Add Stream
Docs
Getting StartedGuidesAPI Reference
More
BlogGitHub
555 Platform
Copyright © 2024 555 Platform ™
555docs-v0.0.94