Calling System Recordings in Custom Dialplan

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?

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

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

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

Thanks for your help!

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:

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

And call it like this:

custom-1,s,1

Thank you,

Daniel Friedman
Trixton LTD.

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:
[custom-1]
exten => s,1,Answer
exten => s,n,play-system-recording,57,2
exten => s,n,…

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:

[custom-1]
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.

1 Like

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.

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.

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

[custom-play-recording-hangup-handler]
exten => s,1,Log(NOTICE,Entering to the hangup handler)
same => n,Return()

image

Thank you,

Daniel Friedman
Trixton LTD.

1 Like

I would do it like this:

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

From the asterisk docs: Home - Asterisk Documentation

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

1 Like

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";
1 Like

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

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

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