I needed to prefix our Asterisk inbound Trunks with a caller ID Name so I could see if the person had dialled Sales, Support or my direct dial number. This is handy for seeing which of your inbound trunks the caller has dialed, if you have multiple businesses or office numbers.
How to prefix the caller ID with a caller ID in Asterisk 1.8.4
Note this is for Asterisk, not Trixbox or any of those other GUI type tools (yuk).
Add the CID Prefix Line in extensions.conf
Open up /etc/asterisk/extensions.conf in vi or your favorite text editor and add the following line to your inbound trunks that you want the caller ID to be prefixed with a name.
exten => 02073NNNNNN,3,Set(CALLERID(name)=SUPPORT)
Obviously your existing inbound number will replace the 02073NNNNNN, this need to put in place before the Dial line or Asterisk won’t prefix the CID Name. Replace SUPPORT with the name you want the COD prefixing with.
Example of my inbound Asterisk Trunk with CID Name Prefixing
The entire inbound trunk with the Caller ID Name prefix would look like this:
;support number exten => 02073NNNNNN,1,Playback(thank-you-for-calling) exten => 02073NNNNNN,2,wait(1) exten => 02073NNNNNN,3,Set(CALLERID(name)=SUPPORT) exten => 02073NNNNNN,4,Dial(SIP/581&SIP/582&SIP/584&SIP/583,20) exten => 02073NNNNNN,n,Macro(voicemail,900,${DIALSTATUS}) exten => 02073NNNNNN,n,Hangup()
Let me break down exactly hat this does for you, from the top down…
Line 1, is a comment so i can easily tell which trunk is which in my extensions.conf file.
Line 2, Plays a welcome message for my inbound callers. “Thank you for calling COMPANY NAME”
Line 3, Waits 1 second
Line 4, Sets the inbound caller ID name before the caller ID number, in this case SUPPORT
Line 5, Dials the SIP extensions for the people that are lucky enough to dealing with IT Support
Line 6, Dials voicemail, the number at the end of the line above tells you how long to wait before dialling the next option, so in this example the person would call for 20 seconds if no one answered the call would go to voicemail.
Line 7, Hangs up the call, I always have this option as last, if all the above fails the call will be terminated.
I hope this was helpful! Don’t forget to subscribe to our RSS feed, if you have any questions please post a comment!
Alternatively you can use my company for VoIP or Asterisk Support.