Receive a Call
This guide covers how to receive a call with the Vonage Client SDK. Before you begin, make sure you added the SDK to your app and (Android, iOS, JS).
NOTE: On iOS it is expected that you use CallKit for incoming and outgoing calls. Please follow the push notification guide.
Receive a Call Invite
In order to receive an incoming in-app call, you should listen for incoming call invites:
To receive an incoming in-app call, listen for the callInvite event:
Add the current ViewController, or similar, as a delegate for the voice client:
ViewController will now have to conform to VGVoiceClientDelegate, the didReceiveInviteForCall function will be called when there is an incoming call invite. Keep reference to the callId as this will be needed to perform further operations:
Then, you’ll be able to answer or reject the invite.
Answer
Reject
Hang Up
For an on-going call:
Listen For Call Events
To see updates on the state of a call, for example, to know if the other member answered or hung up the call, you should listen to leg status events.
To see updates on the state of the call and its members:
The didReceiveLegStatusUpdateForCall function will update you on changes to call legs for the active call: