From 995375f500e6450cfc5a938178bc8db72d996b6e Mon Sep 17 00:00:00 2001 From: Doug Rylaarsdam Date: Thu, 10 Sep 2020 22:22:59 +0000 Subject: [PATCH] Add support for metadata in stop_recording. (Issue #1075 on sipwise/rtpengine) --- daemon/call_interfaces.c | 6 ++++-- daemon/recording.c | 7 +++++-- include/recording.h | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index bd45429b7..b9cdc211a 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1649,15 +1649,17 @@ const char *call_start_recording_ng(bencode_item_t *input, bencode_item_t *outpu const char *call_stop_recording_ng(bencode_item_t *input, bencode_item_t *output) { str callid; struct call *call; + str metadata; if (!bencode_dictionary_get_str(input, "call-id", &callid)) return "No call-id in message"; + bencode_dictionary_get_str(input, "metadata", &metadata); call = call_get_opmode(&callid, OP_OTHER); if (!call) return "Unknown call-id"; call->recording_on = 0; - recording_stop(call); + recording_stop(call, &metadata); rwlock_unlock_w(&call->master_lock); obj_put(call); @@ -1783,7 +1785,7 @@ const char *call_stop_forwarding_ng(bencode_item_t *input, bencode_item_t *outpu } } - recording_stop(call); + recording_stop(call, NULL); errstr = NULL; out: diff --git a/daemon/recording.c b/daemon/recording.c index 348a59cd8..c158cfc6c 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -302,10 +302,13 @@ void recording_start(struct call *call, const char *prefix, str *metadata) { recording_update_flags(call); } -void recording_stop(struct call *call) { +void recording_stop(struct call *call, str *metadata) { if (!call->recording) return; + if (metadata) + update_metadata(call, metadata); + // check if all recording options are disabled if (call->recording_on || call->rec_forwarding) { recording_update_flags(call); @@ -346,7 +349,7 @@ void detect_setup_recording(struct call *call, const str *recordcall, str *metad } else if (!str_cmp(recordcall, "no") || !str_cmp(recordcall, "off")) { call->recording_on = 0; - recording_stop(call); + recording_stop(call, NULL); } else ilog(LOG_INFO, "\"record-call\" flag "STR_FORMAT" is invalid flag.", STR_FMT(recordcall)); diff --git a/include/recording.h b/include/recording.h index c3e7dec78..4a2855cdb 100644 --- a/include/recording.h +++ b/include/recording.h @@ -117,7 +117,7 @@ void recording_fs_free(void); void detect_setup_recording(struct call *call, const str *recordcall, str *metadata); void recording_start(struct call *call, const char *prefix, str *metadata); -void recording_stop(struct call *call); +void recording_stop(struct call *call, str *metadata); /**