Skip to main content
Version: v4

Events

Overview

Events allow for a decoupled, flexible architecture where different parts of the application can interact without having to directly reference each other. This makes it easier to create complex, interactive experiences, as well as to extend and customize the functionality provided by the CometChat UI Kit.

Both Components and Composite Components have the ability to emit events. These events are dispatched in response to certain changes or user interactions within the component. By emitting events, these components allow other parts of the application to react to changes or interactions, thus enabling dynamic and interactive behavior within the application.

User Events

CometChatUserEvents emits events when the logged-in user executes some action on another user

It contains the following properties and methods

observer

This is a List of Dictionary that contains components listening to user events in key value pairs

Type

[String: CometChatUserEventListener]()


addListener

this method stores the passed listenerClass against the passed id in the usersListener.

Signature

Uses

addListener(_ id: String,_ observer: CometChatUserEventListener)

Parameters

ParametersTypeDescription
idStringthe key to store the component against
observerCometChatUserEventListenerthe component listening to user events

removeListener

this method removes the entry with the passed id from the usersListener.

Signature

removeListener(_ id: String)

Parameters

ParametersTypeDescription
idStringthe key of the entry to remove

onUserBlock

This method is used to perform some task when the logged-in user has blocked a user

Signature

onUserBlock(user: User)

Parameters

ParametersTypeDescription
userUserthe user that has been blocked

onUserUnblock

This method is used to perform some task when the logged-in user has unblocked a blocked user.

Signature

onUserUnblock(user: User)

Parameters

ParametersTypeDescription
userUserthe user that has been unblocked

Return Type

void

Emitting User Events

There are two types of user event listeners, one is for the SDK, which listens for events emitted from the backend for actions taken by users other than the logged in user and second, the events specific to the UI Kit which listens for events emitted from the client side for actions made by the logged-in user. The code snippets shared below contains how to emit such client-side user events to inform other UI components in your project that a user has been blocked or unblocked, the methods being used are static and hence they can be called without having to create an instance of CometChatUserEvents class.

//pass the [User] object of the user which has been blocked by the logged in user
CometChatUserEvents.emitOnUserBlock(user: User)

//pass the [User] object of the user which has been unblocked by the logged in user
CometChatUserEvents.emitOnUserUnblock(user: User)

Listening to User Events

Here we will go through how anyone can listen to these client-side User Events to update the state of the UI accordingly.

EventsDescription
onUserBlockedThis will get triggered when the logged in user blocks another user
onUserUnblockedThis will get triggered when the logged in user unblocks another user
// View controller from your project where you want to listen events.
public class ViewController: UIViewController {

public override func viewDidLoad() {
super.viewDidLoad()

// Subscribing for the listener to listen events from user module
CometChatUserEvents.addListener("UNIQUE_ID", self as CometChatUserEventListener)
}

public override func viewWillDisappear(_ animated: Bool) {
// Uncubscribing for the listener to listen events from user module
CometChatUserEvents.removeListener("LISTENER_ID_USED_FOR_ADDING_THIS_LISTENER")
}


}

// Listener events from user module
extension ViewController: CometChatUserEventListener {

func onUserBlock(user: User) {
// Do Stuff
}

func onUserUnblock(user: User) {
// Do Stuff
}
}

Group Events

CometChatGroupEvents emits events when the logged-in user executes some action on a group or group member

It contains the following properties and methods:

observer

This is a List of Dictionary that contains components listening to group events in key value pairs

Type

[String: CometChatGroupEventListener]()


addListener

this method stores the passed listenerClass against the passed listenerId in the observer.

Signature

addListener(_ id: String,_ observer: CometChatGroupEventListener)

Parameters

ParametersTypeDescription
idStringthe key to store the component against
observerCometChatGroupEventListenerthe component listening to group events

removeListener

this method removes the entry with the passed listenerId from the observer.

Signature

removeListener(_ id: String)

Parameters

ParametersTypeDescription
idStringthe key of the entry to remove

onGroupCreate

This method is used to perform some task when the logged-in user has created a group

Signature

onGroupCreate(group: Group)

Parameters

ParametersTypeDescription
groupGroupthe new group that has been created

onCreateGroupClick

This method is used to perform some task when the logged-in user click on Create group button

Signature

onCreateGroupClick()

onGroupDelete

This method is used to perform some task when the logged-in user has deleted a group.

