pipecat icon indicating copy to clipboard operation
pipecat copied to clipboard

Add DTMFAggregator

Open markbackman opened this issue 7 months ago • 2 comments

Please describe the changes in your PR. If it is addressing an issue, please reference that as well.

This adds a DTMFAggregator, inspired by this older PR: https://github.com/pipecat-ai/pipecat/pull/1362.

The DTMFAggregator works by creating a TranscriptionFrame from the aggregated InputDTMFFrames. This works well in general, but has an important edge case to handle: it’s common to press a key while the bot is speaking. Right now, the TranscriptionFrames result in an EmulatedUserStartedSpeakingFrame because there’s no VAD event to trigger a UserStartedSpeakingFrame. We no longer interrupt when the bot is speaking and there’s an EmulatedUserStartedSpeakingFrame, so there isn’t an interruption. The user expectation is that a keypress would result in an interruption.

@aconchillo what do you recommend for this case?

A keypress is an explicit input, so it should trigger an interruption. Maybe we push an interruption frame when the first keypress is detected? What other options do we have?

markbackman avatar May 24 '25 14:05 markbackman

Codecov Report

:x: Patch coverage is 94.11765% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../pipecat/processors/aggregators/dtmf_aggregator.py 94.11% 4 Missing :warning:
Files with missing lines Coverage Δ
.../pipecat/processors/aggregators/dtmf_aggregator.py 94.11% <94.11%> (ø)

... and 1 file with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar May 25 '25 14:05 codecov[bot]

I've struggled to get tests to be 100% happy. They're running and passing now but with this warning:

RuntimeWarning: coroutine 'DTMFAggregator._aggregation_task_handler' was never awaited

@aconchillo maybe you have a tip?

markbackman avatar May 25 '25 15:05 markbackman

@aconchillo this is cleaned up. All errors are resolved, tests are passing, and it works well with the Twilio example, which I'm not including here. We might need a simple DTMF example in foundational now that we support Twilio there...

markbackman avatar May 29 '25 02:05 markbackman

LGTM!

aconchillo avatar May 29 '25 20:05 aconchillo