Well, Ward's new article about post-dialing routines gave me some impetus to move farther on this subject - although the implementation is really not very pretty, its really not very hard to implement. The more difficult part will probably be maintenance - which is at least part of why Ward said it was harder than it looked.
I took advantage of the extensions_override_freepbx.conf to replace the "cidlookup" context. For my setup it only contains one meaningful routine, since I only have the Callerid Superfecta source defined. I copied the original context from extensions_additional.conf:
[cidlookup]
include => cidlookup-custom
exten => cidlookup_1,1,Set(CALLERID(name)=${CURL(http://localhost:80/callerid.php?thenumber=${CALLERID(num)})})
exten => cidlookup_1,n,Return()
exten => cidlookup_return,1,LookupCIDName
exten => cidlookup_return,n,Return()
; end of [cidlookup]
and here's what I put in extensions_override_freepbx.conf :
[cidlookup]
include => cidlookup-custom
exten => cidlookup_1,1,GotoIf($[ "${CALLERID(name)}" = "" ] ?need)
exten => cidlookup_1,n,GotoIf($[ "${CALLERID(name)}" = "Unknown" ] ?need)
exten => cidlookup_1,n,GotoIf($[ "${CALLERID(name)}" = "Unavailable" ] ?need:noneed)
exten => cidlookup_1,n(need),Set(CALLERID(name)=${CURL(http://localhost:80/callerid.php?thenumber=${CALLERID(num)})})
exten => cidlookup_1,n(noneed),Return()
exten => cidlookup_return,1,LookupCIDName
exten => cidlookup_return,n,Return()
If the provider sends a null CNAM, or the string "Unavailable" or the string "Unknown" - then I proceed to invoke the Superfecta. Otherwise I skip it and keep what the provider has sent. (I have seen all three cases in my logs). Its working for at least the Unknown and Unavailable cases (my daughter's calls are alternately sent with good CNAM and Unknown). I know catching all the "crap" isn't possible but I'll run this for a while and see how it goes. I'd just like to see the real data if the provider sends it (which mine usually does) instead of replacing it with "Podunk IA landline" which I often get from the Superfecta. Its really only meaningful for numbers that are not already "known" to me - because I already have them in Asteridex.
Its not really a big deal - just trying to fine tune my setup, and learn a little bit more in the process.
Jeff