]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_tonedetect: Add option for TONE_DETECT detection to auto stop.
authorNaveen Albert <asterisk@phreaknet.org>
Thu, 28 Aug 2025 12:29:02 +0000 (08:29 -0400)
committerGeorge Joseph <gjoseph@sangoma.com>
Wed, 17 Sep 2025 20:04:27 +0000 (14:04 -0600)
commitedd33c1967e16b9c2b1a644474e2a8c7fa0d8c75
treeeea79a462abd4ce3d4fd4cffb31949d2941312c5
parent18f6b254259bcc30fa174941182b759d48260376
res_tonedetect: Add option for TONE_DETECT detection to auto stop.

One of the problems with TONE_DETECT as it was originally written
is that if a tone is detected multiple times, it can trigger
the redirect logic multiple times as well. For example, if we
do an async goto in the dialplan after detecting a tone, because
the detector is still active until explicitly disabled, if we
detect the tone again, we will branch again and start executing
that dialplan a second time. This is rarely ever desired behavior,
and can happen if the detector is not removed quickly enough.

Add a new option, 'e', which automatically disables the detector
once the desired number of matches have been heard. This eliminates
the potential race condition where previously the detector would
need to be disabled immediately, but doing so quickly enough
was not guaranteed. This also allows match criteria to be retained
longer if needed, so the detector does not need to be destroyed
prematurely.

Resolves: #1390

UserNote: The 'e' option for TONE_DETECT now allows detection to
be disabled automatically once the desired number of matches have
been fulfilled, which can help prevent race conditions in the
dialplan, since TONE_DETECT does not need to be disabled after
a hit.

(cherry picked from commit d555e8117fa0ffd53bf5cd2215f334c1f65a140b)
res/res_tonedetect.c