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
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379 #ifndef __OPAL_H323CON_H
00380 #define __OPAL_H323CON_H
00381
00382 #ifdef P_USE_PRAGMA
00383 #pragma interface
00384 #endif
00385
00386 #ifdef P_DTMF
00387 #include <ptclib/dtmf.h>
00388 #endif
00389
00390 #include "h323caps.h"
00391 #include "transports.h"
00392 #include "channels.h"
00393 #include "guid.h"
00394 #include "openh323buildopts.h"
00395 #include "h235auth.h"
00396
00397 #ifdef H323_TRANSNEXUS_OSP
00398 #include "opalosp.h"
00399
00400
00401
00402
00403
00404
00405 #endif
00406
00407 #if OPAL_H224
00408 class OpalH224Handler;
00409 class OpalH281Handler;
00410 #endif
00411
00412 #ifdef H323_SIGNAL_AGGREGATE
00413 #include <ptclib/sockagg.h>
00414
00417 class H323AggregatedH2x5Handle : public PAggregatedHandle
00418 {
00419 PCLASSINFO(H323AggregatedH2x5Handle, PAggregatedHandle)
00420 public:
00421 H323AggregatedH2x5Handle(H323Transport & _transport, H323Connection & _connection);
00422 ~H323AggregatedH2x5Handle();
00423
00424 PAggregatorFDList_t GetFDs();
00425
00426 BOOL OnRead();
00427 virtual BOOL HandlePDU(BOOL ok, PBYTEArray & pdu) = 0;
00428 PTimeInterval GetTimeout()
00429 { return transport.GetReadTimeout(); }
00430
00431 protected:
00432 PAggregatorFD fd;
00433 H323Transport & transport;
00434 H323Connection & connection;
00435 PBYTEArray pduBuffer;
00436 PINDEX pduDataLen;
00437 };
00438
00439 #endif
00440
00441 #ifdef H323_H248
00442 #include "svcctrl.h"
00443 #endif
00444
00445
00446
00447
00448
00449
00450
00451 class PPER_Stream;
00452
00453 class H225_EndpointType;
00454 class H225_TransportAddress;
00455 class H225_ArrayOf_PASN_OctetString;
00456 class H225_ProtocolIdentifier;
00457 class H225_AdmissionRequest;
00458 class H225_FeatureSet;
00459 class H225_Setup_UUIE;
00460 class H225_ArrayOf_ServiceControlSession;
00461 class H225_ServiceControlSession_reason;
00462
00463 class H245_TerminalCapabilitySet;
00464 class H245_TerminalCapabilitySetReject;
00465 class H245_OpenLogicalChannel;
00466 class H245_OpenLogicalChannelAck;
00467 class H245_TransportAddress;
00468 class H245_UserInputIndication;
00469 class H245_RequestMode;
00470 class H245_RequestModeAck;
00471 class H245_RequestModeReject;
00472 class H245_ModeDescription;
00473 class H245_ArrayOf_ModeDescription;
00474 class H245_SendTerminalCapabilitySet;
00475 class H245_MultiplexCapability;
00476 class H245_FlowControlCommand;
00477 class H245_MiscellaneousCommand;
00478 class H245_MiscellaneousIndication;
00479 class H245_JitterIndication;
00480 class H245_ConferenceRequest;
00481 class H245_ConferenceResponse;
00482 class H245_ConferenceCommand;
00483 class H245_ConferenceIndication;
00484
00485 class H323SignalPDU;
00486 class H323ControlPDU;
00487
00488 class H235Authenticators;
00489
00490 class H245NegMasterSlaveDetermination;
00491 class H245NegTerminalCapabilitySet;
00492 class H245NegLogicalChannels;
00493 class H245NegRequestMode;
00494 class H245NegRoundTripDelay;
00495
00496 #ifdef H323_H450
00497
00498 class H450xDispatcher;
00499 class H4502Handler;
00500 class H4503Handler;
00501 class H4504Handler;
00502 class H4506Handler;
00503 class H45011Handler;
00504
00505 #endif
00506
00507 #ifdef H323_T120
00508 class OpalT120Protocol;
00509 #endif
00510
00511 #ifdef H323_T38
00512 class OpalT38Protocol;
00513 #endif
00514
00515 #ifdef OPAL_H224
00516 class OpalH224Handler;
00517 class OpalH281Handler;
00518 #endif
00519
00520 class OpalRFC2833;
00521 class OpalRFC2833Info;
00522
00523 #ifdef H323_H460
00524 class H460_FeatureSet;
00525 #endif
00526
00527
00529
00537 class H323Connection : public PObject
00538 {
00539 PCLASSINFO(H323Connection, PObject);
00540
00541 friend class AggregatedH225Handle;
00542 friend class AggregatedH245Handle;
00543 public:
00546 enum Options {
00547 FastStartOptionDisable = 0x0001,
00548 FastStartOptionEnable = 0x0002,
00549 FastStartOptionMask = 0x0003,
00550
00551 H245TunnelingOptionDisable = 0x0004,
00552 H245TunnelingOptionEnable = 0x0008,
00553 H245TunnelingOptionMask = 0x000c,
00554
00555 H245inSetupOptionDisable = 0x0010,
00556 H245inSetupOptionEnable = 0x0020,
00557 H245inSetupOptionMask = 0x0030,
00558
00559 DetectInBandDTMFOptionDisable= 0x0040,
00560 DetectInBandDTMFOptionEnable = 0x0080,
00561 DetectInBandDTMFOptionMask = 0x00c0,
00562
00563 #ifdef H323_RTP_AGGREGATE
00564 RTPAggregationDisable = 0x0100,
00565 RTPAggregationEnable = 0x0200,
00566 RTPAggregationMask = 0x0300,
00567 #endif
00568
00569 #ifdef H323_SIGNAL_AGGREGATE
00570 SignallingAggregationDisable = 0x0400,
00571 SignallingAggregationEnable = 0x0800,
00572 SignallingAggregationMask = 0x0c00
00573 #endif
00574 };
00575
00578 H323Connection(
00579 H323EndPoint & endpoint,
00580 unsigned callReference,
00581 unsigned options = 0
00582 );
00583
00586 ~H323Connection();
00587
00597 BOOL Lock();
00598
00610 int TryLock();
00611
00617 void Unlock();
00618
00625 virtual void OnSendARQ(
00626 H225_AdmissionRequest & arq
00627 );
00628
00632 virtual void OnEstablished();
00633
00637 virtual void OnCleared();
00638
00645 BOOL IsConnected() const { return connectionState == HasExecutedSignalConnect || connectionState == EstablishedConnection; }
00646
00652 BOOL IsEstablished() const { return connectionState == EstablishedConnection; }
00653
00658 enum CallEndReason {
00659 EndedByLocalUser,
00660 EndedByNoAccept,
00661 EndedByAnswerDenied,
00662 EndedByRemoteUser,
00663 EndedByRefusal,
00664 EndedByNoAnswer,
00665 EndedByCallerAbort,
00666 EndedByTransportFail,
00667 EndedByConnectFail,
00668 EndedByGatekeeper,
00669 EndedByNoUser,
00670 EndedByNoBandwidth,
00671 EndedByCapabilityExchange,
00672 EndedByCallForwarded,
00673 EndedBySecurityDenial,
00674 EndedByLocalBusy,
00675 EndedByLocalCongestion,
00676 EndedByRemoteBusy,
00677 EndedByRemoteCongestion,
00678 EndedByUnreachable,
00679 EndedByNoEndPoint,
00680 EndedByHostOffline,
00681 EndedByTemporaryFailure,
00682 EndedByQ931Cause,
00683 EndedByDurationLimit,
00684 EndedByInvalidConferenceID,
00685 EndedByOSPRefusal,
00686 EndedByInvalidNumberFormat,
00687 EndedByUnspecifiedProtocolError,
00688 EndedByNoFeatureSupport,
00689 NumCallEndReasons
00690 };
00691 #if PTRACING
00692 friend ostream & operator<<(ostream & o, CallEndReason r);
00693 #endif
00694
00703 CallEndReason GetCallEndReason() const { return callEndReason; }
00704
00709 virtual void SetCallEndReason(
00710 CallEndReason reason,
00711 PSyncPoint * sync = NULL
00712 );
00713
00719 virtual BOOL ClearCall(
00720 CallEndReason reason = EndedByLocalUser
00721 );
00722
00725 virtual BOOL ClearCallSynchronous(
00726 PSyncPoint * sync,
00727 CallEndReason reason = EndedByLocalUser
00728 );
00729
00738 virtual void CleanUpOnCallEnd();
00740
00741
00746 virtual void AttachSignalChannel(
00747 const PString & token,
00748 H323Transport * channel,
00749 BOOL answeringCall
00750 );
00751
00754 BOOL WriteSignalPDU(
00755 H323SignalPDU & pdu
00756 );
00757
00761 virtual void HandleSignallingChannel();
00762
00766 virtual BOOL HandleReceivedSignalPDU(BOOL readStatus, H323SignalPDU & pdu);
00767
00771 virtual BOOL HandleReceivedControlPDU(BOOL readStatus, PPER_Stream & strm);
00772
00776 virtual BOOL HandleSignalPDU(
00777 H323SignalPDU & pdu
00778 );
00779
00783 virtual void HandleTunnelPDU(
00784 H323SignalPDU * txPDU
00785 );
00786
00794 virtual BOOL OnReceivedSignalSetup(
00795 const H323SignalPDU & pdu
00796 );
00797
00804 virtual BOOL OnReceivedSignalSetupAck(
00805 const H323SignalPDU & pdu
00806 );
00807
00814 virtual BOOL OnReceivedSignalInformation(
00815 const H323SignalPDU & pdu
00816 );
00817
00826 virtual BOOL OnReceivedCallProceeding(
00827 const H323SignalPDU & pdu
00828 );
00829
00838 virtual BOOL OnReceivedProgress(
00839 const H323SignalPDU & pdu
00840 );
00841
00848 virtual BOOL OnReceivedAlerting(
00849 const H323SignalPDU & pdu
00850 );
00851
00860 virtual BOOL OnReceivedSignalConnect(
00861 const H323SignalPDU & pdu
00862 );
00863
00872 virtual BOOL OnReceivedFacility(
00873 const H323SignalPDU & pdu
00874 );
00875
00882 virtual BOOL OnReceivedSignalNotify(
00883 const H323SignalPDU & pdu
00884 );
00885
00892 virtual BOOL OnReceivedSignalStatus(
00893 const H323SignalPDU & pdu
00894 );
00895
00902 virtual BOOL OnReceivedStatusEnquiry(
00903 const H323SignalPDU & pdu
00904 );
00905
00910 virtual void OnReceivedReleaseComplete(
00911 const H323SignalPDU & pdu
00912 );
00913
00920 virtual BOOL OnUnknownSignalPDU(
00921 const H323SignalPDU & pdu
00922 );
00923
00935 virtual BOOL OnIncomingCall(
00936 const H323SignalPDU & setupPDU,
00937 H323SignalPDU & alertingPDU
00938 );
00939 virtual BOOL OnIncomingCall(
00940 const H323SignalPDU & setupPDU,
00941 H323SignalPDU & alertingPDU,
00942 CallEndReason & reason
00943 );
00944
00954 virtual BOOL ForwardCall(
00955 const PString & forwardParty
00956 );
00957
00958 #ifdef H323_H450
00959
00964 void TransferCall(
00965 const PString & remoteParty,
00966 const PString & callIdentity = PString::Empty()
00968 );
00969
00974 void ConsultationTransfer(
00975 const PString & primaryCallToken
00976 );
00977
00980 virtual void OnReceivedInitiateReturnError();
00981
00988 virtual void HandleConsultationTransfer(
00989 const PString & callIdentity,
00991 H323Connection & incoming
00992 );
00993
00996 BOOL IsTransferringCall() const;
00997
01000 BOOL IsTransferredCall() const;
01001
01006 virtual void HandleTransferCall(
01007 const PString & token,
01008 const PString & identity
01009 );
01010
01015 int GetCallTransferInvokeId();
01016
01024 virtual void HandleCallTransferFailure(
01025 const int returnError
01026 );
01027
01032 void SetAssociatedCallToken(
01033 const PString & token
01034 );
01035
01040 virtual void OnConsultationTransferSuccess(
01041 H323Connection & secondaryCall
01042 );
01043
01048 virtual void SetCallLinkage(
01049 H225_AdmissionRequest & arq
01050 );
01051
01056 virtual void GetCallLinkage(
01057 const H225_AdmissionRequest & arq
01058 );
01059
01065 BOOL GetRedirectingNumber(
01066 PString &originalCalledNr,
01067 PString &lastDivertingNr,
01068 int &divCounter,
01069 int &originaldivReason,
01070 int &divReason);
01071
01076 void HoldCall(
01077 BOOL localHold
01078 );
01079
01085 void RetrieveCall();
01086
01093 void SetHoldMedia(
01094 PChannel * audioChannel
01095 );
01096
01100 virtual PChannel * OnCallHold(BOOL IsEncoder,
01101 unsigned sessionId,
01102 unsigned bufferSize,
01103 PChannel * channel);
01104
01108 virtual PChannel * OnCallRetrieve(BOOL IsEncoder,
01109 unsigned sessionId,
01110 unsigned bufferSize,
01111 PChannel * channel);
01112
01115 BOOL IsMediaOnHold() const;
01116
01119 BOOL IsLocalHold() const;
01120
01123 BOOL IsRemoteHold() const;
01124
01127 BOOL IsCallOnHold() const;
01128
01133 virtual void IntrudeCall(
01134 unsigned capabilityLevel
01135 );
01136
01141 virtual void HandleIntrudeCall(
01142 const PString & token,
01143 const PString & identity
01144 );
01145
01151 void SetCallIntrusion() { isCallIntrusion = TRUE; }
01152
01153 BOOL IsCallIntrusion() { return isCallIntrusion; }
01154
01157 unsigned GetLocalCallIntrusionProtectionLevel() { return callIntrusionProtectionLevel; }
01158
01162 virtual BOOL GetRemoteCallIntrusionProtectionLevel(
01163 const PString & callToken,
01164 unsigned callIntrusionProtectionLevel
01165 );
01166
01167 virtual void SetIntrusionImpending();
01168
01169 virtual void SetForcedReleaseAccepted();
01170
01171 virtual void SetIntrusionNotAuthorized();
01172
01179 void SendCallWaitingIndication(
01180 const unsigned nbOfAddWaitingCalls = 0
01181 );
01182
01183 #endif // H323_H450
01184
01185 enum AnswerCallResponse {
01186 AnswerCallNow,
01187 AnswerCallDenied,
01188 AnswerCallPending,
01189 AnswerCallDeferred,
01190 AnswerCallAlertWithMedia,
01191 AnswerCallDeferredWithMedia,
01192 AnswerCallDeniedByInvalidCID,
01193 NumAnswerCallResponses
01194 };
01195 #if PTRACING
01196 friend ostream & operator<<(ostream & o, AnswerCallResponse s);
01197 #endif
01198
01225 virtual AnswerCallResponse OnAnswerCall(
01226 const PString & callerName,
01227 const H323SignalPDU & setupPDU,
01228 H323SignalPDU & connectPDU
01229 );
01230
01241 void AnsweringCall(
01242 AnswerCallResponse response
01243 );
01244
01255 virtual CallEndReason SendSignalSetup(
01256 const PString & alias,
01257 const H323TransportAddress & address
01258 );
01259
01271 virtual BOOL OnSendSignalSetup(
01272 H323SignalPDU & setupPDU
01273 );
01274
01283 virtual BOOL OnSendCallProceeding(
01284 H323SignalPDU & callProceedingPDU
01285 );
01286
01298 virtual BOOL OnSendReleaseComplete(
01299 H323SignalPDU & releaseCompletePDU
01300 );
01301
01312 virtual BOOL OnAlerting(
01313 const H323SignalPDU & alertingPDU,
01314 const PString & user
01315 );
01316
01331 virtual BOOL OnInsufficientDigits();
01332
01345 virtual void SendMoreDigits(
01346 const PString & digits
01347 );
01348
01358 virtual BOOL OnOutgoingCall(
01359 const H323SignalPDU & connectPDU
01360 );
01361
01373 virtual BOOL SendFastStartAcknowledge(
01374 H225_ArrayOf_PASN_OctetString & array
01375 );
01376
01388 virtual BOOL HandleFastStartAcknowledge(
01389 const H225_ArrayOf_PASN_OctetString & array
01390 );
01391
01399 virtual BOOL StartControlChannel();
01400
01412 virtual BOOL StartControlChannel(
01413 const H225_TransportAddress & h245Address
01414 );
01416
01423 BOOL WriteControlPDU(
01424 const H323ControlPDU & pdu
01425 );
01426
01429 virtual BOOL StartControlNegotiations(
01430 BOOL renegotiate = FALSE
01431 );
01432
01435 virtual void HandleControlChannel();
01436
01443 virtual BOOL HandleControlData(
01444 PPER_Stream & strm
01445 );
01446
01453 virtual BOOL HandleControlPDU(
01454 const H323ControlPDU & pdu
01455 );
01456
01466 virtual BOOL OnUnknownControlPDU(
01467 const H323ControlPDU & pdu
01468 );
01469
01473 virtual BOOL OnH245Request(
01474 const H323ControlPDU & pdu
01475 );
01476
01480 virtual BOOL OnH245Response(
01481 const H323ControlPDU & pdu
01482 );
01483
01487 virtual BOOL OnH245Command(
01488 const H323ControlPDU & pdu
01489 );
01490
01494 virtual BOOL OnH245Indication(
01495 const H323ControlPDU & pdu
01496 );
01497
01500 virtual BOOL OnH245_SendTerminalCapabilitySet(
01501 const H245_SendTerminalCapabilitySet & pdu
01502 );
01503
01508 virtual BOOL OnH245_FlowControlCommand(
01509 const H245_FlowControlCommand & pdu
01510 );
01511
01516 virtual BOOL OnH245_MiscellaneousCommand(
01517 const H245_MiscellaneousCommand & pdu
01518 );
01519
01524 virtual BOOL OnH245_MiscellaneousIndication(
01525 const H245_MiscellaneousIndication & pdu
01526 );
01527
01532 virtual BOOL OnH245_JitterIndication(
01533 const H245_JitterIndication & pdu
01534 );
01535
01538 enum ControlProtocolErrors {
01539 e_MasterSlaveDetermination,
01540 e_CapabilityExchange,
01541 e_LogicalChannel,
01542 e_ModeRequest,
01543 e_RoundTripDelay
01544 };
01545
01557 virtual BOOL OnControlProtocolError(
01558 ControlProtocolErrors errorSource,
01559 const void * errorData = NULL
01560 );
01561
01569 virtual void OnSendCapabilitySet(
01570 H245_TerminalCapabilitySet & pdu
01571 );
01572
01584 virtual BOOL OnReceivedCapabilitySet(
01585 const H323Capabilities & remoteCaps,
01586 const H245_MultiplexCapability * muxCap,
01587 H245_TerminalCapabilitySetReject & reject
01588 );
01589
01592 virtual void SendCapabilitySet(
01593 BOOL empty
01594 );
01595
01604 virtual void OnSetLocalCapabilities();
01605
01608 BOOL IsH245Master() const;
01609
01612 void StartRoundTripDelay();
01613
01616 PTimeInterval GetRoundTripDelay() const;
01618
01658 virtual void OnSelectLogicalChannels();
01659
01662 virtual void SelectDefaultLogicalChannel(
01663 unsigned sessionID
01664 );
01665
01669 virtual void SelectFastStartChannels(
01670 unsigned sessionID,
01671 BOOL transmitter,
01672 BOOL receiver
01673 );
01674
01689 virtual BOOL OpenLogicalChannel(
01690 const H323Capability & capability,
01691 unsigned sessionID,
01692 H323Channel::Directions dir
01693 );
01694
01704 virtual BOOL OnOpenLogicalChannel(
01705 const H245_OpenLogicalChannel & openPDU,
01706 H245_OpenLogicalChannelAck & ackPDU,
01707 unsigned & errorCode
01708 );
01709
01717 virtual BOOL OnConflictingLogicalChannel(
01718 H323Channel & channel
01719 );
01720
01725 virtual H323Channel * CreateLogicalChannel(
01726 const H245_OpenLogicalChannel & open,
01727 BOOL startingFast,
01728 unsigned & errorCode
01729 );
01730
01766 virtual H323Channel * CreateRealTimeLogicalChannel(
01767 const H323Capability & capability,
01768 H323Channel::Directions dir,
01769 unsigned sessionID,
01770 const H245_H2250LogicalChannelParameters * param,
01772 RTP_QOS * rtpqos = NULL
01773 );
01774
01785 virtual BOOL OnCreateLogicalChannel(
01786 const H323Capability & capability,
01787 H323Channel::Directions dir,
01788 unsigned & errorCode
01789 );
01790
01795 virtual BOOL OnStartLogicalChannel(
01796 H323Channel & channel
01797 );
01798
01799 #ifndef NO_H323_AUDIO_CODECS
01800
01806 virtual BOOL OpenAudioChannel(
01807 BOOL isEncoding,
01808 unsigned bufferSize,
01809 H323AudioCodec & codec
01810 );
01811 #endif
01812
01813 #ifndef NO_H323_VIDEO
01814
01820 virtual BOOL OpenVideoChannel(
01821 BOOL isEncoding,
01822 H323VideoCodec & codec
01823 );
01824 #endif // NO_H323_VIDEO
01825
01828 virtual void CloseLogicalChannel(
01829 unsigned number,
01830 BOOL fromRemote
01831 );
01832
01835 virtual void CloseLogicalChannelNumber(
01836 const H323ChannelNumber & number
01837 );
01838
01841 virtual void CloseAllLogicalChannels(
01842 BOOL fromRemote
01843 );
01844
01850 virtual void OnClosedLogicalChannel(
01851 const H323Channel & channel
01852 );
01853
01862 virtual BOOL OnClosingLogicalChannel(
01863 H323Channel & channel
01864 );
01865
01874 virtual void OnLogicalChannelFlowControl(
01875 H323Channel * channel,
01876 long bitRateRestriction
01877 );
01878
01887 virtual void OnLogicalChannelJitter(
01888 H323Channel * channel,
01889 DWORD jitter,
01890 int skippedFrameCount,
01891 int additionalBuffer
01892 );
01893
01896 void SendLogicalChannelMiscCommand(
01897 H323Channel & channel,
01898 unsigned command
01899 );
01900
01904 H323Channel * GetLogicalChannel(
01905 unsigned number,
01906 BOOL fromRemote
01907 ) const;
01908
01914 H323Channel * FindChannel(
01915 unsigned sessionId,
01916 BOOL fromRemote
01917 ) const;
01919
01926 unsigned GetBandwidthUsed() const;
01927
01933 BOOL UseBandwidth(
01934 unsigned bandwidth,
01935 BOOL removing
01936 );
01937
01940 unsigned GetBandwidthAvailable() const { return bandwidthAvailable; }
01941
01946 BOOL SetBandwidthAvailable(
01947 unsigned newBandwidth,
01948 BOOL force = FALSE
01949 );
01951
01954 enum SendUserInputModes {
01955 SendUserInputAsQ931,
01956 SendUserInputAsString,
01957 SendUserInputAsTone,
01958 SendUserInputAsInlineRFC2833,
01959 SendUserInputAsSeparateRFC2833,
01960 NumSendUserInputModes
01961 };
01962 #if PTRACING
01963 friend ostream & operator<<(ostream & o, SendUserInputModes m);
01964 #endif
01965
01968 void SetSendUserInputMode(SendUserInputModes mode);
01969
01972 SendUserInputModes GetSendUserInputMode() const { return sendUserInputMode; }
01973
01979 SendUserInputModes GetRealSendUserInputMode() const;
01980
01994 virtual void SendUserInput(
01995 const PString & value
01996 );
01997
02004 virtual void OnUserInputString(
02005 const PString & value
02006 );
02007
02032 virtual void SendUserInputTone(
02033 char tone,
02034 unsigned duration = 0,
02035 unsigned logicalChannel = 0,
02036 unsigned rtpTimestamp = 0
02037 );
02038
02043 virtual void OnUserInputTone(
02044 char tone,
02045 unsigned duration,
02046 unsigned logicalChannel,
02047 unsigned rtpTimestamp
02048 );
02049
02053 void SendUserInputHookFlash(
02054 int duration = 500
02055 ) { SendUserInputTone('!', duration); }
02056
02063 virtual void SendUserInputIndicationQ931(
02064 const PString & value
02065 );
02066
02073 virtual void SendUserInputIndicationString(
02074 const PString & value
02075 );
02076
02081 virtual void SendUserInputIndicationTone(
02082 char tone,
02083 unsigned duration = 0,
02084 unsigned logicalChannel = 0,
02085 unsigned rtpTimestamp = 0
02086 );
02087
02096 virtual void SendUserInputIndication(
02097 const H245_UserInputIndication & pdu
02098 );
02099
02104 virtual void OnUserInputIndication(
02105 const H245_UserInputIndication & pdu
02106 );
02108
02114 virtual RTP_Session * GetSession(
02115 unsigned sessionID
02116 ) const;
02117
02121 virtual H323_RTP_Session * GetSessionCallbacks(
02122 unsigned sessionID
02123 ) const;
02124
02134 virtual RTP_Session * UseSession(
02135 unsigned sessionID,
02136 const H245_TransportAddress & pdu,
02137 H323Channel::Directions dir,
02138 RTP_QOS * rtpqos = NULL
02139 );
02140
02144 virtual void ReleaseSession(
02145 unsigned sessionID
02146 );
02147
02155 virtual void OnRTPStatistics(
02156 const RTP_Session & session
02157 ) const;
02158
02162 virtual PString GetSessionCodecNames(
02163 unsigned sessionID
02164 ) const;
02165
02168 BOOL IsBehindNAT() const
02169 { return remoteIsNAT; }
02170
02173 void SetRemoteNAT()
02174 { remoteIsNAT = TRUE; }
02175
02177
02195 virtual BOOL RequestModeChange(
02196 const PString & newModes
02197 );
02198
02206 virtual BOOL RequestModeChange(
02207 const H245_ArrayOf_ModeDescription & newModes
02208 );
02209
02212 virtual BOOL OnRequestModeChange(
02213 const H245_RequestMode & pdu,
02214 H245_RequestModeAck & ack,
02215 H245_RequestModeReject & reject,
02216 PINDEX & selectedMode
02217 );
02218
02225 virtual void OnModeChanged(
02226 const H245_ModeDescription & newMode
02227 );
02228
02233 virtual void OnAcceptModeChange(
02234 const H245_RequestModeAck & pdu
02235 );
02236
02241 virtual void OnRefusedModeChange(
02242 const H245_RequestModeReject * pdu
02243 );
02245
02246 #ifdef H323_T120
02247
02261 virtual OpalT120Protocol * CreateT120ProtocolHandler();
02262 #endif
02263
02264 #ifdef H323_T38
02265
02277 virtual OpalT38Protocol * CreateT38ProtocolHandler();
02278
02281 virtual BOOL RequestModeChangeT38(
02282 const char * capabilityNames = "T.38\nT38FaxUDP"
02283 );
02284 #endif
02285
02286 #ifdef OPAL_H224
02287
02299 virtual OpalH224Handler *CreateH224ProtocolHandler(unsigned sessionID);
02300
02310 virtual OpalH281Handler *CreateH281ProtocolHandler(OpalH224Handler & h224Handler);
02311 #endif
02312
02322 virtual BOOL GetAdmissionRequestAuthentication(
02323 const H225_AdmissionRequest & arq,
02324 H235Authenticators & authenticators
02325 );
02327
02332 H323EndPoint & GetEndPoint() const { return endpoint; }
02333
02336 BOOL HadAnsweredCall() const { return callAnswered; }
02337
02340 BOOL IsGatekeeperRouted() const { return gatekeeperRouted; }
02341
02345 unsigned GetQ931Cause() const { return q931Cause; }
02346
02350 void SetQ931Cause(unsigned v) { q931Cause = v; }
02351
02356 unsigned GetDistinctiveRing() const { return distinctiveRing; }
02357
02364 void SetDistinctiveRing(unsigned pattern) { distinctiveRing = pattern&7; }
02365
02368 const PString & GetCallToken() const { return callToken; }
02369
02372 unsigned GetCallReference() const { return callReference; }
02373
02376 const OpalGloballyUniqueID & GetCallIdentifier() const { return callIdentifier; }
02377
02380 const OpalGloballyUniqueID & GetConferenceIdentifier() const { return conferenceIdentifier; }
02381
02384 const PString & GetLocalPartyName() const { return localPartyName; }
02385
02388 void SetLocalPartyName(const PString & name);
02389
02392 void SetDisplayName(const PString & name) { localDisplayName = name; }
02393
02396 const PString GetDisplayName() const { return localDisplayName; }
02397
02398 const PStringList & GetLocalAliasNames() const { return localAliasNames; }
02399
02406 const PString & GetRemotePartyName() const { return remotePartyName; }
02407
02412 const PString & GetRemotePartyNumber() const { return remotePartyNumber; }
02413
02420 const PString & GetRemotePartyAddress() const { return remotePartyAddress; }
02421
02424 void SetRemotePartyInfo(
02425 const H323SignalPDU & pdu
02426 );
02427
02439 const PString & GetRemoteApplication() const { return remoteApplication; }
02440
02443 void SetRemoteApplication(
02444 const H225_EndpointType & pdu
02445 );
02446
02449 const H323Capabilities & GetLocalCapabilities() const { return localCapabilities; }
02450
02453 const H323Capabilities & GetRemoteCapabilities() const { return remoteCapabilities; }
02454
02457 unsigned GetRemoteMaxAudioDelayJitter() const { return remoteMaxAudioDelayJitter; }
02458
02461 const H323Transport * GetSignallingChannel() const { return signallingChannel; }
02462
02465 unsigned GetSignallingVersion() const { return h225version; }
02466
02469 const H323Transport & GetControlChannel() const;
02470
02473 unsigned GetControlVersion() const { return h245version; }
02474
02477 PTime GetSetupUpTime() const { return setupTime; }
02478
02481 PTime GetAlertingTime() const { return alertingTime; }
02482
02486 PTime GetConnectionStartTime() const { return connectedTime; }
02487
02490 PTime GetConnectionEndTime() const { return callEndTime; }
02491
02494 PTime GetReverseMediaOpenTime() const { return reverseMediaOpenTime; }
02495
02499 unsigned GetMinAudioJitterDelay() const { return minAudioJitterDelay; }
02500
02504 unsigned GetMaxAudioJitterDelay() const { return maxAudioJitterDelay; }
02505
02508 void SetAudioJitterDelay(
02509 unsigned minDelay,
02510 unsigned maxDelay
02511 );
02512
02515 unsigned GetUUIEsRequested() const { return uuiesRequested; }
02516
02519 void SetUUIEsRequested(unsigned mask) { uuiesRequested = mask; }
02520
02523 const PString GetGkAccessTokenOID() const { return gkAccessTokenOID; }
02524
02527 void SetGkAccessTokenOID(const PString & oid) { gkAccessTokenOID = oid; }
02528
02531 const PBYTEArray & GetGkAccessTokenData() const { return gkAccessTokenData; }
02532
02535 void SetDestExtraCallInfo(
02536 const PString & info
02537 ) { destExtraCallInfo = info; }
02538
02541 void SetRemoteCallWaiting(const unsigned value) { remoteCallWaiting = value; }
02542
02548 const int GetRemoteCallWaiting() const { return remoteCallWaiting; }
02549
02554 void SetEnforcedDurationLimit(
02555 unsigned seconds
02556 );
02558
02559 virtual BOOL OnSendFeatureSet(unsigned, H225_FeatureSet &) const;
02560
02561 virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet &) const;
02562
02563 #ifndef DISABLE_CALLAUTH
02564
02568 const H235Authenticators & GetEPAuthenticators() const;
02569
02574 virtual void SetAuthenticationConnection();
02575
02580 virtual BOOL OnCallAuthentication(const PString & username,
02581 PString & password);
02582
02586 virtual void OnAuthenticationFinalise(unsigned pdu,PBYTEArray & rawData);
02587
02590 BOOL HasAuthentication() const
02591 { return hasAuthentication; }
02593 #endif
02594
02595 #ifdef H323_H248
02596
02600 BOOL OnSendServiceControlSessions(
02601 H225_ArrayOf_ServiceControlSession & serviceControl,
02602 H225_ServiceControlSession_reason reason
02603 ) const;
02604
02607 void OnReceiveServiceControlSessions(
02608 const H225_ArrayOf_ServiceControlSession & serviceControl
02609 );
02610
02613 virtual void OnReceiveServiceControl(const PString & amount,
02614 BOOL credit,
02615 const unsigned & timelimit,
02616 const PString & url
02617 );
02618
02621 virtual BOOL OnSendServiceControl(PString & amount,
02622 BOOL credit,
02623 unsigned & timelimit,
02624 PString & url
02625 ) const;
02627 #endif
02628
02633 virtual void DisableH245inSETUP();
02634
02637 virtual void SetNonCallConnection();
02638
02639 #ifdef H323_H460
02640
02642 virtual H460_FeatureSet * GetFeatureSet();
02643 #endif
02644
02645
02646 enum ReleaseSequence {
02647 ReleaseSequenceUnknown,
02648 ReleaseSequence_Local,
02649 ReleaseSequence_Remote
02650 };
02651
02652 ReleaseSequence GetReleaseSequence() const
02653 { return releaseSequence; }
02654
02655 virtual BOOL OnHandleConferenceRequest(const H245_ConferenceRequest &)
02656 { return FALSE; }
02657
02658 virtual BOOL OnHandleConferenceResponse(const H245_ConferenceResponse &)
02659 { return FALSE; }
02660
02661 virtual BOOL OnHandleConferenceCommand(const H245_ConferenceCommand &)
02662 { return FALSE; }
02663
02664 virtual BOOL OnHandleConferenceIndication(const H245_ConferenceIndication &)
02665 { return FALSE; }
02666
02667 protected:
02673 virtual void InternalEstablishedConnectionCheck();
02674 BOOL DecodeFastStartCaps(const H225_ArrayOf_PASN_OctetString & fastStartCaps);
02675 BOOL InternalEndSessionCheck(PPER_Stream & strm);
02676 void SetRemoteVersions(const H225_ProtocolIdentifier & id);
02677 void MonitorCallStatus();
02678 PDECLARE_NOTIFIER(OpalRFC2833Info, H323Connection, OnUserInputInlineRFC2833);
02679 PDECLARE_NOTIFIER(H323Codec::FilterInfo, H323Connection, OnUserInputInBandDTMF);
02680
02681 H323EndPoint & endpoint;
02682 PSyncPoint * endSync;
02683
02684 int remoteCallWaiting;
02685 BOOL callAnswered;
02686 BOOL gatekeeperRouted;
02687 unsigned distinctiveRing;
02688 PString callToken;
02689 unsigned callReference;
02690 OpalGloballyUniqueID callIdentifier;
02691 OpalGloballyUniqueID conferenceIdentifier;
02692
02693 PStringList localAliasNames;
02694 PString localPartyName;
02695 PString localDisplayName;
02696 H323Capabilities localCapabilities;
02697 PString remotePartyName;
02698 PString remotePartyNumber;
02699 PString remotePartyAddress;
02700 PString destExtraCallInfo;
02701 PString remoteApplication;
02702 H323Capabilities remoteCapabilities;
02703 unsigned remoteMaxAudioDelayJitter;
02704 PTimer roundTripDelayTimer;
02705 unsigned minAudioJitterDelay;
02706 unsigned maxAudioJitterDelay;
02707 unsigned bandwidthAvailable;
02708 unsigned uuiesRequested;
02709 PString gkAccessTokenOID;
02710 PBYTEArray gkAccessTokenData;
02711 BOOL addAccessTokenToSetup;
02712 SendUserInputModes sendUserInputMode;
02713
02714 H323Transport * signallingChannel;
02715 H323Transport * controlChannel;
02716 BOOL h245Tunneling;
02717 H323SignalPDU * h245TunnelRxPDU;
02718 H323SignalPDU * h245TunnelTxPDU;
02719 H323SignalPDU * alertingPDU;
02720 H323SignalPDU * connectPDU;
02721
02722 enum ConnectionStates {
02723 NoConnectionActive,
02724 AwaitingGatekeeperAdmission,
02725 AwaitingTransportConnect,
02726 AwaitingSignalConnect,
02727 AwaitingLocalAnswer,
02728 HasExecutedSignalConnect,
02729 EstablishedConnection,
02730 ShuttingDownConnection,
02731 NumConnectionStates
02732 } connectionState;
02733
02734 PTime setupTime;
02735 PTime alertingTime;
02736 PTime connectedTime;
02737 PTime callEndTime;
02738 PTime reverseMediaOpenTime;
02739 CallEndReason callEndReason;
02740 unsigned q931Cause;
02741 ReleaseSequence releaseSequence;
02742
02743 unsigned h225version;
02744 unsigned h245version;
02745 BOOL h245versionSet;
02746 BOOL doH245inSETUP;
02747 BOOL lastPDUWasH245inSETUP;
02748 BOOL detectInBandDTMF;
02749 BOOL mustSendDRQ;
02750 BOOL mediaWaitForConnect;
02751 BOOL transmitterSidePaused;
02752 BOOL earlyStart;
02753
02754 #ifdef H323_T120
02755 BOOL startT120;
02756 #endif
02757
02758 #ifdef H323_T38
02759 PString t38ModeChangeCapabilities;
02760 #endif
02761
02762 #ifdef OPAL_H224
02763 BOOL startH224;
02764 #endif
02765
02766 PSyncPoint digitsWaitFlag;
02767 BOOL endSessionNeeded;
02768 BOOL endSessionSent;
02769 PSyncPoint endSessionReceived;
02770 PTimer enforcedDurationLimit;
02771
02772 #ifdef H323_H450
02773
02774 PChannel * holdMediaChannel;
02775 BOOL isConsultationTransfer;
02776
02778 BOOL isCallIntrusion;
02779 unsigned callIntrusionProtectionLevel;
02780 #endif
02781
02782 RTP_SessionManager rtpSessions;
02783
02784 enum FastStartStates {
02785 FastStartDisabled,
02786 FastStartInitiate,
02787 FastStartResponse,
02788 FastStartAcknowledged,
02789 NumFastStartStates
02790 };
02791 FastStartStates fastStartState;
02792 H323LogicalChannelList fastStartChannels;
02793
02794 #if PTRACING
02795 static const char * const ConnectionStatesNames[NumConnectionStates];
02796 friend ostream & operator<<(ostream & o, ConnectionStates s) { return o << ConnectionStatesNames[s]; }
02797 static const char * const FastStartStateNames[NumFastStartStates];
02798 friend ostream & operator<<(ostream & o, FastStartStates s) { return o << FastStartStateNames[s]; }
02799 #endif
02800
02801
02802
02803
02804 H245NegMasterSlaveDetermination * masterSlaveDeterminationProcedure;
02805 H245NegTerminalCapabilitySet * capabilityExchangeProcedure;
02806 H245NegLogicalChannels * logicalChannels;
02807 H245NegRequestMode * requestModeProcedure;
02808 H245NegRoundTripDelay * roundTripDelayProcedure;
02809
02810 #ifdef H323_H450
02811 H450xDispatcher * h450dispatcher;
02812 H4502Handler * h4502handler;
02813 H4503Handler * h4503handler;
02814 H4504Handler * h4504handler;
02815 H4506Handler * h4506handler;
02816 H45011Handler * h45011handler;
02817 #endif
02818
02819 OpalRFC2833 * rfc2833handler;
02820
02821 #ifdef H323_T120
02822 OpalT120Protocol * t120handler;
02823 #endif
02824
02825 #ifdef H323_T38
02826 OpalT38Protocol * t38handler;
02827 #endif
02828
02829 #ifdef OPAL_H224
02830 OpalH224Handler * h224handler;
02831 OpalH281Handler * h281handler;
02832 #endif
02833
02834 #ifdef P_DTMF
02835
02836
02837 PDTMFDecoder dtmfDecoder;
02838 #endif
02839
02840
02841 BOOL remoteIsNAT;
02842
02843 #ifdef H323_TRANSNEXUS_OSP
02844 public:
02845 OpalOSP::Transaction * GetOSPTransaction() const
02846 { return ospTransaction; }
02847
02848 void SetOSPTransaction(OpalOSP::Transaction * tran)
02849 { ospTransaction = tran; }
02850
02851 protected:
02852 OpalOSP::Transaction * ospTransaction;
02853 virtual void CleanUpOSP();
02854 BOOL AuthoriseOSPTransaction(OpalOSP::Transaction & transaction, OpalOSP::Transaction::DestinationInfo & destInfo);
02855 #endif
02856
02857 #ifndef DISABLE_CALLAUTH
02858 BOOL AuthenticationFailed;
02859 BOOL hasAuthentication;
02860 const H235Authenticators EPAuthenticators;
02861 #endif
02862
02863 #ifdef HAS_AEC
02864 PAec * aec;
02865 #endif
02866
02867 BOOL IsNonCallConnection;
02868
02869 private:
02870 PChannel * SwapHoldMediaChannels(PChannel * newChannel);
02871
02872 PTimedMutex outerMutex;
02873 PMutex innerMutex;
02874
02875 public:
02876 BOOL StartHandleControlChannel();
02877 void EndHandleControlChannel();
02878
02879 #ifdef H323_RTP_AGGREGATE
02880 private:
02881 BOOL useRTPAggregation;
02882 #endif
02883
02884 #ifdef H323_SIGNAL_AGGREGATE
02885 public:
02886 void AggregateSignalChannel(H323Transport * transport);
02887 void AggregateControlChannel(H323Transport * transport);
02888 protected:
02889 BOOL useSignallingAggregation;
02890 H323AggregatedH2x5Handle * signalAggregator;
02891 H323AggregatedH2x5Handle * controlAggregator;
02892 #endif
02893
02894 #ifdef H323_H248
02895 PDictionary<POrdinalKey, H323ServiceControlSession> serviceControlSessions;
02896 #endif
02897
02898 #ifdef H323_H460
02899 H460_FeatureSet & features;
02900 #endif
02901
02902 #ifdef OPAL_H224
02903 OpalH224Handler * h224Handler;
02904 #endif
02905 };
02906
02907
02908 PLIST(H323ConnectionList, H323Connection);
02909 PDICTIONARY(H323ConnectionDict, PString, H323Connection);
02910 PDICTIONARY(H323CallIdentityDict, PString, H323Connection);
02911
02912
02913 #endif // __OPAL_H323CON_H
02914
02915