开发者

How to create a link that will dial a SIP address on a VoIP application on an iPhone

I want to properly markup all the phone numbers on my website so that they are clickable. Th开发者_如何学编程e solution has been offered on SO: in general and specifically for an iPhone. However when targeting the iPhone this evokes the normal phone application.

Is it possible to have a link that invokes the SIP VoIP application if one is installed( I guess on pc's a tel link always invokes a VoIP application, because they simply don't have regular phones built in...)


It's possible, but with some limitations.

Any application can register custom URL scheme. But this URL scheme "must" be unique. For example my-cool-sip-app:..., another application can have scheme like super-duper-sip-app:, etc. You can check if an application with selected URL scheme is installed or not (UIApplication, canOpenURL:).

Or, several applications can have same custom URL scheme, in your case sip:... for example. But if you have 2 or more applications with the same scheme installed, you can't say which one should handle sip:... URL. Apple's documentation:

If your URL type includes a scheme that is identical to one defined by Apple, the Apple-provided application is launched instead of your application. If multiple third-party applications register to handle the same URL scheme, it is undefined as to which of the applications is picked to handle URLs of that type.

Valid SIP URLs are:

  • SIP:someone@10.1.2.3 SIP URL with IP address.
  • SIP:someone@example.com;transport=TCP SIP URL with transport specified as TCP. The default transport is UDP if none is specified.
  • SIP:someone@example.com Basic SIP URL.
  • SIP:+12225550189@example.com;user=phone SIP URL with global phone number and specified gateway.
  • SIP:+1 206 555-0146@10.2.3.4;user=phone SIP URL with global phone number format and specified gateway.

So, if you have a SIP application installed, you should try one of the mentioned SIP URLs. Any SIP application should support it.

Here's an Acrobits Softphone application where you can read (in description) that it supports asoftphone:number URL scheme. It's good if you want to use just this application, but it's bad for the end user, because other developers are not willing to go through AppStore and add support for all custom URL schemes other than sip:...

My answer is - try sip:... and if you have good SIP application, it should handle these links flawlessly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