CID Superfecta in FOP2 Version 2.31.36 (Latest)

Hello friends!
Recently, I updated my FOP2 to the latest version (2.31.36, on August 15, 2023) which brought some new features mainly in the phonebook part.
The module was reformulated, but I noticed that after the update the CID Superfecta module was no longer recognizing the FOP2 contacts (it recognized what was saved in the cache, but not the new contacts).

When checking the error, I realized that it was something related to a variable.
I was curious, I went to check the database to see if there were differences in the visual_phonebook table between the most updated version of FOP2 and the previous version and… yes!

In the previous version, the FOP2 phonebook table was simpler - all the information was on it (name, last name, company, and number)

In this most recent version, the FOP2 Phonebook was divided into 4 - visual phonebook, visual phonebook_phones, visual phonebook_tags and visual phonebook_contacts - these tables are related to each other to feed the structure of the FOP2 phonebook module.

See the before and after structure:

FOP2 Visual Phonebook (before - it is based on this structure that the current CID Superfecta searches)

FOP2 Visual Phonebook - After

FOP2 Visual Phonebook Phones Content

As some clients I serve have already updated FOP2 and use this function, I will try to adapt the FOP2 Source query to search under this new structure - and if it works, I will share the adapted code here.

But it would be cool if this function came natively in FreePBX in future updates of the superfecta module - is there any way to open a ticket for sangoma to analyze the possibility of including this in a future update?

Thanks guys!

The superfecta included file for FOP2 is


The lookup is done using an SQL query, so it is likely possible to develop a new query for the new dbase schema. Then you’ll need a mechanism to determine which query to use. I can think of a few ways, simple would be to create a new user config field making the admin specify which version is installed, see if there’s a universal way to determine which version of FOP2 is present and use the correct query, use both and choose the one that succeeds, etc.

Even better would be to find out from FOP2 what the supported method to do this would be, i.e. is there a supported API that will work with all versions, and if so rewrite to use that instead of using SQL directly.

When you get a working versions, open a ticket at and share the results.

Dear Lorne,
I followed the idea of generating a config field by having the administrator select the FOP2 version (I put the old version as default) and it worked perfectly.

By selecting the option “fop2 old version”, the query is made in the standard way, and by selecting “fop2 with advanced phonebook” the query is made using a JOIN between the necessary tables, identifying the contact correctly.

The idea of there being an API to check the FOP2 version universally is also a wonderful idea, I will contact the FOP2 developers to better understand this possibility (there is a chat group on Telegram where they are very active), however at first, I followed the simplest implementation.

The updated code is already working in my FreePBX, I copied it here:

I tried to generate the ticket at with my credentials that I use on the forum, but I couldn’t access it… it seems like they are different accounts.

When I tried to register on the website to have access to open tickets this error occurred:

So I’m sharing the results of adapting the code here
What do you think of the results?
Can we improve the code?

Thanks for the support :grin:

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