Callkit call End issue(error domain=com.apple.callkit.error.requesttransaction code=4) and Audio issue after Call accept
Asked Answered
E

3

6

I made VOIP App.For that i am using PushKit and Callkit with pjsip.

When app in background get notification of call and based on this i open callkit screen and after click on accept call connect using pjsip.

1) call End issue

but when call hangout pjsip call hangout successfully but then callkit give me following error:

error domain=com.apple.callkit.error.requesttransaction code=4

For that i checked answer and end call uuid also same but again not end call.I spent lot of time but not get any solution.

Any one have solution then please help me.

2) Audio issue After Accept call

After Accept call audio is not configure.Audio session give me following error :

audio session error: Error Domain=NSOSStatusErrorDomain Code=561017449 "(null)" [aurioc] 892: failed: '!pri' (enable 3, outf< 1 ch, 44100 Hz, Int16> inf< 1 ch, 44100 Hz, Int16>)

For above error any one have solution then give me.

Thank you.

Eventual answered 7/9, 2017 at 7:10 Comment(0)
H
4

I fixed it by making the class which contains the CallKit functions as a singleton and never allocate a new instance of it. You can take a look at this helper class:

https://github.com/naandonov-mm/iOS-10-Sampler/tree/master/CallKit

Hyperaemia answered 29/10, 2017 at 12:38 Comment(1)
@Muhammad Adly why did making it a singleton fix the problem? i.e. what was the issue and how come a singleton was the solution to that problem? ThanksGrimsley
C
3

1) call End issue

com.apple.callkit.error.requesttransaction code=4 is saying that UUID is unknown.

CXErrorCodeRequestTransactionErrorUnknownCallUUID = 4

To end call properly in CallKit framework you have to init CXEndCallAction with your unique UUID and request transaction with "end call action" from your CXCallController.

CXEndCallAction *action = [[CXEndCallAction alloc] initWithCallUUID:c_UUID]; 
[self.callController requestTransaction:[CXTransaction transactionWithActions:@[action]] completion:completion];

In the provider method you should end your call through pjsip and don't forget to call [action fulfill].

- (void)provider:(CXProvider *)provider performEndCallAction:(nonnull CXEndCallAction *)action {
   // get your current pjsip call object
   ...
   // make hangup - something like:
   pj_status_t status = pjsua_call_hangup([self identifier], 0, NULL, NULL);
   if (status != PJ_SUCCESS) {
       NSString *errStr = [NSString stringWithFormat:@"Error hanging up call %@", self];
       ALog(@"%@", errStr);
   }
   [action fulfill];
}

2) Audio issue After Accept call

When you accept the call following method is triggered - (void)provider:(CXProvider *)provider didActivateAudioSession:(AVAudioSession *)audioSession and when you end the call this method is called (void)provider:(CXProvider *)provider didDeactivateAudioSession:(AVAudioSession *)audioSession.

- (void)provider:(CXProvider *)provider didActivateAudioSession:(AVAudioSession *)audioSession{
    // start audio and configure pjsip sound
    pj_status_t status = pjsua_set_snd_dev(input, output); // '0' for input and output
}

And deactivate sound for pjsip call in following method.

- (void)provider:(CXProvider *)provider didDeactivateAudioSession:(AVAudioSession *)audioSession{
    // end audio
    pj_status_t status = pjsua_set_null_snd_dev();
}
Cardinal answered 7/9, 2017 at 8:36 Comment(19)
Hello McLaLa, I stored UUID of answer call in app delegate global variable and this UUID used when call end but again it give me same error. Error requesting transaction: The operation couldn’t be completed. (com.apple.CallKit.error.requesttransaction error 4.) i refer following for callkit: raywenderlich.com/150015/callkit-tutorial-iosEventual
When i call end that time get following UUID and transaction :- call uuid is--->9DD75246-78AF-4560-BA9D-288934E159D0 call transaction is---><CXTransaction 0x170a247a0 UUID=FB93784C-122B-4F7F-AA41-693CC489A152 isComplete=0 actions=( "<CXEndCallAction 0x17146bdc0 UUID=7804F772-21E7-49A2-B41C-E391865EE832 state=0 commitDate=(null) callUUID=9DD75246-78AF-4560-BA9D-288934E159D0 dateEnded=(null)>" )> In above same callUUID but it give me same error.Eventual
As I understand you write in swift. Can you please post your code for ending the call?Cardinal
End call code:- let endCallAction = CXEndCallAction.init(call: call.uuid) let transaction = CXTransaction(action: endCallAction) CXCallController.request(transaction) { error in if let error = error { print("Error requesting transaction: (error.localizedDescription)") } else { print("Requested transaction successfully") } }Eventual
2 times call end working properly at 3 rd time it give me same error.Eventual
You do not track your unique UUID in proper way. When you get incoming call or when you report incoming call, you have provide right UUID.Cardinal
@Shraddha Vaishnani you want to use same UUID for one complete call. use the same UUID which is used for reportnewincomingcall. Try this one! For us also same error occurs in 4 th time. In some references, they said to use xcode 11 beta version.Erb
@NandhaKumar i checked reportincomingcall and end call UUID same but 3rd time call not end.Eventual
@McLaLa i used CallUUID not used UUID and i also checked reportincomingcall CallUUID and endcall CallUUID same.2 times call end working properly but 3 rd time it's not working properly.Eventual
@Shraddha Vaishnani did you found solution for this problem?Erb
@NandhaKumar currently i have not found any solution.if you have any solution then please help me.Eventual
Try to debug and see where UUID changes, it feels like you do not overwrite your unique UUID when third call appears.Cardinal
Hello McLaLa, 1) "<CXEndCallAction 0x17486a1c0 UUID=5FE629FB-5507-4FCB-912B-6DB0336A1698 state=0 commitDate=(null) callUUID=4636B97A-2014-49E4-8F47-4A98660688A2 dateEnded=(null)>" 2) "<CXEndCallAction 0x171c6a600 UUID=5463E552-7CD1-4860-942D-C7EE62B26B2F state=0 commitDate=(null) callUUID=4636B97A-2014-49E4-8F47-4A98660688A2 dateEnded=(null)>" 3) "<CXEndCallAction 0x175660ac0 UUID=9D3703DC-FD5A-4E6A-A48C-CF3599E69224 state=0 commitDate=(null) callUUID=4636B97A-2014-49E4-8F47-4A98660688A2 dateEnded=(null)>" in first 2 action successfully reject call.3rd not reject call.Eventual
@NandhaKumar did you found solution for this problem?Eventual
Hello McLaLa, have any idea of video call using pjsip?Eventual
@ShraddhaVaishnani Nope... need to update xcode and check with ios 11.Now the project is put on hold. if you found the solution please update here!Erb
Hello Nandhakumar,i hope you are fine.have you any solution for above issue?Eventual
@ShraddhaVaishnani I am facing the same error, did you find any solution ?Dingy
Has anyone found solution for this?Amnion
D
2

Maintain only one instance of Provider, Configuration and CXCallController solved the end call issue.

Duffy answered 3/3, 2020 at 11:5 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.