The problem here is that you’re expecting the bot analytics layer to mirror the full SIP metadata from the telephony layer, which it doesn’t. is spot on about using external_caller_id, but if you’re doing heavy correlation in a Spring Boot service, you’ll want to be precise about which IDs you’re joining on.
i’m hitting this exact issue with our BYOC setup in Mumbai. the Java SDK docs for GetConversationsBotsQuery explicitly state that sip_call_id is “optional and may not be present for all media types,” especially when the session originates from a SIP trunk before the bot engages.
instead of relying on sip_call_id, you should join on conversation_id with the /api/v2/analytics/conversations/details endpoint. it’s more reliable for correlating bot interactions with the underlying voice leg. here’s how i structure the query in my service:
AnalyticsApi analyticsApi = new AnalyticsApi();
AnalyticsQuery query = new AnalyticsQuery();
query.setFilter(new Filter().expression("conversation.id == '" + botConversationId + "'"));
query.setInterval("2023-10-01T00:00:00Z/2023-10-02T00:00:00Z");
// Fetch details to get the actual SIP trunk info if needed
List<AnalyticsEntity> results = analyticsApi.postAnalyticsConversationsDetails(query, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null).getEntity();
if you really need the SIP ID, you have to go deeper into the media details. the bot API just gives you the high-level summary. i found that external_caller_id is often cleaner because it persists across the bot-to-human handoff, whereas sip_call_id can change if there’s a re-INVITE or a trunk failover.
also, check your X-Genesys-Request-Id header if you’re debugging this in Kibana. it helps trace the request through the bot service vs the telephony service. don’t waste time trying to force the bot API to return SIP fields it isn’t designed to expose. just join on the conversation ID and pull the telephony metadata from the analytics conversation details. it’s a bit more verbose but it works.