Overriding callerid

I’m wondering if there’s a way to override the “name” part of the callerid information when it comes through? For example, cell phones here in BC have the name show up as “Brit. Columbia”. For a select number of phone numbers that I know, I’d like to be able to get Asterisk to replace what the phone company sends with the actual names of the people with this set of cell phone numbers. Is there a way to do this?



I’m curious about this too, however, I’m pretty sure it’s not possible to do. When you think about it, the phone company comes AFTER Asterisk in the whole “phone call” process, therefore they have the final say on what goes out on the CallerID information. I could be wrong though, so someone correct me if that’s the case.

I believe I know how to do this. Call me.



i use an AGI to lookup records in a MySQL DB table for number match. then populate the CallerID from that. PM me for a copy if you haven’t alrady worked something out.

CallerIDname on the PSTN network is only definable at the SS7 network level. CallerIDnumber is dynamic and definable at the per-call level. If you want to change the callerIDname for a number you control you need to contact your carrier and have them change the name in their database. That’s pretty much the only way unless you become a carrier. For SIP calls it’s very different, it is definable per call just like number, but the entire call has to be VOIP-only.

I think “Set(CALLERID(name)=whatever)” works for your goal. It works for SIP channel, I am sure.

it works for all channel types, as far as i know. i’ve used this to work around an asterisk oddity from VoIP providers. what happens is: if the caller has blocked CID, the VoIP provider (if they use asterisk) instead of sending a null CIDNAME/NUMBER send you garbage like ‘asterisk’, or ‘UNKNOWN’. i had my incoming custom context check for various bogus strings and null them out so that zapateller and privacy manager would work properly.

I think I wasn’t quite clear in my problem. I’m not wanting to change the caller ID information for outgoing calls; rather, when an incoming call comes into my Asterisk system, I’d like to replace the name for certain matching numbers. Normally, a call from a cell phone would come into my system as:

Brit Columbia (604-555-1234)

I’d like to have a table of numbers with which I’m familiar so that the above number would show up on my phone as:

Patrick (604-555-1234)

you were quite clear. my response addressed that. where did i give the impression i was talking about outbound calls? the hack i was referring to involves changing the name for certain name/numbers.

Sorry, I wasn’t replying to you specifically. I’m fairly new to Asterisk, so I’m still climbing the learning curve with respect to certain things. I would be interested in seeing how you accomplished that. So, you have your incoming calls via POTS go into a special context that cleans up the caller id, and then you pass it into your regular context?

yes. like this:

(note, which timeconditions context depends on how AAH set it up - you have to look for where [timeconditions] is defined)

exten => s,1,Answer
exten => s,n(blacklisted),LookupBlacklist(j)
exten => s,n,GotoIf($["${CALLERID(name)}" = “UNKNOWN”]?fixup_cid)
exten => s,n,GotoIf($["${CALLERID(name)}" = “unknown”]?fixup_cid)
exten => s,n,GotoIf($["${CALLERID(name)}" = “PRIVATE”]?fixup_cid)
exten => s,n,GotoIf($["${CALLERID(name)}" != UNAVAILABLE"]?check_cid)
exten => s,n(fixup_cid),SetCallerID(,)
exten => s,n(check_cid),Zapateller(nocallerid)
exten => s,n(privacyfailure),PrivacyManager
exten => s,n,LookupCIDName
exten => s,n,Goto(timeconditions,3,1)
exten => s,privacyfailure+101,Congestion
exten => s,blacklisted+101,SetCallerID(,)
exten => s,n,Zapateller(nocallerid)
exten => s,n,Congestion