View | Details | Raw Unified | Return to bug 146420
Collapse All | Expand All

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

Return to bug 146420