Twilio 21220 - Call is not in-progress. Cannot redirect intermittently when moving <Dial><Number> legs into a Conference via REST API
03:00 04 Sep 2026

Setup:

I have a call-center dialer built on Twilio Voice + PHP (SuiteCRM backend). The flow is:

  1. Agent's browser calls Device.connect() (Twilio Client SDK), which hits my Voice Request URL (TwiML App).

  2. That URL returns a direct TwiML (agent's leg dials the customer directly — this is the "parent" call):

xml


    
        +91xxxxxxxxxx
    

  1. When the child (customer) leg's status webhook reports CallStatus=in-progress, my status-callback endpoint tries to move both legs (parent and child) into a using the REST API, so features like hold/transfer/multi-party work:

php

$twiml = ''
       . htmlspecialchars($conferenceName) . '';

$client->calls($incomingCallSid)->update(['twiml' => $twiml]); // child
$client->calls($parentCallSid)->update(['twiml' => $twiml]);   // parent

Problem:

This works most of the time, but intermittently (not reproducible on demand, happens more under production load than in testing) the parent call's update() call fails with:

json

{
    "message": "Call is not in-progress. Cannot redirect. ",
    "code": 21220,
    "userError": true,
    "httpStatusCode": -1
}

Looking at the parent call's Insights in the Twilio Console for a failing case, I see the parent call actually completes very quickly (sometimes in the same second it started, sometimes matching the child's completion time) — well before my redirect attempt was expected to run. The child call, meanwhile, is often successfully redirected into the conference just before the parent fails.

What I've observed/tried:

  • Redirecting the child into the Conference first (before the parent) seems to correlate with the parent's verb resolving/completing prematurely — as if moving the child out from under the parent's causes Twilio to consider that Dial resolved. Reversing the order (parent first) caused other call-flow issues in my testing, so I reverted that.

  • Added defensive code: after a 21220, I re-fetch() the call to check its live status before deciding how to update my local DB record, so a failed redirect doesn't get treated as a hard disconnect. This reduced user-facing symptoms significantly but the underlying 21220 still occurs.

  • Identified that a scheduled DB backup job (heavy SELECT * FROM table queries, several seconds each) runs on the same DB server roughly every 6-8 hours, and failures seem to cluster loosely around those windows — suggesting that when my status-callback endpoint's PHP/DB processing is slower than usual, the race gets worse.

  • Optimized the endpoint to do the Twilio REST redirect calls before any DB writes/logging, to minimize processing time before the redirect attempt.

Questions:

  1. Is it expected/documented Twilio behavior that redirecting a child leg of a (created implicitly by that noun) into independent TwiML (e.g., a Conference) via the REST API can cause the parent leg's to resolve/complete on its own — even though the parent's own update() hasn't been called yet?

  2. Is there a more reliable pattern for converting an in-progress call into a Conference with both legs, without hitting this 21220 race — for example should I be checking something more specific than CallStatus=in-progress before attempting the redirect (e.g., inspecting the parent's current TwiML/verb state via the API)?

  3. Is the right long-term fix simply to avoid entirely and have both legs join the Conference from their original TwiML (parent joins Conference directly, customer leg is added via a separate outbound REST calls.create() targeting the Conference from the start) rather than trying to redirect an in-progress Dial after the fact?

php twilio twilio-twiml