Asterisk 13 - Channel recording path always use default

I am trying to save the recording to a different location.
I already tried changing in asterisk.conf
astspooldir => /var/sc_recordings

But it keeps saving it to /var/spool/asterisk/recording path.

– Channel PJSIP/clickproxytrunk-00000001 joined ‘simple_bridge’ stasis-bridge <24>
– Channel Recorder/ARI-00000000;2 joined ‘simple_bridge’ stasis-bridge <24>
– x=0, open writing: /var/spool/asterisk/recording/recording_outbound_10068.ulaw format: ulaw, 0x7f4fbc002340

Isn’t astspooldir supposed to be the dir to define the output directory for the recording?
I tried restarting asterisk service but it doesn’t work.

The spool directory has more than just recordings in it, it’s where voicemail is stored as well as the outgoing and outgoing_done folders for processing call files.

You should be able to specify a full path when you start recording regardless of where the spool directory is set to.

Did you verify the permissions for the dir, also you can specify the recording path, if filename is an absolute path, mixmonitor will uses that path

Oh ok, so i will keep the spool dir as the default for now.

I am using ARI, so in my code I am sending the full path I want to save the file
i.e. /var/sc_recording/client_10/2017-12-21/recording_outbound_2134.ulaw
But when i try to locate the file generated, it is not in that path above, it is in the path below

So it is concatenating the path. What am I missing?

I believe the permissions are fine for that folder I mentioned.
I am using ARI, so I am not using MixMonitor, but instead I am sending a POST like below:

CS_POST, “/ari/bridges/”+bridgeId+"/record" “name=”+fileName+"&format="+format+"&maxDurationSeconds=0&ifExists=append"

The problem is that it keeps sending the ulaw to that /var/spool/asterisk/recording/
As I wrote to John, I am sending the full path when starting recording, but it concatenates the paths.

I have while without use ARI, but reading the documentation I think that you cant specify the path on the POST request

“The location of stored recordings is in the /recording subdirectory of the configured astspooldir in asterisk.conf. By default, this places recordings in /var/spool/asterisk/recording.”

1 Like

Yes, I also checked that link before.
In my POST I do send the full path I want to save the call record, but still it is concatenating with the default path.

I guess path need to be edited on asterisk.conf file, you cant do it on your POST request, it is not something im 100 % sure but based on the above link I guess that

I just found a discussion in asterisk-app-dev mailing list that confirms that allowing the users to specify a location is a bad idea.

"That’s the expected behavior.

Allowing remote users to create files in random locations on the server is
generally a bad idea. The paths that you specify are all relative to
/var/spool/asterisk/recording (or rather, the Asterisk recording directory).


@mjordan, This afirmation on the link above really means I can’t define a location to a record not relative to /var/spool/asterisk/recording ? I am using ARI to record a channel and I tried different approaches but none of them worked.

Thanks in advance.

Correct. Any path you specify is going to be relative to your Asterisk system’s recording directory.

It shouldn’t be to hard to think of why that’s the case. Allowing a remote system to have write file access to literally anywhere on your Asterisk system is a horrible idea. I don’t even want to contemplate the shenanigans that would happen to random systems if we allowed that.

You have a couple of rather easy options:

  1. Change the location of your recording directory in asterisk.conf

  2. Record the file in its default location, and have a cron job or other daemon copy/move the file to where you want it to be.

Keep in mind that if you want to play back those recordings at some point, you’ll need them in a place that ARI can find them. That doesn’t have to be the recording directory, but there are limitations in Asterisk on where it looks for files to play back as well (sounds directory, recording directories, etc.)

1 Like

Yep, I understand your considerations.
in fact my system just need the recordings as call register. I won’t play them or manipulate them using asterisk. Those records will be available only in my system after converting the ulaws to mp4.

I started this post because as you stated:

Change the location of your recording directory in asterisk.conf

I also believed i could point the recording to a different location after changing the astspooldir. But it didn’t work at all. It kept saving those files to the “/var/spool/asterisk/recording” even though I was specifying the full path of the recordings to “/var/sc_recording/client_10/” for example.
And it was concatenating both paths.

“/var/spool/asterisk/recording” + “/var/sc_recording/client_10/”

I tried changing the astspooldir to “/var/sc_recording” but it didn’t work.
After changing the asterisk.conf, I did a “core reload” and also tried restarting asterisk service but none of them worked.

The only thing I noticed is that it was creating a temporary file on “/var/sc_recording” replacing the “/” for “_”.
Something like that:


But as soon as I stopped recording, that file disappeared from that path and was sent to the concatenated path