inviteToCall method
Make a P2P call to room
roomId
The room id to call
type
The type of call to be made.
Implementation
Future<CallSession> inviteToCall(String roomId, CallType type) async {
final room = client.getRoomById(roomId);
if (room == null) {
Logs().v('[VOIP] Invalid room id [$roomId].');
return Null as CallSession;
}
final callId = 'cid${DateTime.now().millisecondsSinceEpoch}';
if (currentGroupCID == null) {
incomingCallRoomId[roomId] = callId;
}
final opts = CallOptions()
..callId = callId
..type = type
..dir = CallDirection.kOutgoing
..room = room
..voip = this
..localPartyId = localPartyId!
..iceServers = await getIceSevers();
final newCall = createNewCall(opts);
currentCID = callId;
await newCall.initOutboundCall(type).then((_) {
delegate.handleNewCall(newCall);
});
currentCID = callId;
return newCall;
}