-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcall_event.dart
More file actions
1521 lines (1128 loc) · 42.3 KB
/
call_event.dart
File metadata and controls
1521 lines (1128 loc) · 42.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
part of 'call_bloc.dart';
sealed class CallEvent extends Equatable {
const CallEvent();
@override
List<Object?> get props => [];
}
class CallStarted extends CallEvent {
const CallStarted();
}
class _AppLifecycleStateChanged extends CallEvent {
const _AppLifecycleStateChanged(this.state);
final AppLifecycleState state;
@override
List<Object?> get props => [state];
}
class _ConnectivityResultChanged extends CallEvent {
const _ConnectivityResultChanged(this.result);
final ConnectivityResult result;
@override
List<Object?> get props => [result];
}
class _NavigatorMediaDevicesChange extends CallEvent {
const _NavigatorMediaDevicesChange();
}
class _IceRestartTriggered extends CallEvent {
const _IceRestartTriggered(this.callId);
final String callId;
@override
List<Object?> get props => [callId];
}
// registration event change
class _RegistrationChange extends CallEvent {
const _RegistrationChange({required this.registration});
final Registration registration;
@override
List<Object?> get props => [registration];
}
// handle app state
sealed class _ResetStateEvent extends CallEvent {
const _ResetStateEvent();
const factory _ResetStateEvent.completeCalls() = _ResetStateEventCompleteCalls;
const factory _ResetStateEvent.completeCall(String callId, {CallkeepEndCallReason endReason}) =
_ResetStateEventCompleteCall;
}
class _ResetStateEventCompleteCalls extends _ResetStateEvent {
const _ResetStateEventCompleteCalls();
}
class _ResetStateEventCompleteCall extends _ResetStateEvent {
const _ResetStateEventCompleteCall(this.callId, {this.endReason = CallkeepEndCallReason.remoteEnded});
final String callId;
final CallkeepEndCallReason endReason;
@override
List<Object?> get props => [callId, endReason];
}
// signaling client events
sealed class _SignalingClientEvent extends CallEvent {
const _SignalingClientEvent();
const factory _SignalingClientEvent.connecting() = _SignalingClientEventConnecting;
const factory _SignalingClientEvent.connected() = _SignalingClientEventConnected;
const factory _SignalingClientEvent.failed(Object error) = _SignalingClientEventFailed;
const factory _SignalingClientEvent.disconnecting() = _SignalingClientEventDisconnecting;
const factory _SignalingClientEvent.disconnected(int? code, String? reason) = _SignalingClientEventDisconnected;
}
class _SignalingClientEventConnecting extends _SignalingClientEvent {
const _SignalingClientEventConnecting();
}
class _SignalingClientEventConnected extends _SignalingClientEvent {
const _SignalingClientEventConnected();
}
class _SignalingClientEventFailed extends _SignalingClientEvent {
const _SignalingClientEventFailed(this.error);
final Object error;
@override
List<Object?> get props => [error];
}
class _SignalingClientEventDisconnecting extends _SignalingClientEvent {
const _SignalingClientEventDisconnecting();
}
class _SignalingClientEventDisconnected extends _SignalingClientEvent {
const _SignalingClientEventDisconnected(this.code, this.reason);
final int? code;
final String? reason;
@override
List<Object?> get props => [code, reason];
}
// handshake signaling events
class _HandshakeSignalingEventState extends CallEvent {
const _HandshakeSignalingEventState({required this.registration, required this.linesCount});
final Registration registration;
final int linesCount;
@override
List<Object?> get props => [registration, linesCount];
}
// call signaling events
sealed class _CallSignalingEvent extends CallEvent {
const _CallSignalingEvent();
const factory _CallSignalingEvent.incoming({
required int? line,
required String callId,
required String callee,
required String caller,
String? callerDisplayName,
String? referredBy,
String? replaceCallId,
bool? isFocus,
JsepValue? jsep,
}) = _CallSignalingEventIncoming;
const factory _CallSignalingEvent.ringing({required int? line, required String callId}) = _CallSignalingEventRinging;
const factory _CallSignalingEvent.progress({
required int? line,
required String callId,
required String callee,
JsepValue? jsep,
}) = _CallSignalingEventProgress;
const factory _CallSignalingEvent.accepted({
required int? line,
required String callId,
String? callee,
JsepValue? jsep,
}) = _CallSignalingEventAccepted;
const factory _CallSignalingEvent.hangup({
required int? line,
required String callId,
required int code,
required String reason,
}) = _CallSignalingEventHangup;
const factory _CallSignalingEvent.callUpdating({
required int? line,
required String callId,
required String callee,
required String caller,
String? callerDisplayName,
String? referredBy,
String? replaceCallId,
bool? isFocus,
JsepValue? jsep,
}) = _CallSignalingEventCallUpdating;
const factory _CallSignalingEvent.updating({required int? line, required String callId}) =
_CallSignalingEventUpdating;
const factory _CallSignalingEvent.updated({required int? line, required String callId}) = _CallSignalingEventUpdated;
const factory _CallSignalingEvent.transfer({
required int? line,
required String referId,
required String referTo,
required String? referredBy,
required String? replaceCallId,
}) = _CallSignalingEventTransfer;
const factory _CallSignalingEvent.transferring({required int? line, required String callId}) =
_CallSignalingEventTransferring;
const factory _CallSignalingEvent.notifyRefer({
required int? line,
required String callId,
required String? notify,
required SubscriptionState? subscriptionState,
required ReferNotifyState state,
}) = _CallSignalingEventNotifyRefer;
const factory _CallSignalingEvent.notifyUnknown({
required int? line,
required String callId,
required String? notify,
required SubscriptionState? subscriptionState,
required String? contentType,
required String? content,
}) = _CallSignalingEventNotifyUnknown;
const factory _CallSignalingEvent.registration(RegistrationStatus status, {int? code, String? reason}) =
_CallSignalingEventRegistration;
const factory _CallSignalingEvent.callError({
required int? line,
required String callId,
required int code,
required String reason,
}) = _CallSignalingEventCallError;
}
sealed class _GlobalEvent extends CallEvent {
const _GlobalEvent();
@override
List<Object?> get props => [];
const factory _GlobalEvent.numberPresenceUpdate({
required String number,
required List<SignalingPresenceInfo> presenceInfo,
}) = _GlobalEventNumberPresenceUpdate;
const factory _GlobalEvent.numberDialogsUpdate({
required String number,
required List<SignalingDialogInfo> dialogInfos,
}) = _GlobalEventNumberDialogsUpdate;
}
class _CallSignalingEventIncoming extends _CallSignalingEvent {
const _CallSignalingEventIncoming({
required this.line,
required this.callId,
required this.callee,
required this.caller,
this.callerDisplayName,
this.referredBy,
this.replaceCallId,
this.isFocus,
this.jsep,
});
final int? line;
final String callId;
final String callee;
final String caller;
final String? callerDisplayName;
final String? referredBy;
final String? replaceCallId;
final bool? isFocus;
final JsepValue? jsep;
@override
List<Object?> get props => [
line,
callId,
callee,
caller,
callerDisplayName,
referredBy,
replaceCallId,
isFocus,
jsep,
];
}
class _CallSignalingEventRinging extends _CallSignalingEvent {
const _CallSignalingEventRinging({required this.line, required this.callId});
final int? line;
final String callId;
@override
List<Object?> get props => [line, callId];
}
class _CallSignalingEventProgress extends _CallSignalingEvent {
const _CallSignalingEventProgress({required this.line, required this.callId, required this.callee, this.jsep});
final int? line;
final String callId;
final String callee;
final JsepValue? jsep;
@override
List<Object?> get props => [line, callId, callee, jsep];
}
class _CallSignalingEventAccepted extends _CallSignalingEvent {
const _CallSignalingEventAccepted({required this.line, required this.callId, this.callee, this.jsep});
final int? line;
final String callId;
final String? callee;
final JsepValue? jsep;
@override
List<Object?> get props => [line, callId, callee, jsep];
}
class _CallSignalingEventHangup extends _CallSignalingEvent {
const _CallSignalingEventHangup({required this.line, required this.callId, required this.code, required this.reason});
final int? line;
final String callId;
final int code;
final String reason;
@override
List<Object?> get props => [line, callId, code, reason];
}
class _CallSignalingEventCallUpdating extends _CallSignalingEvent {
const _CallSignalingEventCallUpdating({
required this.line,
required this.callId,
required this.callee,
required this.caller,
this.callerDisplayName,
this.referredBy,
this.replaceCallId,
this.isFocus,
this.jsep,
});
final int? line;
final String callId;
final String callee;
final String caller;
final String? callerDisplayName;
final String? referredBy;
final String? replaceCallId;
final bool? isFocus;
final JsepValue? jsep;
@override
List<Object?> get props => [
line,
callId,
callee,
caller,
callerDisplayName,
referredBy,
replaceCallId,
isFocus,
jsep,
];
}
class _CallSignalingEventUpdating extends _CallSignalingEvent {
const _CallSignalingEventUpdating({required this.line, required this.callId});
final int? line;
final String callId;
@override
List<Object?> get props => [line, callId];
}
class _CallSignalingEventUpdated extends _CallSignalingEvent {
const _CallSignalingEventUpdated({required this.line, required this.callId});
final int? line;
final String callId;
@override
List<Object?> get props => [line, callId];
}
class _CallSignalingEventTransfer extends _CallSignalingEvent {
const _CallSignalingEventTransfer({
required this.line,
required this.referId,
required this.referTo,
required this.referredBy,
required this.replaceCallId,
});
final int? line;
final String referId;
final String referTo;
final String? referredBy;
final String? replaceCallId;
@override
List<Object?> get props => [line, referId, referTo, referredBy, replaceCallId];
}
class _CallSignalingEventTransferring extends _CallSignalingEvent {
const _CallSignalingEventTransferring({required this.line, required this.callId});
final int? line;
final String callId;
@override
List<Object?> get props => [line, callId];
}
class _CallSignalingEventNotifyRefer extends _CallSignalingEvent {
const _CallSignalingEventNotifyRefer({
required this.line,
required this.callId,
required this.notify,
required this.subscriptionState,
required this.state,
});
final int? line;
final String callId;
final String? notify;
final SubscriptionState? subscriptionState;
final ReferNotifyState state;
@override
List<Object?> get props => [line, callId, notify, subscriptionState, state];
}
class _CallSignalingEventNotifyUnknown extends _CallSignalingEvent {
const _CallSignalingEventNotifyUnknown({
required this.line,
required this.callId,
required this.notify,
required this.subscriptionState,
required this.contentType,
required this.content,
});
final int? line;
final String callId;
final String? notify;
final SubscriptionState? subscriptionState;
final String? contentType;
final String? content;
@override
List<Object?> get props => [line, callId, notify, subscriptionState, contentType, content];
}
class _GlobalEventNumberPresenceUpdate extends _GlobalEvent {
const _GlobalEventNumberPresenceUpdate({required this.number, required this.presenceInfo});
final String number;
final List<SignalingPresenceInfo> presenceInfo;
@override
List<Object?> get props => [number, presenceInfo];
}
class _GlobalEventNumberDialogsUpdate extends _GlobalEvent {
const _GlobalEventNumberDialogsUpdate({required this.number, required this.dialogInfos});
final String number;
final List<SignalingDialogInfo> dialogInfos;
@override
List<Object?> get props => [number, dialogInfos];
}
class _CallSignalingEventRegistration extends _CallSignalingEvent {
const _CallSignalingEventRegistration(this.status, {this.code, this.reason});
final RegistrationStatus status;
final int? code;
final String? reason;
@override
List<Object?> get props => [status, code, reason];
}
class _CallSignalingEventCallError extends _CallSignalingEvent {
const _CallSignalingEventCallError({
required this.line,
required this.callId,
required this.code,
required this.reason,
});
final int? line;
final String callId;
final int code;
final String reason;
@override
List<Object?> get props => [line, callId, code, reason];
}
// call push events
class _CallPushEventIncoming extends CallEvent {
const _CallPushEventIncoming({
required this.callId,
required this.handle,
this.displayName,
required this.video,
this.error,
});
final String callId;
final CallkeepHandle handle;
final String? displayName;
final bool video;
final CallkeepIncomingCallError? error;
@override
List<Object?> get props => [callId, handle, displayName, video, error];
}
// call control events
sealed class CallControlEvent extends CallEvent {
const CallControlEvent();
const factory CallControlEvent.started({
int? line,
String? generic,
String? number,
String? email,
String? displayName,
String? replaces,
String? fromNumber,
required bool video,
}) = _CallControlEventStarted;
const factory CallControlEvent.answered(String callId) = _CallControlEventAnswered;
const factory CallControlEvent.ended(String callId) = _CallControlEventEnded;
const factory CallControlEvent.setHeld(String callId, bool onHold) = _CallControlEventSetHeld;
const factory CallControlEvent.setMuted(String callId, bool muted) = _CallControlEventSetMuted;
const factory CallControlEvent.sentDTMF(String callId, String key) = _CallControlEventSentDTMF;
const factory CallControlEvent.cameraSwitched(String callId) = _CallControlEventCameraSwitched;
const factory CallControlEvent.cameraEnabled(String callId, bool enabled) = _CallControlEventCameraEnabled;
const factory CallControlEvent.audioDeviceSet(String callId, CallAudioDevice device) =
_CallControlEventAudioDeviceSet;
const factory CallControlEvent.failureApproved(String callId) = _CallControlEventFailureApproved;
const factory CallControlEvent.blindTransferInitiated(String callId) = _CallControlEventBlindTransferInitiated;
const factory CallControlEvent.attendedTransferInitiated(String callId) = _CallControlEventAttendedTransferInitiated;
const factory CallControlEvent.blindTransferSubmitted({required String number}) =
_CallControlEventBlindTransferSubmitted;
const factory CallControlEvent.attendedTransferSubmitted({
required ActiveCall referorCall,
required ActiveCall replaceCall,
}) = _CallControlEventAttendedTransferSubmitted;
const factory CallControlEvent.attendedRequestDeclined({required String callId, required String referId}) =
_CallControlEventAttendedRequestDeclined;
const factory CallControlEvent.attendedRequestApproved({required String referId, required String referTo}) =
_CallControlEventAttendedRequestApproved;
}
class _CallControlEventStarted extends CallControlEvent with CallControlEventStartedMixin {
const _CallControlEventStarted({
this.line,
this.generic,
this.number,
this.email,
this.displayName,
this.replaces,
this.fromNumber,
required this.video,
});
final int? line;
@override
final String? generic;
@override
final String? number;
@override
final String? email;
final String? displayName;
final String? replaces;
final String? fromNumber;
final bool video;
@override
List<Object?> get props => [line, generic, number, email, displayName, replaces, fromNumber, video];
}
class _CallControlEventAnswered extends CallControlEvent {
const _CallControlEventAnswered(this.callId);
final String callId;
@override
List<Object?> get props => [callId];
}
class _CallControlEventEnded extends CallControlEvent {
const _CallControlEventEnded(this.callId);
final String callId;
@override
List<Object?> get props => [callId];
}
class _CallControlEventSetHeld extends CallControlEvent {
const _CallControlEventSetHeld(this.callId, this.onHold);
final String callId;
final bool onHold;
@override
List<Object?> get props => [callId, onHold];
}
class _CallControlEventSetMuted extends CallControlEvent {
const _CallControlEventSetMuted(this.callId, this.muted);
final String callId;
final bool muted;
@override
List<Object?> get props => [callId, muted];
}
class _CallControlEventSentDTMF extends CallControlEvent {
const _CallControlEventSentDTMF(this.callId, this.key);
final String callId;
final String key;
@override
List<Object?> get props => [callId, key];
}
class _CallControlEventCameraSwitched extends CallControlEvent {
const _CallControlEventCameraSwitched(this.callId);
final String callId;
@override
List<Object?> get props => [callId];
}
class _CallControlEventCameraEnabled extends CallControlEvent {
const _CallControlEventCameraEnabled(this.callId, this.enabled);
final String callId;
final bool enabled;
@override
List<Object?> get props => [callId, enabled];
}
class _CallControlEventAudioDeviceSet extends CallControlEvent {
const _CallControlEventAudioDeviceSet(this.callId, this.device);
final String callId;
final CallAudioDevice device;
@override
List<Object?> get props => [callId, device];
}
class _CallControlEventFailureApproved extends CallControlEvent {
const _CallControlEventFailureApproved(this.callId);
final String callId;
@override
List<Object?> get props => [callId];
}
class _CallControlEventBlindTransferInitiated extends CallControlEvent {
const _CallControlEventBlindTransferInitiated(this.callId);
final String callId;
@override
List<Object?> get props => [callId];
}
class _CallControlEventAttendedTransferInitiated extends CallControlEvent {
const _CallControlEventAttendedTransferInitiated(this.callId);
final String callId;
@override
List<Object?> get props => [callId];
}
class _CallControlEventBlindTransferSubmitted extends CallControlEvent {
const _CallControlEventBlindTransferSubmitted({required this.number});
final String number;
@override
List<Object?> get props => [number];
}
class _CallControlEventAttendedTransferSubmitted extends CallControlEvent {
const _CallControlEventAttendedTransferSubmitted({required this.referorCall, required this.replaceCall});
final ActiveCall referorCall;
final ActiveCall replaceCall;
@override
List<Object?> get props => [referorCall, replaceCall];
}
class _CallControlEventAttendedRequestDeclined extends CallControlEvent {
const _CallControlEventAttendedRequestDeclined({required this.callId, required this.referId});
final String callId;
final String referId;
@override
List<Object?> get props => [callId, referId];
}
class _CallControlEventAttendedRequestApproved extends CallControlEvent {
const _CallControlEventAttendedRequestApproved({required this.referId, required this.referTo});
final String referId;
final String referTo;
@override
List<Object?> get props => [referId, referTo];
}
mixin CallControlEventStartedMixin {
String? get generic;
String? get number;
String? get email;
CallkeepHandle get handle {
if (generic != null) {
return CallkeepHandle.generic(generic!);
} else if (number != null) {
return CallkeepHandle.number(number!);
} else if (email != null) {
return CallkeepHandle.email(email!);
} else {
throw StateError('one of generic, number or email parameters must be assign');
}
}
}
// call perform events
sealed class _CallPerformEvent extends CallEvent {
_CallPerformEvent();
factory _CallPerformEvent.started(
String callId, {
required CallkeepHandle handle,
String? displayName,
required bool video,
}) = _CallPerformEventStarted;
factory _CallPerformEvent.answered(String callId) = _CallPerformEventAnswered;
factory _CallPerformEvent.ended(String callId) = _CallPerformEventEnded;
factory _CallPerformEvent.setHeld(String callId, bool onHold) = _CallPerformEventSetHeld;
factory _CallPerformEvent.setMuted(String callId, bool muted) = _CallPerformEventSetMuted;
factory _CallPerformEvent.sentDTMF(String callId, String key) = _CallPerformEventSentDTMF;
factory _CallPerformEvent.audioDeviceSet(String callId, CallAudioDevice device) = _CallPerformEventAudioDeviceSet;
factory _CallPerformEvent.audioDevicesUpdate(String callId, List<CallAudioDevice> devices) =
_CallPerformEventAudioDevicesUpdate;
final _performCompleter = Completer<bool>();
Future<bool> get future => _performCompleter.future;
void fulfill() => _performCompleter.isCompleted ? null : _performCompleter.complete(true);
void fail() => _performCompleter.isCompleted ? null : _performCompleter.complete(false);
}
class _CallPerformEventStarted extends _CallPerformEvent {
_CallPerformEventStarted(this.callId, {required this.handle, this.displayName, required this.video});
final String callId;
final CallkeepHandle handle;
final String? displayName;
final bool video;
@override
List<Object?> get props => [callId, handle, displayName, video];
}
class _CallPerformEventAnswered extends _CallPerformEvent {
_CallPerformEventAnswered(this.callId);
final String callId;
@override
List<Object?> get props => [callId];
}
class _CallPerformEventEnded extends _CallPerformEvent {
_CallPerformEventEnded(this.callId);
final String callId;
@override
List<Object?> get props => [callId];
}
class _CallPerformEventSetHeld extends _CallPerformEvent {
_CallPerformEventSetHeld(this.callId, this.onHold);
final String callId;
final bool onHold;
@override
List<Object?> get props => [callId, onHold];
}
class _CallPerformEventSetMuted extends _CallPerformEvent {
_CallPerformEventSetMuted(this.callId, this.muted);
final String callId;
final bool muted;
@override
List<Object?> get props => [callId, muted];
}
class _CallPerformEventSentDTMF extends _CallPerformEvent {
_CallPerformEventSentDTMF(this.callId, this.key);
final String callId;
final String key;
@override
List<Object?> get props => [callId, key];
}
class _CallPerformEventAudioDeviceSet extends _CallPerformEvent {
_CallPerformEventAudioDeviceSet(this.callId, this.device);
final String callId;
final CallAudioDevice device;
@override
List<Object?> get props => [callId, device];
}
class _CallPerformEventAudioDevicesUpdate extends _CallPerformEvent {
_CallPerformEventAudioDevicesUpdate(this.callId, this.devices);
final String callId;
final List<CallAudioDevice> devices;
@override
List<Object?> get props => [callId, devices];
}
// peer connection events
sealed class _PeerConnectionEvent extends CallEvent {
const _PeerConnectionEvent();
const factory _PeerConnectionEvent.signalingStateChanged(String callId, RTCSignalingState state) =
_PeerConnectionEventSignalingStateChanged;
const factory _PeerConnectionEvent.connectionStateChanged(String callId, RTCPeerConnectionState state) =
_PeerConnectionEventConnectionStateChanged;
const factory _PeerConnectionEvent.iceGatheringStateChanged(String callId, RTCIceGatheringState state) =
_PeerConnectionEventIceGatheringStateChanged;
const factory _PeerConnectionEvent.iceConnectionStateChanged(String callId, RTCIceConnectionState state) =
_PeerConnectionEventIceConnectionStateChanged;
const factory _PeerConnectionEvent.iceCandidateIdentified(String callId, RTCIceCandidate candidate) =
_PeerConnectionEventIceCandidateIdentified;
const factory _PeerConnectionEvent.streamAdded(String callId, MediaStream stream) = _PeerConnectionEventStreamAdded;
const factory _PeerConnectionEvent.streamRemoved(String callId, MediaStream stream) =
_PeerConnectionEventStreamRemoved;
const factory _PeerConnectionEvent.renegotiationNeeded(String callId, int? lineId) =
_PeerConnectionEventRenegotiationNeeded;
}
class _PeerConnectionEventSignalingStateChanged extends _PeerConnectionEvent {
const _PeerConnectionEventSignalingStateChanged(this.callId, this.state);
final String callId;
final RTCSignalingState state;
@override
List<Object?> get props => [callId, state];
}