00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
#ifndef __OPAL_H450PDU_H
00065
#define __OPAL_H450PDU_H
00066
00067
#ifdef P_USE_PRAGMA
00068
#pragma interface
00069
#endif
00070
00071
00072
#include "x880.h"
00073
00074
00075
class H323EndPoint;
00076
class H323Connection;
00077
class H323TransportAddress;
00078
class H323SignalPDU;
00079
00080
class H4501_EndpointAddress;
00081
class H4501_InterpretationApdu;
00082
00083
00085
00088 class H450ServiceAPDU :
public X880_ROS
00089 {
00090
public:
00091
X880_Invoke&
BuildInvoke(
int invokeId,
int operation);
00092
X880_ReturnResult&
BuildReturnResult(
int invokeId);
00093
X880_ReturnError&
BuildReturnError(
int invokeId,
int error);
00094
X880_Reject&
BuildReject(
int invokeId);
00095
00096
void BuildCallTransferInitiate(
int invokeId,
00097
const PString & callIdentity,
00098
const PString & alias,
00099
const H323TransportAddress & address);
00100
00101
void BuildCallTransferIdentify(
int invokeId);
00102
void BuildCallTransferAbandon(
int invokeId);
00103
void BuildCallTransferSetup(
int invokeId,
00104
const PString & callIdentity);
00105
00106
void BuildCallWaiting(
int invokeId,
int numCallsWaiting);
00107
00108
void BuildCallIntrusionForcedRelease(
int invokeId,
int CICL);
00109
X880_ReturnResult&
BuildCallIntrusionForcedReleaseResult(
int invokeId);
00110
void BuildCallIntrusionForcedReleaseError();
00111
void BuildCallIntrusionGetCIPL(
int invokeId);
00112
void BuildCallIntrusionImpending(
int invokeId);
00113
void BuildCallIntrusionForceRelesed(
int invokeId);
00114
00115
void AttachSupplementaryServiceAPDU(
H323SignalPDU & pdu);
00116 BOOL
WriteFacilityPDU(
00117
H323Connection & connection
00118 );
00119
00120
static void ParseEndpointAddress(
H4501_EndpointAddress & address,
00121 PString & party);
00122 };
00123
00124
00125
class H450xDispatcher;
00126
00127 class H450xHandler :
public PObject
00128 {
00129 PCLASSINFO(
H450xHandler, PObject);
00130
public:
00131
H450xHandler(
00132
H323Connection &
connection,
00133
H450xDispatcher &
dispatcher
00134 );
00135
00136
virtual void AttachToSetup(
00137
H323SignalPDU & pdu
00138 );
00139
00140
virtual void AttachToAlerting(
00141
H323SignalPDU & pdu
00142 );
00143
00144
virtual void AttachToConnect(
00145
H323SignalPDU & pdu
00146 );
00147
00148
virtual void AttachToReleaseComplete(
00149
H323SignalPDU & pdu
00150 );
00151
00152
virtual BOOL
OnReceivedInvoke(
00153
int opcode,
00154
int invokeId,
00155
int linkedId,
00156 PASN_OctetString * argument
00157 ) = 0;
00158
00159
virtual BOOL
OnReceivedReturnResult(
00160
X880_ReturnResult & returnResult
00161 );
00162
00163
virtual BOOL
OnReceivedReturnError(
00164
int errorCode,
00165
X880_ReturnError & returnError
00166 );
00167
00168
virtual BOOL
OnReceivedReject(
00169
int problemType,
00170
int problemNumber
00171 );
00172
00175
void SendReturnError(
int returnError);
00176
00177
void SendGeneralReject(
int problem);
00178
00179
void SendInvokeReject(
int problem);
00180
00181
void SendReturnResultReject(
int problem);
00182
00183
void SendReturnErrorReject(
int problem);
00184
00185 BOOL
DecodeArguments(
00186 PASN_OctetString * argString,
00187 PASN_Object & argObject,
00188
int absentErrorCode
00189 );
00190
00191 unsigned GetInvokeId()
const {
return currentInvokeId; }
00192
00193
00194
protected:
00195 H323EndPoint &
endpoint;
00196 H323Connection & connection;
00197 H450xDispatcher & dispatcher;
00198 unsigned currentInvokeId;
00199 };
00200
00201
PLIST(H450xHandlerList,
H450xHandler);
00202
PDICTIONARY(H450xHandlerDict, POrdinalKey,
H450xHandler);
00203
00204
00205 class H450xDispatcher :
public PObject
00206 {
00207 PCLASSINFO(
H450xDispatcher, PObject);
00208
public:
00209
H450xDispatcher(
00210
H323Connection &
connection
00211 );
00212
00215
void AddOpCode(
00216
unsigned opcode,
00217
H450xHandler * handler
00218 );
00219
00220
virtual void AttachToSetup(
00221
H323SignalPDU & pdu
00222 );
00223
00224
virtual void AttachToAlerting(
00225
H323SignalPDU & pdu
00226 );
00227
00228
virtual void AttachToConnect(
00229
H323SignalPDU & pdu
00230 );
00231
00232
virtual void AttachToReleaseComplete(
00233
H323SignalPDU & pdu
00234 );
00235
00238
virtual BOOL
HandlePDU(
00239
const H323SignalPDU & pdu
00240 );
00241
00246
virtual BOOL
OnReceivedInvoke(
X880_Invoke& invoke,
H4501_InterpretationApdu& interpretation);
00247
00253
virtual BOOL
OnReceivedReturnResult(
X880_ReturnResult& returnResult);
00254
00260
virtual BOOL
OnReceivedReturnError(
X880_ReturnError& returnError);
00261
00267
virtual BOOL
OnReceivedReject(
X880_Reject& reject);
00268
00271
void SendReturnError(
int invokeId,
int returnError);
00272
00273
void SendGeneralReject(
int invokeId,
int problem);
00274
00275
void SendInvokeReject(
int invokeId,
int problem);
00276
00277
void SendReturnResultReject(
int invokeId,
int problem);
00278
00279
void SendReturnErrorReject(
int invokeId,
int problem);
00280
00283 unsigned GetNextInvokeId()
const {
return ++
nextInvokeId; }
00284
00285
protected:
00286 H323Connection & connection;
00287 H450xHandlerList
handlers;
00288 H450xHandlerDict
opcodeHandler;
00289 mutable unsigned nextInvokeId;
00290 };
00291
00292
00293 class H4502Handler :
public H450xHandler
00294 {
00295 PCLASSINFO(
H4502Handler,
H450xHandler);
00296
public:
00297
H4502Handler(
00298
H323Connection & connection,
00299
H450xDispatcher & dispatcher
00300 );
00301
00302
virtual void AttachToSetup(
00303
H323SignalPDU & pdu
00304 );
00305
00306
virtual void AttachToAlerting(
00307
H323SignalPDU & pdu
00308 );
00309
00310
virtual void AttachToConnect(
00311
H323SignalPDU & pdu
00312 );
00313
00314
virtual void AttachToReleaseComplete(
00315
H323SignalPDU & pdu
00316 );
00317
00318
virtual BOOL
OnReceivedInvoke(
00319
int opcode,
00320
int invokeId,
00321
int linkedId,
00322 PASN_OctetString * argument
00323 );
00324
00327
virtual void OnReceivedCallTransferIdentify(
00328
int linkedId
00329 );
00330
00333
virtual void OnReceivedCallTransferAbandon(
00334
int linkedId
00335 );
00336
00339
virtual void OnReceivedCallTransferInitiate(
00340
int linkedId,
00341 PASN_OctetString * argument
00342 );
00343
00346
virtual void OnReceivedCallTransferSetup(
00347
int linkedId,
00348 PASN_OctetString * argument
00349 );
00350
00353
virtual void OnReceivedCallTransferUpdate(
00354
int linkedId,
00355 PASN_OctetString * argument
00356 );
00357
00360
virtual void OnReceivedSubaddressTransfer(
00361
int linkedId,
00362 PASN_OctetString * argument
00363 );
00364
00367
virtual void OnReceivedCallTransferComplete(
00368
int linkedId,
00369 PASN_OctetString * argument
00370 );
00371
00374
virtual void OnReceivedCallTransferActive(
00375
int linkedId,
00376 PASN_OctetString * argument
00377 );
00378
00379
virtual BOOL
OnReceivedReturnResult(
00380
X880_ReturnResult & returnResult
00381 );
00382
00387
void OnReceivedInitiateReturnResult();
00388
00394
void OnReceivedSetupReturnResult();
00395
00400
void OnReceivedIdentifyReturnResult(
X880_ReturnResult &returnResult);
00401
00402
virtual BOOL
OnReceivedReturnError(
00403
int errorCode,
00404
X880_ReturnError & returnError
00405 );
00406
00411
void OnReceivedInitiateReturnError(
00412
const bool timerExpiry =
false
00413 );
00414
00421
void OnReceivedSetupReturnError(
00422
int errorCode,
00423
const bool timerExpiry =
false
00424 );
00425
00430
void OnReceivedIdentifyReturnError(
00431
const bool timerExpiry =
false
00432 );
00433
00438
void TransferCall(
00439
const PString & remoteParty,
00440
const PString & callIdentity
00441 );
00442
00447
void ConsultationTransfer(
00448
const PString & primaryCallToken
00449 );
00450
00453
void HandleConsultationTransfer(
00454
const PString & callIdentity,
00455
H323Connection& incoming
00456 );
00457
00458
void AwaitSetupResponse(
00459
const PString & token,
00460
const PString & identity
00461 );
00462
00465 enum State {
00466
e_ctIdle,
00467
e_ctAwaitIdentifyResponse,
00468
e_ctAwaitInitiateResponse,
00469
e_ctAwaitSetupResponse,
00470
e_ctAwaitSetup,
00471
e_ctAwaitConnect
00472 };
00473
00476 State GetState()
const {
return ctState; }
00477
00487
virtual void onReceivedAdmissionReject(
const int returnError);
00488
00491
void HandleCallTransferFailure(
00492
const int returnError
00493 );
00494
00497 void StartctTimer(
const PTimeInterval value) {
ctTimer = value; }
00498
00501
void StopctTimer();
00502
00505 BOOL
IsctTimerRunning() {
return ctTimer.IsRunning(); }
00506
00509 PDECLARE_NOTIFIER(PTimer,
H4502Handler, OnCallTransferTimeOut);
00510
00513 const H323Connection&
getAssociatedConnection()
const {
return connection; }
00514
00517 void SetAssociatedCallToken(
const PString& token) {
CallToken = token; }
00518
00521 const PString&
getTransferringCallToken()
const {
return transferringCallToken; }
00522
00525 unsigned GetNextCallIdentityValue()
const {
return nextCallIdentity++; }
00526
00529 void SetConsultationTransferSuccess() {
consultationTransfer = TRUE; }
00530
00533 BOOL
isConsultationTransferSuccess() {
return consultationTransfer; }
00534
00535
protected:
00536 PString
transferringCallToken;
00537 PString
transferringCallIdentity;
00538 State ctState;
00539 BOOL
ctResponseSent;
00540 PTimer
ctTimer;
00541 PString
CallToken;
00542
00543 mutable unsigned nextCallIdentity;
00544
00545 BOOL
consultationTransfer;
00546
00547 };
00548
00549
00550 class H4504Handler :
public H450xHandler
00551 {
00552 PCLASSINFO(
H4504Handler,
H450xHandler);
00553
public:
00554
H4504Handler(
00555
H323Connection & connection,
00556
H450xDispatcher & dispatcher
00557 );
00558
00559
virtual BOOL
OnReceivedInvoke(
00560
int opcode,
00561
int invokeId,
00562
int linkedId,
00563 PASN_OctetString * argument
00564 );
00565
00568
virtual void OnReceivedLocalCallHold(
00569
int linkedId
00570 );
00571
00574
virtual void OnReceivedLocalCallRetrieve(
00575
int linkedId
00576 );
00577
00581
virtual void OnReceivedRemoteCallHold(
00582
int linkedId
00583 );
00584
00588
virtual void OnReceivedRemoteCallRetrieve(
00589
int linkedId
00590 );
00591
00595
void HoldCall(
00596 BOOL localHold
00597 );
00598
00602
void RetrieveCall();
00603
00606 enum State {
00607
e_ch_Idle,
00608
e_ch_NE_Held,
00609
e_ch_RE_Requested,
00610
e_ch_RE_Held,
00611
e_ch_RE_Retrieve_Req
00612 };
00613
00614 State GetState()
const {
return holdState; }
00615
00616
00617
protected:
00618 State holdState;
00619 };
00620
00621
00622 class H4506Handler :
public H450xHandler
00623 {
00624 PCLASSINFO(
H4506Handler,
H450xHandler);
00625
public:
00626
H4506Handler(
00627
H323Connection & connection,
00628
H450xDispatcher & dispatcher
00629 );
00630
00631
virtual BOOL
OnReceivedInvoke(
00632
int opcode,
00633
int invokeId,
00634
int linkedId,
00635 PASN_OctetString * argument
00636 );
00637
00640
virtual void OnReceivedCallWaitingIndication(
00641
int linkedId,
00642 PASN_OctetString *argument
00643 );
00644
00650
virtual void AttachToAlerting(
00651
H323SignalPDU & pdu,
00652
unsigned numberOfCallsWaiting = 0
00653 );
00654
00657 enum State {
00658
e_cw_Idle,
00659
e_cw_Invoked
00660 };
00661
00662 State GetState()
const {
return cwState; }
00663
00664
00665
protected:
00666 State cwState;
00667 };
00668
00669
00670 class H45011Handler :
public H450xHandler
00671 {
00672 PCLASSINFO(
H45011Handler,
H450xHandler);
00673
public:
00674
H45011Handler(
00675
H323Connection & connection,
00676
H450xDispatcher & dispatcher
00677 );
00678
00679
virtual void AttachToSetup(
00680
H323SignalPDU & pdu
00681 );
00682
00683
virtual void AttachToAlerting(
00684
H323SignalPDU & pdu
00685 );
00686
00687
virtual void AttachToConnect(
00688
H323SignalPDU & pdu
00689 );
00690
00691
virtual void AttachToReleaseComplete(
00692
H323SignalPDU & pdu
00693 );
00694
00695
virtual BOOL
OnReceivedInvoke(
00696
int opcode,
00697
int invokeId,
00698
int linkedId,
00699 PASN_OctetString * argument
00700 );
00701
00704
virtual void OnReceivedCallIntrusionRequest(
00705
int linkedId,
00706 PASN_OctetString *argument
00707 );
00708
00711
virtual void OnReceivedCallIntrusionGetCIPL(
00712
int linkedId,
00713 PASN_OctetString *argument
00714 );
00715
00718
virtual void OnReceivedCallIntrusionIsolate(
00719
int linkedId,
00720 PASN_OctetString *argument
00721 );
00722
00725
virtual BOOL
OnReceivedCallIntrusionForcedRelease(
00726
int linkedId,
00727 PASN_OctetString *argument
00728 );
00729
00732
virtual void OnReceivedCallIntrusionWOBRequest(
00733
int linkedId,
00734 PASN_OctetString *argument
00735 );
00736
00739
virtual void OnReceivedCallIntrusionSilentMonitor(
00740
int linkedId,
00741 PASN_OctetString *argument
00742 );
00743
00746
virtual void OnReceivedCallIntrusionNotification(
00747
int linkedId,
00748 PASN_OctetString *argument
00749 );
00750
00753
virtual void OnReceivedCfbOverride(
00754
int linkedId,
00755 PASN_OctetString *argument
00756 );
00757
00760
virtual void OnReceivedRemoteUserAlerting(
00761
int linkedId,
00762 PASN_OctetString *argument
00763 );
00764
00767
virtual void OnReceivedCallWaiting(
00768
int linkedId,
00769 PASN_OctetString *argument
00770 );
00771
00772
virtual BOOL
OnReceivedReturnResult(
00773
X880_ReturnResult & returnResult
00774 );
00775
00776
void OnReceivedCIRequestResult();
00777
00778
virtual BOOL
OnReceivedReturnError(
00779
int errorCode,
00780
X880_ReturnError & returnError
00781 );
00782
00783 BOOL
OnReceivedInvokeReturnError (
00784
int errorCode,
00785
const bool timerExpiry =
false
00786 );
00787
00788
void OnReceivedCIGetCIPLResult(
00789
X880_ReturnResult & returnResult
00790 );
00791
00792 BOOL
OnReceivedGetCIPLReturnError(
00793
int errorCode,
00794
const bool timerExpiry =
false
00795 );
00796
00797
void IntrudeCall(
int CICL );
00798
00799
void AwaitSetupResponse(
00800
const PString & token,
00801
const PString & identity
00802 );
00803
00804 BOOL
GetRemoteCallIntrusionProtectionLevel(
00805
const PString & intrusionCallToken,
00806
unsigned intrusionCICL
00807 );
00808
00809
void SetIntrusionImpending();
00810
00811
void SetForcedReleaseAccepted();
00812
00813
void SetIntrusionNotAuthorized();
00814
00815
virtual BOOL
OnReceivedReject(
00816
int problemType,
00817
int problemNumber
00818 );
00819
00822 enum State {
00823
e_ci_Idle,
00824
e_ci_WaitAck,
00825
e_ci_GetCIPL,
00826
e_ci_OrigInvoked,
00827
e_ci_OrigIsolated,
00828
e_ci_DestNotify,
00829
e_ci_DestInvoked,
00830
e_ci_DestIsolated,
00831
e_ci_DestWOB,
00832
e_ci_IsolationRequest,
00833
e_ci_ForcedReleaseRequest,
00834
e_ci_WOBRequest
00835 };
00836
00838 enum Generate{
00839
e_ci_gIdle,
00840
e_ci_gConferenceRequest,
00841
e_ci_gHeldRequest,
00842
e_ci_gSilentMonitorRequest,
00843
e_ci_gIsolationRequest,
00844
e_ci_gForcedReleaseRequest,
00845
e_ci_gWOBRequest
00846 };
00847
00849 enum SendState{
00850
e_ci_sIdle,
00851
e_ci_sAttachToSetup,
00852
e_ci_sAttachToAlerting,
00853
e_ci_sAttachToConnect,
00854
e_ci_sAttachToReleseComplete
00855 };
00856
00858 enum ReturnState{
00859
e_ci_rIdle,
00860
e_ci_rCallIntrusionImpending,
00861
e_ci_rCallIntruded,
00862
e_ci_rCallIsolated,
00863
e_ci_rCallForceReleased,
00864
e_ci_rCallForceReleaseResult,
00865
e_ci_rCallIntrusionComplete,
00866
e_ci_rCallIntrusionEnd,
00867
e_ci_rNotBusy,
00868
e_ci_rTempUnavailable,
00869
e_ci_rNotAuthorized
00870 };
00871
00874 State GetState()
const {
return ciState; }
00875
00878 void StartciTimer(
const PTimeInterval value) {
ciTimer = value; }
00879
00882
void StopciTimer();
00883
00886 BOOL
IsctTimerRunning() {
return ciTimer.IsRunning(); }
00887
00890 PDECLARE_NOTIFIER(PTimer,
H45011Handler, OnCallIntrudeTimeOut);
00891
00892
protected:
00893 State ciState;
00894 PTimer
ciTimer;
00895 PString
intrudingCallToken;
00896 PString
intrudingCallIdentity;
00897 PString
activeCallToken;
00898 ReturnState ciReturnState;
00899 SendState ciSendState;
00900 Generate ciGenerateState;
00901 int ciCICL;
00902 unsigned intrudingCallCICL;
00903 };
00904
00905
00906
#endif // __OPAL_H450PDU_H
00907
00908