# Asterisk Project : Screening Calls with Recorded Introductions

Added by mdavenport , edited by mdavenport on Aug 31, 2010

### Philosophical Side Note

The 'P' option stores the CALLERID in the database, along with the callee's choice of actions, as a convenience to the CALLEE, whereas introductions are stored and re-used for the convenience of the CALLER.

### Introductions

Unless instructed to not save introductions (see the 'n' option above), the screening modes will save the recordings of the caller's names in the directory /var/lib/asterisk/sounds/priv-callerintros, if they have a CallerID. Just the 10-digit callerid numbers are used as filenames, with a ".gsm" at the end.

Having these recordings around can be very useful, however...

First of all, if a callerid is supplied, and a recorded intro for that number is already present, the caller is spared the inconvenience of having to supply their name, which shortens their call a bit.

Next of all, these intros can be used in voicemail, played over loudspeakers, and perhaps other nifty things. For instance:

    exten => s,6,Set(PATH=/var/lib/asterisk/sounds/priv-callerintros)
    exten => s,7,System(/usr/bin/play ${PATH}/${CALLERID(num)}.gsm&,0)

When a call comes in at the house, the above priority gets executed, and the callers intro is played over the phone systems speakers. This gives us a hint who is calling.

(Note: the ,0 option at the end of the System command above, is a local mod I made to the System command. It forces a 0 result code to be returned, whether the play command successfully completed or not. Therefore, I don't have to ensure that the file exists or not. While I've turned this mod into the developers, it hasn't been incorporated yet. You might want to write an AGI or shell script to handle it a little more intelligently)

And one other thing. You can easily supply your callers with an option to listen to, and re-record their introductions. Here's what I did in the home system's extensions.conf. (assume that a Goto(home-introduction,s,1) exists somewhere in your main menu as an option):

    [home-introduction]
    exten => s,1,Background(intro-options) ;; Script:
    ;; To hear your Introduction, dial 1.
    ;; to record a new introduction, dial 2.
    ;; to return to the main menu, dial 3.
    ;; to hear what this is all about, dial 4.
    exten => 1,1,Playback,priv-callerintros/${CALLERID(num)}
    exten => 1,2,Goto(s,1)
    exten => 2,1,Goto(home-introduction-record,s,1)
    exten => 3,1,Goto(homeline,s,7)
    exten => 4,1,Playback(intro-intro) ;; Script:
    ;; This may seem a little strange, but it really is a neat
    ;; thing, both for you and for us. I've taped a short introduction
    ;; for many of the folks who normally call us. Using the Caller ID
    ;; from each incoming call, the system plays the introduction
    ;; for that phone number over a speaker, just as the call comes in.
    ;; This helps the folks
    ;; here in the house more quickly determine who is calling.
    ;; and gets the right ones to gravitate to the phone.
    ;; You can listen to, and record a new intro for your phone number
    ;; using this menu.
    exten => 4,2,Goto(s,1)
    exten => t,1,Goto(s,1)
    exten => i,1,Background(invalid)
    exten => i,2,Goto(s,1)
    exten => o,1,Goto(s,1)

    [home-introduction-record]
    exten => s,1,Background(intro-record-choices) ;; Script:
    ;; If you want some advice about recording your
    ;; introduction, dial 1.
    ;; otherwise, dial 2, and introduce yourself after
    ;; the beep.
    exten => 1,1,Playback(intro-record)
    ;; Your introduction should be short and sweet and crisp.
    ;; Your introduction will be limited to 4 seconds.
    ;; This is NOT meant to be a voice mail message, so
    ;; please, don't say anything about why you are calling.
    ;; After we are done making the recording, your introduction
    ;; will be saved for playback.
    ;; If you are the only person that would call from this number,
    ;; please state your name. Otherwise, state your business
    ;; or residence name instead. For instance, if you are
    ;; friend of the family, say, Olie McPherson, and both
    ;; you and your kids might call here a lot, you might
    ;; say: "This is the distinguished Olie McPherson Residence!"
    ;; If you are the only person calling, you might say this:
    ;; "This is the illustrious Kermit McFrog! Pick up the Phone, someone!!
    ;; If you are calling from a business, you might pronounce a more sedate introduction, like,
    ;; "Fritz from McDonalds calling.", or perhaps the more original introduction:
    ;; "John, from the Park County Morgue. You stab 'em, we slab 'em!".
    ;; Just one caution: the kids will hear what you record every time
    ;; you call. So watch your language!
    ;; I will begin recording after the tone.
    ;; When you are done, hit the # key. Gather your thoughts and get
    ;; ready. Remember, the # key will end the recording, and play back
    ;; your intro. Good Luck, and Thank you!"
    exten => 1,2,Goto(2,1)
    exten => 2,1,Background(intro-start)
    ;; OK, here we go! After the beep, please give your introduction.
    exten => 2,2,Background(beep)
    exten => 2,3,Record(priv-callerintros/${CALLERID(num)}:gsm,4)
    exten => 2,4,Background(priv-callerintros/${CALLERID(num)})
    exten => 2,5,Goto(home-introduction,s,1)
    exten => t,1,Goto(s,1)
    exten => i,1,Background(invalid)
    exten => i,2,Goto(s,1)
    exten => o,1,Goto(s,1)

In the above, you'd most likely reword the messages to your liking, and maybe do more advanced things with the 'error' conditions (i,o,t priorities), but I hope it conveys the idea.