john_ryan
john_ryan

Reputation: 1787

Handling tel: links in voip app

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.

Upvotes: 0

Views: 531

Answers (2)

BonzaiThePenguin
BonzaiThePenguin

Reputation: 1433

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
  }

Upvotes: 1

Stuart M
Stuart M

Reputation: 11588

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.

Upvotes: 1

Related Questions