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;
69 class H323ServiceControlSession;
70 
71 ///////////////////////////////////////////////////////////////////////////////
72 
73 /**This class manages the H323 endpoint.
74    An endpoint may have zero or more listeners to create incoming connections
75    or zero or more outgoing connections initiated via the MakeCall() function.
76    Once a conection exists it is managed by this class instance.
77 
78    The main thing this class embodies is the capabilities of the application,
79    that is the codecs and protocols it is capable of.
80 
81    An application may create a descendent off this class and overide the
82    CreateConnection() function, if they require a descendent of H323Connection
83    to be created. This would be quite likely in most applications.
84  */
85 class H323EndPoint : public OpalRTPEndPoint
86 {
87   PCLASSINFO(H323EndPoint, OpalRTPEndPoint);
88 
89   public:
90     enum {
91       DefaultTcpSignalPort = 1720
92     };
93 
94   /**@name Construction */
95   //@{
96     /**Create a new endpoint.
97      */
98     H323EndPoint(
99       OpalManager & manager
100     );
101 
102     /**Destroy endpoint.
103      */
104     ~H323EndPoint();
105   //@}
106 
107   /**@name Overrides from OpalEndPoint */
108   //@{
109     /**Shut down the endpoint, this is called by the OpalManager just before
110        destroying the object and can be handy to make sure some things are
111        stopped before the vtable gets clobbered.
112       */
113     virtual void ShutDown();
114 
115     /**Set up a connection to a remote party.
116        This is called from the OpalManager::SetUpConnection() function once
117        it has determined that this is the endpoint for the protocol.
118 
119        The general form for this party parameter is:
120 
121             [proto:][alias@][transport$]address[:port]
122 
123        where the various fields will have meanings specific to the endpoint
124        type. For example, with H.323 it could be "h323:Fred@site.com" which
125        indicates a user Fred at gatekeeper size.com. Whereas for the PSTN
126        endpoint it could be "pstn:5551234" which is to call 5551234 on the
127        first available PSTN line.
128 
129        The proto field is optional when passed to a specific endpoint. If it
130        is present, however, it must agree with the endpoints protocol name or
131        false is returned.
132 
133        This function usually returns almost immediately with the connection
134        continuing to occur in a new background thread.
135 
136        If false is returned then the connection could not be established. For
137        example if a PSTN endpoint is used and the assiciated line is engaged
138        then it may return immediately. Returning a non-NULL value does not
139        mean that the connection will succeed, only that an attempt is being
140        made.
141 
142        The default behaviour is pure.
143      */
144     virtual PSafePtr<OpalConnection> MakeConnection(
145       OpalCall & call,                  ///<  Owner of connection
146       const PString & party,            ///<  Remote party to call
147       void * userData  = NULL,          ///<  Arbitrary data to pass to connection
148       unsigned int options = 0,         ///<  options to pass to conneciton
149       OpalConnection::StringOptions * stringOptions = NULL
150     );
151   //@}
152 
153   /**@name Set up functions */
154   //@{
155     /**Set the endpoint information in H225 PDU's.
156       */
157     virtual void SetEndpointTypeInfo(
158       H225_EndpointType & info
159     ) const;
160 
161     /**Set the vendor information in H225 PDU's.
162       */
163     virtual void SetVendorIdentifierInfo(
164       H225_VendorIdentifier & info
165     ) const;
166 
167     /**Set the H221NonStandard information in H225 PDU's.
168       */
169     virtual void SetH221NonStandardInfo(
170       H225_H221NonStandard & info
171     ) const;
172 
173     /**Set the Gateway supported protocol default always H.323
174       */
175     virtual bool SetGatewaySupportedProtocol(
176       H225_ArrayOf_SupportedProtocols & protocols
177     ) const;
178 
179     /**Set the gateway prefixes
180        Override this to set the acceptable prefixes to the gatekeeper
181       */
182     virtual bool OnSetGatewayPrefixes(
183       PStringList & prefixes
184     ) const;
185   //@}
186 
187 
188   /**@name Capabilities */
189   //@{
190     /**Add a codec to the capabilities table. This will assure that the
191        assignedCapabilityNumber field in the codec is unique for all codecs
192        installed on this endpoint.
193 
194        If the specific instnace of the capability is already in the table, it
195        is not added again. Ther can be multiple instances of the same
196        capability class however.
197      */
198     void AddCapability(
199       H323Capability * capability   ///<  New codec specification
200     );
201 
202     /**Set the capability descriptor lists. This is three tier set of
203        codecs. The top most level is a list of particular capabilities. Each
204        of these consists of a list of alternatives that can operate
205        simultaneously. The lowest level is a list of codecs that cannot
206        operate together. See H323 section 6.2.8.1 and H245 section 7.2 for
207        details.
208 
209        If descriptorNum is P_MAX_INDEX, the the next available index in the
210        array of descriptors is used. Similarly if simultaneous is P_MAX_INDEX
211        the the next available SimultaneousCapabilitySet is used. The return
212        value is the index used for the new entry. Note if both are P_MAX_INDEX
213        then the return value is the descriptor index as the simultaneous index
214        must be zero.
215 
216        Note that the capability specified here is automatically added to the
217        capability table using the AddCapability() function. A specific
218        instance of a capability is only ever added once, so multiple
219        SetCapability() calls with the same H323Capability pointer will only
220        add that capability once.
221      */
222     PINDEX SetCapability(
223       PINDEX descriptorNum, ///<  The member of the capabilityDescriptor to add
224       PINDEX simultaneous,  ///<  The member of the SimultaneousCapabilitySet to add
225       H323Capability * cap  ///<  New capability specification
226     );
227 
228     /**Add all matching capabilities in list.
229        All capabilities that match the specified name are added. See the
230        capabilities code for details on the matching algorithm.
231       */
232     PINDEX AddAllCapabilities(
233       PINDEX descriptorNum, ///<  The member of the capabilityDescriptor to add
234       PINDEX simultaneous,  ///<  The member of the SimultaneousCapabilitySet to add
235       const PString & name  ///<  New capabilities name, if using "known" one.
236     );
237 
238     /**Add all user input capabilities to this endpoints capability table.
239       */
240     void AddAllUserInputCapabilities(
241       PINDEX descriptorNum, ///<  The member of the capabilityDescriptor to add
242       PINDEX simultaneous   ///<  The member of the SimultaneousCapabilitySet to add
243     );
244 
245     /**Remove capabilites in table.
246       */
247     void RemoveCapabilities(
248       const PStringArray & codecNames
249     );
250 
251     /**Reorder capabilites in table.
252       */
253     void ReorderCapabilities(
254       const PStringArray & preferenceOrder
255     );
256 
257     /**Find a capability that has been registered.
258      */
259     H323Capability * FindCapability(
260       const H245_Capability & cap  ///<  H245 capability table entry
261     ) const;
262 
263     /**Find a capability that has been registered.
264      */
265     H323Capability * FindCapability(
266       const H245_DataType & dataType  ///<  H245 data type of codec
267     ) const;
268 
269     /**Find a capability that has been registered.
270      */
271     H323Capability * FindCapability(
272       H323Capability::MainTypes mainType,   ///<  Main type of codec
273       unsigned subType                      ///<  Subtype of codec
274     ) const;
275   //@}
276 
277   /**@name Gatekeeper management */
278   //@{
279     /**Use and register with an explicit gatekeeper.
280        This will call other functions according to the following table:
281 
282            address    identifier   function
283            empty      empty        DiscoverGatekeeper()
284            non-empty  empty        SetGatekeeper()
285            empty      non-empty    LocateGatekeeper()
286            non-empty  non-empty    SetGatekeeperZone()
287 
288        The localAddress field, if non-empty, indicates the interface on which
289        to look for the gatekeeper. An empty string is equivalent to "ip$*:*"
290        which is any interface or port.
291 
292        If the endpoint is already registered with a gatekeeper that meets
293        the same criteria then the gatekeeper is not changed, otherwise it is
294        deleted (with unregistration) and new one created and registered to.
295 
296        Note that a gatekeeper address of "*" is treated like an empty string
297        resulting in gatekeeper discovery.
298      */
299     PBoolean UseGatekeeper(
300       const PString & address = PString::Empty(),     ///<  Address of gatekeeper to use.
301       const PString & identifier = PString::Empty(),  ///<  Identifier of gatekeeper to use.
302       const PString & localAddress = PString::Empty() ///<  Local interface to use.
303     );
304 
305     /**Select and register with an explicit gatekeeper.
306        This will use the specified transport and a string giving a transport
307        dependent address to locate a specific gatekeeper. The endpoint will
308        register with that gatekeeper and, if successful, set it as the current
309        gatekeeper used by this endpoint.
310 
311        Note the transport being passed in will be deleted by this function or
312        the H323Gatekeeper object it becomes associated with. Also if transport
313        is NULL then a H323TransportUDP is created.
314      */
315     PBoolean SetGatekeeper(
316       const PString & address,          ///<  Address of gatekeeper to use.
317       H323Transport * transport = NULL  ///<  Transport over which to talk to gatekeeper.
318     );
319 
320     /**Select and register with an explicit gatekeeper and zone.
321        This will use the specified transport and a string giving a transport
322        dependent address to locate a specific gatekeeper. The endpoint will
323        register with that gatekeeper and, if successful, set it as the current
324        gatekeeper used by this endpoint.
325 
326        The gatekeeper identifier is set to the spplied parameter to allow the
327        gatekeeper to either allocate a zone or sub-zone, or refuse to register
328        if the zones do not match.
329 
330        Note the transport being passed in will be deleted by this function or
331        the H323Gatekeeper object it becomes associated with. Also if transport
332        is NULL then a H323TransportUDP is created.
333      */
334     PBoolean SetGatekeeperZone(
335       const PString & address,          ///<  Address of gatekeeper to use.
336       const PString & identifier,       ///<  Identifier of gatekeeper to use.
337       H323Transport * transport = NULL  ///<  Transport over which to talk to gatekeeper.
338     );
339 
340     /**Locate and select gatekeeper.
341        This function will use the automatic gatekeeper discovery methods to
342        locate the gatekeeper on the particular transport that has the specified
343        gatekeeper identifier name. This is often the "Zone" for the gatekeeper.
344 
345        Note the transport being passed in will be deleted becomes owned by the
346        H323Gatekeeper created by this function and will be deleted by it. Also
347        if transport is NULL then a H323TransportUDP is created.
348      */
349     PBoolean LocateGatekeeper(
350       const PString & identifier,       ///<  Identifier of gatekeeper to locate.
351       H323Transport * transport = NULL  ///<  Transport over which to talk to gatekeeper.
352     );
353 
354     /**Discover and select gatekeeper.
355        This function will use the automatic gatekeeper discovery methods to
356        locate the first gatekeeper on a particular transport.
357 
358        Note the transport being passed in will be deleted becomes owned by the
359        H323Gatekeeper created by this function and will be deleted by it. Also
360        if transport is NULL then a H323TransportUDP is created.
361      */
362     PBoolean DiscoverGatekeeper(
363       H323Transport * transport = NULL  ///<  Transport over which to talk to gatekeeper.
364     );
365 
366     /**Create a gatekeeper.
367        This allows the application writer to have the gatekeeper as a
368        descendent of the H323Gatekeeper in order to add functionality to the
369        base capabilities in the library.
370 
371        The default creates an instance of the H323Gatekeeper class.
372      */
373     virtual H323Gatekeeper * CreateGatekeeper(
374       H323Transport * transport  ///<  Transport over which gatekeepers communicates.
375     );
376 
377     /**Get the gatekeeper we are registered with.
378      */
GetGatekeeper()379     H323Gatekeeper * GetGatekeeper() const { return gatekeeper; }
380 
381     /**Return if endpoint is registered with gatekeeper.
382       */
383     PBoolean IsRegisteredWithGatekeeper() const;
384 
385     /**Unregister and delete the gatekeeper we are registered with.
386        The return value indicates false if there was an error during the
387        unregistration. However the gatekeeper is still removed and its
388        instance deleted regardless of this error.
389      */
390     PBoolean RemoveGatekeeper(
391       int reason = -1    ///<  Reason for gatekeeper removal
392     );
393 
394     /**Set the H.235 password for the gatekeeper.
395       */
396     virtual void SetGatekeeperPassword(
397       const PString & password,
398       const PString & username = PString::Empty()
399     );
400 
401     /**Get the H.235 username for the gatekeeper.
402       */
GetGatekeeperUsername()403     virtual const PString & GetGatekeeperUsername() const { return gatekeeperUsername; }
404 
405     /**Get the H.235 password for the gatekeeper.
406       */
GetGatekeeperPassword()407     virtual const PString & GetGatekeeperPassword() const { return gatekeeperPassword; }
408 
409     /**Create a list of authenticators for gatekeeper.
410       */
411     virtual H235Authenticators CreateAuthenticators();
412 
413     /**Called when the gatekeeper sends a GatekeeperConfirm
414       */
415     virtual void  OnGatekeeperConfirm();
416 
417     /**Called when the gatekeeper sends a GatekeeperReject
418       */
419     virtual void  OnGatekeeperReject();
420 
421     /**Called when the gatekeeper sends a RegistrationConfirm
422       */
423     virtual void OnRegistrationConfirm();
424 
425     /**Called when the gatekeeper sends a RegistrationReject
426       */
427     virtual void  OnRegistrationReject();
428   //@}
429 
430   /**@name Connection management */
431   //@{
432     /**Handle new incoming connetion from listener.
433       */
434     virtual PBoolean NewIncomingConnection(
435       OpalTransport * transport  ///<  Transport connection came in on
436     );
437 
438     /**Create a connection that uses the specified call.
439       */
440     virtual H323Connection * CreateConnection(
441       OpalCall & call,                         ///<  Call object to attach the connection to
442       const PString & token,                   ///<  Call token for new connection
443       void * userData,                         ///<  Arbitrary user data from MakeConnection
444       OpalTransport & transport,               ///<  Transport for connection
445       const PString & alias,                   ///<  Alias for outgoing call
446       const H323TransportAddress & address,    ///<  Address for outgoing call
447       H323SignalPDU * setupPDU,                ///<  Setup PDU for incoming call
448       unsigned options = 0,
449       OpalConnection::StringOptions * stringOptions = NULL ///<  complex string options
450     );
451 
452     /**Setup the transfer of an existing call (connection) to a new remote party
453        using H.450.2.  This sends a Call Transfer Setup Invoke message from the
454        B-Party (transferred endpoint) to the C-Party (transferred-to endpoint).
455 
456        If the transport parameter is NULL the transport is determined from the
457        remoteParty description. The general form for this parameter is
458        [alias@][transport$]host[:port] where the default alias is the same as
459        the host, the default transport is "ip" and the default port is 1720.
460 
461        This function returns almost immediately with the transfer occurring in a
462        new background thread.
463 
464        This function is declared virtual to allow an application to override
465        the function and get the new call token of the forwarded call.
466      */
467     virtual PBoolean SetupTransfer(
468       const PString & token,        ///<  Existing connection to be transferred
469       const PString & callIdentity, ///<  Call identity of the secondary call (if it exists)
470       const PString & remoteParty,  ///<  Remote party to transfer the existing call to
471       void * userData = NULL        ///<  user data to pass to CreateConnection
472     );
473 
474     /**Initiate the transfer of an existing call (connection) to a new remote
475        party using H.450.2.  This sends a Call Transfer Initiate Invoke
476        message from the A-Party (transferring endpoint) to the B-Party
477        (transferred endpoint).
478      */
479     void TransferCall(
480       const PString & token,        ///<  Existing connection to be transferred
481       const PString & remoteParty,  ///<  Remote party to transfer the existing call to
482       const PString & callIdentity = PString::Empty()
483                                     ///<  Call Identity of secondary call if present
484     );
485 
486     /**Transfer the call through consultation so the remote party in the
487        primary call is connected to the called party in the second call
488        using H.450.2.  This sends a Call Transfer Identify Invoke message
489        from the A-Party (transferring endpoint) to the C-Party
490        (transferred-to endpoint).
491      */
492     void ConsultationTransfer(
493       const PString & primaryCallToken,   ///<  Token of primary call
494       const PString & secondaryCallToken  ///<  Token of secondary call
495     );
496 
497     /** Initiate Call intrusion
498         Designed similar to MakeCall function
499       */
500     PBoolean IntrudeCall(
501       const PString & remoteParty,  ///<  Remote party to intrude call
502       unsigned capabilityLevel,     ///<  Capability level
503       void * userData = NULL        ///<  user data to pass to CreateConnection
504     );
505 
506     /**Parse a party address into alias and transport components.
507        An appropriate transport is determined from the remoteParty parameter.
508        The general form for this parameter is [alias@][transport$]host[:port]
509        where the default alias is the same as the host, the default transport
510        is "ip" and the default port is 1720.
511       */
512     PBoolean ParsePartyName(
513       const PString & party,          ///<  Party name string.
514       PString & alias,                ///<  Parsed alias name
515       H323TransportAddress & address, ///<  Parsed transport address
516       OpalConnection::StringOptions * stringOptions = NULL ///< String options parsed from party name
517     );
518 
519     /**Find a connection that uses the specified token.
520        This searches the endpoint for the connection that contains the token
521        as provided by functions such as MakeCall(). if not found it will then search for
522        the string representation of the CallIdentifier for the connection, and
523        finally try for the string representation of the ConferenceIdentifier.
524 
525        Note the caller of this function MUSt call the H323Connection::Unlock()
526        function if this function returns a non-NULL pointer. If it does not
527        then a deadlock can occur.
528       */
529     PSafePtr<H323Connection> FindConnectionWithLock(
530       const PString & token,     ///<  Token to identify connection
531       PSafetyMode mode = PSafeReadWrite
532     );
533 
534     /** OnSendSignalSetup is a hook for the appliation to attach H450 info in setup,
535         for instance, H450.7 Activate or Deactivate
536         @param connection the connection associated to the setup
537         @param pduSetup the setup message to modify
538         @return if false, do no send the setup pdu
539       */
540 
541     virtual PBoolean OnSendSignalSetup(H323Connection & connection,
542                                    H323SignalPDU & setupPDU);
543 
544     /**Adjust call proceeding PDU being sent. This function is called from
545        the OnReceivedSignalSetup() function before it sends the Call
546        Proceeding PDU. It gives an opportunity for an application to alter
547        the request before transmission to the other endpoint. If this function
548        returns false then the Call Proceeding PDU is not sent at all.
549 
550        The default behaviour simply returns true.
551        @param connection the connection associated to the call proceeding
552        @param callProceedingPDU the call processding to modify
553        @return if false, do no send the connect pdu
554      */
555     virtual PBoolean OnSendCallProceeding(
556       H323Connection & connection,
557       H323SignalPDU & callProceedingPDU
558     );
559 
560     /**Adjust call connect PDU being sent. This function is called from
561        the H323Connection::SetConnected function before it sends the connect  PDU.
562        It gives an opportunity for an application to alter
563        the request before transmission to the other endpoint. If this function
564        returns false then the connect PDU is not sent at all.
565 
566        The default behaviour simply returns true.
567        @param connection the connection associated to the connect
568        @param connectPDU the connect to modify
569        @return if false, do no send the connect pdu
570      */
571     virtual PBoolean OnSendConnect(
572       H323Connection & connection,
573       H323SignalPDU & connectPDU
574     );
575 
576     /**Call back for incoming call.
577        This function is called from the OnReceivedSignalSetup() function
578        before it sends the Alerting PDU. It gives an opportunity for an
579        application to alter the reply before transmission to the other
580        endpoint.
581 
582        If false is returned the connection is aborted and a Release Complete
583        PDU is sent.
584 
585        The default behaviour simply returns true.
586      */
587     virtual PBoolean OnIncomingCall(
588       H323Connection & connection,    ///<  Connection that was established
589       const H323SignalPDU & setupPDU,   ///<  Received setup PDU
590       H323SignalPDU & alertingPDU       ///<  Alerting PDU to send
591     );
592 
593     /**Called when an outgoing call connects
594        If false is returned the connection is aborted and a Release Complete
595        PDU is sent.
596 
597        The default behaviour simply returns true.
598       */
599     virtual PBoolean OnOutgoingCall(
600       H323Connection & conn,
601       const H323SignalPDU & connectPDU
602     );
603 
604     /**Handle a connection transfer.
605        This gives the application an opportunity to abort the transfer.
606        The default behaviour just returns true.
607       */
608     virtual PBoolean OnCallTransferInitiate(
609       H323Connection & connection,    ///<  Connection to transfer
610       const PString & remoteParty     ///<  Party transferring to.
611     );
612 
613     /**Handle a transfer via consultation.
614        This gives the transferred-to user an opportunity to abort the transfer.
615        The default behaviour just returns true.
616       */
617     virtual PBoolean OnCallTransferIdentify(
618       H323Connection & connection    ///<  Connection to transfer
619     );
620 
621     /**
622       * Callback for ARQ send to a gatekeeper. This allows the endpoint
623       * to change or check fields in the ARQ before it is sent.
624       */
625     virtual void OnSendARQ(
626       H323Connection & conn,
627       H225_AdmissionRequest & arq
628     );
629 
630     /**Call back for answering an incoming call.
631        This function is a H.323 specific version of OpalEndPoint::OnAnswerCall
632        that contains additional information that applies only to H.323.
633 
634        By default this calls OpalEndPoint::OnAnswerCall, which returns
635      */
636     virtual OpalConnection::AnswerCallResponse OnAnswerCall(
637       H323Connection & connection,    ///< Connection that was established
638       const PString & callerName,       ///< Name of caller
639       const H323SignalPDU & setupPDU,   ///< Received setup PDU
640       H323SignalPDU & connectPDU,       ///< Connect PDU to send.
641       H323SignalPDU & progressPDU        ///< Progress PDU to send.
642     );
643     virtual OpalConnection::AnswerCallResponse OnAnswerCall(
644        OpalConnection & connection,
645        const PString & caller
646     );
647 
648     /**Call back for remote party being alerted.
649        This function is called from the SendSignalSetup() function after it
650        receives the optional Alerting PDU from the remote endpoint. That is
651        when the remote "phone" is "ringing".
652 
653        If false is returned the connection is aborted and a Release Complete
654        PDU is sent.
655 
656        The default behaviour simply returns true.
657      */
658     virtual PBoolean OnAlerting(
659       H323Connection & connection,    ///<  Connection that was established
660       const H323SignalPDU & alertingPDU,  ///<  Received Alerting PDU
661       const PString & user                ///<  Username of remote endpoint
662     );
663 
664     /** A call back function when the alerting is about to be sent,
665         can be used by the application to alter the alerting Pdu
666         @return if false, then the alerting is not sent
667      */
668     virtual PBoolean OnSendAlerting(
669       H323Connection & connection,  ///< onnection that was established
670       H323SignalPDU & alerting,     ///< Alerting PDU to modify
671       const PString & calleeName,   ///< Name of endpoint being alerted.
672       PBoolean withMedia                ///< Open media with alerting
673     );
674 
675     /** A call back function when the alerting has been sent, can be used by the application
676         to send the connect as soon as the alerting has been sent.
677      */
678     virtual PBoolean OnSentAlerting(
679       H323Connection & connection
680     );
681 
682     /**A call back function when a connection indicates it is to be forwarded.
683        An H323 application may handle this call back so it can make
684        complicated decisions on if the call forward ius to take place. If it
685        decides to do so it must call MakeCall() and return true.
686 
687        The default behaviour simply returns false and that the automatic
688        call forwarding should take place. See ForwardConnection()
689       */
690     virtual PBoolean OnConnectionForwarded(
691       H323Connection & connection,    ///<  Connection to be forwarded
692       const PString & forwardParty,   ///<  Remote party to forward to
693       const H323SignalPDU & pdu       ///<  Full PDU initiating forwarding
694     );
695 
696     /**Forward the call using the same token as the specified connection.
697        Return true if the call is being redirected.
698 
699        The default behaviour will replace the current call in the endpoints
700        call list using the same token as the call being redirected. Not that
701        even though the same token is being used the actual object is
702        completely mad anew.
703       */
704     virtual PBoolean ForwardConnection(
705       H323Connection & connection,    ///<  Connection to be forwarded
706       const PString & forwardParty,   ///<  Remote party to forward to
707       const H323SignalPDU & pdu       ///<  Full PDU initiating forwarding
708     );
709 
710     /**A call back function whenever a connection is established.
711        This indicates that a connection to a remote endpoint was established
712        with a control channel and zero or more logical channels.
713 
714        The default behaviour does nothing.
715       */
716     virtual void OnConnectionEstablished(
717       H323Connection & connection,    ///<  Connection that was established
718       const PString & token           ///<  Token for identifying connection
719     );
720 
721     /**Determine if a connection is established.
722       */
723     virtual PBoolean IsConnectionEstablished(
724       const PString & token   ///<  Token for identifying connection
725     );
726   //@}
727 
728 
729   /**@name Logical Channels management */
730   //@{
731     /**Call back for opening a logical channel.
732 
733        The default behaviour simply returns true.
734       */
735     virtual PBoolean OnStartLogicalChannel(
736       H323Connection & connection,    ///<  Connection for the channel
737       H323Channel & channel           ///<  Channel being started
738     );
739 
740     /**Call back for closed a logical channel.
741 
742        The default behaviour does nothing.
743       */
744     virtual void OnClosedLogicalChannel(
745       H323Connection & connection,    ///<  Connection for the channel
746       const H323Channel & channel     ///<  Channel being started
747     );
748 
749     /**Callback from the RTP session for statistics monitoring.
750        This is called every so many packets on the transmitter and receiver
751        threads of the RTP session indicating that the statistics have been
752        updated.
753 
754        The default behaviour does nothing.
755       */
756     virtual void OnRTPStatistics(
757       const H323Connection & connection,  ///<  Connection for the channel
758       const RTP_Session & session         ///<  Session with statistics
759     ) const;
760 
761     /**Call back from GK admission confirm to notify the
762      * Endpoint it is behind a NAT (GNUGK Gatekeeper).
763      * The default does nothing.
764      * Override this to notify the user they are behind a NAT.
765      */
766     virtual void OnGatekeeperNATDetect(
767       PIPSocket::Address publicAddr,         ///> Public address as returned by the Gatekeeper
768       PString & gkIdentifier,                ///> Identifier at the gatekeeper
769       H323TransportAddress & gkRouteAddress  ///> Gatekeeper Route Address
770     );
771   //@}
772 
773   /**@name Service Control */
774   //@{
775     /**Call back for HTTP based Service Control.
776        An application may override this to use an HTTP based channel using a
777        resource designated by the session ID. For example the session ID can
778        correspond to a browser window and the
779 
780        The default behaviour does nothing.
781       */
782     virtual void OnHTTPServiceControl(
783       unsigned operation,  ///<  Control operation
784       unsigned sessionId,  ///<  Session ID for HTTP page
785       const PString & url  ///<  URL to use.
786     );
787 
788     /**Call back for call credit information.
789        An application may override this to display call credit information
790        on registration, or when a call is started.
791 
792        The canDisplayAmountString member variable must also be set to true
793        for this to operate.
794 
795        The default behaviour does nothing.
796       */
797     virtual void OnCallCreditServiceControl(
798       const PString & amount,  ///<  UTF-8 string for amount, including currency.
799       PBoolean mode          ///<  Flag indicating that calls will debit the account.
800     );
801 
802     /**Handle incoming service control session information.
803        Default behaviour calls session.OnChange()
804      */
805     virtual void OnServiceControlSession(
806       unsigned type,
807       unsigned sessionid,
808       const H323ServiceControlSession & session,
809       H323Connection * connection
810     );
811 
812     /**Create the service control session object.
813      */
814     virtual H323ServiceControlSession * CreateServiceControlSession(
815       const H225_ServiceControlDescriptor & contents
816     );
817   //@}
818 
819   /**@name Additional call services */
820   //@{
821     /** Called when an endpoint receives a SETUP PDU with a
822         conference goal of "invite"
823 
824         The default behaviour is to return false, which will close the connection
825      */
826     virtual PBoolean OnConferenceInvite(
827       const H323SignalPDU & setupPDU
828     );
829 
830     /** Called when an endpoint receives a SETUP PDU with a
831         conference goal of "callIndependentSupplementaryService"
832 
833         The default behaviour is to return false, which will close the connection
834      */
835     virtual PBoolean OnCallIndependentSupplementaryService(
836       const H323SignalPDU & setupPDU
837     );
838 
839     /** Called when an endpoint receives a SETUP PDU with a
840         conference goal of "capability_negotiation"
841 
842         The default behaviour is to return false, which will close the connection
843      */
844     virtual PBoolean OnNegotiateConferenceCapabilities(
845       const H323SignalPDU & setupPDU
846     );
847   //@}
848 
849   /**@name Member variable access */
850   //@{
851     /**Set the default local party name for all connections on this endpoint.
852       */
853     virtual void SetDefaultLocalPartyName(
854       const PString & name  /// Name for local party
855     );
856 
857     /**Set the user name to be used for the local end of any connections. This
858        defaults to the logged in user as obtained from the
859        PProcess::GetUserName() function.
860 
861        Note that this name is technically the first alias for the endpoint.
862        Additional aliases may be added by the use of the AddAliasName()
863        function, however that list will be cleared when this function is used.
864      */
865     virtual void SetLocalUserName(
866       const PString & name  ///<  Local name of endpoint (prime alias)
867     );
868 
869     /**Get the user name to be used for the local end of any connections. This
870        defaults to the logged in user as obtained from the
871        PProcess::GetUserName() function.
872      */
GetLocalUserName()873     virtual const PString & GetLocalUserName() const { return localAliasNames.front(); }
874 
875     /**Add an alias name to be used for the local end of any connections. If
876        the alias name already exists in the list then is is not added again.
877 
878        The list defaults to the value set in the SetLocalUserName() function.
879        Note that calling SetLocalUserName() will clear the alias list.
880      */
881     PBoolean AddAliasName(
882       const PString & name  ///<  New alias name to add
883     );
884 
885     /**Remove an alias name used for the local end of any connections.
886        defaults to an empty list.
887      */
888     PBoolean RemoveAliasName(
889       const PString & name  ///<  New alias namer to add
890     );
891 
892     /**Get the user name to be used for the local end of any connections. This
893        defaults to the logged in user as obtained from the
894        PProcess::GetUserName() function.
895      */
GetAliasNames()896     const PStringList & GetAliasNames() const { return localAliasNames; }
897 
898     /**Get the alias patterns, might be used in terminalAliasPattern.
899      */
GetAliasNamePatterns()900     const PStringList & GetAliasNamePatterns() const { return localAliasPatterns; }
901 
902     /**Add an alias name pattern to localAliasPatterns. If
903        the pattern already exists in the list then is is not added again.
904      */
905     PBoolean AddAliasNamePattern(
906       const PString & pattern
907     );
908 
909     /**Get the default ILS server to use for user lookup.
910       */
GetDefaultILSServer()911     const PString & GetDefaultILSServer() const { return manager.GetDefaultILSServer(); }
912 
913     /**Set the default ILS server to use for user lookup.
914       */
SetDefaultILSServer(const PString & server)915     void SetDefaultILSServer(
916       const PString & server
917     ) { manager.SetDefaultILSServer(server); }
918 
919     /**Get the default fast start mode.
920       */
IsFastStartDisabled()921     PBoolean IsFastStartDisabled() const
922       { return disableFastStart; }
923 
924     /**Set the default fast start mode.
925       */
DisableFastStart(PBoolean mode)926     void DisableFastStart(
927       PBoolean mode ///<  New default mode
928     ) { disableFastStart = mode; }
929 
930     /**Get the default H.245 tunneling mode.
931       */
IsH245TunnelingDisabled()932     PBoolean IsH245TunnelingDisabled() const
933       { return disableH245Tunneling; }
934 
935     /**Set the default H.245 tunneling mode.
936       */
DisableH245Tunneling(PBoolean mode)937     void DisableH245Tunneling(
938       PBoolean mode ///<  New default mode
939     ) { disableH245Tunneling = mode; }
940 
941     /**Get the default H.245 tunneling mode.
942       */
IsH245inSetupDisabled()943     PBoolean IsH245inSetupDisabled() const
944       { return disableH245inSetup; }
945 
946     /**Set the default H.245 tunneling mode.
947       */
DisableH245inSetup(PBoolean mode)948     void DisableH245inSetup(
949       PBoolean mode ///<  New default mode
950     ) { disableH245inSetup = mode; }
951 
952     /** find out if h245 is disabled or enabled
953       * @return true if h245 is disabled
954       */
IsH245Disabled()955     PBoolean IsH245Disabled() const
956     { return m_bH245Disabled; }
957 
958     /**Disable/Enable H.245, used at least for h450.7 calls
959      * @param  bH245Disabled true if h245 has to be disabled
960      */
DisableH245(PBoolean bH245Disabled)961     void DisableH245(PBoolean bH245Disabled) { m_bH245Disabled = bH245Disabled; }
962 
963     /**Get the flag indicating the endpoint can display an amount string.
964       */
CanDisplayAmountString()965     PBoolean CanDisplayAmountString() const
966       { return canDisplayAmountString; }
967 
968     /**Set the flag indicating the endpoint can display an amount string.
969       */
SetCanDisplayAmountString(PBoolean mode)970     void SetCanDisplayAmountString(
971       PBoolean mode ///<  New default mode
972     ) { canDisplayAmountString = mode; }
973 
974     /**Get the flag indicating the call will automatically clear after a time.
975       */
CanEnforceDurationLimit()976     PBoolean CanEnforceDurationLimit() const
977       { return canEnforceDurationLimit; }
978 
979     /**Set the flag indicating the call will automatically clear after a time.
980       */
SetCanEnforceDurationLimit(PBoolean mode)981     void SetCanEnforceDurationLimit(
982       PBoolean mode ///<  New default mode
983     ) { canEnforceDurationLimit = mode; }
984 
985 #if OPAL_H450
986     /**Get Call Intrusion Protection Level of the end point.
987       */
GetCallIntrusionProtectionLevel()988     unsigned GetCallIntrusionProtectionLevel() const { return callIntrusionProtectionLevel; }
989 
990     /**Set Call Intrusion Protection Level of the end point.
991       */
SetCallIntrusionProtectionLevel(unsigned level)992     void SetCallIntrusionProtectionLevel(
993       unsigned level  ///<  New level from 0 to 3
994     ) { PAssert(level<=3, PInvalidParameter); callIntrusionProtectionLevel = level; }
995 #endif
996 
997     /**Called from H.450 OnReceivedInitiateReturnError
998       */
999     virtual void OnReceivedInitiateReturnError();
1000 
1001     /**See if should automatically do call forward of connection.
1002      */
CanAutoCallForward()1003     PBoolean CanAutoCallForward() const { return autoCallForward; }
1004 
1005     /**Get the current capability table for this endpoint.
1006      */
1007     const H323Capabilities & GetCapabilities() const;
1008 
1009     /**Endpoint types.
1010      */
1011     enum TerminalTypes {
1012       e_TerminalOnly = 50,
1013       e_TerminalAndMC = 70,
1014       e_GatewayOnly = 60,
1015       e_GatewayAndMC = 80,
1016       e_GatewayAndMCWithDataMP = 90,
1017       e_GatewayAndMCWithAudioMP = 100,
1018       e_GatewayAndMCWithAVMP = 110,
1019       e_GatekeeperOnly = 120,
1020       e_GatekeeperWithDataMP = 130,
1021       e_GatekeeperWithAudioMP = 140,
1022       e_GatekeeperWithAVMP = 150,
1023       e_MCUOnly = 160,
1024       e_MCUWithDataMP = 170,
1025       e_MCUWithAudioMP = 180,
1026       e_MCUWithAVMP = 190
1027     };
1028 
1029     /**Get the endpoint terminal type.
1030      */
SetTerminalType(TerminalTypes type)1031     void SetTerminalType(TerminalTypes type) { terminalType = type; }
1032 
1033     /**Get the endpoint terminal type.
1034      */
GetTerminalType()1035     TerminalTypes GetTerminalType() const { return terminalType; }
1036 
1037     /**Determine if endpoint is terminal type.
1038      */
1039     PBoolean IsTerminal() const;
1040 
1041     /**Determine if endpoint is gateway type.
1042      */
1043     PBoolean IsGateway() const;
1044 
1045     /**Determine if endpoint is gatekeeper type.
1046      */
1047     PBoolean IsGatekeeper() const;
1048 
1049     /**Determine if endpoint is gatekeeper type.
1050      */
1051     PBoolean IsMCU() const;
1052 
1053     /**Get the default maximum audio jitter delay parameter.
1054        Defaults to 50ms
1055      */
GetMinAudioJitterDelay()1056     unsigned GetMinAudioJitterDelay() const { return manager.GetMinAudioJitterDelay(); }
1057 
1058     /**Get the default maximum audio delay jitter parameter.
1059        Defaults to 250ms.
1060      */
GetMaxAudioJitterDelay()1061     unsigned GetMaxAudioJitterDelay() const { return manager.GetMaxAudioJitterDelay(); }
1062 
1063     /**Set the maximum audio delay jitter parameter.
1064      */
SetAudioJitterDelay(unsigned minDelay,unsigned maxDelay)1065     void SetAudioJitterDelay(
1066       unsigned minDelay,   ///<  New minimum jitter buffer delay in milliseconds
1067       unsigned maxDelay    ///<  New maximum jitter buffer delay in milliseconds
1068     ) { manager.SetAudioJitterDelay(minDelay, maxDelay); }
1069 
1070     /**Get the initial bandwidth parameter.
1071      */
GetInitialBandwidth()1072     unsigned GetInitialBandwidth() const { return initialBandwidth; }
1073 
1074     /**Get the initial bandwidth parameter.
1075      */
SetInitialBandwidth(unsigned bandwidth)1076     void SetInitialBandwidth(unsigned bandwidth) { initialBandwidth = bandwidth; }
1077 
1078 #if OPAL_H239
1079     /**Get the default H.239 control capability.
1080      */
GetDefaultH239Control()1081     bool GetDefaultH239Control() const { return m_defaultH239Control; }
1082 
1083     /**Set the default H.239 control capability.
1084      */
SetDefaultH239Control(bool on)1085     void SetDefaultH239Control(
1086       bool on   ///< H.239 control capability is to be sent to remote
1087     ) { m_defaultH239Control = on; }
1088 #endif
1089 
1090     /**Called when an outgoing PDU requires a feature set
1091      */
1092     virtual PBoolean OnSendFeatureSet(unsigned, H225_FeatureSet &);
1093 
1094     /**Called when an incoming PDU contains a feature set
1095      */
1096     virtual void OnReceiveFeatureSet(unsigned, const H225_FeatureSet &);
1097 
1098     /**Load the Base FeatureSet usually called when you initialise the endpoint prior to
1099        registering with a gatekeeper.
1100       */
1101     virtual void LoadBaseFeatureSet();
1102 
1103     /**Callback when creating Feature Instance. This can be used to disable features on
1104        a case by case basis by returning FALSE
1105        Default returns TRUE
1106       */
1107     virtual bool OnFeatureInstance(
1108       int instType,
1109       const PString & identifer
1110     );
1111 
1112 #if OPAL_H460
1113     /** Is the FeatureSet disabled
1114       */
FeatureSetDisabled()1115     bool FeatureSetDisabled() const { return disableH460; }
1116 
1117     /** Disable all FeatureSets. Use this for pre H323v4 interoperability
1118       */
FeatureSetDisable()1119     void FeatureSetDisable() { disableH460 = true; }
1120 
1121     /** Get the Endpoint FeatureSet
1122         This creates a new instance of the featureSet
1123       */
GetFeatureSet()1124     H460_FeatureSet * GetFeatureSet() { return features.DeriveNewFeatureSet(); };
1125 #endif
1126 
1127     /**Determine if the address is "local", ie does not need STUN
1128      */
IsLocalAddress(const PIPSocket::Address & remoteAddress)1129     virtual PBoolean IsLocalAddress(
1130       const PIPSocket::Address & remoteAddress
1131     ) const { return manager.IsLocalAddress(remoteAddress); }
1132 
1133     /**Provide TCP address translation hook
1134      */
1135     virtual void TranslateTCPAddress(
1136       PIPSocket::Address & localAddr,
1137       const PIPSocket::Address & remoteAddr
1138     );
1139 
1140     /**Get the TCP port number base for H.245 channels
1141      */
GetTCPPortBase()1142     WORD GetTCPPortBase() const { return manager.GetTCPPortBase(); }
1143 
1144     /**Get the TCP port number base for H.245 channels.
1145      */
GetTCPPortMax()1146     WORD GetTCPPortMax() const { return manager.GetTCPPortMax(); }
1147 
1148     /**Set the TCP port number base and max for H.245 channels.
1149      */
SetTCPPorts(unsigned tcpBase,unsigned tcpMax)1150     void SetTCPPorts(unsigned tcpBase, unsigned tcpMax) { manager.SetTCPPorts(tcpBase, tcpMax); }
1151 
1152     /**Get the next TCP port number for H.245 channels
1153      */
GetNextTCPPort()1154     WORD GetNextTCPPort() { return manager.GetNextTCPPort(); }
1155 
1156     /**Get the UDP port number base for RAS channels
1157      */
GetUDPPortBase()1158     WORD GetUDPPortBase() const { return manager.GetUDPPortBase(); }
1159 
1160     /**Get the UDP port number base for RAS channels.
1161      */
GetUDPPortMax()1162     WORD GetUDPPortMax() const { return manager.GetUDPPortMax(); }
1163 
1164     /**Set the TCP port number base and max for H.245 channels.
1165      */
SetUDPPorts(unsigned udpBase,unsigned udpMax)1166     void SetUDPPorts(unsigned udpBase, unsigned udpMax) { manager.SetUDPPorts(udpBase, udpMax); }
1167 
1168     /**Get the next UDP port number for RAS channels
1169      */
GetNextUDPPort()1170     WORD GetNextUDPPort() { return manager.GetNextUDPPort(); }
1171 
1172     /**Get the UDP port number base for RTP channels.
1173      */
GetRtpIpPortBase()1174     WORD GetRtpIpPortBase() const { return manager.GetRtpIpPortBase(); }
1175 
1176     /**Get the max UDP port number for RTP channels.
1177      */
GetRtpIpPortMax()1178     WORD GetRtpIpPortMax() const { return manager.GetRtpIpPortMax(); }
1179 
1180     /**Set the UDP port number base and max for RTP channels.
1181      */
SetRtpIpPorts(unsigned udpBase,unsigned udpMax)1182     void SetRtpIpPorts(unsigned udpBase, unsigned udpMax) { manager.SetRtpIpPorts(udpBase, udpMax); }
1183 
1184     /**Get the UDP port number pair for RTP channels.
1185      */
GetRtpIpPortPair()1186     WORD GetRtpIpPortPair() { return manager.GetRtpIpPortPair(); }
1187 
1188     /**Get the IP Type Of Service byte for RTP channels.
1189      */
GetRtpIpTypeofService()1190     BYTE P_DEPRECATED GetRtpIpTypeofService() const { return manager.GetMediaTypeOfService(); }
1191 
1192     /**Set the IP Type Of Service byte for RTP channels.
1193      */
SetRtpIpTypeofService(unsigned tos)1194     void P_DEPRECATED SetRtpIpTypeofService(unsigned tos) { manager.SetMediaTypeOfService(tos); }
1195 
1196     /**Get the default timeout for calling another endpoint.
1197      */
GetSignallingChannelCallTimeout()1198     const PTimeInterval & GetSignallingChannelCallTimeout() const { return signallingChannelCallTimeout; }
1199 
1200     /**Get the default timeout for incoming H.245 connection.
1201      */
GetControlChannelStartTimeout()1202     const PTimeInterval & GetControlChannelStartTimeout() const { return controlChannelStartTimeout; }
1203 
1204     /**Get the default timeout for waiting on an end session.
1205      */
GetEndSessionTimeout()1206     const PTimeInterval & GetEndSessionTimeout() const { return endSessionTimeout; }
1207 
1208     /**Get the default timeout for master slave negotiations.
1209      */
GetMasterSlaveDeterminationTimeout()1210     const PTimeInterval & GetMasterSlaveDeterminationTimeout() const { return masterSlaveDeterminationTimeout; }
1211 
1212     /**Get the default retries for H245 master slave negotiations.
1213      */
GetMasterSlaveDeterminationRetries()1214     unsigned GetMasterSlaveDeterminationRetries() const { return masterSlaveDeterminationRetries; }
1215 
1216     /**Get the default timeout for H245 capability exchange negotiations.
1217      */
GetCapabilityExchangeTimeout()1218     const PTimeInterval & GetCapabilityExchangeTimeout() const { return capabilityExchangeTimeout; }
1219 
1220     /**Get the default timeout for H245 logical channel negotiations.
1221      */
GetLogicalChannelTimeout()1222     const PTimeInterval & GetLogicalChannelTimeout() const { return logicalChannelTimeout; }
1223 
1224     /**Get the default timeout for H245 request mode negotiations.
1225      */
GetRequestModeTimeout()1226     const PTimeInterval & GetRequestModeTimeout() const { return logicalChannelTimeout; }
1227 
1228     /**Get the default timeout for H245 round trip delay negotiations.
1229      */
GetRoundTripDelayTimeout()1230     const PTimeInterval & GetRoundTripDelayTimeout() const { return roundTripDelayTimeout; }
1231 
1232     /**Get the default rate H245 round trip delay is calculated by connection.
1233      */
GetRoundTripDelayRate()1234     const PTimeInterval & GetRoundTripDelayRate() const { return roundTripDelayRate; }
1235 
1236     /**Get the flag for clearing a call if the round trip delay calculation fails.
1237      */
ShouldClearCallOnRoundTripFail()1238     PBoolean ShouldClearCallOnRoundTripFail() const { return clearCallOnRoundTripFail; }
1239 
1240     /**Get the amount of time with no media that should cause call to clear
1241      */
GetNoMediaTimeout()1242     const PTimeInterval & GetNoMediaTimeout() const { return manager.GetNoMediaTimeout(); }
1243 
1244     /**Set the amount of time with no media that should cause call to clear
1245      */
SetNoMediaTimeout(const PTimeInterval & newInterval)1246     PBoolean SetNoMediaTimeout(
1247       const PTimeInterval & newInterval  ///<  New timeout for media
1248     ) { return manager.SetNoMediaTimeout(newInterval); }
1249 
1250     /**Get the default timeout for GatekeeperRequest and Gatekeeper discovery.
1251      */
GetGatekeeperRequestTimeout()1252     const PTimeInterval & GetGatekeeperRequestTimeout() const { return gatekeeperRequestTimeout; }
1253 
1254     /**Get the default retries for GatekeeperRequest and Gatekeeper discovery.
1255      */
GetGatekeeperRequestRetries()1256     unsigned GetGatekeeperRequestRetries() const { return gatekeeperRequestRetries; }
1257 
1258     /**Get the default timeout for RAS protocol transactions.
1259      */
GetRasRequestTimeout()1260     const PTimeInterval & GetRasRequestTimeout() const { return rasRequestTimeout; }
1261 
1262     /**Get the default retries for RAS protocol transations.
1263      */
GetRasRequestRetries()1264     unsigned GetRasRequestRetries() const { return rasRequestRetries; }
1265 
1266     /**Get the default time for gatekeeper to reregister.
1267        A value of zero disables the keep alive facility.
1268      */
GetGatekeeperTimeToLive()1269     const PTimeInterval & GetGatekeeperTimeToLive() const { return registrationTimeToLive; }
1270 
1271     /**Set the default time for gatekeeper to reregister.
1272        A value of zero disables the keep alive facility.
1273      */
SetGatekeeperTimeToLive(const PTimeInterval & ttl)1274     void SetGatekeeperTimeToLive(const PTimeInterval & ttl) { registrationTimeToLive = ttl; }
1275 
1276     /**Get the iNow Gatekeeper Access Token OID.
1277      */
GetGkAccessTokenOID()1278     const PString & GetGkAccessTokenOID() const { return gkAccessTokenOID; }
1279 
1280     /**Set the iNow Gatekeeper Access Token OID.
1281      */
SetGkAccessTokenOID(const PString & token)1282     void SetGkAccessTokenOID(const PString & token) { gkAccessTokenOID = token; }
1283 
1284     /**Get flag to indicate whether to send GRQ on gatekeeper registration
1285      */
GetSendGRQ()1286     PBoolean GetSendGRQ() const
1287     { return sendGRQ; }
1288 
1289     /**Sent flag to indicate whether to send GRQ on gatekeeper registration
1290      */
SetSendGRQ(PBoolean v)1291     void SetSendGRQ(PBoolean v)
1292     { sendGRQ = v; }
1293 
1294     /**Get the default timeout for Call Transfer Timer CT-T1.
1295      */
GetCallTransferT1()1296     const PTimeInterval & GetCallTransferT1() const { return callTransferT1; }
1297 
1298     /**Get the default timeout for Call Transfer Timer CT-T2.
1299      */
GetCallTransferT2()1300     const PTimeInterval & GetCallTransferT2() const { return callTransferT2; }
1301 
1302     /**Get the default timeout for Call Transfer Timer CT-T3.
1303      */
GetCallTransferT3()1304     const PTimeInterval & GetCallTransferT3() const { return callTransferT3; }
1305 
1306     /**Get the default timeout for Call Transfer Timer CT-T4.
1307      */
GetCallTransferT4()1308     const PTimeInterval & GetCallTransferT4() const { return callTransferT4; }
1309 
1310     /** Get Call Intrusion timers timeout */
GetCallIntrusionT1()1311     const PTimeInterval & GetCallIntrusionT1() const { return callIntrusionT1; }
GetCallIntrusionT2()1312     const PTimeInterval & GetCallIntrusionT2() const { return callIntrusionT2; }
GetCallIntrusionT3()1313     const PTimeInterval & GetCallIntrusionT3() const { return callIntrusionT3; }
GetCallIntrusionT4()1314     const PTimeInterval & GetCallIntrusionT4() const { return callIntrusionT4; }
GetCallIntrusionT5()1315     const PTimeInterval & GetCallIntrusionT5() const { return callIntrusionT5; }
GetCallIntrusionT6()1316     const PTimeInterval & GetCallIntrusionT6() const { return callIntrusionT6; }
1317 
1318     /**Get the dictionary of <callIdentities, connections>
1319      */
GetCallIdentityDictionary()1320     H323CallIdentityDict& GetCallIdentityDictionary() { return secondaryConnectionsActive; }
1321 
1322     /**Get the next available invoke Id for H450 operations
1323       */
1324 #if OPAL_H450
GetNextH450CallIdentityValue()1325     unsigned GetNextH450CallIdentityValue() const { return ++nextH450CallIdentity; }
1326 #endif
1327 
1328     PString GetDefaultTransport() const;
1329   //@}
1330 
1331   protected:
1332     bool InternalCreateGatekeeper(H323Transport * transport);
1333     H323Connection * InternalMakeCall(
1334       OpalCall & call,
1335       const PString & existingToken,           ///<  Existing connection to be transferred
1336       const PString & callIdentity,            ///<  Call identity of the secondary call (if it exists)
1337       unsigned capabilityLevel,                ///<  Intrusion capability level
1338       const PString & remoteParty,             ///<  Remote party to call
1339       void * userData,                         ///<  user data to pass to CreateConnection
1340       unsigned int options = 0,                ///<  options to pass to connection
1341       OpalConnection::StringOptions * stringOptions = NULL ///<  complex string options
1342     );
1343 
1344     // Configuration variables, commonly changed
1345     PStringList     localAliasNames;
1346     PStringList     localAliasPatterns;
1347     PBoolean        autoCallForward;
1348     PBoolean        disableFastStart;
1349     PBoolean        disableH245Tunneling;
1350     PBoolean        disableH245inSetup;
1351     PBoolean        m_bH245Disabled; /* enabled or disabled h245 */
1352     PBoolean        canDisplayAmountString;
1353     PBoolean        canEnforceDurationLimit;
1354 #if OPAL_H450
1355     unsigned        callIntrusionProtectionLevel;
1356 #endif
1357 
1358     TerminalTypes   terminalType;
1359 
1360 #if OPAL_H239
1361     bool            m_defaultH239Control;
1362 #endif
1363 
1364     PBoolean        clearCallOnRoundTripFail;
1365 
1366     // Some more configuration variables, rarely changed.
1367     PTimeInterval signallingChannelCallTimeout;
1368     PTimeInterval controlChannelStartTimeout;
1369     PTimeInterval endSessionTimeout;
1370     PTimeInterval masterSlaveDeterminationTimeout;
1371     unsigned      masterSlaveDeterminationRetries;
1372     PTimeInterval capabilityExchangeTimeout;
1373     PTimeInterval logicalChannelTimeout;
1374     PTimeInterval requestModeTimeout;
1375     PTimeInterval roundTripDelayTimeout;
1376     PTimeInterval roundTripDelayRate;
1377     PTimeInterval gatekeeperRequestTimeout;
1378     unsigned      gatekeeperRequestRetries;
1379     PTimeInterval rasRequestTimeout;
1380     unsigned      rasRequestRetries;
1381     PTimeInterval registrationTimeToLive;
1382 
1383     PString       gkAccessTokenOID;
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 
1399     /** Call Intrusion Timers */
1400     PTimeInterval callIntrusionT1;
1401     PTimeInterval callIntrusionT2;
1402     PTimeInterval callIntrusionT3;
1403     PTimeInterval callIntrusionT4;
1404     PTimeInterval callIntrusionT5;
1405     PTimeInterval callIntrusionT6;
1406 
1407     // Dynamic variables
1408     mutable H323Capabilities capabilities;
1409     H323Gatekeeper *     gatekeeper;
1410     PString              gatekeeperUsername;
1411     PString              gatekeeperPassword;
1412     H323CallIdentityDict secondaryConnectionsActive;
1413 
1414 #if OPAL_H450
1415     mutable PAtomicInteger nextH450CallIdentity;
1416             /// Next available callIdentity for H450 Transfer operations via consultation.
1417 #endif
1418 
1419 #if OPAL_H460
1420     bool            disableH460;
1421     H460_FeatureSet features;
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 
1433 /////////////////////////////////////////////////////////////////////////////
1434