I’m using Azure Communication Service to create video calls between 2 people (person 1 and person 2).
Person 1 logs in and waits for person 2 to log in.
When person 2 connects person 1 is notified by the "incomingCall" function
callAgent.on('incomingCall', async (args) => {
console.log("-------- ON incomingCall ------------");
try {
incomingCall = args.incomingCall;
acceptCallPop.style.display = "block";
ring();
} catch (error) {
console.error("incomingCall ERROR");
console.error(error);
}
});
Person 1 can therefore accept the call with the "acceptCall" button.
But if person 1 takes too long to accept (around 30s), the call is destroyed and if person 1 clicks on "acceptCall" there is an error.
I manage to activate a function for person 2 who can therefore know that the call is destroyed but I cannot find how to make person 1 aware when the call is destroyed.
How can person 1 know that the call is destroyed in real time ?
2
Answers
Thanks to the link in your answer I found this which allows you to know if the call is failed:
But I have another problem, if the 2 people connect at the same time, they both receive a call activating the incomingCall function. Let's imagine that person 2 answers, the call goes through to both people but since person 1 did not really respond to their incomingCall, the call disconnects after 30 seconds.
Is it possible to destroy incomingCall when the call is started?
For voice and video calling, access tokens are typically used to authenticate users and enable them to make calls. These tokens are issued for a limited timeframe (30 seconds in this case) and have a limit on the number of requests (1000 for issuing access tokens). When integrating voice and video calling features into your application, managing user identities and their associated access tokens within these limits is necessary, as stated in this document.
Identity:
To handle the scenario where Person 1 needs to know if the call is destroyed in real time, event handling in Azure Communication Services can be utilized.
-Code was taken from git
Alternatively, listen for the
callEnded
event on theCall
object, as shown in this doc.