Hello.
As VitalPBX does not have Webhooks, my application consults the “/api/v2/cdr” endpoint every 2 minutes, reporting the timestamp of the last check in the “start_date” parameter. This way, I only obtain calls that occurred after the last check, that is, those that my application is not yet aware of.
However, I noticed a situation: this route only displays calls that have been terminated. In other words, if a call started at 07:00 and lasted 20 minutes, it will only be available on this endpoint from 07:20, but will be registered with “start_date” at 07:00. As our cron runs every 2 minutes and applies a “start_date” filter based on the timestamp of the last check to obtain only new records, calls lasting longer than 2 minutes end up not being captured because they will be recorded after cron runs and with the “start_date” with a value from the past.
Filtering by the date the record was created in the database would resolve this issue. How can I apply this filter?