Skip to main content

Twilio-compatible API error codes (twilio-compat)

The Twilio-compatible routes answer errors in Twilio's body {code, message, more_info, status} plus mpbx_code, one of the codes below (or the native code of the route it maps to). TwiML that runs on a call placed through Calls create (Twiml or Url) stops with one of these codes when a document cannot run: the PBX then hangs up and logs the Twilio code and the MonoPbx code (never the address, the document or the keys pressed). Guide: Twilio migration.

CodeKindMeaningWhat to do
MPBX-TWIML-PARSEinvalid_argumentTwilio 12100: the TwiML is not well-formed XML, is not a <Response> document, has a DOCTYPE, or is larger than 64 KiB (or more than 100 verbs). Inline Twiml is checked before the call is placed (400); a fetched document stops the call.Fix the document.
MPBX-TWIML-UNSUPPORTEDinvalid_argumentTwilio 12200: a verb, noun or attribute outside the supported subset, for example <Enqueue>, <Conference>, speech <Gather>, <Record> or <Dial><Queue> on a call placed through the API, a verb after <Dial>, a relative address in inline TwiML, a flow: address at run time, or a method other than GET or POST. The message names the verb and the reason.Use the subset in the guide, or compile the document into a call flow (TwiML/compile).
MPBX-TWIML-FETCH-FAILEDunavailableTwilio 11200 (the server answered with a status other than 2xx, redirects included: they are not followed) or 11205 (no connection, or no answer within 10 seconds).Check that the address answers 200 with TwiML quickly and without a redirect.
MPBX-TWIML-FETCH-BLOCKEDinvalid_argumentTwilio 21205 (Url on Calls create or update), 21609 (StatusCallback) or 11210 (during the call): the address is not a public https:// address on port 443 or 1024 and above, has credentials in it, or resolves to a private, loopback, link-local, metadata or other non-public address.Serve TwiML from a public https:// address.
MPBX-TWIML-TOO-LARGEinvalid_argumentTwilio 11750: the answer is larger than 64 KiB, or remote Play media is larger than 8 MiB.Return a smaller document (split it with Redirect).
MPBX-TWIML-CONTENT-TYPEinvalid_argumentTwilio 12300: the answer is not XML (Content-Type must be text/xml or application/xml).Send the TwiML with an XML content type.
MPBX-TWIML-LOOPresource_exhaustedTwilio 11215: one call asked for more than 20 documents (Redirect, Gather action and the first document together).Look for a document that redirects to itself.
MPBX-TWIML-MEDIAunavailableTwilio 12400: Say could not be spoken (the company has no text-to-speech provider for the voice agent, or it failed), a Play prompt is not in the prompt library or is not a WAV the PBX can play, or remote Play media is not an audio file the PBX can decode (MP3, WAV, Ogg, FLAC, AAC; at most 10 minutes).Set up text-to-speech in the AI settings, upload the prompt, or serve a supported audio file.
MPBX-TWIML-CALL-REFUSEDpermission_denied403 on Calls create: the dial plan does not let the From extension call To (a refused number, an emergency number, an extension or a feature code). Nothing rang.Call an outside number the extension may dial, or change its outbound rules.
MPBX-TWIML-UNAVAILABLEunavailable503 (Twilio 20503) on Calls create with Twiml or Url: this server has no call engine or media service to place the call.Send the request to a server that runs calls, or check the media service.
MPBX-TWIML-NOT-RUNNINGconflict409 on call update with Twiml or Url: the call was not created with Twiml or Url, a Dial has connected it, it has ended, or it runs on another server.Hang the call up with Status=completed, or redirect only calls that run TwiML.
MPBX-TWIML-REPLACEDunavailableLogged only: a call update replaced the running document.Nothing to do.
MPBX-TWIML-CALL-ENDEDunavailableLogged only: the callee hung up while the document ran.Nothing to do.