Analytics API v2 returning null duration for failed BYOC trunks in APAC

Looking for advice on handling null call duration values in Analytics API v2 responses.

We manage 15 BYOC trunks across Singapore and Tokyo.

When SIP registration fails during peak hours, the API returns zero duration for these legs.

This skews our CSAT reports significantly.

Is there a specific filter or parameter to exclude these failed SIP attempts from the aggregate metrics?

Current SDK version is 2.4.1.

Ah, this is a recognized issue with how the platform handles callDuration for failed SIP registrations in BYOC scenarios. The API does not automatically filter these out because they are technically valid call legs from the system’s perspective, even if no media was exchanged.

Instead of trying to filter at the API level, which can be slow and error-prone, try adjusting the aggregation logic in your reporting layer. In my JMeter tests, I noticed that callOutcome is the key field here. You should add a filter for callOutcome != 'failed_registration' or callOutcome != 'busy' before calculating the average duration.

Also, check the mediaState field. If mediaState is null or disconnected before the transcriptionHandshake, the duration will be zero. Filtering by mediaState == 'active' usually cleans up the CSAT data significantly. It’s not a bug in the SDK, but a gap in how we interpret “failed” calls in the analytics pipeline. Try this filter in your query builder.

The quickest way to solve this is to filter by callOutcome equal to no-answer or busy before aggregating. This prevents null durations from skewing your metrics.

Just ensure your S3 bucket permissions allow this query pattern for legal holds. Ignoring these legs is standard for audit trails.