OPAL  Version 3.10.10
h323ep.h
Go to the documentation of this file.
1 /*
2  * h323ep.h
3  *
4  * H.323 protocol handler
5  *
6  * Open H323 Library
7  *
8  * Copyright (c) 1998-2001 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Open H323 Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Portions of this code were written with the assisance of funding from
25  * Vovida Networks, Inc. http://www.vovida.com.
26  *
27  * Contributor(s): ______________________________________.
28  *
29  * $Revision: 28579 $
30  * $Author: rjongbloed $
31  * $Date: 2012-11-25 23:46:48 -0600 (Sun, 25 Nov 2012) $
32  */
33 
34 #ifndef OPAL_H323_H323EP_H
35 #define OPAL_H323_H323EP_H
36 
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40 
41 #include <opal/buildopts.h>
42 
43 #if OPAL_H323
44 
45 #include <opal/rtpep.h>
46 #include <opal/manager.h>
47 #include <opal/call.h>
48 #include <opal/transports.h>
49 #include <h323/h323con.h>
50 #include <h323/h323caps.h>
51 #include <h323/h235auth.h>
52 #include <asn/h225.h>
53 
54 #if OPAL_H460
55 #include <h460/h4601.h>
56 #endif
57 
58 
59 class H225_EndpointType;
60 class H225_VendorIdentifier;
61 class H225_H221NonStandard;
62 class H225_ServiceControlDescriptor;
63 class H225_FeatureSet;
64 
65 class H235SecurityInfo;
66 
67 class H323Gatekeeper;
68 class H323SignalPDU;
70 
72 
86 {
87  PCLASSINFO(H323EndPoint, OpalRTPEndPoint);
88 
89  public:
90  enum {
92  };
93 
100  );
101 
104  ~H323EndPoint();
106 
113  virtual void ShutDown();
114 
144  virtual PSafePtr<OpalConnection> MakeConnection(
145  OpalCall & call,
146  const PString & party,
147  void * userData = NULL,
148  unsigned int options = NULL,
149  OpalConnection::StringOptions * stringOptions = NULL
150  );
152 
157  virtual void SetEndpointTypeInfo(
158  H225_EndpointType & info
159  ) const;
160 
163  virtual void SetVendorIdentifierInfo(
164  H225_VendorIdentifier & info
165  ) const;
166 
169  virtual void SetH221NonStandardInfo(
170  H225_H221NonStandard & info
171  ) const;
172 
175  virtual bool SetGatewaySupportedProtocol(
176  H225_ArrayOf_SupportedProtocols & protocols
177  ) const;
178 
182  virtual bool OnSetGatewayPrefixes(
183  PStringList & prefixes
184  ) const;
186 
187 
198  void AddCapability(
199  H323Capability * capability
200  );
201 
222  PINDEX SetCapability(
223  PINDEX descriptorNum,
224  PINDEX simultaneous,
225  H323Capability * cap
226  );
227 
232  PINDEX AddAllCapabilities(
233  PINDEX descriptorNum,
234  PINDEX simultaneous,
235  const PString & name
236  );
237 
241  PINDEX descriptorNum,
242  PINDEX simultaneous
243  );
244 
247  void RemoveCapabilities(
248  const PStringArray & codecNames
249  );
250 
253  void ReorderCapabilities(
254  const PStringArray & preferenceOrder
255  );
256 
260  const H245_Capability & cap
261  ) const;
262 
266  const H245_DataType & dataType
267  ) const;
268 
272  H323Capability::MainTypes mainType,
273  unsigned subType
274  ) const;
276 
299  PBoolean UseGatekeeper(
300  const PString & address = PString::Empty(),
301  const PString & identifier = PString::Empty(),
302  const PString & localAddress = PString::Empty()
303  );
304 
315  PBoolean SetGatekeeper(
316  const PString & address,
317  H323Transport * transport = NULL
318  );
319 
334  PBoolean SetGatekeeperZone(
335  const PString & address,
336  const PString & identifier,
337  H323Transport * transport = NULL
338  );
339 
349  PBoolean LocateGatekeeper(
350  const PString & identifier,
351  H323Transport * transport = NULL
352  );
353 
362  PBoolean DiscoverGatekeeper(
363  H323Transport * transport = NULL
364  );
365 
374  H323Transport * transport
375  );
376 
380 
383  PBoolean IsRegisteredWithGatekeeper() const;
384 
390  PBoolean RemoveGatekeeper(
391  int reason = -1
392  );
393 
396  virtual void SetGatekeeperPassword(
397  const PString & password,
398  const PString & username = PString::Empty()
399  );
400 
403  virtual const PString & GetGatekeeperUsername() const { return gatekeeperUsername; }
404 
407  virtual const PString & GetGatekeeperPassword() const { return gatekeeperPassword; }
408 
411  virtual H235Authenticators CreateAuthenticators();
412 
415  virtual void OnGatekeeperConfirm();
416 
419  virtual void OnGatekeeperReject();
420 
423  virtual void OnRegistrationConfirm();
424 
427  virtual void OnRegistrationReject();
429 
434  virtual PBoolean NewIncomingConnection(
435  OpalTransport * transport
436  );
437 
441  OpalCall & call,
442  const PString & token,
443  void * userData,
444  OpalTransport & transport,
445  const PString & alias,
446  const H323TransportAddress & address,
447  H323SignalPDU * setupPDU,
448  unsigned options = 0,
449  OpalConnection::StringOptions * stringOptions = NULL
450  );
451 
467  virtual PBoolean SetupTransfer(
468  const PString & token,
469  const PString & callIdentity,
470  const PString & remoteParty,
471  void * userData = NULL
472  );
473 
479  void TransferCall(
480  const PString & token,
481  const PString & remoteParty,
482  const PString & callIdentity = PString::Empty()
484  );
485 
493  const PString & primaryCallToken,
494  const PString & secondaryCallToken
495  );
496 
500  PBoolean IntrudeCall(
501  const PString & remoteParty,
502  unsigned capabilityLevel,
503  void * userData = NULL
504  );
505 
512  PBoolean ParsePartyName(
513  const PString & party,
514  PString & alias,
515  H323TransportAddress & address,
516  OpalConnection::StringOptions * stringOptions = NULL
517  );
518 
529  PSafePtr<H323Connection> FindConnectionWithLock(
530  const PString & token,
531  PSafetyMode mode = PSafeReadWrite
532  );
533 
541  virtual PBoolean OnSendSignalSetup(H323Connection & connection,
542  H323SignalPDU & setupPDU);
543 
555  virtual PBoolean OnSendCallProceeding(
556  H323Connection & connection,
557  H323SignalPDU & callProceedingPDU
558  );
559 
571  virtual PBoolean OnSendConnect(
572  H323Connection & connection,
573  H323SignalPDU & connectPDU
574  );
575 
587  virtual PBoolean OnIncomingCall(
588  H323Connection & connection,
589  const H323SignalPDU & setupPDU,
590  H323SignalPDU & alertingPDU
591  );
592 
599  virtual PBoolean OnOutgoingCall(
600  H323Connection & conn,
601  const H323SignalPDU & connectPDU
602  );
603 
608  virtual PBoolean OnCallTransferInitiate(
609  H323Connection & connection,
610  const PString & remoteParty
611  );
612 
617  virtual PBoolean OnCallTransferIdentify(
618  H323Connection & connection
619  );
620 
625  virtual void OnSendARQ(
626  H323Connection & conn,
627  H225_AdmissionRequest & arq
628  );
629 
637  H323Connection & connection,
638  const PString & callerName,
639  const H323SignalPDU & setupPDU,
640  H323SignalPDU & connectPDU,
641  H323SignalPDU & progressPDU
642  );
644  OpalConnection & connection,
645  const PString & caller
646  );
647 
658  virtual PBoolean OnAlerting(
659  H323Connection & connection,
660  const H323SignalPDU & alertingPDU,
661  const PString & user
662  );
663 
668  virtual PBoolean OnSendAlerting(
669  H323Connection & connection,
670  H323SignalPDU & alerting,
671  const PString & calleeName,
672  PBoolean withMedia
673  );
674 
678  virtual PBoolean OnSentAlerting(
679  H323Connection & connection
680  );
681 
690  virtual PBoolean OnConnectionForwarded(
691  H323Connection & connection,
692  const PString & forwardParty,
693  const H323SignalPDU & pdu
694  );
695 
704  virtual PBoolean ForwardConnection(
705  H323Connection & connection,
706  const PString & forwardParty,
707  const H323SignalPDU & pdu
708  );
709 
716  virtual void OnConnectionEstablished(
717  H323Connection & connection,
718  const PString & token
719  );
720 
723  virtual PBoolean IsConnectionEstablished(
724  const PString & token
725  );
727 
728 
735  virtual PBoolean OnStartLogicalChannel(
736  H323Connection & connection,
737  H323Channel & channel
738  );
739 
744  virtual void OnClosedLogicalChannel(
745  H323Connection & connection,
746  const H323Channel & channel
747  );
748 
756  virtual void OnRTPStatistics(
757  const H323Connection & connection,
758  const RTP_Session & session
759  ) const;
760 
766  virtual void OnGatekeeperNATDetect(
767  PIPSocket::Address publicAddr,
768  PString & gkIdentifier,
769  H323TransportAddress & gkRouteAddress
770  );
772 
782  virtual void OnHTTPServiceControl(
783  unsigned operation,
784  unsigned sessionId,
785  const PString & url
786  );
787 
797  virtual void OnCallCreditServiceControl(
798  const PString & amount,
799  PBoolean mode
800  );
801 
805  virtual void OnServiceControlSession(
806  unsigned type,
807  unsigned sessionid,
808  const H323ServiceControlSession & session,
809  H323Connection * connection
810  );
811 
815  const H225_ServiceControlDescriptor & contents
816  );
818 
826  virtual PBoolean OnConferenceInvite(
827  const H323SignalPDU & setupPDU
828  );
829 
835  virtual PBoolean OnCallIndependentSupplementaryService(
836  const H323SignalPDU & setupPDU
837  );
838 
844  virtual PBoolean OnNegotiateConferenceCapabilities(
845  const H323SignalPDU & setupPDU
846  );
848 
853  virtual void SetDefaultLocalPartyName(
854  const PString & name
855  );
856 
865  virtual void SetLocalUserName(
866  const PString & name
867  );
868 
873  virtual const PString & GetLocalUserName() const { return localAliasNames.front(); }
874 
881  PBoolean AddAliasName(
882  const PString & name
883  );
884 
888  PBoolean RemoveAliasName(
889  const PString & name
890  );
891 
896  const PStringList & GetAliasNames() const { return localAliasNames; }
897 
900  const PStringList & GetAliasNamePatterns() const { return localAliasPatterns; }
901 
905  PBoolean AddAliasNamePattern(
906  const PString & pattern
907  );
908 
911  const PString & GetDefaultILSServer() const { return manager.GetDefaultILSServer(); }
912 
916  const PString & server
917  ) { manager.SetDefaultILSServer(server); }
918 
921  PBoolean IsFastStartDisabled() const
922  { return disableFastStart; }
923 
927  PBoolean mode
928  ) { disableFastStart = mode; }
929 
932  PBoolean IsH245TunnelingDisabled() const
933  { return disableH245Tunneling; }
934 
938  PBoolean mode
939  ) { disableH245Tunneling = mode; }
940 
943  PBoolean IsH245inSetupDisabled() const
944  { return disableH245inSetup; }
945 
949  PBoolean mode
950  ) { disableH245inSetup = mode; }
951 
955  PBoolean IsH245Disabled() const
956  { return m_bH245Disabled; }
957 
961  void DisableH245(PBoolean bH245Disabled) { m_bH245Disabled = bH245Disabled; }
962 
965  PBoolean CanDisplayAmountString() const
966  { return canDisplayAmountString; }
967 
971  PBoolean mode
972  ) { canDisplayAmountString = mode; }
973 
976  PBoolean CanEnforceDurationLimit() const
977  { return canEnforceDurationLimit; }
978 
982  PBoolean mode
983  ) { canEnforceDurationLimit = mode; }
984 
985 #if OPAL_H450
986 
989 
993  unsigned level
994  ) { PAssert(level<=3, PInvalidParameter); callIntrusionProtectionLevel = level; }
995 #endif
996 
999  virtual void OnReceivedInitiateReturnError();
1000 
1003  PBoolean CanAutoCallForward() const { return autoCallForward; }
1004 
1007  const H323Capabilities & GetCapabilities() const;
1008 
1023  e_MCUOnly = 160,
1027  };
1028 
1032 
1036 
1039  PBoolean IsTerminal() const;
1040 
1043  PBoolean IsGateway() const;
1044 
1047  PBoolean IsGatekeeper() const;
1048 
1051  PBoolean IsMCU() const;
1052 
1057 
1062 
1066  unsigned minDelay,
1067  unsigned maxDelay
1068  ) { manager.SetAudioJitterDelay(minDelay, maxDelay); }
1069 
1072  unsigned GetInitialBandwidth() const { return initialBandwidth; }
1073 
1076  void SetInitialBandwidth(unsigned bandwidth) { initialBandwidth = bandwidth; }
1077 
1078 #if OPAL_H239
1079 
1082 
1086  bool on
1087  ) { m_defaultH239Control = on; }
1088 #endif
1089 
1092  virtual PBoolean OnSendFeatureSet(unsigned, H225_FeatureSet &);
1093 
1096  virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet &);
1097 
1101  virtual void LoadBaseFeatureSet();
1102 
1107  virtual bool OnFeatureInstance(
1108  int instType,
1109  const PString & identifer
1110  );
1111 
1112 #if OPAL_H460
1113 
1115  bool FeatureSetDisabled() const { return disableH460; }
1116 
1119  void FeatureSetDisable() { disableH460 = true; }
1120 
1125 #endif
1126 
1129  virtual PBoolean IsLocalAddress(
1130  const PIPSocket::Address & remoteAddress
1131  ) const { return manager.IsLocalAddress(remoteAddress); }
1132 
1135  virtual void TranslateTCPAddress(
1136  PIPSocket::Address & localAddr,
1137  const PIPSocket::Address & remoteAddr
1138  );
1139 
1142  WORD GetTCPPortBase() const { return manager.GetTCPPortBase(); }
1143 
1146  WORD GetTCPPortMax() const { return manager.GetTCPPortMax(); }
1147 
1150  void SetTCPPorts(unsigned tcpBase, unsigned tcpMax) { manager.SetTCPPorts(tcpBase, tcpMax); }
1151 
1155 
1158  WORD GetUDPPortBase() const { return manager.GetUDPPortBase(); }
1159 
1162  WORD GetUDPPortMax() const { return manager.GetUDPPortMax(); }
1163 
1166  void SetUDPPorts(unsigned udpBase, unsigned udpMax) { manager.SetUDPPorts(udpBase, udpMax); }
1167 
1171 
1174  WORD GetRtpIpPortBase() const { return manager.GetRtpIpPortBase(); }
1175 
1178  WORD GetRtpIpPortMax() const { return manager.GetRtpIpPortMax(); }
1179 
1182  void SetRtpIpPorts(unsigned udpBase, unsigned udpMax) { manager.SetRtpIpPorts(udpBase, udpMax); }
1183 
1187 
1190  BYTE P_DEPRECATED GetRtpIpTypeofService() const { return manager.GetMediaTypeOfService(); }
1191 
1194  void P_DEPRECATED SetRtpIpTypeofService(unsigned tos) { manager.SetMediaTypeOfService(tos); }
1195 
1198  const PTimeInterval & GetSignallingChannelCallTimeout() const { return signallingChannelCallTimeout; }
1199 
1202  const PTimeInterval & GetControlChannelStartTimeout() const { return controlChannelStartTimeout; }
1203 
1206  const PTimeInterval & GetEndSessionTimeout() const { return endSessionTimeout; }
1207 
1211 
1215 
1218  const PTimeInterval & GetCapabilityExchangeTimeout() const { return capabilityExchangeTimeout; }
1219 
1222  const PTimeInterval & GetLogicalChannelTimeout() const { return logicalChannelTimeout; }
1223 
1226  const PTimeInterval & GetRequestModeTimeout() const { return logicalChannelTimeout; }
1227 
1230  const PTimeInterval & GetRoundTripDelayTimeout() const { return roundTripDelayTimeout; }
1231 
1234  const PTimeInterval & GetRoundTripDelayRate() const { return roundTripDelayRate; }
1235 
1239 
1242  const PTimeInterval & GetNoMediaTimeout() const { return manager.GetNoMediaTimeout(); }
1243 
1247  const PTimeInterval & newInterval
1248  ) { return manager.SetNoMediaTimeout(newInterval); }
1249 
1252  const PTimeInterval & GetGatekeeperRequestTimeout() const { return gatekeeperRequestTimeout; }
1253 
1257 
1260  const PTimeInterval & GetRasRequestTimeout() const { return rasRequestTimeout; }
1261 
1264  unsigned GetRasRequestRetries() const { return rasRequestRetries; }
1265 
1269  const PTimeInterval & GetGatekeeperTimeToLive() const { return registrationTimeToLive; }
1270 
1274  void SetGatekeeperTimeToLive(const PTimeInterval & ttl) { registrationTimeToLive = ttl; }
1275 
1278  const PString & GetGkAccessTokenOID() const { return gkAccessTokenOID; }
1279 
1282  void SetGkAccessTokenOID(const PString & token) { gkAccessTokenOID = token; }
1283 
1286  PBoolean GetSendGRQ() const
1287  { return sendGRQ; }
1288 
1291  void SetSendGRQ(PBoolean v)
1292  { sendGRQ = v; }
1293 
1296  const PTimeInterval & GetCallTransferT1() const { return callTransferT1; }
1297 
1300  const PTimeInterval & GetCallTransferT2() const { return callTransferT2; }
1301 
1304  const PTimeInterval & GetCallTransferT3() const { return callTransferT3; }
1305 
1308  const PTimeInterval & GetCallTransferT4() const { return callTransferT4; }
1309 
1311  const PTimeInterval & GetCallIntrusionT1() const { return callIntrusionT1; }
1312  const PTimeInterval & GetCallIntrusionT2() const { return callIntrusionT2; }
1313  const PTimeInterval & GetCallIntrusionT3() const { return callIntrusionT3; }
1314  const PTimeInterval & GetCallIntrusionT4() const { return callIntrusionT4; }
1315  const PTimeInterval & GetCallIntrusionT5() const { return callIntrusionT5; }
1316  const PTimeInterval & GetCallIntrusionT6() const { return callIntrusionT6; }
1317 
1320  H323CallIdentityDict& GetCallIdentityDictionary() { return secondaryConnectionsActive; }
1321 
1324 #if OPAL_H450
1326 #endif
1327 
1328  PString GetDefaultTransport() const;
1330 
1331  protected:
1332  bool InternalCreateGatekeeper(H323Transport * transport);
1334  OpalCall & call,
1335  const PString & existingToken,
1336  const PString & callIdentity,
1337  unsigned capabilityLevel,
1338  const PString & remoteParty,
1339  void * userData,
1340  unsigned int options = 0,
1341  OpalConnection::StringOptions * stringOptions = NULL
1342  );
1343 
1344  // Configuration variables, commonly changed
1345  PStringList localAliasNames;
1346  PStringList localAliasPatterns;
1351  PBoolean m_bH245Disabled; /* enabled or disabled h245 */
1354 #if OPAL_H450
1356 #endif
1357 
1359 
1360 #if OPAL_H239
1362 #endif
1363 
1365 
1366  // Some more configuration variables, rarely changed.
1369  PTimeInterval endSessionTimeout;
1373  PTimeInterval logicalChannelTimeout;
1374  PTimeInterval requestModeTimeout;
1375  PTimeInterval roundTripDelayTimeout;
1376  PTimeInterval roundTripDelayRate;
1379  PTimeInterval rasRequestTimeout;
1381  PTimeInterval registrationTimeToLive;
1382 
1384  PBoolean sendGRQ;
1385 
1386  /* Protect against absence of a response to the ctIdentify reqest
1387  (Transferring Endpoint - Call Transfer with a secondary Call) */
1388  PTimeInterval callTransferT1;
1389  /* Protect against failure of completion of the call transfer operation
1390  involving a secondary Call (Transferred-to Endpoint) */
1391  PTimeInterval callTransferT2;
1392  /* Protect against failure of the Transferred Endpoint not responding
1393  within sufficient time to the ctInitiate APDU (Transferring Endpoint) */
1394  PTimeInterval callTransferT3;
1395  /* May optionally operate - protects against absence of a response to the
1396  ctSetup request (Transferred Endpoint) */
1397  PTimeInterval callTransferT4;
1398 
1400  PTimeInterval callIntrusionT1;
1401  PTimeInterval callIntrusionT2;
1402  PTimeInterval callIntrusionT3;
1403  PTimeInterval callIntrusionT4;
1404  PTimeInterval callIntrusionT5;
1405  PTimeInterval callIntrusionT6;
1406 
1407  // Dynamic variables
1412  H323CallIdentityDict secondaryConnectionsActive;
1413 
1414 #if OPAL_H450
1415  mutable PAtomicInteger nextH450CallIdentity;
1417 #endif
1418 
1419 #if OPAL_H460
1422 #endif
1423 
1424  private:
1425  P_REMOVE_VIRTUAL_VOID(OnConnectionCleared(H323Connection &, const PString &));
1426 };
1427 
1428 #endif // OPAL_H323
1429 
1430 #endif // OPAL_H323_H323EP_H
1431 
1432