From 66360d7a4e9718a118bc222a53ba157f20f1b385 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 (cherry picked from commit e02e03729c558e3b67d5c18b361e89013822b4e5) --- daemon/call.c | 8 ++++++++ daemon/call_interfaces.c | 3 +++ daemon/recording.c | 8 ++++++++ include/call.h | 1 + include/call_interfaces.h | 1 + 5 files changed, 21 insertions(+) diff --git a/daemon/call.c b/daemon/call.c index be84acbfe..81fb19694 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -3032,6 +3032,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)); ml_media = other_ml_media = NULL; @@ -3298,6 +3303,9 @@ int monologue_publish(struct call_monologue *ml, GQueue *streams, struct sdp_ng_ GList *media_iter = NULL; + 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, &media_iter, sp, flags, -1); diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index a89376bb9..e94c25e3d 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -865,6 +865,9 @@ static void call_ng_flags_flags(struct sdp_ng_flags *out, str *s, void *dummy) { case CSH_LOOKUP("record-call"): out->record_call = 1; break; + case CSH_LOOKUP("exclude-recording"): + out->exclude_recording = 1; + break; case CSH_LOOKUP("debug"): out->debug = 1; break; diff --git a/daemon/recording.c b/daemon/recording.c index e903356f2..1dffac14c 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -669,6 +669,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); @@ -848,6 +850,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, @@ -873,6 +877,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) @@ -887,6 +893,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/include/call.h b/include/call.h index 197ac0d10..1bace6de8 100644 --- a/include/call.h +++ b/include/call.h @@ -527,6 +527,7 @@ struct call_monologue { unsigned int rec_forwarding:1; unsigned int inject_dtmf: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 d1e8bd79b..93fd984ec 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -145,6 +145,7 @@ struct sdp_ng_flags { siprec:1, fragment:1, record_call:1, + exclude_recording:1, debug:1, loop_protect:1, original_sendrecv:1,