Play sound file after each call

Hello folks

I’ve got what is (hopefully) a simple query; I know what code I need to use, but unsure of where I can put it to actually work.

At the end of every call (whether internal or external), I want a sound file to play to whoever is on the line after the other party hangs up. The sound file simply repeats “The other person has hung up” twice, then hangs up; very similar to how our PSTN lines work in the UK.

Whereabouts can I put this into my FreePBX (or custom) dial plan to work?

Thanks so much


he h is the standard “hang-up” extension. The h extension, if it is configured, is called when a caller hangs up the phone. Note that as soon as this happens, the content of ${EXTEN} changes to h.

When the ‘h’ extension is running, the call legs have already been torn down. There is no way to delay this happening, and you can’t do anything in the ‘h’ extension that needs to read audio from the channel (since no audio will appear, the first time it tries to read audio it will abort). Thus Playback() or Background(), for example, does not work. Essentially, the only things that make sense to use in the ‘h’ extension are those that don’t have anything to do with the external channel that was involved before the hangup. No audio, no DTMF, etc.

Doing it for either side is difficult. For a long time you have been able to use g on dial to do it for the caller. Latest versions have a method for doing it for the callee. However, I’m not sure that there is anyway of doing it for both.