1/*
2 * Python bindings.
3 *
4 * Open Phone Abstraction Library (OPAL)
5 *
6 * Copyright (c) 2011 Demetrius Cassidy
7 *
8 * The contents of this file are subject to the Mozilla Public License
9 * Version 1.0 (the "License"); you may not use this file except in
10 * compliance with the License. You may obtain a copy of the License at
11 * http://www.mozilla.org/MPL/
12 *
13 * Software distributed under the License is distributed on an "AS IS"
14 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 * the License for the specific language governing rights and limitations
16 * under the License.
17 *
18 * The Original Code is Open Phone Abstraction Library (OPAL)
19 *
20 * The Initial Developer of the Original Code is Demetrius Cassidy
21 *
22 * Contributor(s): ______________________________________.
23 *
24 * $Revision: 26117 $
25 * $Author: rjongbloed $
26 * $Date: 2011-07-04 22:45:05 -0500 (Mon, 04 Jul 2011) $
27 */
28
29%ModuleHeaderCode
30#include <ptlib.h>
31#include <h323/h323ep.h>
32%End
33
34
35///////////////////////////////////////////////////////////////////////////////
36
37/**This class manages the H323 endpoint.
38   An endpoint may have zero or more listeners to create incoming connections
39   or zero or more outgoing connections initiated via the MakeCall() function.
40   Once a conection exists it is managed by this class instance.
41
42   The main thing this class embodies is the capabilities of the application,
43   that is the codecs and protocols it is capable of.
44
45   An application may create a descendent off this class and overide the
46   CreateConnection() function, if they require a descendent of H323Connection
47   to be created. This would be quite likely in most applications.
48 */
49class H323EndPoint : OpalRTPEndPoint
50{
51  public:
52    enum {
53      DefaultTcpSignalPort = 1720
54    };
55
56  /**@name Construction */
57  //@{
58    /**Create a new endpoint.
59     */
60    H323EndPoint(
61      OpalManager & manager
62    );
63
64    /**Destroy endpoint.
65     */
66    ~H323EndPoint();
67  //@}
68
69  /**@name Overrides from OpalEndPoint */
70  //@{
71    /**Shut down the endpoint, this is called by the OpalManager just before
72       destroying the object and can be handy to make sure some things are
73       stopped before the vtable gets clobbered.
74      */
75    virtual void ShutDown();
76
77    /**Set up a connection to a remote party.
78       This is called from the OpalManager::SetUpConnection() function once
79       it has determined that this is the endpoint for the protocol.
80
81       The general form for this party parameter is:
82
83            [proto:][alias@][transport$]address[:port]
84
85       where the various fields will have meanings specific to the endpoint
86       type. For example, with H.323 it could be "h323:Fred@site.com" which
87       indicates a user Fred at gatekeeper size.com. Whereas for the PSTN
88       endpoint it could be "pstn:5551234" which is to call 5551234 on the
89       first available PSTN line.
90
91       The proto field is optional when passed to a specific endpoint. If it
92       is present, however, it must agree with the endpoints protocol name or
93       PFalse is returned.
94
95       This function usually returns almost immediately with the connection
96       continuing to occur in a new background thread.
97
98       If PFalse is returned then the connection could not be established. For
99       example if a PSTN endpoint is used and the assiciated line is engaged
100       then it may return immediately. Returning a non-NULL value does not
101       mean that the connection will succeed, only that an attempt is being
102       made.
103
104       The default behaviour is pure.
105     */
106  /*  virtual PSafePtr<OpalConnection> MakeConnection(
107      OpalCall & call,                  ///<  Owner of connection
108      const PString & party,            ///<  Remote party to call
109      void * userData  = NULL,          ///<  Arbitrary data to pass to connection
110      unsigned int options = NULL,      ///<  options to pass to conneciton
111      OpalConnection::StringOptions * stringOptions = NULL
112    );*/
113  //@}
114
115
116    /**Set the gateway prefixes
117       Override this to set the acceptable prefixes to the gatekeeper
118      */
119    virtual bool OnSetGatewayPrefixes(
120      PStringList & prefixes
121    ) const;
122  //@}
123
124
125  /**@name Capabilities */
126  //@{
127    /**Add a codec to the capabilities table. This will assure that the
128       assignedCapabilityNumber field in the codec is unique for all codecs
129       installed on this endpoint.
130
131       If the specific instnace of the capability is already in the table, it
132       is not added again. Ther can be multiple instances of the same
133       capability class however.
134     */
135    void AddCapability(
136      H323Capability * capability   ///<  New codec specification
137    );
138
139    /**Set the capability descriptor lists. This is three tier set of
140       codecs. The top most level is a list of particular capabilities. Each
141       of these consists of a list of alternatives that can operate
142       simultaneously. The lowest level is a list of codecs that cannot
143       operate together. See H323 section 6.2.8.1 and H245 section 7.2 for
144       details.
145
146       If descriptorNum is P_MAX_INDEX, the the next available index in the
147       array of descriptors is used. Similarly if simultaneous is P_MAX_INDEX
148       the the next available SimultaneousCapabilitySet is used. The return
149       value is the index used for the new entry. Note if both are P_MAX_INDEX
150       then the return value is the descriptor index as the simultaneous index
151       must be zero.
152
153       Note that the capability specified here is automatically added to the
154       capability table using the AddCapability() function. A specific
155       instance of a capability is only ever added once, so multiple
156       SetCapability() calls with the same H323Capability pointer will only
157       add that capability once.
158     */
159    PINDEX SetCapability(
160      PINDEX descriptorNum, ///<  The member of the capabilityDescriptor to add
161      PINDEX simultaneous,  ///<  The member of the SimultaneousCapabilitySet to add
162      H323Capability * cap  ///<  New capability specification
163    );
164
165    /**Add all matching capabilities in list.
166       All capabilities that match the specified name are added. See the
167       capabilities code for details on the matching algorithm.
168      */
169    PINDEX AddAllCapabilities(
170      PINDEX descriptorNum, ///<  The member of the capabilityDescriptor to add
171      PINDEX simultaneous,  ///<  The member of the SimultaneousCapabilitySet to add
172      const PString & name  ///<  New capabilities name, if using "known" one.
173    );
174
175    /**Add all user input capabilities to this endpoints capability table.
176      */
177    void AddAllUserInputCapabilities(
178      PINDEX descriptorNum, ///<  The member of the capabilityDescriptor to add
179      PINDEX simultaneous   ///<  The member of the SimultaneousCapabilitySet to add
180    );
181
182    /**Remove capabilites in table.
183      */
184    void RemoveCapabilities(
185      const PStringArray & codecNames
186    );
187
188    /**Reorder capabilites in table.
189      */
190    void ReorderCapabilities(
191      const PStringArray & preferenceOrder
192    );
193
194      /**Find a capability that has been registered.
195     */
196    H323Capability * FindCapability(
197      H323Capability::MainTypes mainType,   ///<  Main type of codec
198      unsigned subType                      ///<  Subtype of codec
199    ) const;
200  //@}
201
202  /**@name Gatekeeper management */
203  //@{
204    /**Use and register with an explicit gatekeeper.
205       This will call other functions according to the following table:
206
207           address    identifier   function
208           empty      empty        DiscoverGatekeeper()
209           non-empty  empty        SetGatekeeper()
210           empty      non-empty    LocateGatekeeper()
211           non-empty  non-empty    SetGatekeeperZone()
212
213       The localAddress field, if non-empty, indicates the interface on which
214       to look for the gatekeeper. An empty string is equivalent to "ip$*:*"
215       which is any interface or port.
216
217       If the endpoint is already registered with a gatekeeper that meets
218       the same criteria then the gatekeeper is not changed, otherwise it is
219       deleted (with unregistration) and new one created and registered to.
220
221       Note that a gatekeeper address of "*" is treated like an empty string
222       resulting in gatekeeper discovery.
223     */
224    PBoolean UseGatekeeper(
225      const PString & address = PString::Empty(),     ///<  Address of gatekeeper to use.
226      const PString & identifier = PString::Empty(),  ///<  Identifier of gatekeeper to use.
227      const PString & localAddress = PString::Empty() ///<  Local interface to use.
228    );
229
230    /**Select and register with an explicit gatekeeper.
231       This will use the specified transport and a string giving a transport
232       dependent address to locate a specific gatekeeper. The endpoint will
233       register with that gatekeeper and, if successful, set it as the current
234       gatekeeper used by this endpoint.
235
236       Note the transport being passed in will be deleted by this function or
237       the H323Gatekeeper object it becomes associated with. Also if transport
238       is NULL then a H323TransportUDP is created.
239     */
240    PBoolean SetGatekeeper(
241      const PString & address,          ///<  Address of gatekeeper to use.
242      H323Transport * transport = NULL  ///<  Transport over which to talk to gatekeeper.
243    );
244
245    /**Select and register with an explicit gatekeeper and zone.
246       This will use the specified transport and a string giving a transport
247       dependent address to locate a specific gatekeeper. The endpoint will
248       register with that gatekeeper and, if successful, set it as the current
249       gatekeeper used by this endpoint.
250
251       The gatekeeper identifier is set to the spplied parameter to allow the
252       gatekeeper to either allocate a zone or sub-zone, or refuse to register
253       if the zones do not match.
254
255       Note the transport being passed in will be deleted by this function or
256       the H323Gatekeeper object it becomes associated with. Also if transport
257       is NULL then a H323TransportUDP is created.
258     */
259    PBoolean SetGatekeeperZone(
260      const PString & address,          ///<  Address of gatekeeper to use.
261      const PString & identifier,       ///<  Identifier of gatekeeper to use.
262      H323Transport * transport = NULL  ///<  Transport over which to talk to gatekeeper.
263    );
264
265    /**Locate and select gatekeeper.
266       This function will use the automatic gatekeeper discovery methods to
267       locate the gatekeeper on the particular transport that has the specified
268       gatekeeper identifier name. This is often the "Zone" for the gatekeeper.
269
270       Note the transport being passed in will be deleted becomes owned by the
271       H323Gatekeeper created by this function and will be deleted by it. Also
272       if transport is NULL then a H323TransportUDP is created.
273     */
274    PBoolean LocateGatekeeper(
275      const PString & identifier,       ///<  Identifier of gatekeeper to locate.
276      H323Transport * transport = NULL  ///<  Transport over which to talk to gatekeeper.
277    );
278
279    /**Discover and select gatekeeper.
280       This function will use the automatic gatekeeper discovery methods to
281       locate the first gatekeeper on a particular transport.
282
283       Note the transport being passed in will be deleted becomes owned by the
284       H323Gatekeeper created by this function and will be deleted by it. Also
285       if transport is NULL then a H323TransportUDP is created.
286     */
287    PBoolean DiscoverGatekeeper(
288      H323Transport * transport = NULL  ///<  Transport over which to talk to gatekeeper.
289    );
290
291    /**Create a gatekeeper.
292       This allows the application writer to have the gatekeeper as a
293       descendent of the H323Gatekeeper in order to add functionality to the
294       base capabilities in the library.
295
296       The default creates an instance of the H323Gatekeeper class.
297     */
298    virtual H323Gatekeeper * CreateGatekeeper(
299      H323Transport * transport  ///<  Transport over which gatekeepers communicates.
300    ) /Factory/;
301
302    /**Get the gatekeeper we are registered with.
303     */
304    H323Gatekeeper * GetGatekeeper() const;
305
306    /**Return if endpoint is registered with gatekeeper.
307      */
308    PBoolean IsRegisteredWithGatekeeper() const;
309
310    /**Unregister and delete the gatekeeper we are registered with.
311       The return value indicates PFalse if there was an error during the
312       unregistration. However the gatekeeper is still removed and its
313       instance deleted regardless of this error.
314     */
315    PBoolean RemoveGatekeeper(
316      int reason = -1    ///<  Reason for gatekeeper removal
317    );
318
319    /**Set the H.235 password for the gatekeeper.
320      */
321    virtual void SetGatekeeperPassword(
322      const PString & password,
323      const PString & username = PString::Empty()
324    );
325
326    /**Get the H.235 username for the gatekeeper.
327      */
328    virtual const PString & GetGatekeeperUsername() const;
329
330    /**Get the H.235 password for the gatekeeper.
331      */
332    virtual const PString & GetGatekeeperPassword() const;
333
334    /**Create a list of authenticators for gatekeeper.
335      */
336    /*virtual H235Authenticators CreateAuthenticators();*/
337
338    /**Called when the gatekeeper sends a GatekeeperConfirm
339      */
340    virtual void  OnGatekeeperConfirm();
341
342    /**Called when the gatekeeper sends a GatekeeperReject
343      */
344    virtual void  OnGatekeeperReject();
345
346    /**Called when the gatekeeper sends a RegistrationConfirm
347      */
348    virtual void OnRegistrationConfirm();
349
350    /**Called when the gatekeeper sends a RegistrationReject
351      */
352    virtual void  OnRegistrationReject();
353  //@}
354
355  /**@name Connection management */
356  //@{
357    /**Handle new incoming connetion from listener.
358      */
359    virtual PBoolean NewIncomingConnection(
360      OpalTransport * transport  ///<  Transport connection came in on
361    );
362
363     /**Setup the transfer of an existing call (connection) to a new remote party
364       using H.450.2.  This sends a Call Transfer Setup Invoke message from the
365       B-Party (transferred endpoint) to the C-Party (transferred-to endpoint).
366
367       If the transport parameter is NULL the transport is determined from the
368       remoteParty description. The general form for this parameter is
369       [alias@][transport$]host[:port] where the default alias is the same as
370       the host, the default transport is "ip" and the default port is 1720.
371
372       This function returns almost immediately with the transfer occurring in a
373       new background thread.
374
375       This function is declared virtual to allow an application to override
376       the function and get the new call token of the forwarded call.
377     */
378    virtual PBoolean SetupTransfer(
379      const PString & token,        ///<  Existing connection to be transferred
380      const PString & callIdentity, ///<  Call identity of the secondary call (if it exists)
381      const PString & remoteParty,  ///<  Remote party to transfer the existing call to
382      void * userData = NULL        ///<  user data to pass to CreateConnection
383    );
384
385    /**Initiate the transfer of an existing call (connection) to a new remote
386       party using H.450.2.  This sends a Call Transfer Initiate Invoke
387       message from the A-Party (transferring endpoint) to the B-Party
388       (transferred endpoint).
389     */
390    void TransferCall(
391      const PString & token,        ///<  Existing connection to be transferred
392      const PString & remoteParty,  ///<  Remote party to transfer the existing call to
393      const PString & callIdentity = PString::Empty()
394                                    ///<  Call Identity of secondary call if present
395    );
396
397    /**Transfer the call through consultation so the remote party in the
398       primary call is connected to the called party in the second call
399       using H.450.2.  This sends a Call Transfer Identify Invoke message
400       from the A-Party (transferring endpoint) to the C-Party
401       (transferred-to endpoint).
402     */
403    void ConsultationTransfer(
404      const PString & primaryCallToken,   ///<  Token of primary call
405      const PString & secondaryCallToken  ///<  Token of secondary call
406    );
407
408    /**Place the call on hold, suspending all media channels (H.450.4)
409    * NOTE: Only Local Hold is implemented so far.
410    */
411    void HoldCall(
412      const PString & token,        ///<  Existing connection to be transferred
413      PBoolean localHold   ///<  true for Local Hold, false for Remote Hold
414    );
415
416    /** Initiate Call intrusion
417        Designed similar to MakeCall function
418      */
419    PBoolean IntrudeCall(
420      const PString & remoteParty,  ///<  Remote party to intrude call
421      unsigned capabilityLevel,     ///<  Capability level
422      void * userData = NULL        ///<  user data to pass to CreateConnection
423    );
424
425    /**Parse a party address into alias and transport components.
426       An appropriate transport is determined from the remoteParty parameter.
427       The general form for this parameter is [alias@][transport$]host[:port]
428       where the default alias is the same as the host, the default transport
429       is "ip" and the default port is 1720.
430      */
431    PBoolean ParsePartyName(
432      const PString & party,          ///<  Party name string.
433      PString & alias,                ///<  Parsed alias name
434      H323TransportAddress & address, ///<  Parsed transport address
435      OpalConnection::StringOptions * stringOptions = NULL ///< String options parsed from party name
436    );
437
438    ///**Find a connection that uses the specified token.
439    //   This searches the endpoint for the connection that contains the token
440    //   as provided by functions such as MakeCall(). if not found it will then search for
441    //   the string representation of the CallIdentifier for the connection, and
442    //   finally try for the string representation of the ConferenceIdentifier.
443
444    //   Note the caller of this function MUSt call the H323Connection::Unlock()
445    //   function if this function returns a non-NULL pointer. If it does not
446    //   then a deadlock can occur.
447    //  */
448    //PSafePtr<H323Connection> FindConnectionWithLock(
449    //  const PString & token,     ///<  Token to identify connection
450    //  PSafetyMode mode = PSafeReadWrite
451    //);
452
453    /**Handle a connection transfer.
454       This gives the application an opportunity to abort the transfer.
455       The default behaviour just returns PTrue.
456      */
457    virtual PBoolean OnCallTransferInitiate(
458      H323Connection & connection,    ///<  Connection to transfer
459      const PString & remoteParty     ///<  Party transferring to.
460    );
461
462    /**Handle a transfer via consultation.
463       This gives the transferred-to user an opportunity to abort the transfer.
464       The default behaviour just returns PTrue.
465      */
466    virtual PBoolean OnCallTransferIdentify(
467      H323Connection & connection    ///<  Connection to transfer
468    );
469
470    virtual OpalConnection::AnswerCallResponse OnAnswerCall(
471       OpalConnection & connection,
472       const PString & caller
473    );
474
475    /**A call back function whenever a connection is established.
476       This indicates that a connection to a remote endpoint was established
477       with a control channel and zero or more logical channels.
478
479       The default behaviour does nothing.
480      */
481    virtual void OnConnectionEstablished(
482      H323Connection & connection,    ///<  Connection that was established
483      const PString & token           ///<  Token for identifying connection
484    );
485
486    /**Determine if a connection is established.
487      */
488    virtual PBoolean IsConnectionEstablished(
489      const PString & token   ///<  Token for identifying connection
490    );
491
492
493    /**Call back from GK admission confirm to notify the
494     * Endpoint it is behind a NAT (GNUGK Gatekeeper).
495     * The default does nothing.
496     * Override this to notify the user they are behind a NAT.
497     */
498    virtual void OnGatekeeperNATDetect(
499      PIPSocket::Address publicAddr,         ///> Public address as returned by the Gatekeeper
500      PString & gkIdentifier,                ///> Identifier at the gatekeeper
501      H323TransportAddress & gkRouteAddress  ///> Gatekeeper Route Address
502    );
503  //@}
504
505  /**@name Service Control */
506  //@{
507    /**Call back for HTTP based Service Control.
508       An application may override this to use an HTTP based channel using a
509       resource designated by the session ID. For example the session ID can
510       correspond to a browser window and the
511
512       The default behaviour does nothing.
513      */
514    virtual void OnHTTPServiceControl(
515      unsigned operation,  ///<  Control operation
516      unsigned sessionId,  ///<  Session ID for HTTP page
517      const PString & url  ///<  URL to use.
518    );
519
520    /**Call back for call credit information.
521       An application may override this to display call credit information
522       on registration, or when a call is started.
523
524       The canDisplayAmountString member variable must also be set to PTrue
525       for this to operate.
526
527       The default behaviour does nothing.
528      */
529    virtual void OnCallCreditServiceControl(
530      const PString & amount,  ///<  UTF-8 string for amount, including currency.
531      PBoolean mode          ///<  Flag indicating that calls will debit the account.
532    );
533
534  /**@name Member variable access */
535  //@{
536    /**Set the default local party name for all connections on this endpoint.
537      */
538    virtual void SetDefaultLocalPartyName(
539      const PString & name  /// Name for local party
540    );
541
542    /**Set the user name to be used for the local end of any connections. This
543       defaults to the logged in user as obtained from the
544       PProcess::GetUserName() function.
545
546       Note that this name is technically the first alias for the endpoint.
547       Additional aliases may be added by the use of the AddAliasName()
548       function, however that list will be cleared when this function is used.
549     */
550    virtual void SetLocalUserName(
551      const PString & name  ///<  Local name of endpoint (prime alias)
552    );
553
554    /**Get the user name to be used for the local end of any connections. This
555       defaults to the logged in user as obtained from the
556       PProcess::GetUserName() function.
557     */
558    virtual const PString & GetLocalUserName() const;
559
560    /**Add an alias name to be used for the local end of any connections. If
561       the alias name already exists in the list then is is not added again.
562
563       The list defaults to the value set in the SetLocalUserName() function.
564       Note that calling SetLocalUserName() will clear the alias list.
565     */
566    PBoolean AddAliasName(
567      const PString & name  ///<  New alias name to add
568    );
569
570    /**Remove an alias name used for the local end of any connections.
571       defaults to an empty list.
572     */
573    PBoolean RemoveAliasName(
574      const PString & name  ///<  New alias namer to add
575    );
576
577    /**Get the user name to be used for the local end of any connections. This
578       defaults to the logged in user as obtained from the
579       PProcess::GetUserName() function.
580     */
581    const PStringList & GetAliasNames() const;
582
583    /**Get the alias patterns, might be used in terminalAliasPattern.
584     */
585    const PStringList & GetAliasNamePatterns() const;
586
587    /**Add an alias name pattern to localAliasPatterns. If
588       the pattern already exists in the list then is is not added again.
589     */
590    PBoolean AddAliasNamePattern(
591      const PString & pattern
592    );
593
594    /**Get the default ILS server to use for user lookup.
595      */
596    const PString & GetDefaultILSServer() const;
597
598    /**Set the default ILS server to use for user lookup.
599      */
600    void SetDefaultILSServer(
601      const PString & server
602    );
603
604    /**Get the default fast start mode.
605      */
606    PBoolean IsFastStartDisabled() const;
607
608    /**Set the default fast start mode.
609      */
610    void DisableFastStart(
611      PBoolean mode ///<  New default mode
612    );
613
614    /**Get the default H.245 tunneling mode.
615      */
616    PBoolean IsH245TunnelingDisabled() const;
617
618    /**Set the default H.245 tunneling mode.
619      */
620    void DisableH245Tunneling(
621      PBoolean mode ///<  New default mode
622    );
623
624    /**Get the default H.245 tunneling mode.
625      */
626    PBoolean IsH245inSetupDisabled() const;
627
628    /**Set the default H.245 tunneling mode.
629      */
630    void DisableH245inSetup(
631      PBoolean mode ///<  New default mode
632    );
633
634    /** find out if h245 is disabled or enabled
635      * @return PTrue if h245 is disabled
636      */
637    PBoolean IsH245Disabled() const;
638
639    /**Disable/Enable H.245, used at least for h450.7 calls
640     * @param  bH245Disabled PTrue if h245 has to be disabled
641     */
642    void DisableH245(PBoolean bH245Disabled);
643
644    /**Get the flag indicating the endpoint can display an amount string.
645      */
646    PBoolean CanDisplayAmountString() const;
647
648    /**Set the flag indicating the endpoint can display an amount string.
649      */
650    void SetCanDisplayAmountString(
651      PBoolean mode ///<  New default mode
652    );
653
654    /**Get the flag indicating the call will automatically clear after a time.
655      */
656    PBoolean CanEnforceDurationLimit() const;
657
658    /**Set the flag indicating the call will automatically clear after a time.
659      */
660    void SetCanEnforceDurationLimit(
661      PBoolean mode ///<  New default mode
662    );
663
664    /**Get Call Intrusion Protection Level of the end point.
665      */
666    unsigned GetCallIntrusionProtectionLevel() const;
667
668    /**Set Call Intrusion Protection Level of the end point.
669      */
670    void SetCallIntrusionProtectionLevel(
671      unsigned level  ///<  New level from 0 to 3
672    );
673
674    /**Called from H.450 OnReceivedInitiateReturnError
675      */
676    virtual void OnReceivedInitiateReturnError();
677
678    /**See if should automatically do call forward of connection.
679     */
680    PBoolean CanAutoCallForward() const;
681
682    /**Get the current capability table for this endpoint.
683     */
684    /*const H323Capabilities & GetCapabilities() const;*/
685
686    /**Endpoint types.
687     */
688    enum TerminalTypes {
689      e_TerminalOnly = 50,
690      e_TerminalAndMC = 70,
691      e_GatewayOnly = 60,
692      e_GatewayAndMC = 80,
693      e_GatewayAndMCWithDataMP = 90,
694      e_GatewayAndMCWithAudioMP = 100,
695      e_GatewayAndMCWithAVMP = 110,
696      e_GatekeeperOnly = 120,
697      e_GatekeeperWithDataMP = 130,
698      e_GatekeeperWithAudioMP = 140,
699      e_GatekeeperWithAVMP = 150,
700      e_MCUOnly = 160,
701      e_MCUWithDataMP = 170,
702      e_MCUWithAudioMP = 180,
703      e_MCUWithAVMP = 190
704    };
705
706	/**Get the endpoint terminal type.
707	 */
708	void SetTerminalType(TerminalTypes type);
709
710    /**Get the endpoint terminal type.
711     */
712    TerminalTypes GetTerminalType() const;
713
714    /**Determine if endpoint is terminal type.
715     */
716    PBoolean IsTerminal() const;
717
718    /**Determine if endpoint is gateway type.
719     */
720    PBoolean IsGateway() const;
721
722    /**Determine if endpoint is gatekeeper type.
723     */
724    PBoolean IsGatekeeper() const;
725
726    /**Determine if endpoint is gatekeeper type.
727     */
728    PBoolean IsMCU() const;
729
730    /**Get the default maximum audio jitter delay parameter.
731       Defaults to 50ms
732     */
733    unsigned GetMinAudioJitterDelay() const;
734
735    /**Get the default maximum audio delay jitter parameter.
736       Defaults to 250ms.
737     */
738    unsigned GetMaxAudioJitterDelay() const;
739
740    /**Set the maximum audio delay jitter parameter.
741     */
742    void SetAudioJitterDelay(
743      unsigned minDelay,   ///<  New minimum jitter buffer delay in milliseconds
744      unsigned maxDelay    ///<  New maximum jitter buffer delay in milliseconds
745    );
746
747    /**Get the initial bandwidth parameter.
748     */
749    unsigned GetInitialBandwidth() const;
750
751    /**Get the initial bandwidth parameter.
752     */
753    void SetInitialBandwidth(unsigned bandwidth);
754
755    /**Get the default H.239 control capability.
756     */
757    bool GetDefaultH239Control() const;
758
759    /**Set the default H.239 control capability.
760     */
761    void SetDefaultH239Control(
762      bool on   ///< H.239 control capability is to be sent to remote
763    );
764
765    /**Determine if the address is "local", ie does not need STUN
766     */
767    virtual PBoolean IsLocalAddress(
768      const PIPSocket::Address & remoteAddress
769    ) const;
770
771    /**Provide TCP address translation hook
772     */
773    virtual void TranslateTCPAddress(
774      PIPSocket::Address & localAddr,
775      const PIPSocket::Address & remoteAddr
776    );
777
778    /**Get the TCP port number base for H.245 channels
779     */
780    WORD GetTCPPortBase() const;
781
782    /**Get the TCP port number base for H.245 channels.
783     */
784    WORD GetTCPPortMax() const;
785
786    /**Set the TCP port number base and max for H.245 channels.
787     */
788    void SetTCPPorts(unsigned tcpBase, unsigned tcpMax);
789
790    /**Get the next TCP port number for H.245 channels
791     */
792    WORD GetNextTCPPort();
793
794    /**Get the UDP port number base for RAS channels
795     */
796    WORD GetUDPPortBase() const;
797
798    /**Get the UDP port number base for RAS channels.
799     */
800    WORD GetUDPPortMax() const;
801
802    /**Set the TCP port number base and max for H.245 channels.
803     */
804    void SetUDPPorts(unsigned udpBase, unsigned udpMax);
805
806    /**Get the next UDP port number for RAS channels
807     */
808    WORD GetNextUDPPort();
809
810    /**Get the UDP port number base for RTP channels.
811     */
812    WORD GetRtpIpPortBase() const;
813
814    /**Get the max UDP port number for RTP channels.
815     */
816    WORD GetRtpIpPortMax() const;
817
818    /**Set the UDP port number base and max for RTP channels.
819     */
820    void SetRtpIpPorts(unsigned udpBase, unsigned udpMax);
821
822    /**Get the UDP port number pair for RTP channels.
823     */
824    WORD GetRtpIpPortPair();
825
826    /**Get the default timeout for calling another endpoint.
827     */
828    const PTimeInterval & GetSignallingChannelCallTimeout() const;
829
830    /**Get the default timeout for incoming H.245 connection.
831     */
832    const PTimeInterval & GetControlChannelStartTimeout() const;
833
834    /**Get the default timeout for waiting on an end session.
835     */
836    const PTimeInterval & GetEndSessionTimeout() const;
837
838    /**Get the default timeout for master slave negotiations.
839     */
840    const PTimeInterval & GetMasterSlaveDeterminationTimeout() const;
841
842    /**Get the default retries for H245 master slave negotiations.
843     */
844    unsigned GetMasterSlaveDeterminationRetries() const;
845
846    /**Get the default timeout for H245 capability exchange negotiations.
847     */
848    const PTimeInterval & GetCapabilityExchangeTimeout() const;
849
850    /**Get the default timeout for H245 logical channel negotiations.
851     */
852    const PTimeInterval & GetLogicalChannelTimeout() const;
853
854    /**Get the default timeout for H245 request mode negotiations.
855     */
856    const PTimeInterval & GetRequestModeTimeout() const;
857
858    /**Get the default timeout for H245 round trip delay negotiations.
859     */
860    const PTimeInterval & GetRoundTripDelayTimeout() const;
861
862    /**Get the default rate H245 round trip delay is calculated by connection.
863     */
864    const PTimeInterval & GetRoundTripDelayRate() const;
865
866    /**Get the flag for clearing a call if the round trip delay calculation fails.
867     */
868    PBoolean ShouldClearCallOnRoundTripFail() const;
869
870    /**Get the amount of time with no media that should cause call to clear
871     */
872    const PTimeInterval & GetNoMediaTimeout() const;
873
874    /**Set the amount of time with no media that should cause call to clear
875     */
876    PBoolean SetNoMediaTimeout(
877      const PTimeInterval & newInterval  ///<  New timeout for media
878    );
879
880    /**Get the default timeout for GatekeeperRequest and Gatekeeper discovery.
881     */
882    const PTimeInterval & GetGatekeeperRequestTimeout() const;
883
884    /**Get the default retries for GatekeeperRequest and Gatekeeper discovery.
885     */
886    unsigned GetGatekeeperRequestRetries() const;
887
888    /**Get the default timeout for RAS protocol transactions.
889     */
890    const PTimeInterval & GetRasRequestTimeout() const;
891
892    /**Get the default retries for RAS protocol transations.
893     */
894    unsigned GetRasRequestRetries() const;
895
896    /**Get the default time for gatekeeper to reregister.
897       A value of zero disables the keep alive facility.
898     */
899    const PTimeInterval & GetGatekeeperTimeToLive() const;
900
901    /**Set the default time for gatekeeper to reregister.
902       A value of zero disables the keep alive facility.
903     */
904    void SetGatekeeperTimeToLive(const PTimeInterval & ttl);
905
906    /**Get the iNow Gatekeeper Access Token OID.
907     */
908    const PString & GetGkAccessTokenOID() const;
909
910    /**Set the iNow Gatekeeper Access Token OID.
911     */
912    void SetGkAccessTokenOID(const PString & token);
913
914    /**Get flag to indicate whether to send GRQ on gatekeeper registration
915     */
916    PBoolean GetSendGRQ() const;
917
918    /**Sent flag to indicate whether to send GRQ on gatekeeper registration
919     */
920    void SetSendGRQ(PBoolean v);
921
922    /**Get the default timeout for Call Transfer Timer CT-T1.
923     */
924    const PTimeInterval & GetCallTransferT1() const;
925
926    /**Get the default timeout for Call Transfer Timer CT-T2.
927     */
928    const PTimeInterval & GetCallTransferT2() const;
929
930    /**Get the default timeout for Call Transfer Timer CT-T3.
931     */
932    const PTimeInterval & GetCallTransferT3() const;
933
934    /**Get the default timeout for Call Transfer Timer CT-T4.
935     */
936    const PTimeInterval & GetCallTransferT4() const;
937
938    /** Get Call Intrusion timers timeout */
939    const PTimeInterval & GetCallIntrusionT1() const;
940    const PTimeInterval & GetCallIntrusionT2() const;
941    const PTimeInterval & GetCallIntrusionT3() const;
942    const PTimeInterval & GetCallIntrusionT4() const;
943    const PTimeInterval & GetCallIntrusionT5() const;
944    const PTimeInterval & GetCallIntrusionT6() const;
945
946    /**Get the next available invoke Id for H450 operations
947      */
948    unsigned GetNextH450CallIdentityValue() const;
949
950    PString GetDefaultTransport() const;
951  //@}
952
953};