Well, as someone else said (Tshif, maybe?) sometimes when someone asks a question it prompts you to finish something you had put on the shelf. So this thread has prompted me to do more. I did not have modify any PHP code - so Ward's Superfecta is still intact (I know its getting more improvements in another thread).
What I did was change my "override" of the Freepbx call to the Superfecta. This code is in a context named "cidlookup".
The new function is exactly what richie requested. If the Superfecta is installed with ONLY Asteridex configured, then if Asteridex does not find a number in its database, the original incoming callerid name will be restored. To accomplish this I simply saved the callerid name before calling the Superfecta. When the Superfecta returns, if the callerid name = callerid number, then I reset the callerid name from the saved name. Here is the necessary code:
[cidlookup]
include => cidlookup-custom
exten => cidlookup_1,1,Set(SaveCNAM=${CALLERID(name)})
exten => cidlookup_1,n,Set(CALLERID(name)=${CURL(http://localhost:80/callerid.php?thenumber=${CALLERID(num)})})
exten => cidlookup_1,n,GotoIf($[ "${CALLERID(name)}" = "${CALLERID(num)}" ] ?:noneed)
exten => cidlookup_1,n,Set(CALLERID(name)=${SaveCNAM})
exten => cidlookup_1,n,NoOp(${CALLERID(name)})
exten => cidlookup_1,n(noneed),Return()
exten => cidlookup_return,1,LookupCIDName
exten => cidlookup_return,n,Return()
Assumptions:
1. You have installed the Callerid Superfecta (Nerdvittles, or the newer module shouldn't matter as they work the same)
2. You have customized the appropriate inbound routes with a Callerid Source => Superfecta
3. You haven't customized any OTHER callerid source in Freepbx (this is because I suspect this would create multiple entries in the cidlookup context, and I haven't dones this or tested it - and this code OVERRIDES the cidlookup context created by Freepbx)
4. Copy this code into a file named extensions_override_freepbx.conf in the /etc/asterisk subdirectory.
5. restart asterisk by entering "amportal restart" at the command prompt while logged on to your PIAF system
Doing this via "override" means I have to re-validate it every time Freepbx updates, so just beware - this is something you might want to check any time you update Freepbx code levels.
richie, I hope you choose to give this a try. its not too scary and appears to be working well for me.
Jeff