简体   繁体   English

Callkit 呼叫结束问题(错误域=com.apple.callkit.error.requesttransaction 代码=4)和呼叫接受后的音频问题

[英]Callkit call End issue(error domain=com.apple.callkit.error.requesttransaction code=4) and Audio issue after Call accept

I made VOIP App.For that i am using PushKit and Callkit with pjsip.我制作了 VOIP 应用程序。为此,我将 PushKit 和 Callkit 与 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.当后台的应用程序收到呼叫通知并基于此我打开 callkit 屏幕并单击接受呼叫后使用 pjsip 连接。

1) call End issue 1)呼叫结束问题

but when call hangout pjsip call hangout successfully but then callkit give me following error:但是当呼叫环聊 pjsip 成功呼叫环聊但随后 callkit 给我以下错误:

error domain=com.apple.callkit.error.requesttransaction code=4错误域=com.apple.callkit.error.requesttransaction 代码=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.为此,我检查了 answer 和 end call uuid 也相同,但又没有结束通话。我花了很多时间但没有得到任何解决方案。

Any one have solution then please help me.任何人都有解决方案,然后请帮助我。

2) Audio issue After Accept call 2) 接听电话后的音频问题

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>)音频会话错误:错误域=NSOSStatusErrorDomain 代码=561017449“(空)” [aurioc] 892:失败:'!pri'(启用 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.谢谢你。

1) call End issue 1)呼叫结束问题

com.apple.callkit.error.requesttransaction code=4 is saying that UUID is unknown. com.apple.callkit.error.requesttransaction code=4表示 UUID 未知。

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 .要在 CallKit 框架中正确结束呼叫,您必须使用您唯一的UUID初始化CXEndCallAction并从您的CXCallController请求具有“结束呼叫操作”的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] .在 provider 方法中,您应该通过 pjsip 结束您的调用,并且不要忘记调用[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 2) 接听电话后的音频问题

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并且当您结束呼叫时,此方法被调用(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.并在以下方法中停用 pjsip 调用的声音。

- (void)provider:(CXProvider *)provider didDeactivateAudioSession:(AVAudioSession *)audioSession{
    // end audio
    pj_status_t status = pjsua_set_null_snd_dev();
}

I fixed it by making the class which contains the CallKit functions as a singleton and never allocate a new instance of it.我通过将包含 CallKit 函数的类作为单例来修复它,并且从不分配它的新实例。 You can take a look at this helper class:你可以看看这个辅助类:

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

只维护 Provider、Configuration 和 CXCallController 的一个实例就解决了结束调用问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM