MT#59069 seperate out random recording tag

Change-Id: I059ca35e3ddf109c599e41a34629598a18a6b15e
pull/1786/head
Richard Fuchs 2 years ago
parent 8fe72ccec9
commit 8853c53b76

@ -348,6 +348,7 @@ void recording_start(call_t *call) {
rand_hex_str(rand_str, rand_bytes);
g_autoptr(char) meta_prefix = g_strdup_printf("%s-%s", escaped_callid, rand_str);
call_str_cpy(call, &call->recording_meta_prefix, &STR_INIT(meta_prefix));
call_str_cpy(call, &call->recording_random_tag, &STR_CONST_INIT(rand_str));
}
_rm(init_struct, call);
@ -834,6 +835,7 @@ static void proc_init(call_t *call) {
append_meta_chunk_str(recording, &call->callid, "CALL-ID");
append_meta_chunk_s(recording, call->recording_meta_prefix.s, "PARENT");
append_meta_chunk_s(recording, call->recording_random_tag.s, "RANDOM_TAG");
if (call->metadata.len)
recording_meta_chunk(recording, "METADATA", &call->metadata);
}

@ -155,7 +155,7 @@ sufficient for a standard installation of rtpengine.
File name pattern to be used for recording files. The pattern can reference
sub-directories. Parent directories will be created on demand. The default
setting is __%c-%t__.
setting is __%c-%r-%t__.
The pattern must include __printf__-style format sequences. Supported format
sequences are:
@ -169,6 +169,11 @@ sufficient for a standard installation of rtpengine.
The call ID. It is mandatory for the output pattern to include this format
sequence.
- __%r__
A random tag generated by __rtpengine__ to distinguish possibly
repeated or duplicated call IDs.
- __%t__
The stream type. For __single__ streams this is the SSRC written as hexadecimal;

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

@ -317,7 +317,7 @@ static void options(int *argc, char ***argv) {
num_threads = num_cpu_cores(8);
if (!output_pattern)
output_pattern = g_strdup("%c-%t");
output_pattern = g_strdup("%c-%r-%t");
if (!strstr(output_pattern, "%c"))
die("Invalid output pattern '%s' (no '%%c' format present)", output_pattern);
if (!strstr(output_pattern, "%t"))

@ -185,6 +185,8 @@ static void meta_section(metafile_t *mf, char *section, char *content, unsigned
mf->call_id = g_string_chunk_insert(mf->gsc, content);
else if (!strcmp(section, "PARENT"))
mf->parent = g_string_chunk_insert(mf->gsc, content);
else if (!strcmp(section, "RANDOM_TAG"))
mf->random_tag = g_string_chunk_insert(mf->gsc, content);
else if (!strcmp(section, "METADATA"))
if (mf->forward_fd >= 0) {
ilog(LOG_INFO, "Connection already established, sending mid-call metadata %.*s", (int)len, content);

@ -106,7 +106,8 @@ static output_t *output_new(const char *path, const metafile_t *mf, const char *
// construct output file name
struct timeval now;
struct tm tm;
const char *ax = mf->parent;
g_autoptr(char) escaped_callid = g_uri_escape_string(mf->call_id, NULL, 0);
const char *ax = escaped_callid;
gettimeofday(&now, NULL);
localtime_r(&now.tv_sec, &tm);
@ -126,7 +127,10 @@ static output_t *output_new(const char *path, const metafile_t *mf, const char *
g_string_append_c(f, '%');
break;
case 'c':
g_string_append(f, mf->parent);
g_string_append(f, escaped_callid);
break;
case 'r':
g_string_append(f, mf->random_tag);
break;
case 't':
g_string_append(f, type);

@ -113,6 +113,7 @@ struct metafile_s {
char *name;
char *parent;
char *call_id;
char *random_tag;
char *metadata;
char *metadata_db;
char *output_dest;

Loading…
Cancel
Save