How to implement Call screen function

How could one implement a call screen option where a user would be asked to record their name (like in conference mode) then asterisk calls the other party, plays the recording and then the user can press 1 to accept call and 2 to reject call (voicemail) you could set the default if picked up after 10 seconds to auto answer or just hand up.

Thank you



I think I would do it in an AGI with a few applications. So start the AGI, then use

  1. Record(), to record the users name and save it to a file
  2. Dial the other party with Dial(Tech/resource,A()), where A(x) plays an announcment to the dialled user and x is the saved file name.
  3. Cath DTMF and use that to see if 1 or 2 was pressed.

Just a basic outline off the top of my head, may not be perfect. Like you would want to play to the called user " +persons name+ is trying to call, do you want to accept it" , So you would have to mix this with the file the person recorded.

You would think that this should be a built in function?


I’m not sure about havint this as a built in function because it includes a number of steps and different functions. It is probably a good ideal to have some extensions.conf files with example configurations like this that could be downloaded of part of the software installation under an examples directory.


exten => 111,1,Zapateller(answer|nocallerid)
exten => 111,2,Wait(1)
exten => 111,3,SetMusicOnHold(default)
exten => 111,4,GotoIf($["${CALLERIDNUM}" = “”]?who-r-u,s,1)
exten => 111,5,GotoIf($[“foo${CALLERIDNUM}” = “foo”]?who-r-u,s,1)
exten => 111,6,GotoIf($["${CALLERIDNAME:0:9}" = “Anonymous”]?who-r-u,s,1)
exten => 111,7,GotoIf($["${CALLERIDNAME:0:7}" = “Unknown”]?who-r-u,s,1)
exten => 111,8,GotoIf($["${CALLERIDNUM:0:7}" = “Private”]?who-r-u,s,1)
exten => 111,9,GotoIf($["${CALLERIDNAME:0:7}" = “Private”]?who-r-u,s,1)
exten => 111,10,GotoIf($["${CALLERIDNUM:0:10}" = “Restricted”]?who-r-u,s,1)
exten => 111,11,GotoIf($["${CALLERIDNAME:0:11}" = “OUT OF AREA”]?who-r-u,s,1)
exten => 111,12,GotoIf($["${CALLERIDNUM:0:4}" = “PSTN”]?who-r-u,s,1)
exten => 111,13,GotoIf($["${CALLERIDNAME:0:4}" = “PSTN”]?who-r-u,s,1)
exten => 111,14,DigitTimeout,3
exten => 111,15,ResponseTimeout,3
exten => 111,16,Background(custom/welcome)

exten => 0,1,Background(pls-hold-while-try)
exten => 0,2,Dial(local/200@from-internal,20,m)
exten => 0,3,VoiceMail(200@default)
exten => 0,4,Hangup
exten => 1,1,Background(pls-hold-while-try)
exten => 1,2,Dial(local/222@from-internal,20,m)
exten => 1,3,VoiceMail(204@default)
exten => 1,4,Hangup
exten => 4,1,Authenticate(1234588)
exten => 4,2,Background(pls-wait-connect-call)
exten => 4,3,DISA(no-password|from-internal)

exten => 2XX,1,Background(pls-hold-while-try)
exten => 2XX,2,Dial(local/${EXTEN}@from-internal,20,m)
exten => 2XX,3,VoiceMail(${EXTEN}@default)
exten => 2XX,4,Hangup
exten => 2XX,103,Voicemail(${EXTEN}@default)
exten => 2XX,104,Hangup

exten => t,1,Background(pls-hold-while-try)
exten => t,2,Dial(local/204@from-internal,20,m)
exten => t,3,VoiceMail(204@default)
exten => t,4,Hangup

exten => i,1,Playback(wrong-try-again-smarty)
exten => i,2,Goto(111,16)

At the bottom of the extensions_custom.conf file, add the two following contexts:

exten => s,1,Background(privacy-unident)
exten => s,2,Background(vm-rec-name)
exten => s,3,Wait(2)
exten => s,4,Record(/tmp/asterisk-stranger:gsm|5|15)
exten => s,5,Background(pls-hold-while-try)
exten => s,6,Goto(ext-park,70,1)
exten => s,7,VoiceMail(200@default)
exten => s,8,Playback(Goodbye)
exten => s,9,Hangup

exten => 70,1,Answer
exten => 70,2,SetMusicOnHold(default)
exten => 70,3,ParkAndAnnounce(asterisk-friend:/tmp/asterisk-stranger:vm-isonphone:at-following-number:PARKED|40|local/222@from-internal|who-r-u,s,7)
exten => 70,4,Hangup

Privacy Manager is available in * 1.4. You can enable it with the ‘p’ option (if memory recalls). I was just trying it out the other night and it works as expected.