sendInviteMsgToCallee method

Future<void> sendInviteMsgToCallee(
  1. String userId,
  2. ChatCallKitCallType type,
  3. String callId,
  4. String channel,
  5. String? inviteMessage,
  6. Map<String, String>? ext,
)

Implementation

Future<void> sendInviteMsgToCallee(
  String userId,
  ChatCallKitCallType type,
  String callId,
  String channel,
  String? inviteMessage,
  Map<String, String>? ext,
) async {
  String sType = 'voice';
  if (type == ChatCallKitCallType.multi) {
    sType = 'conference';
  } else if (type == ChatCallKitCallType.video_1v1) {
    sType = 'video';
  }
  final msg = ChatCallKitMessage.createTxtSendMessage(
    targetId: userId,
    content: inviteMessage ?? 'invite info: $sType',
  );
  Map<String, dynamic> attr = {
    kMsgType: kMsgTypeValue,
    kAction: kInviteAction,
    kCallId: callId,
    kCallType: type.index,
    kCallerDevId: model.curDevId,
    kChannelName: channel,
    kTs: ts
  };
  if (ext != null) {
    attr[kExt] = ext;
  }

  msg.attributes = attr;
  onMessageWillSend?.call(msg);
  ChatCallKitClient.getInstance.chatManager.sendMessage(msg);
  chatLog("sendInviteMsgToCallee", msg);
}