Calling System Recordings in Custom Dialplan

(Communication Technologies) #1

FreePBX Asterisk 14

I want to use system recordings in my custom dialplan with the purpose of allowing changes to the system recording in the GUI to flow into my custom dialplan. I found the [play-system-recording] context in extensions_addational.conf and the playback seems to always be the second step in the dialplan.

My Question:
Is there a way for me to pull one line of an extension in the [play-system-recording] context into my existing custom dialplan [custom-1]?

What’s the correct way to write the dialplan for [custom-1] so that it calls step two of exten 57 before going to the next s step of the custom context?

something like, I need extension 57 custom recording on line 2:

include => play-system-recording-custom
exten => 57,1,Answer
exten => 57,n,Playback(custom/1021132)
exten => 57,n,Hangup

exten => s,1,Answer
exten => 57,2,Playback(custom/1021132)
exten => s,n,...

Thanks for your help!

(Daniel Friedman) #2

Hi @comtech,

The 57 or any other alfanumeric string is the dialing pattern. The 57 in your example is the id number of this system recording, and you call it in your dialplan like this: play-system-recording,57,1 and in a whole dialplan line for example:

exten => s,n,Goto(play-system-recording,57,1) or

exten => 1,1,Goto(play-system-recording,57,1)

So, in your custom context use it like this:

exten => s,1,Answer
same => n,Playback(custom/1021132)
same => n,...

And call it like this:


Thank you,

Daniel Friedman
Trixton LTD.

(Communication Technologies) #3

Hi @danielf,

Unfortunately I am attempting to call step 2 (and only step 2) of 57 directly, so that if the recording changes for 57, my dialplan has the new recording. Is there anyway to do this that you are aware of?

I need something like:
exten => s,1,Answer
exten => s,n,play-system-recording,57,2
exten => s,n,…

(Daniel Friedman) #4

Hi @comtech,

Once the system recording is getting an id from the GUI it never changes, even if you will replace the recording in the GUI.

This is how you should use it in your dialplan:

exten => s,1,Goto(play-system-recording,57,1)

Then, the context play-system-recording will answer the call and play the recording.
I think that you could do that in the GUI as well on the misc apps module.

Thank you,

Daniel Friedman
Trixton LTD.

(Communication Technologies) #5

I thought so originally also, due to there being an override file warning when rerecording; however, I noticed that the file name does in fact change.

For example, I get the override warning for a file name in system recording, I select yes to override, but the recording shows up as replacement-xxxxx

If I use goto will it jump back to the s route after that step? Ext 57 plays the file then goes to a hangup. I need the recording to play then jump back to the s route to finish the treatment. I cannot modify the 57 extension since that is system generated.

(Daniel Friedman) #6

Hi @comtech,

A bit tricky. Here is my way to do it with the GUI and your custom context:

1.Configure an Announcement that will play your system recording (Inbound route or a misc application).
2.Send the call to your custom context for further processing after the playback.
3.Add a hangup handler if you will need to send events after the hangup.

exten => s,1,Set(CHANNEL(hangup_handler_push)=custom-play-recording-hangup-handler,s,1())
same => n,Playback(auth-thankyou)

exten => s,1,Log(NOTICE,Entering to the hangup handler)
same => n,Return()


Thank you,

Daniel Friedman
Trixton LTD.

(Itzik) #7

I would do it like this:

exten => s,1,Noop(Entering custom stuff)
exten => s,n,Dial(local/57@play-system-recording,,g)
exten => s,n,...

From the asterisk docs:

g - Proceed with dialplan execution at the next priority in the current extension if the destination channel hangs up.

(Lorne Gaetz) #8

Doing this by parsing dialplan is probably not possible. You could pull the filename directly from mysql using some bash magic or an AGI and a query like this

select `filename` from `recordings` where `id` like "57";

(Itzik) #9

Whats the issue with using the Dial application with the g option? unless I misunderstood?

(Communication Technologies) #10

I will try this before making it the more elaborate approaches.

(system) closed #11

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.