AgoraIO / RTM

143 stars 160 forks source link

call invitation #64

Open ashwiniShet-ios opened 4 years ago

ashwiniShet-ios commented 4 years ago

HI, I have to create real time video call app. I am using agora video sdk to set up channel, join the channel. But as per my understanding agora video sdk doesnt handle any call sending/ receiving methods. So I am using Agora RTM sdk to send call invitaion.

// initilaization: var agorartmkit:AgoraRtmKit! var agoraCallKit:AgoraRtmCallKit! var agorainitcallkit:AgoraRtmLocalInvitation!

//usage: agorartmkit.getRtmCall() agorainitcallkit.calleeId = "1234" agorainitcallkit.content = "test" agorainitcallkit.channelId = "test"

                   agoraCallKit.send(agorainitcallkit) { (AgoraRtmInvitationApiCallErrorCode) in
                       var response =    agorainitcallkit.response
                   }

this is how I am using. Its not working.but its getting crashed. Please can anyone help me where i am going wrong.

plutoless commented 4 years ago

you have to login rtm first before using it. you may take a look at this repo https://github.com/AgoraIO-usecase/video-calling

ashwiniShet-ios commented 4 years ago

Thank you so much for sharing this repo link. This is exactly what I have been searching for. Can u pls provide input on how to receive calls , when app is in inactive state. Is it through pushkit?

plutoless commented 4 years ago

you will need to implement push notifications when app is inactive. this is not included in this exmaple.

patelravi20 commented 3 years ago

Hi,

I have implemented push notification to handle audio / video calling for inactive state. But click on push notification after I will start incoming call with use callkit. In accept the call my app getting crash. I will share my code here so can you help me.

func callCenter(_ callCenter: CallCenter, answerCall session: String) {
        callCenter.setCallConnected(of: session)
        self.strRunningCallSession = session

        guard let inviter = AgoraRtm.shared().inviter else {
            fatalError("rtm inviter nil")
        }
        guard let channel = inviter.lastIncomingInvitation?.content else {
            fatalError("lastIncomingInvitation content nil")
        }
        inviter.accpetLastIncomingInvitation()

        self.openCallScreen(session: self.channelName ?? "")
    }
KoryBricker-Personal commented 3 years ago

I'm trying to do this same thing now (combine the Agora RTM invitations with PushKit) and not quite understanding how it is supposed to work. I have everything working ok with sending and receiving invitations through the RTM sdk when both apps are open but what am I supposed to do for the scenario when the remote user's app is not running? I setup PushKit and and have it registering and receiving a PushKit token but what do I do with that token? Do I somehow give it to the RTM SDK so it can send the push for an invitation when it's normal method doesn't work? Or do I somehow need to find out from the RTM SDK that the user isn't available and then have my server send a the push using that token (which doesn't make sense to me since the RTM SDK handles all the invitation details). Or is it a matter of the RTM sdk and it's invitations are only used when the remote user is online so if it returns that they are offline/unreachable then all that invitation stuff is ignored and my server has to handle all the setup and data passed in the notifications payload regarding user and channel etc? I'm kind of lost on how this part is supposed to be handled.

plutoless commented 3 years ago

@KoryBricker-Personal https://docs.agora.io/en/Real-time-Messaging/API%20Reference/RTM_java/interfaceio_1_1agora_1_1rtm_1_1_rtm_status_code_1_1_local_invitation_error.html you can refer to invitation error code. if the code is not ok then you can assume remote app might be in background mode and try using push notification