DEV Community

Misaella Corner
Misaella Corner

Posted on

Errors encountered with Twilio and the WordPress API

Hello,

We are experiencing several issues in managing calls between Twilio and our WordPress system and would need assistance. Here are the details of the observed errors:

  1. Association of CallSid with a User (Voyant)

When initiating the call, the CallSid does not appear to be correctly stored in our WordPress database.

This prevents the proper identification of the CallSid when Twilio sends status updates (e.g., completed) via the webhook.

Example log:

[22-Dec-2024 17:40:16 UTC] No voyant found for CallSid: CA383ca604ed3dbdbdcc7e3fdfd172b715.

  1. Incorrect JSON Decoding of Data Sent by Twilio

In some cases, the data sent by Twilio seems to be in the application/x-www-form-urlencoded format instead of JSON.

This difference causes an error during decoding, resulting in the failure to process the data.

Associated logs:

[22-Dec-2024 17:40:17 UTC] Raw data received: ParentAccountSid=&Payload=%7B...%22  
[22-Dec-2024 17:40:17 UTC] JSON Error: Syntax error
Enter fullscreen mode Exit fullscreen mode
  1. Failure of Requests to the WordPress API

When Twilio sends an update via the webhook, the POST request to our WordPress endpoint (/wp-json/voyance/v1/call_status_update_robust) returns an error.

Twilio logs:

AxiosError: Request failed with status code 404
Enter fullscreen mode Exit fullscreen mode

It seems that the endpoint is either not responding correctly or not properly configured to handle the requests.

  1. Incorrect Status Transition

Once the call is completed, the voyant’s status remains stuck on "busy" in our voyant_status table, even though the call is marked as "completed" by Twilio.

During manual testing with simulated data in Postman, the update works correctly, but it fails with requests sent by Twilio.

Thank you for your assistance!

Top comments (0)