From 6b5f1f081c34cded800c8613ef33bf70eb69cbf4 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 20 Mar 2023 14:06:07 -0400 Subject: [PATCH] MT#56856 log duration only for end events The "duration" is not valid for events which are not end events as there's no previous event to derive a duration from. Change-Id: I3f9dad536b168cce24d1a58c5bcf25e5cacfe7a8 --- daemon/dtmf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/daemon/dtmf.c b/daemon/dtmf.c index 685759355..323b7dd03 100644 --- a/daemon/dtmf.c +++ b/daemon/dtmf.c @@ -403,11 +403,12 @@ void dtmf_dsp_event(const struct dtmf_event *new_event, struct dtmf_event *cur_e // we don't have a real fsin so just use the stream address struct packet_stream *ps = media->streams.head->data; - unsigned int duration = new_event->ts - cur_event.ts; LOCK(&media->dtmf_lock); if (end_event) { + unsigned int duration = new_event->ts - cur_event.ts; + ilog(LOG_DEBUG, "DTMF DSP end event: event %i, volume %i, duration %u", cur_event.code, cur_event.volume, duration); @@ -415,8 +416,8 @@ void dtmf_dsp_event(const struct dtmf_event *new_event, struct dtmf_event *cur_e duration, &ps->endpoint, clockrate, false, ts, injected); } else { - ilog(LOG_DEBUG, "DTMF DSP code event: event %i, volume %i, duration %u", - new_event->code, new_event->volume, duration); + ilog(LOG_DEBUG, "DTMF DSP code event: event %i, volume %i", + new_event->code, new_event->volume); int code = dtmf_code_from_char(new_event->code); // for validation if (code != -1) dtmf_code_event(media, (char) new_event->code, ts, clockrate,