Record_file_timestamp seems broke

Asterisk 16


This is still appending the timestamps:
-rw-r–r-- 1 root root 9324 May 6 23:01 confbridge-8371-1557208907.wav
-rw-r–r-- 1 root root 35244 May 6 23:01 confbridge-8371-1557208911.wav
-rw-r–r-- 1 root root 34284 May 6 23:02 confbridge-8371-1557208945.wav

I just want to use the SAME file per confbridge number and always append, never create a new file.
Is this not possible?

So I discovered I can do it dynamically like this:

sprintf(recfn, "%s/%d.wav", path_confrec, bridge);
ast_setvar("CONFBRIDGE(bridge,internal_sample_rate)", "8000");
ast_setvar("CONFBRIDGE(bridge,record_conference)", "yes");
ast_setvar("CONFBRIDGE(bridge,record_file_append)", "yes");
ast_setvar("CONFBRIDGE(bridge,record_file_timestamp)", "no");
ast_setvar("CONFBRIDGE(bridge,record_file)", recfn);

The thing about this method is ive used it before to set conference variables and it caused a memory leak. My callers are constantly going on/off the bridge and every time then go on these settings happen. I dont understand why this would cause it a leak but it does, after a few days of this my MEM usage will be in the GBs. Any advice on this? Is there a way to unset/clear when the user goes off the bridge? Or is there a way to make it work like I want using confbridge.conf (in my first post).

So this doesnt seem right (and could be part of my problem):

  if (ast_strlen_zero(rec_file)) {
    ast_str_set(filename, 0, "confbridge-%s-%u.wav", conference->name,
      (unsigned int) now);
  } else if (ast_test_flag(&conference->b_profile, BRIDGE_OPT_RECORD_FILE_TIMESTAMP)) {
    /* insert time before file extension */
    ext = strrchr(rec_file, '.');
    if (ext) {
      ast_str_set_substr(filename, 0, rec_file, ext - rec_file);
      ast_str_append(filename, 0, "-%u%s", (unsigned int) now, ext);
    } else {
      ast_str_set(filename, 0, "%s-%u", rec_file, (unsigned int) now);
  } else {
    ast_str_set(filename, 0, "%s", rec_file);

So if the file is ast_strlen_zero its not even testing for BRIDGE_OPT_RECORD_FILE_TIMESTAMP and will always append the timestamp.

That’s correct. If a “rec_file” has not been set then Asterisk attempts to write out the recording to a uniquely named file. In order for help guarantee uniqueness it appends the conference name, and a timestamp. The wiki for ConfBridge configuration has more information. Specifically, the “record_file” section:

… By default, the recorded file is stored in Asterisk’s spool/monitory directory, with a unique filename starting with the ‘confbridge’ prefix.

The reason it works when setting it dynamically is because it appears you are not setting the “record_file” option in the configuration. However you do set it in dynamically:

ast_setvar(“CONFBRIDGE(bridge,record_file)”, recfn);

I’m not sure about the possibly memory leak. If you are witnessing a memory leak, and can easily replicate it please post a bug report on the Asterisk issue tracker along with the steps to reproduce, configuration, relevant dialplan, etc…

1 Like

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