Skip to content

Fix the HFP AG sending OK after rejecting AT+CHLD - #1022

Open
kwy404 wants to merge 1 commit into
google:mainfrom
kwy404:fix-hfp-chld-error-then-ok
Open

kwy404 wants to merge 1 commit into
google:mainfrom
kwy404:fix-hfp-chld-error-then-ok

Conversation

@kwy404

@kwy404 kwy404 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

An HFP Audio Gateway built with Bumble answers a rejected AT+CHLD (unsupported operation or unknown call index) with both +CME ERROR and OK, which shifts every later response on the HF side by one command and still reports the rejected request to the application as a call_hold event.

Root cause

AgProtocol._on_chld sends +CME ERROR when the operation is not in supported_ag_call_hold_operations or when no call matches the index, but it does not return. It falls through to send_ok() and emit(EVENT_CALL_HOLD, ...). The HF treats the error as the final result of AT+CHLD, so the extra OK stays queued and becomes the result of the next command. With Bumble's own HfProtocol, a following AT+CIND? then fails with HfpProtocolError(NO ANSWER), and from there each command receives the previous command's response.

Fix

Return right after sending each error, like the invalid operation branch just above already does.

Test

test_hold_call_with_unknown_call_index in tests/hfp_test.py sends AT+CHLD=11 with no active call, expects the HfpProtocolError, then checks that a following AT+CIND? gets its own +CIND response and that no call_hold event was emitted. Before the change the second command fails with NO ANSWER; after it, the test passes. All tests in tests/hfp_test.py pass and black -S --check is clean on the changed files.

When AT+CHLD named an unsupported operation or an unknown call index,
the AG sent +CME ERROR but then fell through, sent OK as well and
emitted the call_hold event. The HF takes the error as the final result
of AT+CHLD, so the extra OK is read as the result of its next command,
and every later command then gets the previous command's response.
Return after sending the error.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant