diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 4268dc37c..bd1a1d62e 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -2047,11 +2047,7 @@ static const char *call_offer_answer_ng(struct ng_buffer *ngbuf, bencode_item_t bencode_buffer_destroy_add(output->buffer, (free_func_t) sdp_chopper_destroy, chopper); update_metadata_monologue(dialogue[0], &flags.metadata); - detect_setup_recording(call, &flags.record_call_str); - if (flags.record_call) { - call->recording_on = 1; - recording_start(call, NULL, NULL); - } + detect_setup_recording(call, &flags); if (flags.drop_traffic_start) { call->drop_traffic = 1; diff --git a/daemon/recording.c b/daemon/recording.c index b8ff49f7e..418ed0550 100644 --- a/daemon/recording.c +++ b/daemon/recording.c @@ -21,6 +21,7 @@ #include "rtplib.h" #include "cdr.h" #include "log.h" +#include "call_interfaces.h" @@ -413,11 +414,13 @@ void recording_pause(struct call *call) { * * Returns a boolean for whether or not the call is being recorded. */ -void detect_setup_recording(struct call *call, const str *recordcall) { - if (!recordcall || !recordcall->s) +void detect_setup_recording(struct call *call, const struct sdp_ng_flags *flags) { + if (!flags) return; - if (!str_cmp(recordcall, "yes") || !str_cmp(recordcall, "on")) { + const str *recordcall = &flags->record_call_str; + + if (!str_cmp(recordcall, "yes") || !str_cmp(recordcall, "on") || flags->record_call) { call->recording_on = 1; recording_start(call, NULL, NULL); } @@ -425,7 +428,7 @@ void detect_setup_recording(struct call *call, const str *recordcall) { call->recording_on = 0; recording_stop(call); } - else + else if (recordcall->len != 0) 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 12cd1ac39..b74db29a6 100644 --- a/include/recording.h +++ b/include/recording.h @@ -24,6 +24,7 @@ enum call_opmode; struct rtpengine_target_info; struct call_monologue; struct call_media; +struct sdp_ng_flags; struct recording_pcap { @@ -113,7 +114,7 @@ void recording_fs_free(void); * * Returns a boolean for whether or not the call is being recorded. */ -void detect_setup_recording(struct call *call, const str *recordcall); +void detect_setup_recording(struct call *call, const struct sdp_ng_flags *flags); void update_metadata_call(struct call *call, str *metadata); void update_metadata_monologue(struct call_monologue *ml, str *metadata);