From 5b9d624fae7d6d9f37f623c679c30c542834c5a9 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 3 May 2023 10:18:24 -0400 Subject: [PATCH] MT#57302 add `exclude-recording` flag Change-Id: I08cf87ce94720f3e01bfbe3260bdc76da8e1bb63 --- daemon/call.c | 8 ++++++++ daemon/call_interfaces.c | 3 +++ daemon/recording.c | 8 ++++++++ docs/ng_control_protocol.md | 6 ++++++ include/call.h | 1 + include/call_interfaces.h | 1 + 6 files changed, 27 insertions(+) diff --git a/daemon/call.c b/daemon/call.c index 8da3025ef..d8e625fe1 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2810,6 +2810,11 @@ int monologue_offer_answer(struct call_monologue *dialogue[2], GQueue *streams, __call_monologue_init_from_flags(other_ml, flags); + if (flags->exclude_recording) { + monologue->no_recording = 1; + other_ml->no_recording = 1; + } + __C_DBG("this="STR_FORMAT" other="STR_FORMAT, STR_FMT(&monologue->tag), STR_FMT(&other_ml->tag)); set_transcoding_flag(monologue, other_ml, false); @@ -3072,6 +3077,9 @@ struct call_subscription *call_get_call_subscription(GHashTable *ht, struct call int monologue_publish(struct call_monologue *ml, GQueue *streams, struct sdp_ng_flags *flags) { __call_monologue_init_from_flags(ml, flags); + if (flags->exclude_recording) + ml->no_recording = 1; + for (GList *l = streams->head; l; l = l->next) { struct stream_params *sp = l->data; struct call_media *media = __get_media(ml, sp, flags, 0); diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 7bce8e46d..9ca866316 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1034,6 +1034,9 @@ static void call_ng_flags_flags(struct sdp_ng_flags *out, str *s, void *dummy) { case CSH_LOOKUP("discard-recording"): out->discard_recording = 1; break; + case CSH_LOOKUP("exclude-recording"): + out->exclude_recording = 1; + break; case CSH_LOOKUP("inactive"): out->inactive = 1; break; diff --git a/daemon/recording.c b/daemon/recording.c index 253655a80..d40291c3f 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -694,6 +694,8 @@ static void stream_pcap_dump(struct media_packet *mp, const str *s) { } static void dump_packet_pcap(struct media_packet *mp, const str *s) { + if (mp->media->monologue->no_recording) + return; struct recording *recording = mp->call->recording; mutex_lock(&recording->u.pcap.recording_lock); stream_pcap_dump(mp, s); @@ -893,6 +895,8 @@ static void setup_stream_proc(struct packet_stream *stream) { return; if (stream->recording.u.proc.stream_idx != UNINIT_IDX) return; + if (ml->no_recording) + return; len = snprintf(buf, sizeof(buf), "TAG %u MEDIA %u TAG-MEDIA %u COMPONENT %u FLAGS %u", ml->unique_id, media->unique_id, media->index, stream->component, @@ -918,6 +922,8 @@ static void setup_monologue_proc(struct call_monologue *ml) { if (!recording) return; + if (ml->no_recording) + return; append_meta_chunk_str(recording, &ml->tag, "TAG %u", ml->unique_id); if (ml->label.len) @@ -932,6 +938,8 @@ static void setup_media_proc(struct call_media *media) { if (!recording) return; + if (media->monologue->no_recording) + return; append_meta_chunk_null(recording, "MEDIA %u PTIME %i", media->unique_id, media->ptime); diff --git a/docs/ng_control_protocol.md b/docs/ng_control_protocol.md index f1888fc5c..324d2ee18 100644 --- a/docs/ng_control_protocol.md +++ b/docs/ng_control_protocol.md @@ -818,6 +818,12 @@ Spaces in each string may be replaced by hyphens. When file recording is in use, instructs the recording daemon to discard (delete) the recording files, as well as the database entries if present. +* `exclude recording` + + Instructs *rtpengine* to exclude this call participant's media from being + recorded. When used within an offer/answer exchange, applies to both call + parties involved. + * `early media` Used in conjunction with the audio player. If set, audio playback is diff --git a/include/call.h b/include/call.h index ab498527c..1b3f1c39c 100644 --- a/include/call.h +++ b/include/call.h @@ -540,6 +540,7 @@ struct call_monologue { unsigned int inject_dtmf:1; unsigned int dtmf_injection_active:1; unsigned int detect_dtmf:1; + unsigned int no_recording:1; }; struct call_iterator_list { diff --git a/include/call_interfaces.h b/include/call_interfaces.h index 4869d0a96..3a86e1d88 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -158,6 +158,7 @@ struct sdp_ng_flags { fragment:1, record_call:1, discard_recording:1, + exclude_recording:1, debug:1, inactive:1, loop_protect:1,