Signature

onGroupDelete(group: Group)

Parameters

ParametersTypeDescription
groupGroupthe group that has been deleted

onGroupMemberLeave

This method is used to perform some task when the logged-in user has left a group.

Signature

onGroupMemberLeave(leftUser: User, leftGroup:  Group)

Parameters

ParametersTypeDescription
leftUserUserthe user that has left the group
leftGroupGroupthe group from which the logged-user has left

onGroupMemberChangeScope

This method is used to perform some task when the logged-in user has changed the scope of a member of a group.

Signature

onGroupMemberChangeScope(updatedBy: User , updatedUser: User , scopeChangedTo: CometChat.MemberScope , scopeChangedFrom: CometChat.MemberScope, group: Group)

Parameters

ParametersTypeDescription
updatedByUserthe user who changed the scope of group member
updatedUserUserthe user whose scope has been changed
scopeChangedToStringthe new scope
scopeChangedFromStringthe old scope
groupGroupthe group from where the scope change has occurred

onGroupMemberBan

This method is used to perform some task when the logged-in user has banned a user from the group.

Signature

onGroupMemberBan(bannedUser: User, bannedGroup:  Group, bannedBy: User)

Parameters

ParametersTypeDescription
bannedUserUserthe user that has been banned
bannedByUserthe user who has banned
bannedFromGroupthe group from which the user has been banned

onGroupMemberKick

This method is used to perform some task when the logged-in user has kicked a user from the group.

Signature

onGroupMemberKick(kickedUser: User, kickedGroup:  Group, kickedBy: User)

Parameters

ParametersTypeDescription
kickedUserUserthe banned user that has been kicked
kickedByUserthe user who has kicked
kickedGroupGroupthe group from which the user has been kicked

onGroupMemberUnban

This method is used to perform some task when the logged-in user has unbanned a banned user from a group.

Signature

onGroupMemberUnban(unbannedUserUser: User, unbannedUserGroup:  Group, unbannedBy: User)

Parameters

ParametersTypeDescription
unbannedUserUserthe banned user that has been unbanned
unbannedByUserthe user who has unbanned
unbannedFromGroupthe group from which the banned user has been unbanned

onGroupMemberJoin

This method is used to perform some task when the logged-in user has joined a group.

Signature

onGroupMemberJoin(joinedUser: User, joinedGroup:  Group)

Parameters

ParametersTypeDescription
joinedUserUserthe user that has been unblocked
joinedGroupGroupthe group the users have been added to

onGroupMemberAdd

This method is used to perform some task when the logged-in user has added new members to the group

Signature

onGroupMemberAdd(group: Group, members: [GroupMember], addedBy: User)

Parameters

ParametersTypeDescription
membersList<User>the list of users added
groupGroupthe group the users have been added to
addedByUserthe user who has added those new members

onOwnershipChange

This method is used to perform some task when the logged-in user has transferred their ownership of a group.

Signature

onOwnershipChange(group: Group?, member: GroupMember?)

Parameters

ParametersTypeDescription
groupGroupthe group where the ownership has been changed
memberGroupMemberthe group member who has been made owner of the group

Emitting Group Events

There are two types of group event listeners, one is for the SDK, which listens for events emitted from the backend for actions taken by users other than the logged in user and second, the events specific to the UI Kit which listens for events emitted from the client side for actions made by the logged-in user. The code snippets shared below contains how to emit such client-side group events to inform other UI components in a project that a group has been created or deleted or new members have been added to the group, the logged in user themselves have joined a group, members being banned by the logged in user or the change of ownership or scope of a group member, the methods being used are static and hence they can be called without having to create an instance of CometChatGroupEvents class.

//you need to pass the [Group] object of the group which is created
CometChatGroupEvents.emitOnGroupCreate(group: Group)

//you need to pass the [Group] object of the group which is deleted
CometChatGroupEvents.emitOnGroupDelete(group: Group)

//emit this when logged in user leaves the group.
CometChatGroupEvents.emitOnGroupMemberLeave(leftUser: User, leftGroup: Group)

//emit this when group member's scope is changed by logged in user.
CometChatGroupEvents.emitOnGroupMemberChangeScope(updatedBy: User , updatedUser: User , scopeChangedTo: CometChat.MemberScope , scopeChangedFrom: CometChat.MemberScope, group: Group)

