-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document phone number extension handling
- Loading branch information
1 parent
70520ea
commit cdb3818
Showing
3 changed files
with
77 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Handling phone numbers | ||
====================== | ||
|
||
`Google’s libphonenumber “Falsehoods Programmers Believe About Phone Numbers” | ||
<https://github.com/google/libphonenumber/blob/master/FALSEHOODS.md>`_ are | ||
worth keeping in mind, especially since this library relies heavily on | ||
`libphonenumber <https://github.com/google/libphonenumber/>`_. | ||
|
||
About phone numbers extensions | ||
------------------------------ | ||
|
||
An extension is an additional phone line added to an existing phone system, | ||
making it possible to reach a specific employee or department within an | ||
organization. An extension is defined in the following manner: | ||
|
||
.. doctest:: extensions | ||
|
||
>>> import phonenumbers | ||
>>> phonenumbers.parse("+1 604-401-1234 ext. 987") | ||
PhoneNumber(country_code=1, national_number=6044011234, extension='987', italian_leading_zero=None, number_of_leading_zeros=None, country_code_source=0, preferred_domestic_carrier_code=None) | ||
>>> phonenumbers.parse("+1 604-401-1234,987") | ||
PhoneNumber(country_code=1, national_number=6044011234, extension='987', italian_leading_zero=None, number_of_leading_zeros=None, country_code_source=0, preferred_domestic_carrier_code=None) | ||
|
||
The library primarily focuses on public phone numbers, its default format and | ||
database representation are using `E.164 | ||
<https://en.wikipedia.org/wiki/E.164>`_, which has no support for extensions. | ||
|
||
Projects that need to handle phone number extensions must set **both** | ||
:setting:`PHONENUMBER_DEFAULT_FORMAT` and :setting:`PHONENUMBER_DB_FORMAT` to | ||
an extension-compatible format, as described in | ||
:ref:`settings-format-choices`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters