diff --git a/MatrixSDK/VoIP/CallStack/MXCallStackCall.h b/MatrixSDK/VoIP/CallStack/MXCallStackCall.h index 5aec33d8a..12fe87af3 100644 --- a/MatrixSDK/VoIP/CallStack/MXCallStackCall.h +++ b/MatrixSDK/VoIP/CallStack/MXCallStackCall.h @@ -26,8 +26,6 @@ NS_ASSUME_NONNULL_BEGIN -@class MXCall; - @protocol MXCallStackCallDelegate; /** @@ -64,7 +62,7 @@ NS_ASSUME_NONNULL_BEGIN /** Terminate the call. */ -- (void)endCall:(MXCall*)call; +- (void)end; /** Add TURN or STUN servers. @@ -97,8 +95,7 @@ NS_ASSUME_NONNULL_BEGIN @param success A block object called when the operation succeeds. @param failure A block object called when the operation fails. */ -- (void)handleCall:(MXCall*)call - offer:(NSString *)sdpOffer +- (void)handleOffer:(NSString *)sdpOffer success:(void (^)(void))success failure:(void (^)(NSError *error))failure; @@ -114,8 +111,7 @@ NS_ASSUME_NONNULL_BEGIN of the answer. @param failure A block object called when the operation fails. */ -- (void)createAnswer:(MXCall*)call - success:(void (^)(NSString *sdpAnswer))success +- (void)createAnswer:(void (^)(NSString *sdpAnswer))success failure:(void (^)(NSError *error))failure; #pragma mark - Outgoing call @@ -128,8 +124,7 @@ NS_ASSUME_NONNULL_BEGIN of the offer. @param failure A block object called when the operation fails. */ -- (void)createCall:(MXCall*)call - offer:(void (^)(NSString *sdp))success +- (void)createOffer:(void (^)(NSString *sdp))success failure:(void (^)(NSError *error))failure; /** @@ -141,8 +136,7 @@ NS_ASSUME_NONNULL_BEGIN @param success A block object called when the operation succeeds. @param failure A block object called when the operation fails. */ -- (void)handleAnswer:(MXCall*)call - offer:(NSString *)sdp +- (void)handleAnswer:(NSString *)sdp success:(void (^)(void))success failure:(void (^)(NSError *error))failure; diff --git a/MatrixSDK/VoIP/MXCall.m b/MatrixSDK/VoIP/MXCall.m index 96b060125..25a894c4b 100644 --- a/MatrixSDK/VoIP/MXCall.m +++ b/MatrixSDK/VoIP/MXCall.m @@ -298,7 +298,7 @@ - (void)callWithVideo:(BOOL)video #endif MXWeakify(self); - [self->callStackCall createCall: self offer:^(NSString *sdp) { + [self->callStackCall createOffer:^(NSString *sdp) { MXStrongifyAndReturnIfNil(self); [self setState:MXCallStateCreateOffer reason:nil]; @@ -388,7 +388,7 @@ - (void)answer [self setState:MXCallStateConnecting reason:nil]; MXWeakify(self); - [self->callStackCall createAnswer: self success:^(NSString *sdpAnswer) { + [self->callStackCall createAnswer:^(NSString *sdpAnswer) { MXStrongifyAndReturnIfNil(self); MXLogDebug(@"[MXCall][%@] answer - Created SDP:\n%@", self.callId, sdpAnswer); @@ -840,7 +840,7 @@ - (void)setState:(MXCallState)state reason:(MXEvent *)event incoming:self.isIncoming]; // Terminate the call at the stack level - [callStackCall endCall: self]; + [callStackCall end]; } else if (MXCallStateInviteSent == state) { @@ -1158,7 +1158,7 @@ - (void)handleCallInvite:(MXEvent *)event [self.audioOutputRouter reroute]; #endif - [self->callStackCall handleCall: self offer:self->callInviteEventContent.offer.sdp + [self->callStackCall handleAnswer:self->callInviteEventContent.offer.sdp success:^{ MXStrongifyAndReturnIfNil(self); @@ -1251,7 +1251,7 @@ - (void)handleCallAnswer:(MXEvent *)event [self setState:MXCallStateConnecting reason:event]; MXWeakify(self); - [self->callStackCall handleAnswer:self offer:content.answer.sdp + [self->callStackCall handleAnswer:content.answer.sdp success:^{} failure:^(NSError *error) { MXStrongifyAndReturnIfNil(self); @@ -1449,14 +1449,14 @@ - (void)handleCallNegotiate:(MXEvent *)event self.isVideoCall = content.isVideoCall; MXWeakify(self); - [self->callStackCall handleCall: self offer:content.sessionDescription.sdp + [self->callStackCall handleOffer:content.sessionDescription.sdp success:^{ MXStrongifyAndReturnIfNil(self); // TODO: Get offer type from handleOffer and decide auto-accept it or not // auto-accept negotiations for now MXWeakify(self); - [self->callStackCall createAnswer:self success:^(NSString * _Nonnull sdpAnswer) { + [self->callStackCall createAnswer:^(NSString * _Nonnull sdpAnswer) { MXStrongifyAndReturnIfNil(self); MXLogDebug(@"[MXCall][%@] handleCallNegotiate: answer negotiation - Created SDP:\n%@", self.callId, sdpAnswer); @@ -1497,7 +1497,7 @@ - (void)handleCallNegotiate:(MXEvent *)event else if (content.sessionDescription.type == MXCallSessionDescriptionTypeAnswer) { MXWeakify(self); - [self->callStackCall handleAnswer:self offer:content.sessionDescription.sdp + [self->callStackCall handleAnswer:content.sessionDescription.sdp success:^{} failure:^(NSError *error) { MXStrongifyAndReturnIfNil(self); @@ -1631,7 +1631,7 @@ - (void)terminateWithReason:(MXEvent *)event localIceGatheringTimer = nil; // Terminate the call at the stack level - [callStackCall endCall:self]; + [callStackCall end]; // Determine call end reason if (event) @@ -1731,7 +1731,7 @@ - (void)expireCallInvite if (!_isIncoming) { // Terminate the call at the stack level we initiated - [callStackCall endCall: self]; + [callStackCall end]; } // If the call is not aleady ended