3 ms·
“Surely accepting randomly formatted text instead of an international standard won’t ever cause problems”
by doctor_eval 2y ago
“Surely accepting randomly formatted text instead of an international standard won’t ever cause problems”
- airstrike 2y agohow about accepting anything that can be typed with a phone keyboard `[0-9()+*;]` or whatever the right chars are? going from phone keyboard to database and back to phone keyboard should not modify what gets dialed
- doctor_eval 2y agoDTMF signalling restricts what you can dial over a traditional PSTN line. In practice you can only dial what a regular landline phone can dial. * and # are used to signal commands rather than calling numbers. There are another 4 DTMF signals, but CPEs don't generally use them. So that leaves you with just the 10 digits. Which can be easily stored in an integer, which can then be formatted reliably for humans according to the international numbering plan. Like IP addresses, phone numbers are just numbers. You can fuck about all you like by adding funny letters and brackets and complicated parsers (just like you can add dots and colons to an IP address), OR you can just store them as normalised E164 numbers, which will work everywhere and for which there are clear formatting rules. Just like you can store an IP address as an IP address datatype in most databases. Almost nobody wants to store the NZ time service or 911 or anything else in a large database. Nobody is dialling an extension number over the PSTN network - that's like trying to include the port number in an IP address and calling it ... an IP address. Such numbers should be stored somewhere else.