admin管理员组

文章数量:1125377

I am using PHP Laravel. So I have everything working on my project with Twilio Call API. Now I was asked to calculate the ring duration of outgoing call which Twilio does not provide directly. So what I did was, I saved the Timestamp of all outgoing status call back events that are "initiated ringing answered completed".

Next I calculated ring duration this way:

strtotime(Ring_Time_Stamp) - strtotime(In_Progress_Time_Stamp).

I hope my above logic is correct.

The problem: Twilio sends almost same Time Stamps or similar Time Stamps for initiated, ringing, in-progress. Twilio posts something like this:

RINGING:
Timestamp
    "Wed, 08 Jan 2025 21:23:23 +0000"

IN PROGRESS:
Timestamp
    "Wed, 08 Jan 2025 21:23:23 +0000" 

I know that sometimes calls are received immediately which can cause in 0 ring duration. But in my case it is happening with almost all calls. I am getting almost 200-300 calls a day(beta version). This number will go up as soon as I put to Live.

I am also attaching two images for reference

Ring Time Stamp From Twilio

In Progress Time Stamp From Twilio

This example has a difference of 1 second but for many many other calls I am receiving almost same Time Stamp for Initiated, Ringing and in-progress status call backs.

Can someone guide me please or tell me how can I get correct ring duration which in my project plays a crucial role in determining commissions.

Thank you!

本文标签: Twilio out going status call backs returning almost same TimeStampsStack Overflow