dial static method
Implementation
static Future<Call?> dial({
required String receiverId,
required String? receiverName,
String? callerId,
String? callerName,
String? callerPic,
String? receiverPic,
bool? isvideocall = true,
Map? data,
}) async {
bool isgranted = await CallHelper.permissions();
if (isgranted == true) {
Call? call;
int timestamp = DateTime.now().millisecondsSinceEpoch;
String channelName = '$loggedUsername-$timestamp';
AgoraToken? agoraToken = await AgoraRepo().generateToken(channelName);
if (agoraToken == null) {
// AppUtils.showTopMessage(title: 'Token empty');
return call;
}
call = Call(
timeepoch: timestamp,
callerId: callerId ?? loggedUsername,
callerName: callerName ?? '${appPrefs.loginUser!.displayName}',
callerPic: callerPic ?? appPrefs.loginUser!.thumbnail,
receiverId: receiverId,
receiverName: receiverName,
receiverPic: receiverPic,
channelId: channelName,
channelToken: agoraToken.token,
agoraAppId: agoraToken.appId,
isvideocall: isvideocall,
data: data,
);
await _makeCall(call: call);
updateCallState(channelName,
infoCall: call.toJson(),
status: kCallStateCALLING,
pickedAt: 0,
endAt: 0);
call.hasDialled = true;
return call;
} else {
//showTopMessage(title: 'Access to camera, microphone denied');
}
}