invite method
Initiate new outgoing call via sending INVITE request (creates new call instance, adds it to list, notifies UI)
Implementation
Future<void> invite(CallDestination dest) async {
_logs?.print(
'Trying to invite ${dest.toExt} from account:${dest.fromAccId}',
);
try {
int callId = await PjsipConnectFlutter().invite(dest) ?? 0;
String accUri = _accountsModel.getUri(dest.fromAccId);
bool hasSecureMedia = _accountsModel.hasSecureMedia(dest.fromAccId);
CallModel newCall = CallModel(
callId,
accUri,
dest.toExt,
false,
hasSecureMedia,
dest.withVideo,
_logs,
);
newCall.displName = dest.displName ?? "";
_callItems.add(newCall);
_cdrs?.add(newCall);
_postResolveContactName(newCall);
_logs?.print('Added new call $callId');
notifyListeners();
} on PlatformException catch (err) {
_logs?.print('Can\'t invite Err: ${err.code} ${err.message}');
return Future.error((err.message == null) ? err.code : err.message!);
}
}