I have a requirement to detect a pause while speaking over call(It may be VOIP call) and send an pre-recorded reply automatically using Core Audio API. I explored Twilio APIs as well, I want to know feasibility of following things -
Is it possible to detect pause while caller from other side speaks, be it on normal call or VOIP call?
Is it possible to insert a prerecorded audio file during live call in iOS??
After the introduction of CallKit in iOS 10, you can detect whether the user has performed any action with DTMF which is usually the way to answer an IVR call. In case of normal human interaction it should not be possible because every call has this property of supportsDTMF
In a reverse scenario you can add soft and hard pauses while dialing a call programmatically as well using a simple init call.
Related
I'm trying to make an iOS app that can programmatically make a phone call silently, blocking any kind of outgoing phone call sound. (After the phone call is ready the app would then start recording the audio from the microphone.) Does anyone know if that's possible or have any idea about how that can be done?
Apple is really protective in such core features as calls. So we as a programmers have really narrow API to use. Basically, to make a call you have two options:
Open URL with format like tel://
Init call with instance of CXStartCallAction
Everything happens after is held by the system, so you don't have much of control over it. To be concrete, you have no control over call sounds.
You can have much more control, if you use VoIP or something similar.
Welcome Antonio!
Briefly, no you can not.
Let me explain further...
After the recipient answers the call, the system calls the provider
delegate’s provider(_:perform:) method. In your implementation of that
method, configure an AVAudioSession and call the fulfill() method on
the action object when finished.
You may have some doing to configure audio session but the system would block the microphone and from the API side you will not have access whatsoever.
I am deeply sorry for being so blunt, but what you're intending is simply no possible.
I'm using AVAudioSession in my VOIP app (using also CallKit).
I understand that the session can get interrupted by a number of things, for example by a second incoming call.
Apple states towards the bottom of this page:
https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/HandlingAudioInterruptions/HandlingAudioInterruptions.html#//apple_ref/doc/uid/TP40007875-CH4-SW5
"Note: There is no guarantee that a begin interruption will have a
corresponding end interruption. Your app needs to be aware of a switch
to a foreground running state or the user pressing a Play button. In
either case, determine whether your app should reactivate its audio
session."
On the mentioned page there is an example for a special case, when the user ignores the incoming call and in that case AVAudioSessionInterruptionTypeEnded is being sent.
But what should I do to know when the interruption has ended in every other case (in which cases I will never receive an AVAudioSessionInterruptionTypeEnded)? (E.g. When the user answers the 2nd call and puts me on hold and later he ends the 2nd call?)
Thanks!
I remember when you use CallKit, no app using audio like music will interrupt your app except for those other voip apps or native calls.
In that case, your call will be ended/held according to your response on the call kit ui (If your call do not support held, you will not be shown a thid button accept&hold)----Then, you can get your callback from CallKit delegate methods.
The Interruption api just works when CallKit is not used and CallKit app have a higher priority on audio session than those not using it.
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
In phone.app (iOS Native calling app), Is there any mean by which I can perform task like
1.Identify the caller (Incoming and Outgoing), so that on the behalf of caller I can perform some task.
2.Recording of call.
3.If some audio recording already in running state then how a call record can be handled.?
In my finding a reached at below outcome
1. CTCallCenter class have the information about call but i don't get phone number.
2. Call recording is not possible as there is no Apple API to do so.There are some apps on app store but they are not capable to record the call from phone.app. I think they are recording the call by their server (3 Way call.)
3. I think it will lead towards a crash as phone call is a high priority task so that the control of mic and speaker is given to phone call.
Is there any way to get expected result ? Is it possible with call kit.?
Thanks.
Unfortunately, what you're asking for is not possible as far as I know. Your app can be aware of incoming calls and their states, but not access the phone number. Using the CallKit APIs introduced in iOS 10, you can provide a label for an incoming phone number, but even then you have to set up a predefined list of numbers and labels. Your app won't know which number called. See "Identifying Incoming Callers" in the documentation and this SO question.
As for recording calls, there are no ways to do this without introducing a third party to the call, or routing the call to a service you control.
Regards,
Martin
I want to change the standard dialing tone and can not find if it is possible in the twilio documentation.
In the web client (Flash or HTML5) is it possible to upload a custom media file to play while a callee is being dialed?
You can use the sounds reference as #gediminasgu explains found here: https://www.twilio.com/docs/client/device#sounds
Disable incoming ringtone calling
Twilio.Device.sounds.incoming(false). Then you will need to hookup
to event Twilio.Device.incoming and manually start the ringtone and
hookup to other events to stop playing music when call is
answered/cancelled.