Summary: A recipe to automatically detect and markup telephone numbers
Version: 2022-12-22
Prerequisites: PmWiki 2.3.17; PHP 8
Status: Alpha
Maintainer: simon
Licence: GPL3#
Categories: Links, Markup, Media, Mobile
Users: +1 (view / edit)
Discussion: AutoTel-Talk?

Questions answered by this recipe

How can I make the telephone and mobile phone numbers on my wiki dialable?


This recipe automatically detects mobile and land phone numbers. The telephone numbers are wrapped in an anchor element using the "tel:" URI scheme. This enables calling by clicking on the link where supported by a device.

The tel: number in the link is formatted with the hyphen visual separator before area code and subscriber number. The user supplied text is displayed unchanged, but spaces and hyphens are converted to their non-breaking equivalents to avoid the number wrapping.

To recognise a telephone number a visual indicator or separator is required. These include

  • the "+" of the country code
  • optional (parenthesis) around the area code
  • a single visual separator before or after the area code, or in the subscriber number
  • a visual separator is a single space or hyphen

Land and mobile numbers have a different syntax

  • country code and area code are optional for land numbers
  • area code is mandatory for mobile numbers

This recipe is based on Petko Yotov's code snippet from Cookbook:LinkTel-Talk tarted up a bit to improve the matching and delivered in a recipe format.




No changes are required to PmWiki pages, however to improve matching and to reduce false positives some telephone number reformatting may be required.

To limit the scope of this recipe install it as a group or page recipe.

The recipe provides a page variable {$AutoTelVersion} which contains the current version, and page variable {$AutoTel} for a (:if enabled AutoTel:) recipe installation check.

The recipe may create a number of false positive matches of telephone numbers. If this is the case Cookbook:LinkTel may be a better match for your requirements.

Limited configuration can be performed from the config file.

AutoTelConfig = array(
    'CountryCodeDefault' => '+64',
    'AreaCodeDefault' => '4');

The following string can be internationalised:

  • Dial

Change log / Release notes

2022-12-22 Initial version based on Petko Yotov's code snippet at Cookbook:LinkTel-Talk

See also

  • LinkTel   Active telephone links in wiki pages

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.