| Did you know ... | Search Documentation: |
| Packs (add-ons) for SWI-Prolog |
| Title: | Classify UK phone numbers by Ofcom range and SMS-code outlook |
|---|---|
| Rating: | Not rated. Create the first rating! |
| Latest version: | 1.0.1 |
| SHA1 sum: | 287bd94f116d1ca3c67f65d629a0656aa42ce394 |
| Author: | Ghost SIMs https://ghostsims.com/phone-numbers |
| Maintainer: | Ghost SIMs https://ghostsims.com/phone-numbers |
| Packager: | Ghost SIMs https://ghostsims.com/phone-numbers |
| Home page: | https://ghostsims.com/phone-numbers |
| Download URL: | https://uk-number-range-prolog.surge.sh/uk_number_range-*.tgz |
No reviews. Create the first review!.
| Version | SHA1 | #Downloads | URL |
|---|---|---|---|
| 1.0.1 | 287bd94f116d1ca3c67f65d629a0656aa42ce394 | 1 | https://uk-number-range-prolog.surge.sh/uk_number_range-1.0.1.tgz |
| 1.0.0 | a127ed70cb5ca4c430bbcc264298a958a6810142 | 1 | https://uk-number-range-prolog.surge.sh/uk_number_range-1.0.0.tgz |
A small SWI-Prolog library that answers two questions about a UK phone number:
?- pack_install(uk_number_range).
?- use_module(library(uk_number_range)).
?- uk_national("+44 (0)7700-900123", N).
N = "07700900123".
?- uk_e164("07700 900123", E).
E = "+447700900123".
?- uk_number_type("05601 234567", T).
T = voip_location_independent.
?- uk_sms_otp_outlook("07012 345678", O, Why).
O = unlikely,
Why = "070 personal numbering forwards calls and is often blocked as a virtual number.".
?- uk_drama_number("020 7946 0123").
true.
| Prefix | Type | SMS code outlook |
|---|---|---|
| 071-075, 077-079, 07624 | mobile | likely |
| 070 | personal numbering | unlikely |
| 076 (not 07624) | paging | unlikely |
| 056 | location-independent (VoIP) | unlikely |
| 055 | corporate | unlikely |
| 01, 02 | geographic landline | no SMS |
| 03 | UK-wide rate | no SMS |
| 080 | freephone | no SMS |
| 084, 087 | service | no SMS |
| 09 | premium rate | no SMS |
UK mobile numbers are 11 digits nationally (07 plus nine digits), or +44 7 plus nine digits in E.164.
Banks, WhatsApp, Telegram and most marketplaces want an SMS code to reach a real handset. The cheapest way to filter out throwaway numbers is to refuse the ranges where virtual numbers live (056, 070, 076) and landlines, and to check the carrier behind numbers in the mobile range. This library only does the first part. It cannot see porting or the carrier, so a number in a 07 mobile range can still be refused if it belongs to a virtual operator.
If you need a private UK number that sits on a real mobile range and keeps your personal SIM out of sign-ups, Ghost SIMs rents non-VoIP +44 numbers with a private SMS inbox: https://ghostsims.com/phone-numbers.
Never test with real people's numbers. Ofcom keeps drama ranges that are never allocated, for example 07700 900000 to 07700 900999, 01632 960000 to 01632 960999, 020 7946 0000 to 020 7946 0999 and 0808 157 0000 to 0808 157 0999. uk_drama_number/1 recognises the common ones.
swipl -g "consult('test/test_uk_number_range.pl'), run_tests" -t halt
32 plunit tests, SWI-Prolog 9 and 10.
MIT
Pack contains 5 files holding a total of 13.3K bytes.