Closed sowens-csd closed 3 years ago
For this case, you can use System messages. Just send special signaling to yourself on other devices. After receiving this message on another device close the Call screen.
This sounds good, thanks, I'll have a look.
This works well, thanks.
In case anyone else is looking for this here's some code I'm using to send a message to all instances of this user and then ignore it on the sender. The result is that every instance other than the sender can handle the message.
void init() {
_systemMessagesManager =
CubeChatConnection.instance.systemMessagesManager;
_systemMessagesManager.systemMessagesStream.listen(_onSystemMessage);
_originatorId = _getUUID();
}
/// Call this whenever the call has been handled on the local system,
/// that could be by accepting it, rejecting it, hanging up, etc.
void handledCall() {
CubeMessage systemMessage = CubeMessage();
systemMessage.recipientId = _cubeSession.userId;
systemMessage.properties['myEventField'] = handledByMe;
systemMessage.properties['originatorId'] = _originatorId;
_systemMessagesManager.sendSystemMessage(systemMessage);
}
void _onSystemMessage(CubeMessage message) {
if (_originatorId == message.properties['originatorId']) return;
if (handledByMe == message.properties['myEventField'] &&
onHandledByMe != null) {
onHandledByMe();
}
}
I'm trying to work out the correct flow for gracefully handling having the same user logged in on multiple devices. I tried it in the p2p_call_sample app doing the following:
The result starts as expected. The call rings on the first two devices. However, if I answer on one device the other continues to ring. If I hangup on the device that is still ringing both it and the caller hang up while the device that answered remains connected.
Is there a sample or some documentation that shows how you expect this flow to work and what API interactions can be used to handle it?