//emit this when group member is banned from the group by logged in user.
CometChatGroupEvents.emitOnGroupMemberBan(bannedUser: User, bannedGroup: Group, bannedBy: User)

//emit this when group member is kicked from the group by logged in user.
CometChatGroupEvents.emitOnGroupMemberKick(kickedUser: User, kickedGroup: Group, kickedBy: User)

//emit this when a banned group member is unbanned from group by logged in user.
CometChatGroupEvents.emitOnGroupMemberUnban(unbannedUserUser: User, unbannedUserGroup: Group, unbannedBy: User)

//emit this when logged in user has joined a group successfully.
CometChatGroupEvents.emitOnGroupMemberJoin(joinedUser: User, joinedGroup: Group)

//emit this when members are added to a group by the logged in user.
CometChatGroupEvents.emitOnGroupMemberAdd(group: Group, members: [GroupMember], addedBy: User)

//emit this when ownership is changed by logged in user.
CometChatGroupEvents.emitOnGroupMemberChangeScope(updatedBy: User , updatedUser: User , scopeChangedTo: CometChat.MemberScope , scopeChangedFrom: CometChat.MemberScope, group: Group)

Listening to Group Events

Here we will go through how anyone can listen to these client-side Group Events to update the state of the UI accordingly.

EventsDescription
onGroupCreateThis will get triggered when the logged in user creates a group
onGroupDeleteThis will get triggered when the logged in user deletes a group
onGroupMemberLeaveThis will get triggered when the logged in user leaves a group
onGroupMemberChangeScopeThis will get triggered when the logged in user changes the scope of another group member
onGroupMemberBanThis will get triggered when the logged in user bans a group member from the group
onGroupMemberKickThis will get triggered when the logged in user kicks another group member from the group
onGroupMemberUnbanThis will get triggered when the logged in user unbans a user banned from the group
onGroupMemberJoinThis will get triggered when the logged in user joins a group
onGroupMemberAddThis will get triggered when the logged in user add new members to the group
onOwnershipChangeThis will get triggered when the logged in user transfer the ownership of their group to some other member
// View controller from your project where you want to listen events.
public class ViewController: UIViewController {

public override func viewDidLoad() {
super.viewDidLoad()

// Subscribing for the listener to listen events from user module
CometChatGroupEvents.addListener("UNIQUE_ID", self as CometChatGroupEventListener)
}

public override func viewWillDisappear(_ animated: Bool) {
// Uncubscribing for the listener to listen events from user module
CometChatGroupEvents.removeListener("LISTENER_ID_USED_FOR_ADDING_THIS_LISTENER")
}


}

// Listener events from groups module
extension ViewController: CometChatGroupEventListener {

public func onGroupMemberAdd(group: Group, members: [GroupMember], addedBy: User) {
// Do Stuff
}

public func onCreateGroupClick() {
// Do Stuff
}

public func onGroupCreate(group: Group) {
// Do Stuff
}

public func onGroupDelete(group: Group) {
// Do Stuff
}

public func onGroupMemberJoin(joinedUser: User, joinedGroup: Group) {
// Do Stuff
}

public func onGroupMemberLeave(leftUser: User, leftGroup: Group) {
// Do Stuff
}

public func onGroupMemberBan(bannedUser: User, bannedGroup: Group) {
// Do Stuff
}

public func onGroupMemberUnban(unbannedUserUser: User, unbannedUserGroup: Group) {
// Do Stuff
}

public func onGroupMemberKick(kickedUser: User, kickedGroup: Group) {
// Do Stuff
}

public func onGroupMemberChangeScope(updatedBy: User, updatedUser: User, scopeChangedTo: CometChat.MemberScope, scopeChangedFrom: CometChat.MemberScope, group: Group) {
// Do Stuff
}

public func onOwnershipChange(group: Group?, member: GroupMember?) {
// Do Stuff
}
}

Conversation Events

CometChatConversationEvents emits events when the logged-in user executes some action on a conversation object

It contains the following properties and methods

observer

This is a List of Dictionary that contains components listening to user events in key value pairs

Type

[String: CometChatConversationEventListener]()


addListener

this method stores the passed listenerClass against the passed listenerId in the observer.

Signature

addListener(_ id: String, _ observer: CometChatConversationEventListener)

Parameters

