diff --git a/daemon/dtmf.c b/daemon/dtmf.c index c095da9a5..dec881a8a 100644 --- a/daemon/dtmf.c +++ b/daemon/dtmf.c @@ -63,6 +63,12 @@ static GString *dtmf_json_print(struct media_packet *mp, return buf; } +int dtmf_do_logging(void) { + if (_log_facility_dtmf || dtmf_log_sock.family) + return 1; + return 0; +} + int dtmf_event(struct media_packet *mp, str *payload, int clockrate) { struct telephone_event_payload *dtmf; if (payload->len < sizeof(*dtmf)) { @@ -78,7 +84,7 @@ int dtmf_event(struct media_packet *mp, str *payload, int clockrate) { GString *buf = NULL; - if (_log_facility_dtmf || dtmf_log_sock.family) + if (dtmf_do_logging()) buf = dtmf_json_print(mp, dtmf, clockrate); if (buf) { diff --git a/daemon/media_socket.c b/daemon/media_socket.c index 12272986d..02ae2483c 100644 --- a/daemon/media_socket.c +++ b/daemon/media_socket.c @@ -27,6 +27,7 @@ #include "codec.h" #include "media_player.h" #include "jitter_buffer.h" +#include "dtmf.h" #ifndef PORT_RANDOM_MIN @@ -1292,7 +1293,9 @@ static void __determine_handler(struct packet_stream *in, const struct packet_st if (!out_proto) goto err; - if (MEDIA_ISSET(in->media, DTLS) || MEDIA_ISSET(out->media, DTLS)) + if (dtmf_do_logging()) + must_recrypt = 1; + else if (MEDIA_ISSET(in->media, DTLS) || MEDIA_ISSET(out->media, DTLS)) must_recrypt = 1; else if (MEDIA_ISSET(in->media, TRANSCODE) || MEDIA_ISSET(out->media, TRANSCODE)) must_recrypt = 1; diff --git a/include/dtmf.h b/include/dtmf.h index 69afe176e..64bc3f680 100644 --- a/include/dtmf.h +++ b/include/dtmf.h @@ -23,6 +23,7 @@ int dtmf_event_payload(str *, uint64_t *, uint64_t, struct dtmf_event *, GQueue void dtmf_event_free(void *); int dtmf_code_from_char(char); const char *dtmf_inject(struct call_media *media, int code, int volume, int duration, int pause); +int dtmf_do_logging(void); #endif