extractCallIdFromCandidate static method
Extracts call ID from the candidate message parameters. Supports both new server format (callID in params) and legacy format (callId in dialogParams).
params The JSON object containing candidate parameters
Returns the extracted UUID if found, null otherwise
Implementation
static String? extractCallIdFromCandidate(Map<String, dynamic> params) {
String? callId;
// Try to get call ID from multiple possible locations
// 1. Check directly in params for "callID" (new server format)
if (params.containsKey('callID')) {
try {
callId = params['callID'] as String?;
if (callId != null) {
GlobalLogger().i('Found callID directly in params: $callId');
}
} catch (e) {
GlobalLogger().e('Failed to parse callID from params: ${e.toString()}');
}
}
// 2. Fallback to dialogParams for "callId" (legacy format) if not found yet
if (callId == null && params.containsKey('dialogParams')) {
final dialogParams = params['dialogParams'] as Map<String, dynamic>?;
if (dialogParams != null && dialogParams.containsKey('callId')) {
try {
callId = dialogParams['callId'] as String?;
if (callId != null) {
GlobalLogger().i('Found callId in dialogParams: $callId');
}
} catch (e) {
GlobalLogger().e('Failed to parse callId from dialogParams: ${e.toString()}');
}
}
}
return callId;
}