Recently I've started making a client VoIP app from scratch in swift. I have Asterisk server and i want to receive incoming calls (doesn't need to handle outgoing calls) from Asterisk (not from iOS users). How can I implement handling VoIP calls and signalisation (register, reject call) using native tools? If it's impossible to register to a VoIP account with CallKit and PushKit - what would be the best open source solution? I've never made an app for iOS and don't know all capabilites of CallKit and PushKit yet.
CallKit is for front-end functionality of calling apps. It will not help you with connecting a client to your server. If you have never made an iOS app before then making a VOIP app is probably not the best place to start. You will almost certainly have to make your client from scratch unless Asterisk has a library for iOS.
Related
What my requirement is "I need to wake up my application from the background when a call comes in my iPhone".Is Any way to do so? Shall we get a unique number for the each user in
You'll need to use PushKit notifications and CallKit that can start the app even when the app is killed.
The CallKit is not really absolutely necessary, since it "just" allows you to provide standard calling interface. But it is a very nice feature to have - user is used to standard iOS interface for answering/declining calls, so I would definitely recommend to go with CallKit, instead of just standard notifications.
You can take a look at this tutorial, or just google together the PushKit, CallKit and Voip to get other relevant tutorials.
VoIP Push notifications is your solution.
I don't like the "link" answers myself, but here is how to do it:
Voice Over IP (VoIP) Best Practices (Apple documentation)
Roughly saying, VoIP pushes allow you to wake up your application and your code will be executed.
You may also be interested in CallKit, if you're working on soft-phone application.
Maybe someone ever solve the problem with stable connection to server when application is in background? I need to transfer audio data from server to client app.
I know about all hacks for iOS how to keep alive application, but I need legal methods to solve this problem. Maybe you have any idea?
I found that I can send VoIP push to device that will wakeup my app and then establish tcp connect to my server but this socket will be keep alive about 30 seconds (as I see in log, every 3 seconds fires timer in iOS app that send data to server) this is not enough for me.
Maybe this project https://github.com/SmallSharpToolsOpenSource/Speakerbox will be helpful for someone.
And this video https://www.youtube.com/watch?v=lXJ1LDjL4Os
And official answer from Apple tech support:
PushKit is how voip apps can
reliable receive silent notifications, while CallKit is basically a UI
framework voip apps can use to notify the user about calls. Note that there
is NOT any direct connection within the APIs- for example, a voip app can
generate a local notification (instead of using CallKit) or simply do nothing
and “ignore” the notification entirely. Similarly, a voip app could “fake” a
call at anytime by simply telling CallKit that there was an incoming call (our
sample code for CallKit did exactly this).
Anything your app could previously have done when
it received voip socket traffic, it could also do when it received a PushKit
notification.
Standard voip apps
actually operate in two COMPETELY unrelated “modes”:
1) While waiting for an incoming call, the app is suspended until “something”
(PushKit OR a voip socket) wakes the app to tell it about the call.
2) Once a call has started, the app has an active audio session and is relying
an the standard “background audio” behavior of iOS, just like a wide variety
of other audio apps (for example, any streaming music app).
I have set up the latest linphone iOS code (version 3.16.6) and I am able to make audio and video calls but if my app is in background or killed, not getting calls.
Please guide me in details that what I have to do to get the calls even when app is in background or killed.
Please let me know if there is server interaction part also there.
You have to wake up your application with voip-notification, before receiving call on background.
So you can implement your solution which send notification before every call. Notification wake an app and app receive the call
You can use callkit for UI, but callkit itself doesn't handle any background or voip work.
Use some working solution for example FlexiSip from Belledonne
http://www.linphone.org/technical-corner/flexisip/overview
FlexiSip have builtin support for iOS push notification, but you will need to generate certificates and do some server work :)
EDIT
Voip notification process.
Before every SIP Invite you have send voip notification to target device. Voip notification wake application which will be ready for accepting SIP call.
I'm not sure if you use proxy or if you making just direct calls. If you are using proxy you can try FlexiSIP which should handle this logic for you (I didn't tried). Of course you will need to provide your voip certificates to it.
If you making direct calls without SIP proxy, source application should call same API of some web service which send voip notification for target device (For example Houston API). And after you can send SIP invite from source to target application.
In my application, I am using Sinch API for audio and Video call functionality. it's working fine.
But I want to implement UI for the Incoming audio call is like normal phone call UI (like WhatsApp audio call) when the application is not in foreground state (application is in "Background/Inactive/Terminated").
So I want's to know, is Sinch API support CallKit framework or not? if Not then is there any other way to implement this functionality with Sinch API?
Yes Sinch support CallKit. I used it in my iOS app. link for news
for run application in Background/Inactive/Terminated state first you must upload APNS certificates, one for each type - Development, Production & VoIP Services of your app to Sinch server.
Can we integrate VoIP services through the new framework CallKit without using any server services or push notification?
I am really new to this concept, also checked the speaker box app as a sample app but didn't get much idea how it would be working.
Please, share your feedback if anyone has integrated CallKit.
Thanks
The CallKit framework provides programmatic access to VoIP functionality, as well as call blocking and identification. Apps can use CallKit to receive incoming calls and make outgoing calls using the native phone UI.
Reference for call kit.
Can we integrate VoIP services through new framework call kit without using any server services or push notification?
No we can't use it. You will need third parties like Twilio, Plivo, or ICELink and create your own server. Then provide CallKit the data required, it will handle the call and UI stuff. You can read the apple docs for more ideas.
If a CallKit app only intends to make outgoing calls, then it may be possible to not have a server component. But if the app intends to receive incoming calls while the app may not be running (e.g. when it is suspended), those incoming calls must be signaled via Push Notification, and those push notifications are typically sent by a backing server.