Last November, the phone=*
syntax was unilaterally redefined to accommodate telephone extensions and more theoretical details. The changes are technically problematic in several respects. I propose to undo this change and welcome the community’s ideas on what to replace it with.
History
Since 2008, the documentation for phone=*
has recommended formatting the value according to the International Telecommunication Union’s E.123 standard for human-readable phone numbers. The documentation also noted that separating groups of digits by spaces is consistent with the German DIN 5008 standard for German-language publications, and that separating groups of digits by hyphens is consistent with RFC 3966. (This was a bit of a non-sequitur, because E.123 tolerates hyphen separators according to national norms, while RFC 3966 is a standard for machine-readable tel: URIs.)
In the years since, quite a few data consumers have added support for both syntaxes, but there’s been a lot of confusion about how to tag PBX telephone extensions. Although the documentation never mentioned it, E.123 recommends a decidedly non-machine-readable syntax:
To show an extension number of a PABX without direct in-dialling, the nationally used word or abbreviation for “extension” should be written immediately after the telephone numbers and on the same line as the word “telephone”, followed by the extension number itself.
[…]
Example 2: Telephone international +22 607 123 4567 ext. 876
In 2009, contact:*=*
was first documented with an example requiring the DIN 5008 syntax for telephone extensions:
+<country_code> <national_destination_code> <subscriber_number>-<direct_inward_dialing>
Unfortunately, this syntax conflicts with E.123’s tolerance for hyphen-separated digits.
Last November, in response to a question about whether it’s a good idea to tag a telephone extension, the following parameters were added to the phone=*
documentation, ostensibly borrowed from the RFC 3966 standard:
Parameter | Description | Example |
---|---|---|
\;ext= |
Extension | phone=+1 859-255-0270;ext=2 |
\;isub= |
ISDN subaddress | Irrelevant to OSM?[1] |
\;phone-context= |
Emergency number or other service code (e.g., 9-1-1 or 4-1-1 in North America) | None[2] |
As far as I know, this syntax was added to the discussion without a proposal or informal discussion beforehand.
As of writing, the \;ext=
syntax has seen some uptake but not nearly as much as the alternatives:
Syntax | Example | Prevalence |
---|---|---|
DIN 5008 | +49 3831 2681-0 |
83,928 |
E.123 | +43 1 71613 ext. 0 |
756 |
Informal North American | +1-905-688-5550x3369 |
174 |
Escaped semicolon | +34 96 352 54 78\;ext=4298 |
151 |
Problem
Of all the possible syntaxes we could’ve chosen for telephone extensions, \;ext=
is the least intuitive and least interoperable syntax:
-
Unlike the rest of the
phone=*
syntax, it is designed for machine readability at the expense of human readability. -
It conflicts with both the
ext.
syntax from E.123 and the-
syntax from DIN 5008. -
It cherry-picks a part of RFC 3966 that suffers from poor support in mobile operating systems – the very operating systems that matter for this key. Instead, the industry best practice is to use just a comma or semicolon, for example,
tel:+15555555555,2
. -
The semicolon has long been documented as separating multiple phone numbers, so a backslash was added to escape the semicolon, even though the longstanding general syntax for multiple values uses
;;
as the escape sequence. Thus this edit also introduces a novel escape syntax for the semicolon that is valid only in phone number keys but nowhere else.
As far as I can tell, \;ext=
is currently unsupported by OSM data consumers. The main OSM website is unable to detect the value as a phone number. Overpass turbo fails to remove the backslash, resulting in a malformed URI.
Both Organic Maps and OsmAnd remove the \;ext=
, causing iOS to treat the extension as part of the subscriber number. In North America, the public telephone system will ignore these extra digits, so the user will have to enter the extension manually. On the other hand, in a country with variable-length subscriber numbers, the additional digits may connect the user to an altogether different line elsewhere in the country.
Certainly, we could write off these issues as mere bugs, not our problem. But honestly I think these are symptoms of a poorly thought-out redefinition of the longstanding phone=*
syntax.
Proposal
The documentation for phone=*
should stop recommending the \;ext=
syntax. These edits should be undone.
Since there’s clearly a need for telephone extensions in phone numbers, we should come up with something to replace \;ext=
. Here are some options that come to mind:
- Refer mappers to the E.123 notation,
ext.
or the local translation, expecting data consumers to equate anyxzy.
withext.
and extract the extension number. - Refer mappers to the E.123 notation,
ext.
, but require a particular language such as British English rather than allowing it to be localized. - Allow an actual tel: URI for any phone number that can’t be represented by E.123 notation, such as
phone=tel:+1-888-828-4798,2334
. - Choose some other delimiter that doesn’t already have a special meaning, such as a comma (which would be consistent with tel: URIs) or
x
(a very common North American notation).
Note that the hyphen specified by DIN 5008 would not be viable as a global recommendation, as it conflicts with the hyphens used throughout the North American Numbering Plan Area as part of E.123 notation. However, as a practical matter, I’m not currently proposing to deprecate DIN 5008 notation in German-speaking regions.
(FYI to those who have participated in related discussions or touched the relevant wiki documentation recently: @bkil @Kovoschiz @Mateusz_Konieczny @user_5589.)
In theory, an ISDN subaddress would be analogous to an extension. However, I have never seen a shop, office, or other POI advertise an ISDN subaddress as its public point of contact. ↩︎
Both
emergency:phone=*
andemergency_telephone_code=*
are typically set to the number verbatim, without any attempt to conform to a broader scheme. ↩︎