agentos icon indicating copy to clipboard operation
agentos copied to clipboard

A carrier hangup the carrier refuses is not retried: the call stays connected while its record says it ended

Open jddunn opened this issue 3 weeks ago • 1 comments

Before you file

  • [x] I searched the existing issues and found none for this bug.

What happened

CallManager ends a call before it asks the carrier to hang up, and a carrier request that fails is only written to the console (requestCarrierHangup). For a call held in a store, hangupDurable commits hangup-bot first (L649-L667). When the carrier then refuses the hangup or the request fails, hangupCall resolves, processWebhookDurable acknowledges the webhook that triggered a notify call's hangup, and the record reads hangup-bot in the manager and in the store while the call is still connected at the carrier. Nothing asks again: a redelivered call.speak.ended finds the call ended.

Twilio's hangupCall does not read the HTTP status (twilio.ts L425), so a refused Twilio hangup is not even written to the console. A carrier-profile Plivo provider throws on a status outside 2xx, and a carrier-profile Telnyx provider does too from #792.

Expected: a hangup the carrier did not accept stays retryable. The end commits with a pending carrier hangup on the record, cleared once the carrier accepts the command; a redelivered webhook for the call, or a call the host makes on a timer, sends the pending hangup again; and hangupCall tells its caller when the carrier refused.

Steps to reproduce

  1. A carrier-profile TelnyxVoiceProvider and a CallManager with InMemoryTelephonyCallStore; initiateCall({ mode: 'notify', message }), persistCall, then the signed call.answered through processWebhookDurable.
  2. Answer POST /v2/calls/{id}/actions/hangup with 422 (or reject the fetch).
  3. Send the signed call.speak.ended with the speak's client_state and status: completed.

processWebhookDurable resolves { accepted: true, applied: 1 }, the call reads hangup-bot in the manager and the store, and the carrier call is never hung up. A redelivery of the webhook sends nothing.

Package and version

@framers/agentos master fb6fcdf78fc909e3ae1ba71285df1285860dc135

Environment

n/a

Logs

[CallManager] Hangup failed: Error: Telnyx hangup failed: 422

jddunn avatar Nov 11 '26 16:11 jddunn

23 Nov 2026 UTC. The refusal case needs durable pending-hangup state, a retry route that can see an ended call, and consistent error handling from the carrier providers. Making the carrier error visible alone would still leave the persisted call unable to retry.

jddunn avatar Nov 23 '26 06:11 jddunn