Incoming Call announcement

Does anyone know of a way to setup an incoming call announcement? For instance, if someone dials an extension, when the person answers the phone a pre recorded(wav/gsm/mp3) is played before the two people can speak. If you were to call extension 123, the person answering extension 123 would pick up the phone and hear “you have a call from…” Am I making any sense?

Peter

been done a couple of different ways - here is our production setup:

exten => 101,1,Macro(stdexten-announce,sip/101,101,15)

here are the two macros you would need (minus the custom sound files):

[macro-stdexten-announce]
exten => s,1,Playback(sayyourname)
exten => s,2,SetVar(CALLER_NAME=/tmp/${CALLERIDNUM}-${EPOCH})
exten => s,3,Record(${CALLER_NAME}.gsm|2|4)
exten => s,4,Dial(${ARG1}|${ARG3}|rtM(announce^${CALLER_NAME}))
exten => s,5,Voicemail(u${ARG2})
exten => s,6,Hangup
exten => s,105,Goto(5)
exten => h,1,System(/bin/rm -f ${ARG1}.gsm)
;
;
;
[macro-announce]
exten => s,1,Background(callfrom)
exten => s,2,Background(${ARG1})
exten => s,3,Read(ACCEPT|call-accept|1)
exten => s,4,Gotoif($[${ACCEPT} = 1] ?50) ;connect
exten => s,5,Gotoif($[${ACCEPT} = 2] ?30) ;reject to vm
exten => s,6,Gotoif($[${ACCEPT} = 3] ?30:30) ;any thing else vm
exten => s,30,SetVar(MACRO_RESULT=CONTINUE)
exten => s,31,Goto(50)
exten => s,50,System(/bin/rm -f ${ARG1}.gsm)
exten => h,1,System(/bin/rm -f ${ARG1}.gsm)

have fun.

What if I instead of playing a recorded name, I wanted to play a sound clip?

For help modifying the example dial plan for your needs, try taking a quick look at the two links in my signature. You’ll learn all you need to know. Search for “applications commands” in the Wiki.

here you go - just define the sound file you want played (i’m using company-prompt as an example) - when a caller hits this extension, the user will pick up the phone and hear the company name, along with an option to answer or discard the call.

[code][macro-stdexten-announce]
exten => s,1,Set(PROMPT=/var/lib/asterisk/sounds/company-prompt)
exten => s,n,Dial(${ARG1}|${ARG3}|rtM(announce^${PROMPT}))
exten => s,n,Voicemail(u${ARG2})
exten => s,n,Hangup
exten => s,103,Goto(3)
exten => h,1,System(/bin/rm -f ${ARG1}.gsm)

[macro-announce]
exten => s,1,Background(${ARG1})
exten => s,n,Read(ACCEPT|call-accept|1)
exten => s,n,Gotoif($[${ACCEPT} = 1] ?50) ;connect
exten => s,n,Gotoif($[${ACCEPT} = 2] ?30) ;reject to vm
exten => s,n,Gotoif($[${ACCEPT} = 3] ?30:30) ;any thing else vm
exten => s,30,SetVar(MACRO_RESULT=CONTINUE)
exten => s,31,Goto(50)
exten => s,50,System(/bin/rm -f ${ARG1}.gsm)
exten => h,1,System(/bin/rm -f ${ARG1}.gsm) [/code]

but gtcleaves is correct, you could easily modify this yourself if you read up on what the commands mean.

Hello, sorry for my question but im new on this.
Could you please inform me where i have to setup all this that you upload?

This thread is from almost 17 years ago. You should make a new one.

1 Like