Skip to content

Commit

Permalink
Fix wrong call id on hangup busy
Browse files Browse the repository at this point in the history
  • Loading branch information
artemkrachulov committed Oct 11, 2023
1 parent fb8a769 commit 0570460
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions MatrixSDK/VoIP/MXCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#import "MXCallStackCall.h"
#import "MXCallHangupEventContent.h"
#import "MXCallInviteEventContent.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -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
/**
Expand Down
7 changes: 5 additions & 2 deletions MatrixSDK/VoIP/MXCall.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#import "MXSDKOptions.h"
#import "MXEnumConstants.h"

#import "MXCallInviteEventContent.h"
#import "MXCallAnswerEventContent.h"
#import "MXCallSelectAnswerEventContent.h"
#import "MXCallCandidatesEventContent.h"
Expand Down Expand Up @@ -1102,6 +1101,10 @@ - (void)callStackCallDidConnect:(id<MXCallStackCall>)callStackCall

#pragma mark - Event Handlers

- (void)updateCallId:(MXCallInviteEventContent*)invite {
_callId = invite.callId;
}

- (void)handleCallInvite:(MXEvent *)event
{
MXLogDebug(@"[MXCall][%@] handleCallInvite", _callId)
Expand All @@ -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];
Expand Down
2 changes: 2 additions & 0 deletions MatrixSDK/VoIP/MXCallManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0570460

Please sign in to comment.