Open dmagic99 opened 1 month ago
This is my working code. Assume you have extension for Conference inside your asterisk:
@override
void callStateChanged(Call call, CallState callState) {
callProvider.addCurrentCall(call);
callProvider.updateCurrentCall(call);
if (callState.state == CallStateEnum.CALL_INITIATION) {
if (call.remote_identity!.contains("Conference")) {
callProvider.addConferenceCall(call);
// Refer each held call to the conference call
for (var heldCall in callProvider.heldCalls) {
heldCall.refer(call.remote_identity!);
}
callProvider.clearHeldCalls();
callProvider.lastActiveCall!.refer(call.remote_identity!);
}
_navigationService.navigateTo(Routes.call, {"call": call});
}
if (callState.state == CallStateEnum.ENDED) {
callProvider.removeCurrentCall(call);
}
}
Could you please clarify what callProvider is? Is it part of this library? Could you explain it briefly
Could you please clarify what callProvider is? Is it part of this library? Could you explain it briefly
callProvider is just like it name imply. It's a provider for holding data and sharing it between components. Here is an example code:
class CallProvider with ChangeNotifier {
List<Call> heldCalls = [];
List<Call> currentCalls = [];
Set<String> heldCallIds = {};
Set<String> currentCallIds = {};
String lastDialedNumber = '';
Call? lastActiveCall;
Call? activeConferenceCall;
}
So first of all you need a media server to mix audio. For example Asterisk. And then you first make a call to Asterisk then refer all related call to that specific call