Recording not saving on hangup & copying/moving recordings

Hi all,

I am a bit if a novice but have been working on a configuration and referencing the Asterisk manual/guide.

I am working on an appliance running V13.2 (apparently so I have been told) and editing extensions_additional.conf.

I am recording a voice file which is working, but if I hangup it loses the recording/does not save it, but if I press # it will save. I have tried the suggested syntax from the manual/guide as below, but it seems to ignore the k/x option? Any ideas anyone?
I would also like to copy the recorded file and put it in another folder with a date/time stamp for archiving purposes, any help appreciated.

So the manual/guide states the following options can be used;

format - Is the format of the file type to be recorded (wav, gsm, etc).
silence - Is the number of seconds of silence to allow before returning.
maxduration - Is the maximum recording duration in seconds. If missing or 0 there is no maximum.
a - Append to existing recording rather than replacing.
n - Do not answer, but record anyway if line not yet answered.
o - Exit when 0 is pressed, setting the variable RECORD_STATUS to OPERATOR instead of DTMF
q - quiet (do not play a beep tone).
s - skip recording if the line is not yet answered.
t - use alternate ‘*’ terminator key (DTMF) instead of default ‘#’
x - Ignore all terminator keys (DTMF) and keep recording until hangup.
k - Keep recorded file upon hangup.
y - Terminate recording if any DTMF digit is received.

So below is what I have tried;
exten => 4001,1,Answer(500)
same => n,Set(GLOBAL(Numb)=1)
same => n,Record(/var/lib/asterisk/Messages/Msg1.gsm,2,7,k)
same => n,Wait(1)
same => n,Set(messagetosend=curl “”)
same => n,Set(google={SHELL({messagetosend})})
same => n,playback(/var/lib/asterisk/sounds/ThankYouSent)
same => n,Hangup()

I have tried k and x for options in lower and upper case and it does not seem to work, you still have to use # or wait for the max duration to run out.

Any ideas where I am going wrong?

I would also like to save a copy of the recording in another location, is this possible?


I just tried you dialplan it it wrote the file out for me. I did change the directory to ‘/tmp’ though. Maybe it’s a permissions problem? Do you have permissions to write to that directory?

As far as moving the file once written you could use the SHELL function for that I believe. Also there are a couple of “time” functions you could use to retrieve the current data/time, put it in a variable, and then append that to the filename you are writing out to:

Hi @kharwell thanks for the reply.

It also writes the file/records for me, but not if I hang up the call, I have to use # or wait for the timeout. Can you get hangup to work? If so is there an additional option/code I should be using?

I am on 13.2, I see that you have sent me V16 documentation, could this be the issue? Bug with 13.2?

Thank you

Yes I hung up the call and the file remained. I was testing with a newer version of Asterisk, so yes if possible I would recommend testing with the latest released version of Asterisk: 13.26.0 or 16.3.0

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