In re. FREEPBX-22293, CID Superfecta UK number format checking is too restrictive

Hi @lgaetz - you asked me to open a thread here for further discussion of my bug report FREEPBX-22293.

Essentially what’s happening is, CID Superfecta is using an overly restrictive set of filters for UK phone numbers. This is causing some numbers to be misidentified as non-UK, or not correctly passed to the UK CID services.

I posted the UK Number Plan from OFCOM, which defines how UK phone numbers should be interpreted and validated, as a starting point for discussion.

The issue I saw was that this number was rejected as non-UK and not passed to SayNoTo0870:

{{-> Executing Say No To 0870 UK
Skipping Source - Non UK number: 00443337591018
result took 0.0011 seconds. }}

0044 is obviously the country code, which is substituted with “0” for a trunk-dialed (STD coded) UK number. This gives 0333 759 1018

If you manually search SayNoTo0870 for the above number, it identifies it correctly as “Sky Media Head Office”. But CID Superfecta isn’t getting this far, and is rejecting the number as “non-UK” and thus not worth looking up on SayNoTo0870 – because '0870 is a UK-only database.

The code for this superfecta module is in the file:


you can see it references the function IsValidNumber and I believe the user uksteve wrote the UK number validation routine for Superfecta, I’ve not seen anything from him in a long time. You can see the routine here starting on line 667

It looks like the UK number validation might be incomplete but as a work around, reference to the validation routine could be removed from source-Say_No_To_0870_UK.module for testing.

I’ve just noticed the ticket has been closed and locked as “this is a support issue”. It’s not, it’s quite clearly a bug. FREEPBX-22390 raises the same bug, and FREEPBX-19128 shows a similar bug in the same area of the code.

I’m willing to contribute an improvement to the number validation code which follows OFCOM’s recommendations for validating UK phone numbers – however I need to know if this is possible and if so, how I can contribute to FreePBX in that way.

The short summary is, OFCOM advise against trying to validate STD (area/trunk) codes because more are being added as others run out. This is mentioned in the PDF I linked but may be buried quite deeply.
I converted OFCOM’s list of rules down into a shorter set of Asterisk dial patterns as I thought this would more easily convey the concept.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

Hi @philpem

I have committed a version of superfecta_base.php with some updated rules for UK number format checking for the Superfecta module. You can see the changes here:

Since I’m largely ignorant of UK number formats, it would be great if you (or anyone else) would put the above linked file thru it’s paces before code gets merged.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.

UK number validation changes discussed above have been published to edge in Superfecta versions and v16.0.12.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.