Browse Source

MT#59069 add recording-path option

Add an option to override the default output path of created recording
files.

Change-Id: I3fcabeb55ea118b22913630ce3473bd40a8ef85d
pull/1786/head
Richard Fuchs 2 years ago
parent
commit
b19f5982a4
9 changed files with 40 additions and 2 deletions
  1. +18
    -0
      daemon/call_interfaces.c
  2. +1
    -0
      daemon/recording.c
  3. +4
    -0
      daemon/redis.c
  4. +9
    -0
      docs/ng_control_protocol.md
  5. +1
    -0
      include/call.h
  6. +1
    -0
      include/call_interfaces.h
  7. +2
    -0
      recording-daemon/metafile.c
  8. +3
    -2
      recording-daemon/output.c
  9. +1
    -0
      recording-daemon/types.h

+ 18
- 0
daemon/call_interfaces.c View File

@ -1761,6 +1761,24 @@ static void call_ng_main_flags(sdp_ng_flags *out, str *key, bencode_item_t *valu
case CSH_LOOKUP("record-call"):
out->record_call_str = s;
break;
case CSH_LOOKUP("recording path"):
case CSH_LOOKUP("recording dir"):
case CSH_LOOKUP("recording directory"):
case CSH_LOOKUP("recording folder"):
case CSH_LOOKUP("output path"):
case CSH_LOOKUP("output dir"):
case CSH_LOOKUP("output directory"):
case CSH_LOOKUP("output folder"):
case CSH_LOOKUP("recording-path"):
case CSH_LOOKUP("recording-dir"):
case CSH_LOOKUP("recording-directory"):
case CSH_LOOKUP("recording-folder"):
case CSH_LOOKUP("output-path"):
case CSH_LOOKUP("output-dir"):
case CSH_LOOKUP("output-directory"):
case CSH_LOOKUP("output-folder"):
out->recording_path = s;
break;
case CSH_LOOKUP("repeat-times"):
out->repeat_times = bencode_get_integer_str(value, out->repeat_times);
break;


+ 1
- 0
daemon/recording.c View File

@ -289,6 +289,7 @@ static void update_call_field(call_t *call, str *dst_field, const str *src_field
void update_metadata_call(call_t *call, const sdp_ng_flags *flags) {
update_call_field(call, &call->metadata, flags ? &flags->metadata : NULL, "METADATA");
update_call_field(call, &call->recording_file, flags ? &flags->recording_file : NULL, "RECORDING_FILE");
update_call_field(call, &call->recording_path, flags ? &flags->recording_path : NULL, "RECORDING_PATH");
}
// lock must be held


+ 4
- 0
daemon/redis.c View File

@ -2081,6 +2081,8 @@ static void json_restore_call(struct redis *r, const str *callid, bool foreign)
call_str_cpy(c, &c->metadata, &s);
redis_hash_get_str(&s, &call, "recording_file");
call_str_cpy(c, &c->recording_file, &s);
redis_hash_get_str(&s, &call, "recording_path");
call_str_cpy(c, &c->recording_path, &s);
recording_start(c);
}
@ -2372,6 +2374,8 @@ char* redis_encode_json(call_t *c) {
JSON_SET_SIMPLE_STR("recording_meta_prefix", &c->recording_meta_prefix);
if (c->recording_file.len)
JSON_SET_SIMPLE_STR("recording_file", &c->recording_file);
if (c->recording_path.len)
JSON_SET_SIMPLE_STR("recording_path", &c->recording_path);
}
json_builder_end_object(builder);


+ 9
- 0
docs/ng_control_protocol.md View File

@ -1743,6 +1743,15 @@ If the optional `recording-file` key is set, then its value will be used as an
output file. Note that the value must refer to a complete (absolute) path
including file name, and a file name extension will not be added.
If the optional `recording-dir` key is set, then its value will be used as the
directory path for the output file(s), overriding the `output-dir` config
option of the recording daemon. The value should refer to an existing directory
given as an absolute path. Setting this key does not affect the names of the
files that will be created in the directory.
If both `recording-file` and `recording-dir` are set, then `recording-file`
takes precedence.
## `stop recording` Message
The `stop recording` message must contain the key `call-id` as defined above.


+ 1
- 0
include/call.h View File

@ -708,6 +708,7 @@ struct call {
str recording_meta_prefix;
str recording_file;
str recording_random_tag;
str recording_path;
struct call_iterator_entry iterator[NUM_CALL_ITERATORS];
int cpu_affinity;


+ 1
- 0
include/call_interfaces.h View File

@ -35,6 +35,7 @@ struct sdp_ng_flags {
int tos;
str record_call_str;
str recording_file;
str recording_path;
str metadata;
str label;
str set_label;


+ 2
- 0
recording-daemon/metafile.c View File

@ -220,6 +220,8 @@ static void meta_section(metafile_t *mf, char *section, char *content, unsigned
stream_forwarding_on(mf, lu, u);
else if (!strcmp(section, "RECORDING_FILE"))
mf->output_dest = g_string_chunk_insert(mf->gsc, content);
else if (!strcmp(section, "RECORDING_PATH"))
mf->output_path = g_string_chunk_insert(mf->gsc, content);
}


+ 3
- 2
recording-daemon/output.c View File

@ -202,6 +202,7 @@ static output_t *output_new_from_full_path(const char *path, char *name, const c
}
output_t *output_new_ext(metafile_t *mf, const char *type, const char *kind, const char *label) {
const char *output_path = mf->output_path ?: output_dir;
output_t *ret;
dbg("Metadata %s, output destination %s", mf->metadata, mf->output_dest);
if (mf->output_dest) {
@ -214,11 +215,11 @@ output_t *output_new_ext(metafile_t *mf, const char *type, const char *kind, con
ret->skip_filename_extension = TRUE;
}
else
ret = output_new_from_full_path(output_dir, path, kind);
ret = output_new_from_full_path(output_path, path, kind);
g_free(path);
}
else
ret = output_new(output_dir, mf, type, kind, label);
ret = output_new(output_path, mf, type, kind, label);
return ret;
}


+ 1
- 0
recording-daemon/types.h View File

@ -117,6 +117,7 @@ struct metafile_s {
char *metadata;
char *metadata_db;
char *output_dest;
char *output_path;
off_t pos;
unsigned long long db_id;
unsigned int db_streams;


Loading…
Cancel
Save