-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathBcSessions.h
1310 lines (1151 loc) · 45.2 KB
/
BcSessions.h
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
//==============================================================================
//
// BcSessions.h
//
// Copyright (C) 2013-2025 Greg Utas
//
// This file is part of the Robust Services Core (RSC).
//
// RSC is free software: you can redistribute it and/or modify it under the
// terms of the Lesser GNU General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.
//
// RSC is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the Lesser GNU General Public License
// along with RSC. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef BCSESSIONS_H_INCLUDED
#define BCSESSIONS_H_INCLUDED
#include "Event.h"
#include "EventHandler.h"
#include "MediaSsm.h"
#include "Service.h"
#include "SsmFactory.h"
#include "State.h"
#include "Trigger.h"
#include <iosfwd>
#include <string>
#include "BcAddress.h"
#include "BcCause.h"
#include "BcProgress.h"
#include "BcRouting.h"
#include "NbTypes.h"
#include "SbTypes.h"
#include "SysTypes.h"
namespace MediaBase
{
class MediaPsm;
}
namespace CallBase
{
class CipMessage;
class CipPsm;
}
using namespace MediaBase;
using namespace NodeBase;
using namespace SessionBase;
//------------------------------------------------------------------------------
namespace CallBase
{
// Basic call service.
//
// Each concrete basic call subclass must define a singleton instance.
//
class BcService : public Service
{
protected:
// Protected because this class is virtual. By default, basic calls
// support modifier services. The constructor registers event names
// and event handlers that are inherited by all subclasses.
//
explicit BcService(Id sid, bool modifiable = true);
// Protected because subclasses should be singletons.
//
virtual ~BcService();
};
//------------------------------------------------------------------------------
//
// Basic call states.
//
// State identifiers are defined within a pure virtual class that serves as
// a base class for all basic call states. This allows state identifiers
// to appear as, for example, BcState::AuthorizingOrigination.
//
// Basic call modifiers require a uniform call model across all basic call
// subclasses, so subclasses should not define additional states.
//
// Each state indicates the call model to which it applies (OBC=originating,
// TBC=terminating, XBC=both). It also provides a two-letter abbreviation
// for use in class or file names.
//
class BcState : public State
{
public:
static const Id FirstId = ServiceSM::Null;
static const Id Null = FirstId + 0; // XBC NU
static const Id AuthorizingOrigination = FirstId + 1; // OBC AO
static const Id CollectingInformation = FirstId + 2; // OBC CI
static const Id AnalyzingInformation = FirstId + 3; // OBC AI
static const Id SelectingRoute = FirstId + 4; // OBC SR
static const Id AuthorizingCallSetup = FirstId + 5; // OBC AS
static const Id SendingCall = FirstId + 6; // OBC SC
static const Id OrigAlerting = FirstId + 7; // OBC OA
static const Id AuthorizingTermination = FirstId + 8; // TBC AT
static const Id SelectingFacility = FirstId + 9; // TBC SF
static const Id PresentingCall = FirstId + 10; // TBC PC
static const Id TermAlerting = FirstId + 11; // TBC TA
static const Id Active = FirstId + 12; // XBC AC
static const Id LocalSuspending = FirstId + 13; // XBC LS
static const Id RemoteSuspending = FirstId + 14; // XBC RS
static const Id Disconnecting = FirstId + 15; // XBC DI
static const Id Exception = FirstId + 16; // XBC EX
static const Id MaxBcId = FirstId + 16;
protected:
// Protected because this class is virtual.
//
BcState(ServiceId sid, Id stid);
// Protected because subclasses should be singletons.
//
virtual ~BcState();
};
// Each concrete basic call subclass must define a singleton instance of
// each state. The constructor for each class registers the event handler
// identifier that is appropriate for each event identifier.
//
class BcNull : public BcState
{
protected:
explicit BcNull(ServiceId sid);
virtual ~BcNull() = default;
};
class BcAuthorizingOrigination : public BcState
{
protected:
explicit BcAuthorizingOrigination(ServiceId sid);
virtual ~BcAuthorizingOrigination() = default;
};
class BcCollectingInformation : public BcState
{
protected:
explicit BcCollectingInformation(ServiceId sid);
virtual ~BcCollectingInformation() = default;
};
class BcAnalyzingInformation : public BcState
{
protected:
explicit BcAnalyzingInformation(ServiceId sid);
virtual ~BcAnalyzingInformation() = default;
};
class BcSelectingRoute : public BcState
{
protected:
explicit BcSelectingRoute(ServiceId sid);
virtual ~BcSelectingRoute() = default;
};
class BcAuthorizingCallSetup : public BcState
{
protected:
explicit BcAuthorizingCallSetup(ServiceId sid);
virtual ~BcAuthorizingCallSetup() = default;
};
class BcSendingCall : public BcState
{
protected:
explicit BcSendingCall(ServiceId sid);
virtual ~BcSendingCall() = default;
};
class BcOrigAlerting : public BcState
{
protected:
explicit BcOrigAlerting(ServiceId sid);
virtual ~BcOrigAlerting() = default;
};
class BcAuthorizingTermination : public BcState
{
protected:
explicit BcAuthorizingTermination(ServiceId sid);
virtual ~BcAuthorizingTermination() = default;
};
class BcSelectingFacility : public BcState
{
protected:
explicit BcSelectingFacility(ServiceId sid);
virtual ~BcSelectingFacility() = default;
};
class BcPresentingCall : public BcState
{
protected:
explicit BcPresentingCall(ServiceId sid);
virtual ~BcPresentingCall() = default;
};
class BcTermAlerting : public BcState
{
protected:
explicit BcTermAlerting(ServiceId sid);
virtual ~BcTermAlerting() = default;
};
class BcActive : public BcState
{
protected:
explicit BcActive(ServiceId sid);
virtual ~BcActive() = default;
};
class BcLocalSuspending : public BcState
{
protected:
explicit BcLocalSuspending(ServiceId sid);
virtual ~BcLocalSuspending() = default;
};
class BcRemoteSuspending : public BcState
{
protected:
explicit BcRemoteSuspending(ServiceId sid);
virtual ~BcRemoteSuspending() = default;
};
class BcDisconnecting : public BcState
{
protected:
explicit BcDisconnecting(ServiceId sid);
virtual ~BcDisconnecting() = default;
};
class BcException : public BcState
{
protected:
explicit BcException(ServiceId sid);
virtual ~BcException() = default;
};
//------------------------------------------------------------------------------
//
// Basic call events.
//
// Event identifiers are defined within a pure virtual class that serves as
// a base class for all basic call events. This allows event identifiers to
// appear as, for example, BcEvent::AuthorizeOrigination.
//
// Each event specifies the call model to which it applies.
// Identifiers defined by subclasses must start at BcEvent::NextId.
//b Identifiers not used in the POTS implementation are commented out.
//
class BcEvent : public Event
{
public:
static const Id FirstId = Event::NextId;
static const Id Originate = FirstId + 0; // OBC
static const Id AuthorizeOrigination = FirstId + 1; // OBC
static const Id OriginationDenied = FirstId + 2; // OBC
static const Id CollectInformation = FirstId + 3; // OBC
static const Id CollectionTimeout = FirstId + 4; // OBC
static const Id LocalInformation = FirstId + 5; // OBC
static const Id AnalyzeInformation = FirstId + 6; // OBC
static const Id InvalidInformation = FirstId + 7; // OBC
static const Id SelectRoute = FirstId + 8; // OBC
// static const Id ReanalyzeInformation = FirstId + 9; // OBC
// static const Id NetworkBusy = FirstId + 10; // OBC
static const Id AuthorizeCallSetup = FirstId + 11; // OBC
// static const Id AuthorizationDenied = FirstId + 12; // OBC
static const Id SendCall = FirstId + 13; // OBC
// static const Id RouteBusy = FirstId + 14; // OBC
static const Id RemoteProgress = FirstId + 15; // OBC
static const Id RemoteBusy = FirstId + 16; // OBC
static const Id RemoteAlerting = FirstId + 17; // OBC
static const Id RemoteNoAnswer = FirstId + 18; // OBC
static const Id RemoteAnswer = FirstId + 19; // OBC
static const Id Terminate = FirstId + 20; // TBC
static const Id AuthorizeTermination = FirstId + 21; // TBC
static const Id TerminationDenied = FirstId + 22; // TBC
static const Id SelectFacility = FirstId + 23; // TBC
// static const Id FacilitySelected = FirstId + 24; // TBC
static const Id LocalBusy = FirstId + 25; // TBC
static const Id PresentCall = FirstId + 26; // TBC
// static const Id RemoteInformation = FirstId + 27; // TBC
static const Id FacilityFailure = FirstId + 28; // TBC
static const Id LocalProgress = FirstId + 29; // TBC
static const Id LocalAlerting = FirstId + 30; // TBC
static const Id LocalNoAnswer = FirstId + 31; // TBC
static const Id LocalAnswer = FirstId + 32; // TBC
// static const Id LocalInfoRequest = FirstId + 33; // XBC
// static const Id LocalInfoReport = FirstId + 34; // XBC
// static const Id RemoteInfoRequest = FirstId + 35; // XBC
// static const Id RemoteInfoReport = FirstId + 36; // XBC
static const Id LocalSuspend = FirstId + 37; // XBC
static const Id LocalResume = FirstId + 38; // XBC
static const Id RemoteSuspend = FirstId + 39; // XBC
static const Id RemoteResume = FirstId + 40; // XBC
// static const Id RemoteService = FirstId + 41; // XBC
// static const Id LocalDisconnect = FirstId + 42; // XBC
static const Id LocalRelease = FirstId + 43; // XBC
static const Id RemoteRelease = FirstId + 44; // XBC
// static const Id DisconnectTimeout = FirstId + 45; // XBC
static const Id ReleaseCall = FirstId + 46; // XBC
static const Id ApplyTreatment = FirstId + 47; // XBC
static const Id NextId = FirstId + 50;
// Virtual to allow subclassing.
//
virtual ~BcEvent();
protected:
// Protected because this class is virtual.
//
BcEvent(Id eid, ServiceSM& owner);
};
// BcProgressEvent is a common base class for all events associated with
// call progress. It contains a progress indicator.
//
class BcProgressEvent : public BcEvent
{
public:
virtual ~BcProgressEvent();
Progress::Ind GetProgress() const { return progress_; }
void Display(std::ostream& stream,
const std::string& prefix, const Flags& options) const override;
protected:
BcProgressEvent(Id eid, ServiceSM& owner, Progress::Ind progress);
private:
Progress::Ind progress_;
};
// BcReleaseEvent is a common base class for all events associated with
// call takedown. It provides the reason why the call is being released.
//
class BcReleaseEvent : public BcEvent
{
public:
virtual ~BcReleaseEvent();
Cause::Ind GetCause() const { return cause_; }
void Display(std::ostream& stream,
const std::string& prefix, const Flags& options) const override;
protected:
BcReleaseEvent(Id eid, ServiceSM& owner, Cause::Ind cause);
private:
Cause::Ind cause_;
};
// The remaining events are concrete and would rarely be subclassed.
//b Events not used in the POTS implementation are commented out.
class BcOriginateEvent : public BcEvent
{
public:
explicit BcOriginateEvent(ServiceSM& owner);
virtual ~BcOriginateEvent();
};
class BcAuthorizeOriginationEvent : public BcEvent
{
public:
explicit BcAuthorizeOriginationEvent(ServiceSM& owner);
virtual ~BcAuthorizeOriginationEvent();
};
class BcOriginationDeniedEvent : public BcReleaseEvent
{
public:
BcOriginationDeniedEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcOriginationDeniedEvent();
};
class BcCollectInformationEvent : public BcEvent
{
public:
explicit BcCollectInformationEvent(ServiceSM& owner);
virtual ~BcCollectInformationEvent();
};
class BcCollectionTimeoutEvent : public BcReleaseEvent
{
public:
BcCollectionTimeoutEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcCollectionTimeoutEvent();
};
class BcLocalInformationEvent : public BcEvent
{
public:
explicit BcLocalInformationEvent(ServiceSM& owner);
virtual ~BcLocalInformationEvent();
};
class BcAnalyzeInformationEvent : public BcEvent
{
public:
explicit BcAnalyzeInformationEvent(ServiceSM& owner);
virtual ~BcAnalyzeInformationEvent();
};
class BcInvalidInformationEvent : public BcReleaseEvent
{
public:
BcInvalidInformationEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcInvalidInformationEvent();
};
class BcSelectRouteEvent : public BcEvent
{
public:
explicit BcSelectRouteEvent(ServiceSM& owner);
virtual ~BcSelectRouteEvent();
};
// class BcReanalyzeInformationEvent : public BcEvent
// {
// public:
// explicit BcReanalyzeInformationEvent(ServiceSM& owner);
// virtual ~BcReanalyzeInformationEvent();
// };
// class BcNetworkBusyEvent : public BcReleaseEvent
// {
// public:
// BcNetworkBusyEvent(ServiceSM& owner, Cause::Ind cause);
// virtual ~BcNetworkBusyEvent();
// };
class BcAuthorizeCallSetupEvent : public BcEvent
{
public:
explicit BcAuthorizeCallSetupEvent(ServiceSM& owner);
virtual ~BcAuthorizeCallSetupEvent();
};
// class BcAuthorizationDeniedEvent : public BcReleaseEvent
// {
// public:
// BcAuthorizationDeniedEvent(ServiceSM& owner, Cause::Ind cause);
// virtual ~BcAuthorizationDeniedEvent();
// };
class BcSendCallEvent : public BcEvent
{
public:
explicit BcSendCallEvent(ServiceSM& owner);
virtual ~BcSendCallEvent();
};
// class BcRouteBusyEvent : public BcReleaseEvent
// {
// public:
// BcRouteBusyEvent(ServiceSM& owner, Cause::Ind cause);
// virtual ~BcRouteBusyEvent();
// };
class BcRemoteBusyEvent : public BcReleaseEvent
{
public:
BcRemoteBusyEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcRemoteBusyEvent();
};
class BcRemoteAlertingEvent : public BcEvent
{
public:
explicit BcRemoteAlertingEvent(ServiceSM& owner);
virtual ~BcRemoteAlertingEvent();
};
class BcRemoteNoAnswerEvent : public BcReleaseEvent
{
public:
BcRemoteNoAnswerEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcRemoteNoAnswerEvent();
};
class BcRemoteProgressEvent : public BcProgressEvent
{
public:
BcRemoteProgressEvent(ServiceSM& owner, Progress::Ind progress);
virtual ~BcRemoteProgressEvent();
};
class BcRemoteAnswerEvent : public BcEvent
{
public:
explicit BcRemoteAnswerEvent(ServiceSM& owner);
virtual ~BcRemoteAnswerEvent();
};
class BcTerminateEvent : public BcEvent
{
public:
explicit BcTerminateEvent(ServiceSM& owner);
virtual ~BcTerminateEvent();
};
class BcAuthorizeTerminationEvent : public BcEvent
{
public:
explicit BcAuthorizeTerminationEvent(ServiceSM& owner);
virtual ~BcAuthorizeTerminationEvent();
};
class BcTerminationDeniedEvent : public BcReleaseEvent
{
public:
BcTerminationDeniedEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcTerminationDeniedEvent();
};
class BcSelectFacilityEvent : public BcEvent
{
public:
explicit BcSelectFacilityEvent(ServiceSM& owner);
virtual ~BcSelectFacilityEvent();
};
// class BcFacilitySelectedEvent : public BcEvent
// {
// public:
// BcFacilitySelectedEvent(ServiceSM& owner);
// virtual ~BcFacilitySelectedEvent();
// };
class BcLocalBusyEvent : public BcReleaseEvent
{
public:
BcLocalBusyEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcLocalBusyEvent();
};
class BcPresentCallEvent : public BcEvent
{
public:
explicit BcPresentCallEvent(ServiceSM& owner);
virtual ~BcPresentCallEvent();
};
// class BcRemoteInformationEvent : public BcEvent
// {
// public:
// BcRemoteInformationEvent(ServiceSM& owner);
// virtual ~BcRemoteInformationEvent();
// };
class BcFacilityFailureEvent : public BcReleaseEvent
{
public:
BcFacilityFailureEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcFacilityFailureEvent();
};
class BcLocalProgressEvent : public BcProgressEvent
{
public:
BcLocalProgressEvent(ServiceSM& owner, Progress::Ind progress);
virtual ~BcLocalProgressEvent();
};
class BcLocalAlertingEvent : public BcEvent
{
public:
explicit BcLocalAlertingEvent(ServiceSM& owner);
virtual ~BcLocalAlertingEvent();
};
class BcLocalNoAnswerEvent : public BcReleaseEvent
{
public:
BcLocalNoAnswerEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcLocalNoAnswerEvent();
};
class BcLocalAnswerEvent : public BcEvent
{
public:
explicit BcLocalAnswerEvent(ServiceSM& owner);
virtual ~BcLocalAnswerEvent();
};
// class BcLocalInfoRequestEvent : public BcEvent
// {
// public:
// BcLocalInfoRequestEvent(ServiceSM& owner);
// virtual ~BcLocalInfoRequestEvent();
// };
// class BcLocalInfoReportEvent : public BcEvent
// {
// public:
// explicit BcLocalInfoReportEvent(ServiceSM& owner);
// virtual ~BcLocalInfoReportEvent();
// };
// class BcRemoteInfoRequestEvent : public BcEvent
// {
// public:
// explicit BcRemoteInfoRequestEvent(ServiceSM& owner);
// virtual ~BcRemoteInfoRequestEvent();
// };
// class BcRemoteInfoReportEvent : public BcEvent
// {
// public:
// explicit BcRemoteInfoReportEvent(ServiceSM& owner);
// virtual ~BcRemoteInfoReportEvent();
// };
class BcLocalSuspendEvent : public BcEvent
{
public:
explicit BcLocalSuspendEvent(ServiceSM& owner);
virtual ~BcLocalSuspendEvent();
};
class BcLocalResumeEvent : public BcEvent
{
public:
explicit BcLocalResumeEvent(ServiceSM& owner);
virtual ~BcLocalResumeEvent();
};
class BcRemoteSuspendEvent : public BcEvent
{
public:
explicit BcRemoteSuspendEvent(ServiceSM& owner);
virtual ~BcRemoteSuspendEvent();
};
class BcRemoteResumeEvent : public BcEvent
{
public:
explicit BcRemoteResumeEvent(ServiceSM& owner);
virtual ~BcRemoteResumeEvent();
};
// class BcRemoteServiceEvent : public BcEvent
// {
// public:
// explicit BcRemoteServiceEvent(ServiceSM& owner);
// virtual ~BcRemoteServiceEvent();
// };
// class BcLocalDisconnectEvent : public BcReleaseEvent
// {
// public:
// BcLocalDisconnectEvent(ServiceSM& owner, Cause::Ind cause);
// virtual ~BcLocalDisconnectEvent();
// };
class BcLocalReleaseEvent : public BcReleaseEvent
{
public:
BcLocalReleaseEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcLocalReleaseEvent();
};
class BcRemoteReleaseEvent : public BcReleaseEvent
{
public:
BcRemoteReleaseEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcRemoteReleaseEvent();
};
// class BcDisconnectTimeoutEvent : public BcReleaseEvent
// {
// public:
// BcDisconnectTimeoutEvent(ServiceSM& owner, Cause::Ind cause);
// virtual ~BcDisconnectTimeoutEvent();
// };
class BcReleaseCallEvent : public BcReleaseEvent
{
public:
BcReleaseCallEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcReleaseCallEvent();
};
class BcApplyTreatmentEvent : public BcReleaseEvent
{
public:
BcApplyTreatmentEvent(ServiceSM& owner, Cause::Ind cause);
virtual ~BcApplyTreatmentEvent();
};
//------------------------------------------------------------------------------
//
// Basic call event handlers.
//
// These are the standard state-event combinations for the basic call model.
// The names are formed by "state abbreviation + event name".
//
// If a subclass reuses or subclasses a basic call state (defined above),
// these event handler identifiers are automatically registered against
// the appropriate event identifiers when the subclass registers its state.
//
// Each identifier specifies the call model to which it applies.
// Identifiers defined by subclasses must start at BcEventHandler::NextId.
//b Identifiers not used in the POTS implementation are commented out.
//
class BcEventHandler : public EventHandler
{
public:
static const Id FirstNu = EventHandler::NextId;
static const Id NuAnalyzeLocalMessage = FirstNu + 0; // OBC
static const Id NuAnalyzeRemoteMessage = FirstNu + 1; // TBC
static const Id NuOriginate = FirstNu + 2; // OBC
static const Id NuTerminate = FirstNu + 3; // TBC
static const Id NuReleaseCall = FirstNu + 4; // XBC
static const Id FirstAo = FirstNu + 5;
static const Id AoAnalyzeLocalMessage = FirstAo + 0; // OBC
static const Id AoAuthorizeOrigination = FirstAo + 1; // OBC
static const Id AoOriginationDenied = FirstAo + 2; // OBC
// static const Id AoLocalDisconnect = FirstAo + 3; // OBC
static const Id AoLocalRelease = FirstAo + 4; // OBC
static const Id AoReleaseCall = FirstAo + 5; // OBC
static const Id FirstCi = FirstAo + 6;
static const Id CiAnalyzeLocalMessage = FirstCi + 0; // OBC
static const Id CiCollectInformation = FirstCi + 1; // OBC
static const Id CiCollectionTimeout = FirstCi + 2; // OBC
static const Id CiLocalInformation = FirstCi + 3; // OBC
// static const Id CiLocalDisconnect = FirstCi + 4; // OBC
static const Id CiLocalRelease = FirstCi + 5; // OBC
static const Id CiReleaseCall = FirstCi + 6; // OBC
static const Id FirstAi = FirstCi + 7;
static const Id AiAnalyzeLocalMessage = FirstAi + 0; // OBC
static const Id AiAnalyzeInformation = FirstAi + 1; // OBC
static const Id AiInvalidInformation = FirstAi + 2; // OBC
// static const Id AiReanalyzeInformation = FirstAi + 3; // OBC
// static const Id AiLocalDisconnect = FirstAi + 4; // OBC
static const Id AiLocalRelease = FirstAi + 5; // OBC
static const Id AiReleaseCall = FirstAi + 6; // OBC
static const Id FirstSr = FirstAi + 7;
static const Id SrAnalyzeLocalMessage = FirstSr + 0; // OBC
static const Id SrSelectRoute = FirstSr + 1; // OBC
// static const Id SrReanalyzeInformation = FirstSr + 2; // OBC
// static const Id SrNetworkBusy = FirstSr + 3; // OBC
// static const Id SrLocalDisconnect = FirstSr + 4; // OBC
static const Id SrLocalRelease = FirstSr + 5; // OBC
static const Id SrReleaseCall = FirstSr + 6; // OBC
static const Id FirstAs = FirstSr + 7;
static const Id AsAnalyzeLocalMessage = FirstAs + 0; // OBC
static const Id AsAuthorizeCallSetup = FirstAs + 1; // OBC
// static const Id AsAuthorizationDenied = FirstAs + 2; // OBC
// static const Id AsLocalDisconnect = FirstAs + 3; // OBC
static const Id AsLocalRelease = FirstAs + 4; // OBC
static const Id AsReleaseCall = FirstAs + 5; // OBC
static const Id FirstSc = FirstAs + 6;
static const Id ScAnalyzeLocalMessage = FirstSc + 0; // OBC
static const Id ScAnalyzeRemoteMessage = FirstSc + 1; // OBC
static const Id ScSendCall = FirstSc + 2; // OBC
// static const Id ScRouteBusy = FirstSc + 3; // OBC
// static const Id ScLocalInformation = FirstSc + 4; // OBC
static const Id ScRemoteProgress = FirstSc + 5; // OBC
static const Id ScRemoteAlerting = FirstSc + 6; // OBC
static const Id ScRemoteAnswer = FirstSc + 7; // OBC
static const Id ScRemoteBusy = FirstSc + 8; // OBC
// static const Id ScRemoteNoAnswer = FirstSc + 9; // OBC
static const Id ScRemoteRelease = FirstSc + 10; // OBC
// static const Id ScLocalDisconnect = FirstSc + 11; // OBC
static const Id ScLocalRelease = FirstSc + 12; // OBC
static const Id ScReleaseCall = FirstSc + 13; // OBC
static const Id FirstOa = FirstSc + 14;
static const Id OaAnalyzeLocalMessage = FirstOa + 0; // OBC
static const Id OaAnalyzeRemoteMessage = FirstOa + 1; // OBC
static const Id OaRemoteAnswer = FirstOa + 2; // OBC
static const Id OaRemoteNoAnswer = FirstOa + 3; // OBC
static const Id OaRemoteRelease = FirstOa + 4; // OBC
// static const Id OaLocalDisconnect = FirstOa + 5; // OBC
static const Id OaLocalRelease = FirstOa + 6; // OBC
static const Id OaReleaseCall = FirstOa + 7; // OBC
static const Id FirstAt = FirstOa + 8;
static const Id AtAnalyzeRemoteMessage = FirstAt + 0; // TBC
static const Id AtAuthorizeTermination = FirstAt + 1; // TBC
static const Id AtTerminationDenied = FirstAt + 2; // TBC
// static const Id AtRemoteInformation = FirstAt + 3; // TBC
static const Id AtRemoteRelease = FirstAt + 4; // TBC
static const Id AtReleaseCall = FirstAt + 5; // TBC
static const Id FirstSf = FirstAt + 6;
static const Id SfAnalyzeLocalMessage = FirstSf + 0; // TBC
static const Id SfAnalyzeRemoteMessage = FirstSf + 1; // TBC
static const Id SfSelectFacility = FirstSf + 2; // TBC
// static const Id SfFacilityFailure = FirstSf + 3; // TBC
static const Id SfLocalBusy = FirstSf + 4; // TBC
// static const Id SfRemoteInformation = FirstSf + 5; // TBC
static const Id SfRemoteRelease = FirstSf + 6; // TBC
static const Id SfReleaseCall = FirstSf + 7; // TBC
static const Id FirstPc = FirstSf + 8;
static const Id PcAnalyzeLocalMessage = FirstPc + 0; // TBC
static const Id PcAnalyzeRemoteMessage = FirstPc + 1; // TBC
static const Id PcPresentCall = FirstPc + 2; // TBC
static const Id PcFacilityFailure = FirstPc + 3; // TBC
static const Id PcLocalProgress = FirstPc + 4; // TBC
static const Id PcLocalAlerting = FirstPc + 5; // TBC
static const Id PcLocalAnswer = FirstPc + 6; // TBC
// static const Id PcLocalNoAnswer = FirstPc + 7; // TBC
static const Id PcLocalRelease = FirstPc + 8; // TBC
// static const Id PcRemoteInformation = FirstPc + 9; // TBC
static const Id PcRemoteRelease = FirstPc + 10; // TBC
static const Id PcReleaseCall = FirstPc + 11; // TBC
static const Id FirstTa = FirstPc + 12;
static const Id TaAnalyzeLocalMessage = FirstTa + 0; // TBC
static const Id TaAnalyzeRemoteMessage = FirstTa + 1; // TBC
static const Id TaLocalAnswer = FirstTa + 2; // TBC
static const Id TaLocalNoAnswer = FirstTa + 3; // TBC
static const Id TaLocalRelease = FirstTa + 4; // TBC
static const Id TaRemoteRelease = FirstTa + 5; // TBC
static const Id TaReleaseCall = FirstTa + 6; // TBC
static const Id FirstAc = FirstTa + 7;
static const Id AcAnalyzeLocalMessage = FirstAc + 0; // XBC
static const Id AcAnalyzeRemoteMessage = FirstAc + 1; // XBC
static const Id AcLocalSuspend = FirstAc + 2; // XBC
// static const Id AcLocalDisconnect = FirstAc + 3; // XBC
static const Id AcLocalRelease = FirstAc + 4; // XBC
static const Id AcRemoteSuspend = FirstAc + 5; // XBC
static const Id AcRemoteRelease = FirstAc + 6; // XBC
static const Id AcReleaseCall = FirstAc + 7; // XBC
static const Id FirstLs = FirstAc + 8;
static const Id LsAnalyzeLocalMessage = FirstLs + 0; // XBC
static const Id LsAnalyzeRemoteMessage = FirstLs + 1; // XBC
static const Id LsLocalResume = FirstLs + 2; // XBC
static const Id LsLocalRelease = FirstLs + 3; // XBC
static const Id LsRemoteRelease = FirstLs + 4; // XBC
static const Id LsReleaseCall = FirstLs + 5; // XBC
static const Id FirstRs = FirstLs + 6;
static const Id RsAnalyzeLocalMessage = FirstRs + 0; // XBC
static const Id RsAnalyzeRemoteMessage = FirstRs + 1; // XBC
// static const Id RsLocalDisconnect = FirstRs + 2; // XBC
static const Id RsLocalRelease = FirstRs + 3; // XBC
static const Id RsRemoteResume = FirstRs + 4; // XBC
static const Id RsRemoteRelease = FirstRs + 5; // XBC
static const Id RsReleaseCall = FirstRs + 6; // XBC
static const Id FirstDi = FirstRs + 7;
// static const Id DiAnalyzeLocalMessage = FirstDi + 0; // XBC
// static const Id DiLocalRelease = FirstDi + 1; // XBC
// static const Id DiDisconnectTimeout = FirstDi + 2; // XBC
// static const Id DiReleaseCall = FirstDi + 3; // XBC
static const Id FirstEx = FirstDi + 4;
static const Id ExAnalyzeLocalMessage = FirstEx + 0; // XBC
static const Id ExApplyTreatment = FirstEx + 1; // XBC
// static const Id ExLocalDisconnect = FirstEx + 2; // XBC
static const Id ExLocalRelease = FirstEx + 3; // XBC
static const Id ExReleaseCall = FirstEx + 4; // XBC
static const Id FirstUn = FirstEx + 5;
// static const Id LocalProgress = FirstUn + 0; // XBC except PC
// static const Id RemoteProgress = FirstUn + 1; // XBC except SC
// static const Id LocalInfoRequest = FirstUn + 2; // XBC
// static const Id LocalInfoReport = FirstUn + 3; // XBC
// static const Id RemoteInfoRequest = FirstUn + 4; // XBC
// static const Id RemoteInfoReport = FirstUn + 5; // XBC
// static const Id RemoteService = FirstUn + 6; // XBC
static const Id NextId = FirstUn + 7;
protected:
BcEventHandler() = default;
virtual ~BcEventHandler() = default;
};
//------------------------------------------------------------------------------
//
// Basic call triggers.
//
// Trigger identifiers are defined within a pure virtual class that serves
// as a base class for all basic call triggers. This allows identifiers
// to appear as, for example, BcTrigger::AuthorizeTerminationSap.
//
// Each concrete basic call subclass must define a singleton instance of
// each trigger* that is required by a modifier's Initiator* and register
// it against its service.
//
// Each identifier specifies the call model to which it applies.
// Identifiers defined by subclasses must start at BcTrigger::NextId.
//b Identifiers not used in the POTS implementation are commented out.
//
class BcTrigger : public Trigger
{
public:
static const Id FirstId = NIL_ID + 1;
static const Id OriginateSnp = FirstId + 0; // OBC
static const Id AuthorizeOriginationSap = FirstId + 1; // OBC
static const Id OriginationDeniedSap = FirstId + 2; // OBC
static const Id OriginatedSnp = FirstId + 3; // OBC
static const Id CollectInformationSap = FirstId + 4; // OBC
static const Id CollectionTimeoutSap = FirstId + 5; // OBC
static const Id LocalInformationSap = FirstId + 6; // OBC
static const Id InformationCollectedSnp = FirstId + 7; // OBC
static const Id AnalyzeInformationSap = FirstId + 8; // OBC
// static const Id ReanalyzeInformationSap = FirstId + 9; // OBC
static const Id InvalidInformationSap = FirstId + 10; // OBC
static const Id InformationAnalyzedSnp = FirstId + 11; // OBC
static const Id SelectRouteSap = FirstId + 12; // OBC
// static const Id NetworkBusySap = FirstId + 13; // OBC
static const Id RouteSelectedSnp = FirstId + 14; // OBC
static const Id AuthorizeCallSetupSap = FirstId + 15; // OBC
// static const Id AuthorizationDeniedSap = FirstId + 16; // OBC
static const Id CallSetupAuthorizedSnp = FirstId + 17; // OBC
static const Id SendCallSap = FirstId + 18; // OBC
static const Id SendCallSnp = FirstId + 19; // OBC
// static const Id RouteBusySap = FirstId + 20; // OBC
static const Id RemoteBusySap = FirstId + 21; // OBC
static const Id RemoteProgressSnp = FirstId + 22; // XBC
static const Id RemoteAlertingSnp = FirstId + 23; // OBC
static const Id RemoteNoAnswerSap = FirstId + 24; // OBC
static const Id RemoteAnswerSnp = FirstId + 25; // OBC
static const Id TerminateSnp = FirstId + 26; // TBC
static const Id AuthorizeTerminationSap = FirstId + 27; // TBC
static const Id TerminationDeniedSap = FirstId + 28; // TBC
static const Id TerminatedSnp = FirstId + 29; // TBC
static const Id SelectFacilitySap = FirstId + 30; // TBC
static const Id FacilitySelectedSnp = FirstId + 31; // TBC
static const Id LocalBusySap = FirstId + 32; // TBC
static const Id PresentCallSap = FirstId + 33; // TBC
static const Id PresentCallSnp = FirstId + 34; // TBC
static const Id FacilityFailureSap = FirstId + 35; // TBC
static const Id LocalProgressSnp = FirstId + 36; // TBC
static const Id LocalAlertingSnp = FirstId + 37; // TBC
static const Id LocalNoAnswerSap = FirstId + 38; // TBC
static const Id LocalAnswerSap = FirstId + 39; // TBC
static const Id LocalAnswerSnp = FirstId + 40; // TBC
// static const Id LocalDisconnectSap = FirstId + 41; // XBC
// static const Id LocalDisconnectSnp = FirstId + 42; // XBC
static const Id LocalReleaseSap = FirstId + 43; // XBC
static const Id LocalReleaseSnp = FirstId + 44; // XBC
static const Id RemoteReleaseSap = FirstId + 45; // XBC
static const Id RemoteReleaseSnp = FirstId + 46; // XBC
static const Id ReleaseCallSap = FirstId + 47; // XBC
static const Id ApplyTreatmentSap = FirstId + 48; // XBC
static const Id CallClearedSnp = FirstId + 49; // XBC
static const Id NextId = FirstId + 52;
protected:
explicit BcTrigger(Id tid);
virtual ~BcTrigger();
};
//------------------------------------------------------------------------------
//
// Basic call service state machine.
//
class BcSsm : public MediaSsm
{
public:
enum Model
{
XbcModel, // unspecified call model
ObcModel, // originating call model
TbcModel // terminating call model
};
// Returns the call model.
//
Model GetModel() const { return model_; }
// Sets the call model.
//
void SetModel(Model model);
// Returns the CIP PSM.
//
CipPsm* NPsm() const { return nPsm_; }
// Returns the user-side PSM.
//
MediaPsm* UPsm() const { return uPsm_; }
// Returns the digits dialed thus far.
//
const DigitString& DialedDigits() const { return dialed_; }
DigitString& DialedDigits() { return dialed_; }