Thanks to visit codestin.com
Credit goes to github.com

Skip to content

res_tonedetect: Add option for TONE_DETECT detection to auto stop.#1391

Merged
github-actions[bot] merged 1 commit into
asterisk:masterfrom
InterLinked1:master-issue-1390
Sep 3, 2025
Merged

res_tonedetect: Add option for TONE_DETECT detection to auto stop.#1391
github-actions[bot] merged 1 commit into
asterisk:masterfrom
InterLinked1:master-issue-1390

Conversation

@InterLinked1

Copy link
Copy Markdown
Contributor

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.

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: asterisk#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.
@InterLinked1

InterLinked1 commented Aug 22, 2025

Copy link
Copy Markdown
Contributor Author

cherry-pick-to: 23
cherry-pick-to: 22

@github-actions

Copy link
Copy Markdown

Workflow PRCheck failed
master-pjs2: FAILED TEST: channels/pjsip/transfers/attended_transfer/nominal/callee_local

@gtjoseph gtjoseph added the cherry-pick-test Trigger dry run of cherry-picks label Aug 27, 2025
@github-actions github-actions Bot added cherry-pick-testing-in-progress Cherry-Pick tests in progress cherry-pick-checks-failed Cherry-Pick checks failed and removed cherry-pick-test Trigger dry run of cherry-picks cherry-pick-testing-in-progress Cherry-Pick tests in progress labels Aug 27, 2025
@github-actions

Copy link
Copy Markdown

Workflow PRCPCheck failed
Setup: cherryPick.sh: Unable to cherry-pick commit 'res_tonedetect: Add option for TONE_DETECT detection to auto stop.' to branch 21
Setup: cherryPick.sh: Unable to cherry-pick commit 'res_tonedetect: Add option for TONE_DETECT detection to auto stop.' to branch 20

@gtjoseph gtjoseph left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cherry-picks to 20 and 21 failed.

@InterLinked1

Copy link
Copy Markdown
Contributor Author

Cherry-picks to 20 and 21 failed.

What does this mean exactly? They need to be manually cherry picked as separate PRs?

@jcolp

jcolp commented Aug 27, 2025

Copy link
Copy Markdown
Member

Yes.

@InterLinked1 InterLinked1 requested a review from gtjoseph August 28, 2025 12:30
@InterLinked1

Copy link
Copy Markdown
Contributor Author

Separate PR for 20/21 added here: #1404

@gtjoseph gtjoseph dismissed their stale review September 3, 2025 12:29

Issues addressed.

@gtjoseph gtjoseph added cherry-pick-test Trigger dry run of cherry-picks and removed cherry-pick-checks-failed Cherry-Pick checks failed labels Sep 3, 2025
@github-actions github-actions Bot added cherry-pick-testing-in-progress Cherry-Pick tests in progress cherry-pick-checks-passed Cherry-Pick checks passed and removed cherry-pick-test Trigger dry run of cherry-picks cherry-pick-testing-in-progress Cherry-Pick tests in progress labels Sep 3, 2025
@github-actions

github-actions Bot commented Sep 3, 2025

Copy link
Copy Markdown

Workflow PRCPCheck completed successfully

@github-actions github-actions Bot merged commit 0a46be9 into asterisk:master Sep 3, 2025
69 of 71 checks passed
@github-actions

github-actions Bot commented Sep 3, 2025

Copy link
Copy Markdown

Successfully merged to branch master and cherry-picked to ["23","22"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[improvement]: res_tonedetect: Add option to automatically end detection in TONE_DETECT

3 participants