MT#55283 lightweight recording fields

Change-Id: Ic1d8fe3252aee215d4deff86264641863869b83c
master
Richard Fuchs 1 week ago
parent 272b3c3bc5
commit c66bc4521f

@ -2810,7 +2810,7 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c
if (flags->label.s) {
t_hash_table_remove(call->labels, &ml->label);
ml->label = call_str_cpy(&flags->label);
memory_arena_str_cpy_free(&ml->label, &flags->label);
t_hash_table_replace(call->labels, &ml->label, ml);
}
@ -5471,6 +5471,8 @@ void __monologue_free(struct call_monologue *m) {
memory_arena_free_lw(m->sdp_session_information.s);
memory_arena_free_lw(m->moh_blob.s);
memory_arena_free_lw(m->moh_file.s);
memory_arena_free_lw(m->label.s);
memory_arena_free_lw(m->metadata.s);
memory_arena_free_lw(m);
}

@ -1483,7 +1483,7 @@ static const char *media_block_match(call_t **call, struct call_monologue **mono
// for generic ops, handle set-label here if given
if (IS_OP_OTHER(flags->opmode) && flags->set_label.len && *monologue) {
t_hash_table_remove((*call)->labels, &(*monologue)->label);
(*monologue)->label = call_str_cpy(&flags->set_label);
memory_arena_str_cpy_free(&(*monologue)->label, &flags->set_label);
t_hash_table_replace((*call)->labels, &(*monologue)->label, *monologue);
}

@ -278,7 +278,7 @@ static void update_call_field(call_t *call, str *dst_field, const str *src_field
return;
if (src_field && src_field->len && str_cmp_str(src_field, dst_field))
*dst_field = call_str_cpy(src_field);
memory_arena_str_cpy_free(dst_field, src_field);
if (call->recording && dst_field->len) {
va_list ap;
@ -862,11 +862,18 @@ void recording_finish(call_t *call, bool discard) {
call->recording_meta_prefix = STR_NULL;
memory_arena_free_lw(call->recording_random_tag.s);
call->recording_random_tag = STR_NULL;
// also clear per-recording path overrides so they are not
// inadvertently reused if the next start recording omits them
memory_arena_free_lw(call->recording_file.s);
call->recording_file = STR_NULL;
memory_arena_free_lw(call->recording_path.s);
call->recording_path = STR_NULL;
memory_arena_free_lw(call->recording_pattern.s);
call->recording_pattern = STR_NULL;
memory_arena_free_lw(call->metadata.s);
call->metadata = STR_NULL;
}

@ -1662,9 +1662,9 @@ static int redis_tags(call_t *c, struct redis_list *tags, parser_arg arg) {
if (!redis_hash_get_str(&s, rh, "via-branch"))
__monologue_viabranch(ml, &s);
if (!redis_hash_get_str(&s, rh, "label"))
ml->label = call_str_cpy(&s);
memory_arena_str_cpy_free(&ml->label, &s);
if (!redis_hash_get_str(&s, rh, "metadata"))
ml->metadata = call_str_cpy(&s);
memory_arena_str_cpy_free(&ml->metadata, &s);
redis_hash_get_time_t(&ml->deleted_us, rh, "deleted");
if (!redis_hash_get_int(&ii, rh, "block_dtmf"))
ml->block_dtmf = ii;
@ -2388,15 +2388,15 @@ static void json_restore_call(struct redis *r, const str *callid, bool foreign)
memory_arena_str_cpy_free(&c->recording_meta_prefix, &s);
// coverity[check_return : FALSE]
redis_hash_get_str(&s, &call, "recording_metadata");
c->metadata = call_str_cpy(&s);
memory_arena_str_cpy_free(&c->metadata, &s);
redis_hash_get_str(&s, &call, "recording_file");
c->recording_file = call_str_cpy(&s);
memory_arena_str_cpy_free(&c->recording_file, &s);
redis_hash_get_str(&s, &call, "recording_path");
c->recording_path = call_str_cpy(&s);
memory_arena_str_cpy_free(&c->recording_path, &s);
redis_hash_get_str(&s, &call, "recording_pattern");
c->recording_pattern = call_str_cpy(&s);
memory_arena_str_cpy_free(&c->recording_pattern, &s);
redis_hash_get_str(&s, &call, "recording_random_tag");
c->recording_random_tag = call_str_cpy(&s);
memory_arena_str_cpy_free(&c->recording_random_tag, &s);
recording_start_daemon(c);
}

Loading…
Cancel
Save