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
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 #ifndef __OPAL_H450PDU_H
00104 #define __OPAL_H450PDU_H
00105
00106 #ifdef P_USE_PRAGMA
00107 #pragma interface
00108 #endif
00109
00110
00111 #include <asn/x880.h>
00112 #include <asn/h4501.h>
00113 #include <asn/h4502.h>
00114
00115 #include <asn/h4507.h>
00116
00117 class H323EndPoint;
00118 class H323Connection;
00119 class H323TransportAddress;
00120 class H323SignalPDU;
00121
00122 class H4501_EndpointAddress;
00123 class H4501_InterpretationApdu;
00124
00125
00127
00130 class H450ServiceAPDU : public X880_ROS
00131 {
00132 public:
00133 X880_Invoke& BuildInvoke(int invokeId, int operation);
00134 X880_ReturnResult& BuildReturnResult(int invokeId);
00135 X880_ReturnError& BuildReturnError(int invokeId, int error);
00136 X880_Reject& BuildReject(int invokeId);
00137
00138 void BuildCallTransferInitiate(int invokeId,
00139 const PString & callIdentity,
00140 const PString & alias,
00141 const H323TransportAddress & address);
00142
00143 void BuildCallTransferIdentify(int invokeId);
00144 void BuildCallTransferAbandon(int invokeId);
00145 void BuildCallTransferSetup(int invokeId,
00146 const PString & callIdentity);
00147
00148 void BuildCallWaiting(int invokeId, int numCallsWaiting);
00149 void BuildMessageWaiting(int invokeId,
00150 H4507_H323_MWI_Operations &mwiOp,
00151 PASN_Sequence &argument);
00152 void BuildInterrogateResult(int invokeId,
00153 H4507_MWIInterrogateRes &interrogateResult);
00154
00155 void BuildCallIntrusionForcedRelease(int invokeId, int CICL);
00156 X880_ReturnResult& BuildCallIntrusionForcedReleaseResult(int invokeId);
00157 void BuildCallIntrusionForcedReleaseError();
00158 void BuildCallIntrusionGetCIPL(int invokeId);
00159 void BuildCallIntrusionImpending(int invokeId);
00160 void BuildCallIntrusionForceRelesed(int invokeId);
00161
00162 void AttachSupplementaryServiceAPDU(H323SignalPDU & pdu);
00163 BOOL WriteFacilityPDU(
00164 H323Connection & connection
00165 );
00166
00167 static void ParseEndpointAddress(H4501_EndpointAddress & address,
00168 PString & party);
00169 };
00170
00171
00172 class H450xDispatcher;
00173
00174 class H450xHandler : public PObject
00175 {
00176 PCLASSINFO(H450xHandler, PObject);
00177 public:
00178 H450xHandler(
00179 H323Connection & connection,
00180 H450xDispatcher & dispatcher
00181 );
00182
00183 virtual void AttachToSetup(
00184 H323SignalPDU & pdu
00185 );
00186
00187 virtual void AttachToAlerting(
00188 H323SignalPDU & pdu
00189 );
00190
00191 virtual void AttachToConnect(
00192 H323SignalPDU & pdu
00193 );
00194
00195 virtual void AttachToReleaseComplete(
00196 H323SignalPDU & pdu
00197 );
00198
00199 virtual BOOL OnReceivedInvoke(
00200 int opcode,
00201 int invokeId,
00202 int linkedId,
00203 PASN_OctetString * argument
00204 ) = 0;
00205
00206 virtual BOOL OnReceivedReturnResult(
00207 X880_ReturnResult & returnResult
00208 );
00209
00210 virtual BOOL OnReceivedReturnError(
00211 int errorCode,
00212 X880_ReturnError & returnError
00213 );
00214
00215 virtual BOOL OnReceivedReject(
00216 int problemType,
00217 int problemNumber
00218 );
00219
00222 void SendReturnError(int returnError);
00223
00224 void SendGeneralReject(int problem);
00225
00226 void SendInvokeReject(int problem);
00227
00228 void SendReturnResultReject(int problem);
00229
00230 void SendReturnErrorReject(int problem);
00231
00232 BOOL DecodeArguments(
00233 PASN_OctetString * argString,
00234 PASN_Object & argObject,
00235 int absentErrorCode
00236 );
00237
00238 unsigned GetInvokeId() const { return currentInvokeId; }
00239
00240
00241 protected:
00242 H323EndPoint & endpoint;
00243 H323Connection & connection;
00244 H450xDispatcher & dispatcher;
00245 unsigned currentInvokeId;
00246 };
00247
00248 PLIST(H450xHandlerList, H450xHandler);
00249 PDICTIONARY(H450xHandlerDict, POrdinalKey, H450xHandler);
00250
00251
00252 class H450xDispatcher : public PObject
00253 {
00254 PCLASSINFO(H450xDispatcher, PObject);
00255 public:
00256 H450xDispatcher(
00257 H323Connection & connection
00258 );
00259
00262 void AddOpCode(
00263 unsigned opcode,
00264 H450xHandler * handler
00265 );
00266
00267 virtual void AttachToSetup(
00268 H323SignalPDU & pdu
00269 );
00270
00271 virtual void AttachToAlerting(
00272 H323SignalPDU & pdu
00273 );
00274
00275 virtual void AttachToConnect(
00276 H323SignalPDU & pdu
00277 );
00278
00279 virtual void AttachToReleaseComplete(
00280 H323SignalPDU & pdu
00281 );
00282
00285 virtual BOOL HandlePDU(
00286 const H323SignalPDU & pdu
00287 );
00288
00293 virtual BOOL OnReceivedInvoke(X880_Invoke& invoke, H4501_InterpretationApdu& interpretation);
00294
00300 virtual BOOL OnReceivedReturnResult(X880_ReturnResult& returnResult);
00301
00307 virtual BOOL OnReceivedReturnError(X880_ReturnError& returnError);
00308
00314 virtual BOOL OnReceivedReject(X880_Reject& reject);
00315
00318 void SendReturnError(int invokeId, int returnError);
00319
00320 void SendGeneralReject(int invokeId, int problem);
00321
00322 void SendInvokeReject(int invokeId, int problem);
00323
00324 void SendReturnResultReject(int invokeId, int problem);
00325
00326 void SendReturnErrorReject(int invokeId, int problem);
00327
00330 unsigned GetNextInvokeId() const { return ++nextInvokeId; }
00331
00332 protected:
00333 H323Connection & connection;
00334 H450xHandlerList handlers;
00335 H450xHandlerDict opcodeHandler;
00336 mutable unsigned nextInvokeId;
00337 };
00338
00339
00340 class H4502Handler : public H450xHandler
00341 {
00342 PCLASSINFO(H4502Handler, H450xHandler);
00343 public:
00344 H4502Handler(
00345 H323Connection & connection,
00346 H450xDispatcher & dispatcher
00347 );
00348
00349 virtual void AttachToSetup(
00350 H323SignalPDU & pdu
00351 );
00352
00353 virtual void AttachToAlerting(
00354 H323SignalPDU & pdu
00355 );
00356
00357 virtual void AttachToConnect(
00358 H323SignalPDU & pdu
00359 );
00360
00361 virtual void AttachToReleaseComplete(
00362 H323SignalPDU & pdu
00363 );
00364
00365 virtual BOOL OnReceivedInvoke(
00366 int opcode,
00367 int invokeId,
00368 int linkedId,
00369 PASN_OctetString * argument
00370 );
00371
00374 virtual void OnReceivedCallTransferIdentify(
00375 int linkedId
00376 );
00377
00380 virtual void OnReceivedCallTransferAbandon(
00381 int linkedId
00382 );
00383
00386 virtual void OnReceivedCallTransferInitiate(
00387 int linkedId,
00388 PASN_OctetString * argument
00389 );
00390
00393 virtual void OnReceivedCallTransferSetup(
00394 int linkedId,
00395 PASN_OctetString * argument
00396 );
00397
00400 virtual void OnReceivedCallTransferUpdate(
00401 int linkedId,
00402 PASN_OctetString * argument
00403 );
00404
00407 virtual void OnReceivedSubaddressTransfer(
00408 int linkedId,
00409 PASN_OctetString * argument
00410 );
00411
00414 virtual void OnReceivedCallTransferComplete(
00415 int linkedId,
00416 PASN_OctetString * argument
00417 );
00418
00421 virtual void OnReceivedCallTransferActive(
00422 int linkedId,
00423 PASN_OctetString * argument
00424 );
00425
00426 virtual BOOL OnReceivedReturnResult(
00427 X880_ReturnResult & returnResult
00428 );
00429
00434 void OnReceivedInitiateReturnResult();
00435
00441 void OnReceivedSetupReturnResult();
00442
00447 void OnReceivedIdentifyReturnResult(X880_ReturnResult &returnResult);
00448
00449 virtual BOOL OnReceivedReturnError(
00450 int errorCode,
00451 X880_ReturnError & returnError
00452 );
00453
00458 void OnReceivedInitiateReturnError(
00459 const bool timerExpiry = false
00460 );
00461
00468 void OnReceivedSetupReturnError(
00469 int errorCode,
00470 const bool timerExpiry = false
00471 );
00472
00477 void OnReceivedIdentifyReturnError(
00478 const bool timerExpiry = false
00479 );
00480
00485 void TransferCall(
00486 const PString & remoteParty,
00487 const PString & callIdentity
00488 );
00489
00494 void ConsultationTransfer(
00495 const PString & primaryCallToken
00496 );
00497
00500 void HandleConsultationTransfer(
00501 const PString & callIdentity,
00502 H323Connection& incoming
00503 );
00504
00505 void AwaitSetupResponse(
00506 const PString & token,
00507 const PString & identity
00508 );
00509
00512 enum State {
00513 e_ctIdle,
00514 e_ctAwaitIdentifyResponse,
00515 e_ctAwaitInitiateResponse,
00516 e_ctAwaitSetupResponse,
00517 e_ctAwaitSetup,
00518 e_ctAwaitConnect
00519 };
00520
00523 State GetState() const { return ctState; }
00524
00534 virtual void onReceivedAdmissionReject(const int returnError);
00535
00538 void HandleCallTransferFailure(
00539 const int returnError
00540 );
00541
00544 void StartctTimer(const PTimeInterval value) { ctTimer = value; }
00545
00548 void StopctTimer();
00549
00552 BOOL IsctTimerRunning() { return ctTimer.IsRunning(); }
00553
00556 PDECLARE_NOTIFIER(PTimer, H4502Handler, OnCallTransferTimeOut);
00557
00560 const H323Connection& getAssociatedConnection() const { return connection; }
00561
00564 void SetAssociatedCallToken(const PString& token) { CallToken = token; }
00565
00568 const PString& getTransferringCallToken() const { return transferringCallToken; }
00569
00572 void SetConsultationTransferSuccess() { consultationTransfer = TRUE; }
00573
00576 BOOL isConsultationTransferSuccess() { return consultationTransfer; }
00577
00578 protected:
00579 PString transferringCallToken;
00580 PString transferringCallIdentity;
00581 State ctState;
00582 BOOL ctResponseSent;
00583 PTimer ctTimer;
00584 PString CallToken;
00585
00586 BOOL consultationTransfer;
00587
00588 };
00589
00590
00591 class H4504Handler : public H450xHandler
00592 {
00593 PCLASSINFO(H4504Handler, H450xHandler);
00594 public:
00595 H4504Handler(
00596 H323Connection & connection,
00597 H450xDispatcher & dispatcher
00598 );
00599
00600 virtual BOOL OnReceivedInvoke(
00601 int opcode,
00602 int invokeId,
00603 int linkedId,
00604 PASN_OctetString * argument
00605 );
00606
00609 virtual void OnReceivedLocalCallHold(
00610 int linkedId
00611 );
00612
00615 virtual void OnReceivedLocalCallRetrieve(
00616 int linkedId
00617 );
00618
00622 virtual void OnReceivedRemoteCallHold(
00623 int linkedId
00624 );
00625
00629 virtual void OnReceivedRemoteCallRetrieve(
00630 int linkedId
00631 );
00632
00636 void HoldCall(
00637 BOOL localHold
00638 );
00639
00643 void RetrieveCall();
00644
00647 enum State {
00648 e_ch_Idle,
00649 e_ch_NE_Held,
00650 e_ch_RE_Requested,
00651 e_ch_RE_Held,
00652 e_ch_RE_Retrieve_Req
00653 };
00654
00655 State GetState() const { return holdState; }
00656
00657
00658 protected:
00659 State holdState;
00660 };
00661
00662
00663 class H4506Handler : public H450xHandler
00664 {
00665 PCLASSINFO(H4506Handler, H450xHandler);
00666 public:
00667 H4506Handler(
00668 H323Connection & connection,
00669 H450xDispatcher & dispatcher
00670 );
00671
00672 virtual BOOL OnReceivedInvoke(
00673 int opcode,
00674 int invokeId,
00675 int linkedId,
00676 PASN_OctetString * argument
00677 );
00678
00681 virtual void OnReceivedCallWaitingIndication(
00682 int linkedId,
00683 PASN_OctetString *argument
00684 );
00685
00691 virtual void AttachToAlerting(
00692 H323SignalPDU & pdu,
00693 unsigned numberOfCallsWaiting = 0
00694 );
00695
00698 enum State {
00699 e_cw_Idle,
00700 e_cw_Invoked
00701 };
00702
00703 State GetState() const { return cwState; }
00704
00705
00706 protected:
00707 State cwState;
00708 };
00709
00713 class H4507Handler : public H450xHandler
00714 {
00715 PCLASSINFO(H4507Handler, H450xHandler);
00716 public:
00717 H4507Handler(
00718 H323Connection & connection,
00719 H450xDispatcher & dispatcher
00720 );
00721
00722 virtual BOOL OnReceivedInvoke(
00723 int opcode,
00724 int invokeId,
00725 int linkedId,
00726 PASN_OctetString * argument
00727 );
00728
00729
00732 virtual void OnReceivedMwiInterrogate(
00733 int linkedId,
00734 int invokeId,
00735 PASN_OctetString *argument
00736 );
00737
00738
00742 virtual void AttachToSetup(H323SignalPDU & setupPDU,
00743 H4507_H323_MWI_Operations &mwiOp,
00744 PASN_Sequence &argument);
00745
00748 virtual void AttachInterrogateResultToPdu(H323SignalPDU & pdu,
00749 H4507_MWIInterrogateRes &interrogateResult);
00750 virtual void AttachErrorToPdu(H323SignalPDU & pdu,
00751 H4507_MessageWaitingIndicationErrors error);
00754 enum State {
00755 e_mwi_Idle,
00756 e_mwi_Invoked
00757 };
00758
00759 State GetState() const { return mwiState; }
00760
00761
00762 protected:
00763 State mwiState;
00764 };
00765
00766
00767 class H45011Handler : public H450xHandler
00768 {
00769 PCLASSINFO(H45011Handler, H450xHandler);
00770 public:
00771 H45011Handler(
00772 H323Connection & connection,
00773 H450xDispatcher & dispatcher
00774 );
00775
00776 virtual void AttachToSetup(
00777 H323SignalPDU & pdu
00778 );
00779
00780 virtual void AttachToAlerting(
00781 H323SignalPDU & pdu
00782 );
00783
00784 virtual void AttachToConnect(
00785 H323SignalPDU & pdu
00786 );
00787
00788 virtual void AttachToReleaseComplete(
00789 H323SignalPDU & pdu
00790 );
00791
00792 virtual BOOL OnReceivedInvoke(
00793 int opcode,
00794 int invokeId,
00795 int linkedId,
00796 PASN_OctetString * argument
00797 );
00798
00801 virtual void OnReceivedCallIntrusionRequest(
00802 int linkedId,
00803 PASN_OctetString *argument
00804 );
00805
00808 virtual void OnReceivedCallIntrusionGetCIPL(
00809 int linkedId,
00810 PASN_OctetString *argument
00811 );
00812
00815 virtual void OnReceivedCallIntrusionIsolate(
00816 int linkedId,
00817 PASN_OctetString *argument
00818 );
00819
00822 virtual BOOL OnReceivedCallIntrusionForcedRelease(
00823 int linkedId,
00824 PASN_OctetString *argument
00825 );
00826
00829 virtual void OnReceivedCallIntrusionWOBRequest(
00830 int linkedId,
00831 PASN_OctetString *argument
00832 );
00833
00836 virtual void OnReceivedCallIntrusionSilentMonitor(
00837 int linkedId,
00838 PASN_OctetString *argument
00839 );
00840
00843 virtual void OnReceivedCallIntrusionNotification(
00844 int linkedId,
00845 PASN_OctetString *argument
00846 );
00847
00850 virtual void OnReceivedCfbOverride(
00851 int linkedId,
00852 PASN_OctetString *argument
00853 );
00854
00857 virtual void OnReceivedRemoteUserAlerting(
00858 int linkedId,
00859 PASN_OctetString *argument
00860 );
00861
00864 virtual void OnReceivedCallWaiting(
00865 int linkedId,
00866 PASN_OctetString *argument
00867 );
00868
00869 virtual BOOL OnReceivedReturnResult(
00870 X880_ReturnResult & returnResult
00871 );
00872
00873 void OnReceivedCIRequestResult();
00874
00875 virtual BOOL OnReceivedReturnError(
00876 int errorCode,
00877 X880_ReturnError & returnError
00878 );
00879
00880 BOOL OnReceivedInvokeReturnError (
00881 int errorCode,
00882 const bool timerExpiry = false
00883 );
00884
00885 void OnReceivedCIGetCIPLResult(
00886 X880_ReturnResult & returnResult
00887 );
00888
00889 BOOL OnReceivedGetCIPLReturnError(
00890 int errorCode,
00891 const bool timerExpiry = false
00892 );
00893
00894 void IntrudeCall(int CICL );
00895
00896 void AwaitSetupResponse(
00897 const PString & token,
00898 const PString & identity
00899 );
00900
00901 BOOL GetRemoteCallIntrusionProtectionLevel(
00902 const PString & intrusionCallToken,
00903 unsigned intrusionCICL
00904 );
00905
00906 void SetIntrusionImpending();
00907
00908 void SetForcedReleaseAccepted();
00909
00910 void SetIntrusionNotAuthorized();
00911
00912 virtual BOOL OnReceivedReject(
00913 int problemType,
00914 int problemNumber
00915 );
00916
00919 enum State {
00920 e_ci_Idle,
00921 e_ci_WaitAck,
00922 e_ci_GetCIPL,
00923 e_ci_OrigInvoked,
00924 e_ci_OrigIsolated,
00925 e_ci_DestNotify,
00926 e_ci_DestInvoked,
00927 e_ci_DestIsolated,
00928 e_ci_DestWOB,
00929 e_ci_IsolationRequest,
00930 e_ci_ForcedReleaseRequest,
00931 e_ci_WOBRequest
00932 };
00933
00935 enum Generate{
00936 e_ci_gIdle,
00937 e_ci_gConferenceRequest,
00938 e_ci_gHeldRequest,
00939 e_ci_gSilentMonitorRequest,
00940 e_ci_gIsolationRequest,
00941 e_ci_gForcedReleaseRequest,
00942 e_ci_gWOBRequest
00943 };
00944
00946 enum SendState{
00947 e_ci_sIdle,
00948 e_ci_sAttachToSetup,
00949 e_ci_sAttachToAlerting,
00950 e_ci_sAttachToConnect,
00951 e_ci_sAttachToReleseComplete
00952 };
00953
00955 enum ReturnState{
00956 e_ci_rIdle,
00957 e_ci_rCallIntrusionImpending,
00958 e_ci_rCallIntruded,
00959 e_ci_rCallIsolated,
00960 e_ci_rCallForceReleased,
00961 e_ci_rCallForceReleaseResult,
00962 e_ci_rCallIntrusionComplete,
00963 e_ci_rCallIntrusionEnd,
00964 e_ci_rNotBusy,
00965 e_ci_rTempUnavailable,
00966 e_ci_rNotAuthorized
00967 };
00968
00971 State GetState() const { return ciState; }
00972
00975 void StartciTimer(const PTimeInterval value) { ciTimer = value; }
00976
00979 void StopciTimer();
00980
00983 BOOL IsctTimerRunning() { return ciTimer.IsRunning(); }
00984
00987 PDECLARE_NOTIFIER(PTimer, H45011Handler, OnCallIntrudeTimeOut);
00988
00989 protected:
00990 State ciState;
00991 PTimer ciTimer;
00992 PString intrudingCallToken;
00993 PString intrudingCallIdentity;
00994 PString activeCallToken;
00995 ReturnState ciReturnState;
00996 SendState ciSendState;
00997 Generate ciGenerateState;
00998 int ciCICL;
00999 unsigned intrudingCallCICL;
01000 };
01001
01002
01003 #endif // __OPAL_H450PDU_H
01004
01005