onCallNegotiate method
Implementation
Future<void> onCallNegotiate(Room room, Map<String, dynamic> content) async {
final String callId = content['call_id'];
Logs().d('Negotiate received for call ID $callId');
final call = calls[VoipId(roomId: room.id, callId: callId)];
if (call != null) {
// ideally you also check the lifetime here and discard negotiation events
// if age of the event was older than the lifetime but as to device events
// do not have a unsigned age nor a origin_server_ts there's no easy way to
// override this one function atm
final description = content['description'];
try {
SDPStreamMetadata? metadata;
if (content[sdpStreamMetadataKey] != null) {
metadata = SDPStreamMetadata.fromJson(content[sdpStreamMetadataKey]);
}
await call.onNegotiateReceived(metadata,
RTCSessionDescription(description['sdp'], description['type']));
} catch (e, s) {
Logs().e('[VOIP] Failed to complete negotiation', e, s);
}
}
}