diff --git a/MatrixSDK/VoIP/MXCall.h b/MatrixSDK/VoIP/MXCall.h index f3c24f7f5..1bb18881f 100644 --- a/MatrixSDK/VoIP/MXCall.h +++ b/MatrixSDK/VoIP/MXCall.h @@ -24,6 +24,7 @@ #import "MXCallStackCall.h" #import "MXCallHangupEventContent.h" +#import "MXCallInviteEventContent.h" NS_ASSUME_NONNULL_BEGIN @@ -125,6 +126,12 @@ extern NSString *const kMXCallSupportsTransferringStatusDidChange; */ - (void)handleCallEvent:(MXEvent *)event; +/** + Update call id from invite content + + @param event the call event coming from the event stream. + */ +- (void)updateCallId:(MXCallInviteEventContent*)invite; #pragma mark - Controls /** diff --git a/MatrixSDK/VoIP/MXCall.m b/MatrixSDK/VoIP/MXCall.m index 686ccd4ef..d4ed0b571 100644 --- a/MatrixSDK/VoIP/MXCall.m +++ b/MatrixSDK/VoIP/MXCall.m @@ -26,7 +26,6 @@ #import "MXSDKOptions.h" #import "MXEnumConstants.h" -#import "MXCallInviteEventContent.h" #import "MXCallAnswerEventContent.h" #import "MXCallSelectAnswerEventContent.h" #import "MXCallCandidatesEventContent.h" @@ -1102,6 +1101,10 @@ - (void)callStackCallDidConnect:(id)callStackCall #pragma mark - Event Handlers +- (void)updateCallId:(MXCallInviteEventContent*)invite { + _callId = invite.callId; +} + - (void)handleCallInvite:(MXEvent *)event { MXLogDebug(@"[MXCall][%@] handleCallInvite", _callId) @@ -1121,7 +1124,7 @@ - (void)handleCallInvite:(MXEvent *)event return; } - _callId = callInviteEventContent.callId; + [self updateCallId: callInviteEventContent]; _callerId = event.sender; _callerName = [callManager.mxSession userWithUserId:_callerId].displayname; MXRoom *signalingRoom = [callManager.mxSession roomWithRoomId:event.roomId]; diff --git a/MatrixSDK/VoIP/MXCallManager.m b/MatrixSDK/VoIP/MXCallManager.m index 44c13de6b..f2c3a8cf7 100644 --- a/MatrixSDK/VoIP/MXCallManager.m +++ b/MatrixSDK/VoIP/MXCallManager.m @@ -502,6 +502,8 @@ - (void)handleCallInvite:(MXEvent *)event if (_callKitAdapter.maximumActiveCalls != -1 && runningCalls >= _callKitAdapter.maximumActiveCalls) { + MXCallInviteEventContent* callInviteEventContent = [MXCallInviteEventContent modelFromJSON:event.content]; + [call updateCallId: callInviteEventContent]; [call hangupWithReason: MXCallHangupReasonUserBusy]; return;