ParametersTypeDescription
idStringthe key to store the component against
observerCometChatConversationEventsthe component listening to conversation events

removeListener

this method removes the entry with the passed id from the observer.

Signature

removeListener(_ id: String)

Parameters

ParametersTypeDescription
idStringthe key of the entry to remove

Return Type

void


onConversationDelete

This method is used to perform some task when the logged-in user has deleted a conversation

Signature

onConversationDelete(conversation: Conversation)

Parameters

ParametersTypeDescription
conversationConversationthe user that has been deleted

Emitting Conversation Events

Here we will go through how to emit events specific to the UI Kit which listens for events emitted from the client side for actions made by the logged-in user. The code snippets shared below contains how to emit such client-side conversation events to inform other UI components in a project that a conversation has been deleted, the methods being used are static and hence they can be called without having to create an instance of CometChatConversationEvents class.

//pass the conversation object you want to delete
CometChatConversationEvents.emitConversationDelete(conversation: Conversation)

Listening to Conversation Events

Here we will go through how anyone can listen to these client-side Conversation Events to update the state of the UI accordingly.

EventDescription
onConversationDeleteThis event will be triggered when the logged in user deletes a conversation
// View controller from your project where you want to listen events.
public class ViewController: UIViewController {

public override func viewDidLoad() {
super.viewDidLoad()

// Subscribing for the listener to listen events from conversation module
CometChatConversationEvents.addListener("UNIQUE_ID", self as CometChatConversationEventListener)
}

public override func viewWillDisappear(_ animated: Bool) {
// Uncubscribing for the listener to listen events from conversation module
CometChatConversationEvents.removeListener("LISTENER_ID_USED_FOR_ADDING_THIS_LISTENER")
}


}

// Listener events from conversation module
extension ViewController: CometChatConversationEventListener {

func onConversationDelete(conversation: Conversation) {
// Do Stuff
}

}

Message Events

CometChatMessageEvents emits events when the logged-in user executes some action involving any message object.

It contains the following properties and methods:

observer

This is a List of Dictionary that contains components listening to message events in key value pairs

Type

[String: CometChatMessageEventListener]()


addListener

this method stores the passed listenerClass against the passed id in the observer.

Signature

addListener(_ id: String,_ observer: CometChatMessageEventListener)

Parameters

ParametersTypeDescription
idStringthe key to store the component against
observerCometChatMessageEventListenerthe component listening to message events

removeListener

this method removes the entry with the passed id from the observer.

Signature

removeListener(_ id: String)

Parameters

ParametersTypeDescription
idStringthe key of the entry to remove

onMessageSent

This method is used to perform some task when the logged-in user has sent a message

Signature

onMessageSent(message: BaseMessage, status: MessageStatus)

Parameters

ParametersTypeDescription
messageBaseMessagethe message that has been sent
messageStatusMessageStatusthe status of the message, it can be inProgress, sent or error

onMessageEdit

This method is used to perform some task when the logged-in user has edited a message

Signature

onMessageEdit(message: BaseMessage, status: MessageStatus)

Parameters

ParametersTypeDescription
messageBaseMessagethe message that has been sent
messageStatusMessageEditStatusthe status of the message, it can be inProgress or success

onMessageDelete

This method is used to perform some task when the logged-in user has deleted a message

Signature

onMessageDelete(message: BaseMessage)

Parameters

ParametersTypeDescription
messageBaseMessagethe message that has been sent
messageStatusEventStatusthe status of the message, it can be inProgress or success

onMessageRead

This method is used to perform some task when the logged-in user has read a message

Signature

onMessageRead(message: BaseMessage)

Parameters

ParametersTypeDescription
messageBaseMessagethe message that has been read

onLiveReaction

This method is used to perform some task when the logged-in user has a sent a transient message

Signature

onLiveReaction(reaction: TransientMessage)

Parameters

ParametersTypeDescription
reactionTransientMessagethe image to send as transient message

onViewInformation

This method is used to perform some task when the logged-in user click on detail button.

Signature

onViewInformation(group: Group)
ParametersTypeDescription
groupGroupthe group for which the information has been shown

onParentMessageUpdate

This method is used to perform some task when the logged-in user updates a message that has replies.

Signature

onParentMessageUpdate(message: BaseMessage)
ParametersTypeDescription
messageBaseMessagethe message that has been updated

Emitting Message Events

