FreeAgent Small Business Online Accounting

Asterisk Prefix Caller ID with Caller Name

Asterisk Logo

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.

Technorati Tags: Asterisk, Asterisk 1.8.4, Caller ID, CID, Direct Dial, How-To, HowTo, Inbound Trunk, Name Prefix, Sales, Support, VoIP

You can leave a response, or trackback from your own site.

One Response to “Asterisk Prefix Caller ID with Caller Name”

  1. daudi says:

    Very Cool. Thanks for the post.

    I have a question though. how do you filter inbound calls based on called number. for example my internal extension are three digit, 500,600….etc so if calls with dnis 500 are sent to asterisk, asterisk forwards the calls to extension 500 and the phone rings. My question is, how can you prefix the dnis/called number as a pattern so that any call that comes to asterisk with a 3 digit called number is prefix with 2 (2+XXX) so that its forwarded to the corresponding 4 digit extension? Extension in this case is the phone extension configured on asterisk.

    In cisco access server you have the facility for translation which allows you to manipulate the callind/called numbers.

    Thanks

Leave a Reply