How to disconnect active call with CallKit? - ios

I am making an app with CallKit support with WebRTC. I could not find a way to disconnect active call in CallKitUI, Once I accepted the incoming call from answer button even though the call is disconnected from peer connection.

Related

Network is too low .twilio outgoing call still not disconnected when i am disconnect call

Network is too low .twilio outgoing call still call not disconnected when i am disconnect call.
using below code:
var connection = this.device.activeConnection();
connection.disconnect();
Thanks in Advance.
Twilio developer evangelist here.
The connection.disconnect() method will only disconnect the current call. It is the equivalent of "hanging up". This does not disconnect the entire device.
If you want to completely disconnect the Device so that it can no longer make or receive new connections then you need to call device.destroy(). The documentation describes this method like so:
.destroy()
Destroys the device. Terminates active and pending connections, and cleans up all event listeners attached to the Device, after triggering the offline event handler. Device will not be able to make or receive new connections until you call Device.setup() again.

How to close Callkit UI when call is not connected

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.

Call disconnect if app is terminated

I use Twilio API to create video between two users. It works good if one of the users clicks on "Disconnect". But when user terminates his app, the picture "freezes". How can I disconnect user if he terminates his app (turns off internet connection, ...) ?
Twilio developer evangelist here.
I would implement the TVIRoomDelegate methods didDisconnectWithError and participantDidDisconnect so that you can clear up video connections when a disconnection is detected.

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.

How To Handle A Long Internet Disconnection In Background Using Twilio In iOS?

I am developing an iOS VoIP app using Twilio. I need the app to keep listening for incoming connections at all times.
When app is in background, the Twilio library handles keeping the app running. When a disconnection from Twilio happens (due to an expired capability token for example), a delegate method TCDevice:didStopListeningForIncomingConnections is called, and from there I am able to re-establish connection to Twilio. But if the disconnection occurs due to no internet availability, this method will be called when there is no internet connection, and I will not be able to establish the connection such that even if the user reconnected later, I cannot re-establish the connection.
So the Question is: How To Re-establish Connection To Twilio After A Long Internet Disconnection?

Resources