There are two types of message event listeners, one is for the SDK, which listens for events emitted from the backend for actions taken by users other than the logged in user; and second, the events specific to the UI Kit which listens for events emitted from the client side for actions made by the logged-in user. The code snippets shared below contains how to emit such client-side message events to inform other UI components in a project.

//emit this when the logged in user has sent a message. Pass the object of the [TextMessage], [MediaMessage] or [CustomMessage] being sent and the [MessageStatus] if [inProgress], [sent] successfully or failed with [error]*_
CometChatMessageEvents.emitOnMessageSent(message: BaseMessage, status: MessageStatus)

//emit this for when a message is edited by logged-in user. Pass the object of the [TextMessage], [MediaMessage] or [CustomMessage] being edited and the [MessageEditStatus] if [inProgress] or [success]*_
CometChatMessageEvents.emitOnMessageEdit(message: BaseMessage, status: MessageStatus)

//emit this when a message is being deleted by logged-in user. Pass the object of the [TextMessage], [MediaMessage] or [CustomMessage] being deleted and also pass the [EventStatus] if [inProgress] or [success]*_
CometChatMessageEvents.emitOnMessageDelete(message: BaseMessage)

//emit this when a message is read by logged-in user. Pass the object of the [TextMessage], [MediaMessage] or [CustomMessage] being read*_
CometChatMessageEvents.emitOnMessageRead(message: BaseMessage)

//emit this when a transient message is sent by logged-in user. Pass a [String] asset image of the Live Reaction to show in the animation*_
CometChatMessageEvents.emitOnLiveReaction(reaction: TransientMessage)

//emit this when the logged in user clicked on detail icon.*_
CometChatMessageEvents.emitOnViewInformation(user: User)

//emit this when the logged in user updates a message that contains replies.*_
CometChatMessageEvents.emitOnParentMessageUpdate(message: BaseMessage)

Listening to Message Events

Here we will go through how anyone can listen to these client-side Message Events to update the state of the UI accordingly.

EventsDescription
onMessageSentTriggers whenever a loggedIn user sends any message, it will have two states such as: inProgress & sent
onMessageEditTriggers whenever a loggedIn user edits any message from the list of messages .it will have two states such as: inProgress & sent
onMessageDeleteTriggers whenever a loggedIn user deletes any message from the list of messages
onMessageReadTriggers whenever a loggedIn user reads any message.
onLiveReactionTriggers whenever a loggedIn user clicks on live reaction
onViewInformationTriggers whenever a loggedIn user clicks on detail icon
onParentMessageUpdateTriggers whenever a loggedIn user updates a message that contains replies.
// View controller from your project where you want to listen events.
public class ViewController: UIViewController {

public override func viewDidLoad() {
super.viewDidLoad()

// Subscribing for the listener to listen events from message module
CometChatMessageEvents.addListener("UNIQUE_ID", self as CometChatMessageEventListener)
}

public override func viewWillDisappear(_ animated: Bool) {
// Uncubscribing for the listener to listen events from message module
CometChatMessageEvents.removeListener("LISTENER_ID_USED_FOR_ADDING_THIS_LISTENER")
}


}

// Listener events from message module
extension ViewController: CometChatMessageEventListener {

func onMessageSent(message: BaseMessage, status: MessageStatus) {
// Do Stuff
}

func onMessageEdit(message: BaseMessage, status: MessageStatus) {
// Do Stuff
}

func onMessageDelete(message: BaseMessage, status: MessageStatus) {
// Do Stuff
}

func onMessageReply(message: BaseMessage, status: MessageStatus) {
// Do Stuff
}

func onMessageRead(message: BaseMessage) {
// Do Stuff
}

func onLiveReaction(reaction: TransientMessage) {
// Do Stuff
}

func onMessageError(error: CometChatException) {
// Do Stuff
}

func onVoiceCall(user: User) {
// Do Stuff
}

func onVoiceCall(group: Group) {
// Do Stuff
}

func onVideoCall(user: User) {
// Do Stuff
}

func onVideoCall(group: Group) {
// Do Stuff
}

func onViewInformation(user: User) {
// Do Stuff
}

func onMessageReact(message: BaseMessage, reaction: CometChatMessageReaction) {
// Do Stuff
}

}

Call Events

CometChatCallEvents emits events when the logged-in user executes some action involving any call object.

It contains the following properties and methods:

