call method

  1. @override
Future<ActionCallback> call(
  1. String userId,
  2. String type,
  3. OfflinePushInfo? offlinePushInfo
)
override

Implementation

@override
Future<ActionCallback> call(
    String userId, String type, OfflinePushInfo? offlinePushInfo) async {
  if (!isOnCalling && !isOnInvitation) {
    // 首次拨打电话,生成id,并进入trtc房间
    mCurRoomID = _generateRoomID();
    mCurCallType = type;
    _enterTRTCRoom();
  }else{
    Fluttertoast.showToast(
      msg: TIM_t("正在通话"),
      toastLength: Toast.LENGTH_SHORT,
      gravity: ToastGravity.BOTTOM,
      timeInSecForIosWeb: 1,
      textColor: Colors.white,
      backgroundColor: Colors.black,
    );
    return ActionCallback(code: -10, desc: TIM_t("正在通话"));
  }
  mCurInvitedList.add(userId);

  V2TimValueCallback res = await timManager.getSignalingManager().invite(
      invitee: userId,
      data: jsonEncode(getCustomMap()),
      timeout: timeOutCount,
      offlinePushInfo: offlinePushInfo,
      onlineUserOnly: false);
  if(res.code == 0){
    mCurCallID = res.data;
    mCurCallList.add({'userId': userId, 'callId': mCurCallID});
    return ActionCallback(code: res.code, desc: res.desc);
  }
  return ActionCallback(code: res.code, desc: res.desc);
}