sendAnswerCall method

Future<String?> sendAnswerCall(
  1. Room room,
  2. String callId,
  3. String sdp,
  4. String party_id, {
  5. String type = 'answer',
  6. String version = voipProtoVersion,
  7. String? txid,
  8. CallCapabilities? capabilities,
  9. SDPStreamMetadata? metadata,
})

This event is sent by the callee when they wish to answer the call. callId is a unique identifier for the call. version is the version of the VoIP specification this message adheres to. This specification is version 1. type The type of session description. Must be 'answer'. sdp The SDP text of the session description. party_id The party ID for call, Can be set to client.deviceId.

Implementation

Future<String?> sendAnswerCall(
    Room room, String callId, String sdp, String party_id,
    {String type = 'answer',
    String version = voipProtoVersion,
    String? txid,
    CallCapabilities? capabilities,
    SDPStreamMetadata? metadata}) async {
  txid ??= 'txid${DateTime.now().millisecondsSinceEpoch}';
  final content = {
    'call_id': callId,
    'party_id': party_id,
    if (groupCallId != null) 'conf_id': groupCallId,
    'version': version,
    'answer': {'sdp': sdp, 'type': type},
    if (capabilities != null) 'capabilities': capabilities.toJson(),
    if (metadata != null) sdpStreamMetadataKey: metadata.toJson(),
  };
  return await _sendContent(
    room,
    EventTypes.CallAnswer,
    content,
    txid: txid,
  );
}