observer

This is a List of Dictionary that contains components listening to call events in key value pairs

Type

[String:CometChatCallEventListener]()


addListener

This method stores the passed listenerClass against the passed id in the addListener.

Signature

addListener(_ id: String,_ observer: CometChatCallEventListener)
ParametersTypeDescription
idStringthe key to store the component against
observerCometChatCallEventListenerthe component listening to call events

removeListener

This method removes the entry with the passed id from the observer.

Signature

removeListener(_ id: String)
ParameterTypeDescription
idStringthe key of the entry to remove

onIncomingCallAccepted

This method is used to perform some task when the logged-in user accepts the incoming call

Signature

onIncomingCallAccepted(call: Call)
ParametersTypeDescription
callCallthe call that has been accepted

onIncomingCallRejected

This method is used to perform some task when the logged-in user rejects the incoming call

Signature

onIncomingCallRejected(call: Call)
ParametersTypeDescription
callCallthe call that has been rejected

onCallInitiated

This method is used to perform some task when the logged-in user initiates a call

Signature

onCallInitiated(call: Call)
ParametersTypeDescription
callCallthe call that has been initiated

onCallEnded

This method is used to perform some task when the ongoing or outgoing call ends.

Signature

onCallEnded(call: Call)
ParametersTypeDescription
callCallthe call that has been ended

onOutgoingCallAccepted

This method is used to perform some task when the outgoing call is accepted.

Signature

onOutgoingCallAccepted(call: Call)
ParametersTypeDescription
callCallthe call that has been accepted by the other user.

onOutgoingCallRejected

This method is used to perform some task when the outgoing call is rejected.

Signature

onOutgoingCallRejected(call: Call)
ParametersTypeDescription
callCallthe call that has been rejected by the other user.

Emitting Call Events

There are two types of call event listeners, one for the SDK, which listens for events emitted from the backend for actions taken by users other than the logged-in user; and another for events specific to the UI Kit, which listens for events emitted from the client side for actions made by the logged-in user. The code snippets shared below contain how to emit such client-side call events to inform other UI components in a project.

//emit this when logged in user initiates a call
CometChatCallEvents.emitOnCallInitiated(call: Call)

//emit this when logged in user cancels a call
CometChatCallEvents.emitOnCallEnded(call: Call)

//emit this when logged in user accepts the incoming call
CometChatCallEvents.emitOnIncomingCallAccepted(call: Call)

//emit this when logged in user rejects the incoming call
CometChatCallEvents.emitOnIncomingCallRejected(call: Call)
//emit this when the other user accepts the call
CometChatCallEvents.emitOnOutgoingCallAccepted(call: Call)

//emit this when the other user rejects a call
CometChatCallEvents.emitOnOutgoingCallRejected(call: Call)

Listening to Call Events

Here we will go through how anyone can listen to these client-side Call Events to update the state of the UI accordingly.

EventDescription
onIncomingCallAcceptedTriggers whenever incoming call is accepted by the user
onIncomingCallRejectedTriggers whenever incoming call is rejected by the user
onCallEndedTriggers whenever the call is ended
onCallInitiatedTriggers whenever the call is getting initiated
onOutgoingCallAcceptedTriggers whenever outgoing call is accepted by the user
onOutgoingCallRejectedTriggers whenever outgoing call is rejected by the user
// View controller from your project where you want to listen events.
public class ViewController: UIViewController {

public override func viewDidLoad() {
super.viewDidLoad()

// Subscribing for the listener to listen events from user module
CometChatCallEvents.addListener("UNIQUE_ID", self as CometChatCallEventListener)
}

public override func viewWillDisappear(_ animated: Bool) {
// Uncubscribing for the listener to listen events from user module
CometChatCallEvents.removeListener("LISTENER_ID_USED_FOR_ADDING_THIS_LISTENER")
}


}

// Listener events from user module
extension ViewController: CometChatCallEventListener {

func onIncomingCallAccepted(call: Call) {
// Do Stuff
}

func onIncomingCallRejected(call: Call)
// Do Stuff
}

func onCallEnded(call: Call) {
// Do Stuff
}

func onCallInitiated(call: Call)
// Do Stuff
}

func onOutgoingCallAccepted(call: Call) {
// Do Stuff
}

func onOutgoingCallRejected(call: Call)
// Do Stuff
}
}