HomeiOS Developmentgoal c - iOS - Not capable of reject incoming name programatically

goal c – iOS – Not capable of reject incoming name programatically


I am having a VoIP app wherein calling works usually.

Nevertheless, when we’ve an energetic VoIP name and the consumer receives a standard PSTN name, the energetic VoIP name goes clean – no audio is audible on both aspect.

To resolve this subject, we determined to finish the brand new incoming name programatically and I am efficiently capable of detect an incoming PSTN name. However when I attempt to finish the decision, I get error saying:

EndCallAction transaction request failed: The operation couldn’t be accomplished. (com.apple.CallKit.error.requesttransaction error 4.)

Error code 4 refers to CXErrorCodeRequestTransactionErrorUnknownCallUUID.

Beneath is my code:

// referred to as throughout initialization
self.callObserver = [[CXCallObserver alloc] init];
[self.callObserver setDelegate:self queue:dispatch_get_main_queue()];
- (void)callObserver:(nonnull CXCallObserver *)callObserver callChanged:(nonnull CXCall *)name {
    // isCallInProgress static variable tracks if a VoIP name is energetic and I verified its worth - works as anticipated
    if(isCallInProgress) {
        if(!name.isOutgoing && !name.hasConnected && !name.hasEnded) {
            NSLog(@"*** New incoming name detected whereas a name is in progress - so reject it");
            dispatch_async(dispatch_get_main_queue(), ^{
                CXEndCallAction *endCallAction = [[CXEndCallAction alloc] initWithCallUUID:name.UUID];
                CXTransaction *transaction = [[CXTransaction alloc] initWithAction:endCallAction];

                CXCallController *controller = [[CXCallController alloc] init];
                [controller requestTransaction:transaction completion:^(NSError *error) {
                    if (error) {
                        NSLog(@"*** EndCallAction transaction request failed: %@", [error localizedDescription]);
                    }
                    else {
                        NSLog(@"*** EndCallAction transaction request profitable");
                    }
                }];
            });
        }
    }
} 

Can any person assist right here?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments