How to close Callkit UI when call is not connected - ios

I'm using Twilio Programmable Voice SDK. I'm facing an issue where call doesn't connect but CallKit UI starts. When I send app into background I can see the CAllKit UI running with green notification bar at the top.
There seems to be some issue with Twilio which twilio support hasn't been able to figure out and can't provide a solution.
As a workaround I want to close CallKit UI after a time interval when call doesn't connect.
I know how to kill CallKit UI when a call is connected but this doesn't apply in my case as call isn't connected at all.
My question is how do I kill CallKit UI when call isn't connected?
My issue is exactly similar to what is reported here How to close call kit when call doesn't connect but call kit ui is running in the background
Please read it again.
Call is not connected but CallKit UI is started and I want to close it. Note that when a call is not connected you will not get uuid hence you can't call disconnect.

Looking at the ViewController code, it seems like the UUID should be stored in one of this two members:
var callInvite: TVOCallInvite?
var call: TVOCall?
In the case of an incoming call that has not been already answered the UUID is contained in callInvite, otherwise (i.e. outgoing call or answered incoming call) in the call object.

Related

How to implement callkit with connectycube on cordova ios application

Dear Connectycube Team,
I hope this email finds you well.
Our company has integrated Connectycube into our application, which primarily relies on video calling for communication between users and service providers. To ensure a seamless user experience, it's imperative that the video calling system is robust and reliable.
Unfortunately, our development team is facing challenges in making the system highly robust and 100% reliable. The issue lies in the connection dropping when the application is killed or the phone is locked.
issue: We are trying to integrate connecticube onto cordova app. We are using callkit to implement native incoming screen. The issue is that whenever the app is killed or the phone's screen is locked, accepting the call on callkit leads to failure since the accept call function gets called before the connecticube oncall event listener is called.
I would like to request a call with your technical team to discuss this matter and receive any insights or recommendations that could improve the video calling system.
Thank you for your assistance.
Best regards,
Kanhu
Once we receive incoming call using callkit and the user accepts the call, we try to send the accept call command to connectycube. But since the oncall event is not fired immediately, we create a callback loop to wait for the oncall event to get fired. This works sometimes but fails most of the time. Is there any other way ro achieve the accept call functionalities using callkit and connectycube on cordova.

Get caller number from app when it is in background or in open state in iOS 10 or below?

I am looking for some source code for iOS 10 and below by which I can get the caller number when some phone call arrived and that call can be rejected by the application, if call is some fraud call (checking the local database). 

I have followed following post but did not get any fruitful result.
Via call kit: how to get the incoming call number by using callkit

True caller app already added that feature:
https://blog.truecaller.com/2016/10/26/truecaller-now-available-on-ios-10/

I think it is possible, can anyone help me by giving some idea or source code by which that can be achieved?
It is not possible to get caller's number when user receives a call. Truecaller has a lot of conditions for it to be able to show caller's details. The truecaller app should be active. The caller should call using the truecaller app. Both the calling and call receiving devices should be connected to the internet.
So what it basically does is that when a user presses the call button on the app to call somebody, they simply send him a notification that this person is calling you. It has nothing to do with CallKit and the caller id is not displayed on the call receiving screen.

One-Way Speech Path After Hold/Resume VoIP Call Through CallKit

We've been able to establish a VoIP call using CallKit. However, Hold and Resume operation on this established VoIP call causes one-way speech path issue. I'm able to hear far-end after I hold and resume. Far-end is not able to hear me.
I've already taken Wireshark traces and confirmed that after the resume, there is only one-way audio. Audio is not sent from my device to far-end.
Since Wireshark already showed the problem, I checked WebRTC code for media session errors. I see no errors in startSend or startPlayout (audio unit processing for send and receive)
I re-checked by CallKit integration code to confirm correct sequences
HOLD OPERATION
Press HOLD button on App UI or long-press MUTE button on CallKit UI.
App requests CXSetHeldCallAction transaction to CallKit with onHold as YES.
App receives provider delegate call back performSetHeldCallAction.
App puts the call on hold and then fulfils performSetHeldCallAction.
App receives provider delegate call back didDeactivateAudioSession.
RESUME OPERATION
Press RESUME button on App UI or HELD button on CallKit UI.
App requests CXSetHeldCallAction transaction to CallKit with onHold as NO.
App receives provider delegate call back performSetHeldCallAction.
App configures audio session (AVAudioSessionCategoryPlayAndRecord, AVAudioSessionModeVoiceChat, preferredSampleRate:44100) and then fulfils performSetHeldCallAction but remembers the call to be taken off-hold.
App receives provider delegate call back didActivateAudioSession. Using this App takes the call off-hold (resumes the call). The call is the one that was stored in the above step.
We've already raised an Apple Ticket using bugreport (with no update) and are pursuing raising an Apple Technical Support Incident (Apple TSI).
Hoping for some valuable inputs.

Can I observe the incoming call and outgoing call in background?

When my application is in the foreground it needs to easily detect the call event like call connected, call disconnected but when my application goes into background it does not detect any call events.
So how can I detect call events like incoming call and outgoing call in background?
I am working on CallKit framework with iOS 10 and XCode 8. I found that core telephony framework has been deprecated in iOS 10.
I am using the CXCallObserverDelegate Pattern for observing the call.
I want to calculate the call duration of incoming and outgoing calls during calling.
After searching about this question i ended up with this answer i think might help
Yes, you can detect a Call, but only if your app is running in the foreground.
For this you can use the Core Telephony Framework.
If your app will fall in any of the background running categories (VOIP, AUDIO, Location tracking or accessory ) you might be able to use the
CTCallCenter in the background. But be aware that Apple will reject your app if you use the background running mode for something it was not meant for.
The CTCallCenter will allow you to detect any calls that are started or already in progress.
However, you will not be able to detect any detail about the call, the CTCall identifying the call will only tell you this state. The callID of CTCall will just give you an unique identifier for the call but not the number being called.
original question

Callkit present Application UI instead of native UI

I want to use Callkit framework to present iOS native UI in incoming call for my voip app when smartphone is locked (more efficient than a simple notification), but after answering I would like to go to my app UI instead of one provided by callkit.
Preferentially I would like go immediately after answering the call, 2nd option would be a option in callkit UI to move to my app.
Any idea if that is possible? Didn't figure out any solution till now.
Thank you
Jose
CallKit provides the calling interface
https://developer.apple.com/documentation/callkit
Unfortunately there is no way to control calling interface for an incoming call.
When the device is locked, user will see native call UI after answering the call. If they wish to move to your app, they will have to tap corresponding button ("Messenger" button on the screenshot below):
When the device is unlocked, however, user will be redirected straight to your app automatically once they accept the call, so there is that.

Resources