callStateChanged method
Implementation
@override
void callStateChanged(Call call, PitelCallState pitelCallState) {
_logger.info('callStateChanged ${pitelCallState.state.toString()}');
_logger.info('callLocal ${call.local_identity}');
_logger.info('callRemoter ${call.remote_identity}');
_logger.info('callDirection ${call.direction}');
switch (pitelCallState.state) {
case PitelCallStateEnum.CALL_INITIATION:
switch (call.direction) {
case 'OUTGOING':
for (var element in _sipPitelHelperListener) {
element.onCallInitiated(call.id!);
}
break;
case 'INCOMING':
for (var element in _sipPitelHelperListener) {
if (isBusy) {
_releaseCall(callId: call.id);
} else {
element.onCallReceived(call.id!);
}
}
break;
}
break;
case PitelCallStateEnum.HOLD:
case PitelCallStateEnum.UNHOLD:
hold = pitelCallState.state == PitelCallStateEnum.HOLD;
_holdOriginator = pitelCallState.originator;
break;
case PitelCallStateEnum.STREAM:
_handelStreams(pitelCallState);
for (var element in _sipPitelHelperListener) {
element.callStateChanged(call.id!, pitelCallState);
}
break;
case PitelCallStateEnum.MUTED:
if (pitelCallState.audio) _audioMuted = true;
if (pitelCallState.video) _videoIsOff = true;
for (var element in _sipPitelHelperListener) {
element.callStateChanged(call.id!, pitelCallState);
}
break;
case PitelCallStateEnum.UNMUTED:
if (pitelCallState.audio) _audioMuted = false;
if (pitelCallState.video) _videoIsOff = false;
for (var element in _sipPitelHelperListener) {
element.callStateChanged(call.id!, pitelCallState);
}
break;
default:
for (var element in _sipPitelHelperListener) {
element.callStateChanged(call.id!, pitelCallState);
}
}
}