diff --git a/daemon/call.c b/daemon/call.c index 465393881..dd1895306 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2333,6 +2333,8 @@ static void __update_init_subscribers(struct call_monologue *ml, GQueue *streams } // keep num_subs as shortcut to ml->subscribers.length + recording_setup_monologue(ml); + for (GList *l = ml->medias.head; l; l = l->next) { struct call_media *media = l->data; diff --git a/daemon/recording.c b/daemon/recording.c index aff28c73c..1ad636b02 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -58,6 +58,7 @@ static void dump_packet_proc(struct media_packet *mp, const str *s); static void init_stream_proc(struct packet_stream *); static void setup_stream_proc(struct packet_stream *); static void setup_media_proc(struct call_media *); +static void setup_monologue_proc(struct call_monologue *); static void kernel_info_proc(struct packet_stream *, struct rtpengine_target_info *); static void rec_pcap_eth_header(unsigned char *, struct packet_stream *); @@ -92,6 +93,7 @@ static const struct recording_method methods[] = { .init_stream_struct = init_stream_proc, .setup_stream = setup_stream_proc, .setup_media = setup_media_proc, + .setup_monologue = setup_monologue_proc, .stream_kernel_info = kernel_info_proc, }, }; @@ -302,6 +304,10 @@ void recording_start(struct call *call, const char *prefix, str *metadata, str * // function is called right at the start of the call, all of the following // is essentially a no-op GList *l; + for (l = call->monologues.head; l; l = l->next) { + struct call_monologue *ml = l->data; + recording_setup_monologue(ml); + } for (l = call->medias.head; l; l = l->next) { struct call_media *m = l->data; recording_setup_media(m); @@ -746,9 +752,6 @@ static void proc_init(struct call *call) { static void sdp_before_proc(struct recording *recording, const str *sdp, struct call_monologue *ml, enum call_opmode opmode) { - append_meta_chunk_str(recording, &ml->tag, "TAG %u", ml->unique_id); - if (ml->label.len) - append_meta_chunk_str(recording, &ml->label, "LABEL %u", ml->unique_id); append_meta_chunk_str(recording, sdp, "SDP from %u before %s", ml->unique_id, get_opmode_text(opmode)); } @@ -812,6 +815,18 @@ static void setup_stream_proc(struct packet_stream *stream) { append_meta_chunk(recording, buf, len, "STREAM %u interface", stream->unique_id); } +static void setup_monologue_proc(struct call_monologue *ml) { + struct call *call = ml->call; + struct recording *recording = call->recording; + + if (!recording) + return; + + append_meta_chunk_str(recording, &ml->tag, "TAG %u", ml->unique_id); + if (ml->label.len) + append_meta_chunk_str(recording, &ml->label, "LABEL %u", ml->unique_id); +} + static void setup_media_proc(struct call_media *media) { struct call *call = media->call; struct recording *recording = call->recording; diff --git a/include/recording.h b/include/recording.h index 4662ede92..012ff47f3 100644 --- a/include/recording.h +++ b/include/recording.h @@ -80,6 +80,7 @@ struct recording_method { void (*init_stream_struct)(struct packet_stream *); void (*setup_stream)(struct packet_stream *); void (*setup_media)(struct call_media *); + void (*setup_monologue)(struct call_monologue *); void (*stream_kernel_info)(struct packet_stream *, struct rtpengine_target_info *); }; @@ -190,6 +191,7 @@ void recording_finish(struct call *); #define recording_setup_stream(args...) _rm(setup_stream, args) #define recording_setup_media(args...) _rm(setup_media, args) +#define recording_setup_monologue(args...) _rm(setup_monologue, args) #define recording_init_stream(args...) _rm(init_stream_struct, args) #define recording_stream_kernel_info(args...) _rm(stream_kernel_info, args) #define recording_meta_chunk(args...) _rm(meta_chunk, args)