SDKsiOSEnterprise
Handle call events
Add and remove the OpenIM iOS SDK call signaling delegate in one place.
Implement the OIMSignalingListener protocol in your call state controller to observe incoming call invitations, participant acceptance or rejection, timeouts, and stream updates. Register and unregister the listener using the same retained instance via [OIMManager callbacker].
Code example
@interface CallStore () <OIMSignalingListener>
@end
@implementation CallStore
- (void)startListening {
[[OIMManager callbacker] addSignalingListener:self];
}
- (void)stopListening {
[[OIMManager callbacker] removeSignalingListener:self];
}
- (void)onReceiveNewInvitation:(OIMSignalingInfo *)info {
[self upsertCall:info state:@"ringing"];
}
- (void)onInviteeAccepted:(OIMSignalingInfo *)info {
[self mergeCall:info state:@"accepted"];
}
- (void)onInviteeRejected:(OIMSignalingInfo *)info {
[self mergeCall:info state:@"rejected"];
}
- (void)onInvitationCancelled:(OIMSignalingInfo *)info {
[self finishCall:info.invitation.roomID];
}
- (void)onInvitationTimeout:(OIMSignalingInfo *)info {
[self finishCall:info.invitation.roomID];
}
- (void)onInviteeAcceptedByOtherDevice:(OIMSignalingInfo *)info {
[self stopRinging:info.invitation.roomID];
}
- (void)onInviteeRejectedByOtherDevice:(OIMSignalingInfo *)info {
[self stopRinging:info.invitation.roomID];
}
- (void)onHunguUp:(OIMSignalingInfo *)info {
[self finishCall:info.invitation.roomID];
}
- (void)onRoomParticipantConnected:(OIMParticipantConnectedInfo *)info {
[self mergeParticipants:info roomID:info.roomID];
}
- (void)onRoomParticipantDisconnected:(OIMParticipantConnectedInfo *)info {
[self removeParticipants:info roomID:info.roomID];
}
- (void)onStreamChange:(OIMMeetingStreamEvent *)event {
[self updateStream:event roomID:event.roomID];
}
@endState changes after the call
- State merge key: Merge all incoming signaling events using
roomIDas the primary key. For participant rosters within multi-party calls, combineroomIDanduserID. - Lifecycle management: When logging out, switching user accounts, or tearing down the call controller, invoke
removeSignalingListener:with the exact listener instance registered earlier to avoid memory leaks or cross-account event collisions.
Was this page helpful?