Monday, August 18, 2014

Using "tel" as a URI scheme in web pages

With the explosive growth in website traffic originating from mobile devices, we are now using the "tel" URI scheme for hyperlinks of telephone numbers within our customers' HTML website pages. The use of the "tel" scheme for URI's indicates that an action should be taken congruent with the uses described in IETF RFC 3966. These map, in most cases, to the host operating system handing the event and actions off to the program responsible for initiating telephone calls on the device. Simply stated, this allows users of the webpage to click on the telephone number displayed on a webpage and helps their device dial the number more accurately.

While many devices detect and turn phone numbers into active links, using the scheme will greatly increase the accuracy of those user actions.
To do this successfully, simply use the following scheme within hyperlinks for phone numbers:


<a href="tel:+16048938347">(604) 893 8347</a>

When embedded in a webpage, the links look and behave as such:

Call us at (604) 893 8347.

The use of the plus sign and the country/area code helps the mobile application understand the context for the telephone request and dial from that context.  This helps calls be completed in most cases.

The RFC is available at http://www.ietf.org/rfc/rfc3966.txt.  It is worthwhile understanding more about the finer aspects of the syntax such as characters allowed and not recommended within the scheme.


Characters other than those in the "reserved" and "unsafe" sets (see RFC 2396 [RFC2396]) are equivalent to their "% HEX HEX" percent encoding.
The "tel" URI has the following syntax:

   telephone-uri        = "tel:" telephone-subscriber
   telephone-subscriber = global-number / local-number
   global-number        = global-number-digits *par
   local-number         = local-number-digits *par context *par
   par                  = parameter / extension / isdn-subaddress
   isdn-subaddress      = ";isub=" 1*uric
   extension            = ";ext=" 1*phonedigit
   context              = ";phone-context=" descriptor
   descriptor           = domainname / global-number-digits
   global-number-digits = "+" *phonedigit DIGIT *phonedigit
   local-number-digits  =
      *phonedigit-hex (HEXDIG / "*" / "#")*phonedigit-hex
   domainname           = *( domainlabel "." ) toplabel [ "." ]
   domainlabel          = alphanum
                          / alphanum *( alphanum / "-" ) alphanum
   toplabel             = ALPHA / ALPHA *( alphanum / "-" ) alphanum
   parameter            = ";" pname ["=" pvalue ]
   pname                = 1*( alphanum / "-" )
   pvalue               = 1*paramchar
   paramchar            = param-unreserved / unreserved / pct-encoded
   unreserved           = alphanum / mark
   mark                 = "-" / "_" / "." / "!" / "~" / "*" /
                          "'" / "(" / ")"
   pct-encoded          = "%" HEXDIG HEXDIG
   param-unreserved     = "[" / "]" / "/" / ":" / "&" / "+" / "$"
   phonedigit           = DIGIT / [ visual-separator ]
   phonedigit-hex       = HEXDIG / "*" / "#" / [ visual-separator ]
   visual-separator     = "-" / "." / "(" / ")"
   alphanum             = ALPHA / DIGIT
   reserved             = ";" / "/" / "?" / ":" / "@" / "&" /
                          "=" / "+" / "$" / ","
   uric                 = reserved / unreserved / pct-encoded

Each parameter name ("pname"), the ISDN subaddress, the 'extension', and the 'context' MUST NOT appear more than once.  The 'isdn-subaddress' or 'extension' MUST appear first, if present, followed by the 'context' parameter, if present, followed by any other parameters in lexicographical order.