Analytics Reporting API 500 Error During BYOC Failover in Asia/Singapore

My configuration keeps failing as expected when retrieving call detail records during carrier failover events.

We are managing 15 Bring Your Own Carrier (BYOC) trunks across the Asia/Singapore region. The primary carriers handle the majority of the load without significant latency issues. However, when the failover logic triggers and traffic shifts to the secondary carriers, we encounter a persistent HTTP 500 Internal Server Error when querying the /v2/analytics/reporting/query endpoint.

The issue specifically affects reports that include the call_leg dimension with the direction filter set to outbound. The primary trunks function correctly, and the data returns as expected. The problem arises only when the call legs are associated with the secondary BYOC trunks that have recently taken over the traffic load.

The error response body contains the following JSON:

{
 "error_code": "INTERNAL_SERVER_ERROR",
 "message": "An internal server error occurred while processing the report query.",
 "details": "Failed to aggregate metrics for trunk group SG-BYOC-SEC-01."
}

We have verified the SIP registration status of the secondary trunks, and they appear healthy in the Genesys Cloud admin console. The outbound routing rules are correctly configured to prioritize the primary trunks and failover to the secondary ones based on the least_cost strategy.

We are using the Genesys Cloud Python SDK version 145.0.0 to make these API calls. The request payload for the analytics query is as follows:

{
 "query": {
 "timeRange": {
 "relativeTo": "now",
 "from": "P1D"
 },
 "dimensions": [
 "call_leg",
 "trunk"
 ],
 "filters": [
 {
 "dimension": "direction",
 "op": "equals",
 "values": ["outbound"]
 }
 ],
 "metrics": [
 "call_count",
 "talk_time"
 ]
 }
}

Could someone provide insight into why the analytics service fails to aggregate metrics for the secondary BYOC trunks during failover? We have checked the carrier-specific quirks and SIP credentials, but the issue persists. Any guidance on troubleshooting this would be greatly appreciated.