/api/v2/cdr route in the API

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?

This is normal behavior because the cdr will write only on hangup.

But interested as well how this can be resolved.

There could be a record creation date field where we could filter it on this endpoint.

Thus, when the call ended it would be recorded in the CDR by filling in the current date in this creation date field.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.