beforeCallback method
dynamic
beforeCallback(
- int type,
- Map<String, dynamic> callinfo
)
Implementation
beforeCallback(int type, Map<String, dynamic> callinfo) async {
switch (type) {
case V2SignalingActionType.SIGNALING_ACTION_TYPE_ACCEPT_INVITE:
List<String> inviteeList = List<String>.from(callinfo["inviteeList"]);
if (inviteeList.isNotEmpty) {
List<String> currentInviteeList =
List<String>.from(currentInvite["inviteeList"]);
for (var element in inviteeList) {
currentInviteeList.remove(element);
}
currentInvite["inviteeList"] = currentInviteeList;
if (currentInviteeList.isEmpty) {
currentInvite = {};
}
}
break;
case V2SignalingActionType.SIGNALING_ACTION_TYPE_CANCEL_INVITE:
String inviteID = callinfo["callinfo"] ?? "";
if (inviteID.isNotEmpty) {
currentInvite = {};
}
break;
case V2SignalingActionType.SIGNALING_ACTION_TYPE_INVITE:
// handle on invited and timeout
currentInvite = callinfo;
_onCallbackTimeout(callinfo);
break;
case V2SignalingActionType.SIGNALING_ACTION_TYPE_INVITE_TIMEOUT:
List<String> inviteeList = List<String>.from(callinfo["inviteeList"]);
if (inviteeList.isNotEmpty) {
List<String> currentInviteeList =
List<String>.from(currentInvite["inviteeList"]);
for (var element in inviteeList) {
currentInviteeList.remove(element);
}
currentInvite["inviteeList"] = currentInviteeList;
if (currentInviteeList.isEmpty) {
currentInvite = {};
}
}
break;
case V2SignalingActionType.SIGNALING_ACTION_TYPE_REJECT_INVITE:
List<String> inviteeList = List<String>.from(callinfo["inviteeList"]);
if (inviteeList.isNotEmpty) {
List<String> currentInviteeList =
List<String>.from(currentInvite["inviteeList"]);
for (var element in inviteeList) {
currentInviteeList.remove(element);
}
currentInvite["inviteeList"] = currentInviteeList;
if (currentInviteeList.isEmpty) {
currentInvite = {};
}
}
break;
}
}