Another option is to use call screening in the Dial command. It has two main privacy modes, one that remembers the CID of the caller, and how the callee wants the call handled, and the other, which does not have a "memory".
Turning on these modes in the dial command results in this sequence of events, when someone calls you at an extension:
There are some variations, and these will be explained in due course.
To use these options, set your Dial to something like:
exten => 3,3,Dial(DAHDI/5r3&DAHDI/6r3,35,tmPA(beep)) or exten => 3,3,Dial(DAHDI/5r3&DAHDI/6r3,35,tmP(something)A(beep)) or exten => 3,3,Dial(DAHDI/5r3&DAHDI/6r3,35,tmpA(beep))
The 't' allows the dialed party to transfer the call using '#'. It's optional.
The 'm' is for music on hold. I suggest it. Otherwise, the calling party gets to hear all the ringing, and lack thereof. It is generally better to use Music On Hold. Lots of folks hang up after the 3rd or 4th ring, and you might lose the call before you can enter an option!
The 'P' option alone will database everything using the extension as a default 'tree'. To get multiple extensions sharing the same database, use P(some-shared-key). Also, if the same person has multiple extensions, use P(unique-id) on all their dial commands.
Use little 'p' for screening. Every incoming call will include a prompt for the callee's choice.
the A(beep), will generate a 'beep' that the callee will hear if they choose to talk to the caller. It's kind of a prompt to let the callee know that he has to say 'hi'. It's not required, but I find it helpful.
When there is no CallerID, P and p options will always record an intro for the incoming caller. This intro will be stored temporarily in the /var/lib/asterisk/sounds/priv-callerintros dir, under the name NOCALLERID_extension channelname and will be erased after the callee decides what to do with the call.
Of course, NOCALLERID is not stored in the database. All those with no CALLERID will be considered "Unknown".