emxsys / callattendant

A python-based automated call attendant, call blocker, and voice messaging system running on a Raspberry Pi. Screens callers and block robocalls and scams with a low-cost Raspberry Pi and modem.
https://emxsys.github.io/callattendant/
MIT License
117 stars 36 forks source link

Make phone number display mask configurable #112

Closed emxsys closed 3 years ago

emxsys commented 3 years ago

To support variable phone number formats, make the phone number display format configurable. Include support for no formatting.

emxsys commented 3 years ago

Consider using Template strings for user-supplied format strings: https://docs.python.org/3/library/string.html#template-strings

emxsys commented 3 years ago

Updated phone number formatting to use a common formatting method that uses configurable settings.

PHONE_DISPLAY_FORMAT: Define the formatting of phone numbers in the various lists. You must use the

separator character defined by PHONE_DISPLAY_SEPARATOR above in the format string.

#

The phone display format handles variable length phone numbers. Excess digits not included

in the format string are prepended to the number with a separator.

For example, the AUS number 006173XXXYYYY would be formatted as follows:

General format: 006173-XXX-YYYY

AU format: 00-61-73-XXX-YYYY

US format: 006-173-XXX-YYYY

UK format: 00-6173-XXX-YYYY

FR format: 0061-73X-XX-YY-YY

#

Example: General

PHONE_DISPLAY_FORMAT = "###-####"

#

Example: US

PHONE_DISPLAY_FORMAT = "###-###-####"

#

Example: UK

PHONE_DISPLAY_FORMAT = "####-###-####"

#

Example: FR

PHONE_DISPLAY_FORMAT = "###-##-##-##"

#

Example: AU

PHONE_DISPLAY_FORMAT = "##-##-###-####"

#

Example: Raw - no formatting

PHONE_DISPLAY_FORMAT = ""

# PHONE_DISPLAY_FORMAT = "###-###-####"