Skip to content

Latest commit

 

History

History
executable file
·
60 lines (33 loc) · 1.69 KB

RealtimeCallEvents.md

File metadata and controls

executable file
·
60 lines (33 loc) · 1.69 KB

Real time events for Calling

Since, swift supports extension for AppDelegate, we have managed it for Swift. But if you're using Objective C then you've to add necessory events manually inside your project.


Step 1:

  • Open AppDelegate.h file.

  • Register for CometChatCallDelegate in Application class.

@interface AppDelegate : UIResponder <UIApplicationDelegate, CometChatCallDelegate>

Step 2:

  • Open AppDelegate.m file.

  • Add below code in App Delegate.

- (void)onIncomingCallReceivedWithIncomingCall:(Call *)incomingCall error:(CometChatException *)error{
    
    dispatch_async(dispatch_get_main_queue(), ^{
        CometChatIncomingCall *incomingCallScreen = [[CometChatIncomingCall alloc]init];
        [incomingCallScreen setCallWithCall:incomingCall];
        [ROOTVIEW presentViewController:incomingCallScreen animated:YES completion:^{}];
        });
    [CometChatCallManager.incomingCallDelegate onIncomingCallReceivedWithIncomingCall:incomingCall error:error];
}

- (void)onOutgoingCallRejectedWithRejectedCall:(Call *)rejectedCall error:(CometChatException *)error{
    
    [CometChatCallManager.outgoingCallDelegate onOutgoingCallRejectedWithRejectedCall:rejectedCall error:error];
}

- (void)onIncomingCallCancelledWithCanceledCall:(Call *)canceledCall error:(CometChatException *)error{
    
    [CometChatCallManager.incomingCallDelegate onIncomingCallCancelledWithCanceledCall:canceledCall error:error];
    
}

- (void)onOutgoingCallAcceptedWithAcceptedCall:(Call *)acceptedCall error:(CometChatException *)error{
    
    [CometChatCallManager.outgoingCallDelegate onOutgoingCallAcceptedWithAcceptedCall:acceptedCall error:error];
    
}