Stupid Asterisk Tricks - CallerID Name Randomizer
Earlier this week I decided to finally add paging support to the phone system. It's really handy to be able to yell at everyone through the speakers on their phones every once in a while. One of our techs wanted the CallerID to be a bit more obvious when it's a page so that he'd know not to answer the phone with a, "Hello?"
First off, I'll assume you have a working Page feature in your Asterisk install. It requires the meetme conference bridge, which requires a timing source which comes from DAHDI, formerly Zaptel, cards. Fortunately, starting in the 2.6 line of Linux kernels a strong timing source is available which means you can use the dahdi_dummy driver without any external timing source. Simply build and install DAHDI, modprobe dahdi_dummy, and you're all set, assuming you rebuild Asterisk with meetme support.
This uses the internal database available in Asterisk. In this example, we'll assume you have a bunch of strings, preferably 17 characters or shorter, stored in the database using PagerCID as the family, and 0 through 19 as the keys. Now all you need to do is edit your extensions.conf. You do use extensions.conf, right? You aren't a pansy bedwetter that uses ael or some other simplified configuration language, are you? We use Polycom phones at the office, so the SIPAddHeader may vary in your environment.
; Page all phones at office
exten => 835,1,SIPAddHeader(Alert-Info: Ring Answer)
exten => 835,2,Set(CALLERID(num)=835)
exten => 835,3,Set(CALLERID(name)=${DB(PagerCID/${RAND(0,19)})})
exten => 835,4,Page(SIP/24&SIP/25&SIP/26&SIP/bob-mobile&SIP/29&SIP/27&SIP/41
Have fun!
