Romit Kumar
Romit Kumar

Reputation: 3300

How to play outgoing dialler tone in outgoing call in ios?

I'm using opentok to create app to app voice/video calls. I've also implemented callkit, however, is there any way by which I can play dialler tone while making outgoing call just like what we have in normal calling apps. I've customized provider configuration in callkit

 providerConfiguration.ringtoneSound = "Ringtone.caf"

However, this only works during incoming call as a normal ringtone, not a dialler tune

Upvotes: 2

Views: 1814

Answers (1)

Britto Thomas
Britto Thomas

Reputation: 2120

You can play your on audio as dialler tone, while making voip call using AVFoundation.

var url = URL_OF_YOUR_RINGTONE_FILE
var player = try? AVAudioPlayer(contentsOf: url)
var doSetProperty = UInt32(true)
try? AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)  AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers, MemoryLayout<doSetProperty>.size, doSetProperty)
player?.numberOfLoops = -1
player?.play()

Upvotes: 3

Related Questions