0

Is there any method in iOS (CallKit? perhaps) where a VoIP app can register to handle tel: links? That way when a user selects a phone number (in safari for instance). They would be presented with two options to complete the call.

john_ryan
  • 1,557
  • 1
  • 16
  • 34

2 Answers2

1

That capability does not exist in iOS today. If you are interested in that, I recommend filing a bug report to request it on Apple's Bug Report website.

Stuart M
  • 11,458
  • 6
  • 45
  • 59
1

This is supported in iOS these days if you press and hold on a tel: link. It doesn't use the standard URI scheme system, though. CallKit seems to automatically register your app as a handler of tel: links if you declare support for phone calls, and the link is passed through the following event:

import Intents

protocol SupportedStartCallIntent {
  var contacts: [INPerson]? { get }
}

extension INStartAudioCallIntent: SupportedStartCallIntent {}
extension INStartVideoCallIntent: SupportedStartCallIntent {}

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, CXProviderDelegate {

  func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
    let interaction = userActivity.interaction
    let startCallIntent = interaction?.intent as? SupportedStartCallIntent
    if let contact = startCallIntent?.contacts?.first?.displayName {
      // do what you want with 'contact'
    }
    return true
  }
BonzaiThePenguin
  • 1,413
  • 13
  • 19