Play a message before incoming ring?

Good morning!

I’m running Asterisk 11.25.1 (according to asterisk -rx ‘core show version’)

I have a T1 (dahdi) coming into the system. I need to play a message when a call comes in; the “This call may be monitored or recorded”.

I think that what I maybe need to do is something like modify my extensions_custom.conf something like this:

exten => s,1,Answer()
same => s,n,Playback(this-call-may-be-monitored-or-recorded)
… but then I’m not sure of the next step, which would be to process the call (operator, DID’s, etc.)

I don’t need the message to play on station to station calls, just on incoming trunk calls.

Any help would be greatly appreciated. I hope I’m making sense.

(I’ve only been on Asterisk about 2 years, I’m a certified NEC guy… so I understand telephony, just not the nuances of Asterisk systems yet)

Thank you in advance!


Asterisk dosn’t come with an extensions_custom.conf. You need to contact the people who added that file.

(Also Asterisk doesn’t have a concept of an incoming trunk. The closest you would get would be a context that you have chosen to use for that purpose.)

Help for the most commonly used software than doe have an extensions_custom.conf can be obtained from

Do you know if the system has a web page for setting it up?

When you SSH into the server, does it have a banner that comes up?

There is nothing in the GUI about doing this (Xorcom CompletePBX).

I did contact Xorcom support, but I haven’t heard back, which is why I turned to the experts here (and on

It’s trivial to do in bare Asterisk, using the Playback application before the Dial application, and, optionally using Answer and Wait, to give time for the call to set up before playing the message… The difficulty in answering this on this forum is we don’t know how you integrate this with the huge dialplan that GUIs generally generate.

Answer without Wait achieves nothing, as Playback implicitly answers, unless told not to.

I assume, with the customisation, that you need to do something more to give control back to the GUI, to complete the outgoing leg.

I would, however, be surprised if there weren’t a built-in way of doing this, as it is such a common requirement.

I’ve assumed that incoming ring really means the Ringback tone sent the caller whilst the outgoing line is being rung.

I got the response over on the FreePBX boards (thank you for that suggestion)

For posterity, here’s what I had to do:

Change my context in my DAHDI configuration, I changed it to from-dahdi-announcement

In my extensions_custom.conf (which isn’t auto-generated in Xorcom), I added:

exten => _.,1,Answer()
exten => _.,n,Wait(1)
exten => _.,n,Playback(this-call-may-be-monitored-or-recorded)
exten => _.,n,Goto(from-dahdi,${EXTEN},1)

Which answered the call, waited one second, played the announcement, then continued on down the from-dahdi path.

Thank you all for your input and advice!