Using local CNAM routines only if not filled by provider

jeffmac

Guru
Joined
Jan 16, 2008
Messages
230
Reaction score
9
I have recently moved from a "toy" environment at home (with just me playing on it) to running the house phones with my PIAF. I implemented Ward's Callerid Superfecta - and it works as advertised - but it seems that my primary DID provider "usually" sends the callerid name - and I'd like to be able to only invoke the CNAM routines if the caller name is blank (or a default string like "Unavailable" - which my provider sends). I know that we're depending on the code from FreePBX to invoke the callerid lookup routines - but there are no options in the callerid routines and the only parameter is the callerid number passed. Is there an option anyone already knows for examining or accepting the provider's CNAM?
Jeff
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,218
Reaction score
5,240
The wrinkle to this is that almost every provider sends something in the CallerID Name field. Trying to determine which are legitimate names and which are just crap is a major coding project. Typically, if the callee has their name listed in the CNAM database of your provider, it's also listed in one of the sources being used for the lookups. So you don't lose much by ignoring the incoming CallerID name data. Having said that, I do plan to wrestle with this some more, but it's not as simple as it may appear.
 

jeffmac

Guru
Joined
Jan 16, 2008
Messages
230
Reaction score
9
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
 

Members online

Forum statistics

Threads
25,860
Messages
168,042
Members
19,278
Latest member
kdoyle
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top