-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathh323ep.h
3236 lines (2641 loc) · 112 KB
/
h323ep.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* h323ep.h
*
* H.323 protocol handler
*
* Open H323 Library
*
* Copyright (c) 1998-2001 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Open H323 Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions of this code were written with the assisance of funding from
* Vovida Networks, Inc. http://www.vovida.com.
*
* Contributor(s): ______________________________________.
*
* $Id$
*
*/
#ifndef __OPAL_H323EP_H
#define __OPAL_H323EP_H
#include "h323.h"
#include "h323con.h"
#ifdef P_USE_PRAGMA
#pragma interface
#endif
// Add Feature Support
#ifdef H323_H460
#include "h460/h4601.h"
#endif
#ifdef H323_H46025
#include "h460/h460_std25_pidf_lo.h"
#endif
// Add Association Support
#ifdef H323_H461
#include "h460/h461_base.h"
#endif
// Add NAT Method Support
#ifdef P_STUN
#include <ptclib/pnat.h>
class PSTUNClient;
#endif
// Add H.224 Handlers
#ifdef H323_H224
#include <h224/h224.h>
#endif
// Add T.140 Methods
#ifdef H323_T140
#include <h323t140.h>
#endif
class PHandleAggregator;
/* The following classes have forward references to avoid including the VERY
large header files for H225 and H245. If an application requires access
to the protocol classes they can include them, but for simple usage their
inclusion can be avoided.
*/
class H225_EndpointType;
class H225_ArrayOf_SupportedProtocols;
class H225_VendorIdentifier;
class H225_H221NonStandard;
class H225_ServiceControlDescriptor;
class H225_ArrayOf_AliasAddress;
class H323SignalPDU;
class H323ConnectionsCleaner;
class H323ServiceControlSession;
#if H323_H224
class H224_H281Handler;
#endif
#ifdef H323_T120
class OpalT120Protocol;
#endif
#ifdef H323_T38
class OpalT38Protocol;
#endif
#ifdef H323_H460P
struct PresSubDetails;
class H460PresenceHandler;
#endif
#ifdef H323_GNUGK
class GNUGK_Feature;
#endif
#ifdef H323_UPnP
class PNatMethod_UPnP;
#endif
#ifdef H323_FILE
class H323FileTransferHandler;
class H323FileTransferList;
#endif
///////////////////////////////////////////////////////////////////////////////
/**This class manages the H323 endpoint.
An endpoint may have zero or more listeners to create incoming connections
or zero or more outgoing conenctions initiated via the MakeCall() function.
Once a conection exists it is managed by this class instance.
The main thing this class embodies is the capabilities of the application,
that is the codecs and protocols it is capable of.
An application may create a descendant off this class and overide the
CreateConnection() function, if they require a descendant of H323Connection
to be created. This would be quite likely in most applications.
*/
class H323EndPoint : public PObject
{
PCLASSINFO(H323EndPoint, PObject);
public:
enum {
DefaultTcpPort = 1720,
DefaultTLSPort = 1300
};
/**@name Construction */
//@{
/**Create a new endpoint.
*/
H323EndPoint();
/**Destroy endpoint.
*/
~H323EndPoint();
/**Set the endpoint information in H225 PDU's.
*/
virtual void SetEndpointTypeInfo(
H225_EndpointType & info
) const;
/**Set the vendor information in H225 PDU's.
*/
virtual void SetVendorIdentifierInfo(
H225_VendorIdentifier & info
) const;
/**Set the Gateway supported protocol default always H.323
*/
PBoolean SetGatewaySupportedProtocol(
H225_ArrayOf_SupportedProtocols & protocols
) const;
/**Set the gateway prefixes
Override this to set the acceptable prefixes to the gatekeeper
*/
virtual PBoolean OnSetGatewayPrefixes(
PStringList & prefixes
) const;
/**Set the H221NonStandard information in H225 PDU's.
*/
virtual void SetH221NonStandardInfo(
H225_H221NonStandard & info
) const;
//@}
/**@name Capabilities */
//@{
/**Add a codec to the capabilities table. This will assure that the
assignedCapabilityNumber field in the codec is unique for all codecs
installed on this endpoint.
If the specific instnace of the capability is already in the table, it
is not added again. Ther can be multiple instances of the same
capability class however.
*/
void AddCapability(
H323Capability * capability ///< New codec specification
);
/**Set the capability descriptor lists. This is three tier set of
codecs. The top most level is a list of particular capabilities. Each
of these consists of a list of alternatives that can operate
simultaneously. The lowest level is a list of codecs that cannot
operate together. See H323 section 6.2.8.1 and H245 section 7.2 for
details.
If descriptorNum is P_MAX_INDEX, the the next available index in the
array of descriptors is used. Similarly if simultaneous is P_MAX_INDEX
the the next available SimultaneousCapabilitySet is used. The return
value is the index used for the new entry. Note if both are P_MAX_INDEX
then the return value is the descriptor index as the simultaneous index
must be zero.
Note that the capability specified here is automatically added to the
capability table using the AddCapability() function. A specific
instance of a capability is only ever added once, so multiple
SetCapability() calls with the same H323Capability pointer will only
add that capability once.
*/
PINDEX SetCapability(
PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
PINDEX simultaneous, ///< The member of the SimultaneousCapabilitySet to add
H323Capability * cap ///< New capability specification
);
/**Manually remove capability type. This removes the specified Capability type out of the
default capability list.
*/
PBoolean RemoveCapability(
H323Capability::MainTypes capabilityType ///< capability type
);
#ifdef H323_VIDEO
/**Set the Video Frame Size. This is used for capabilities
that use 1 definition for all Video Frame Sizes. This will remove all capabilities
not matching the specified Frame Size and send a message to the remaining video capabilities
to set the maximum framesize allowed to the specified value
*/
PBoolean SetVideoFrameSize(H323Capability::CapabilityFrameSize frameSize,
int frameUnits = 1
);
/**Set the Video Encoder size and rate.
This is used for generic Video Capabilities to set the appropriate level for a given encoder
frame size and rate.
*/
PBoolean SetVideoEncoder(unsigned frameWidth, unsigned frameHeight, unsigned frameRate);
#endif
/**Add all matching capabilities in list.
All capabilities that match the specified name are added. See the
capabilities code for details on the matching algorithm.
*/
PINDEX AddAllCapabilities(
PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
PINDEX simultaneous, ///< The member of the SimultaneousCapabilitySet to add
const PString & name ///< New capabilities name, if using "known" one.
);
/**Add all user input capabilities to this endpoints capability table.
*/
void AddAllUserInputCapabilities(
PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
PINDEX simultaneous ///< The member of the SimultaneousCapabilitySet to add
);
#ifdef H323_VIDEO
#ifdef H323_H239
/** Open Extended Video Session
*/
PBoolean OpenExtendedVideoSession(
const PString & token ///< Connection Token
);
/** Open Extended Video Session
*/
PBoolean OpenExtendedVideoSession(
const PString & token, ///< Connection Token
H323ChannelNumber & num ///< Opened Channel number
);
PBoolean CloseExtendedVideoSession(
const PString & token ///< Connection Token
);
PBoolean CloseExtendedVideoSession(
const PString & token, ///< Connection Token
const H323ChannelNumber & num ///< channel number
);
/**Add all Extended Video capabilities to this endpoints capability table.
*/
void AddAllExtendedVideoCapabilities(
PINDEX descriptorNum, ///< The member of the capabilityDescriptor to add
PINDEX simultaneous ///< The member of the SimultaneousCapabilitySet to add
);
#endif
#endif
/**Remove capabilites in table.
*/
void RemoveCapabilities(
const PStringArray & codecNames
);
/**Reorder capabilites in table.
*/
void ReorderCapabilities(
const PStringArray & preferenceOrder
);
/**Find a capability that has been registered.
*/
H323Capability * FindCapability(
const H245_Capability & cap ///< H245 capability table entry
) const;
/**Find a capability that has been registered.
*/
H323Capability * FindCapability(
const H245_DataType & dataType ///< H245 data type of codec
) const;
/**Find a capability that has been registered.
*/
H323Capability * FindCapability(
H323Capability::MainTypes mainType, ///< Main type of codec
unsigned subType ///< Subtype of codec
) const;
//@}
/**@name Gatekeeper management */
//@{
/**Use and register with an explicit gatekeeper.
This will call other functions according to the following table:
address identifier function
empty empty DiscoverGatekeeper()
non-empty empty SetGatekeeper()
empty non-empty LocateGatekeeper()
non-empty non-empty SetGatekeeperZone()
The localAddress field, if non-empty, indicates the interface on which
to look for the gatekeeper. An empty string is equivalent to "ip$*:*"
which is any interface or port.
If the endpoint is already registered with a gatekeeper that meets
the same criteria then the gatekeeper is not changed, otherwise it is
deleted (with unregistration) and new one created and registered to.
*/
PBoolean UseGatekeeper(
const PString & address = PString::Empty(), ///< Address of gatekeeper to use.
const PString & identifier = PString::Empty(), ///< Identifier of gatekeeper to use.
const PString & localAddress = PString::Empty() ///< Local interface to use.
);
/**Select and register with an explicit gatekeeper.
This will use the specified transport and a string giving a transport
dependent address to locate a specific gatekeeper. The endpoint will
register with that gatekeeper and, if successful, set it as the current
gatekeeper used by this endpoint.
Note the transport being passed in will be deleted by this function or
the H323Gatekeeper object it becomes associated with. Also if transport
is NULL then a H323TransportUDP is created.
*/
PBoolean SetGatekeeper(
const PString & address, ///< Address of gatekeeper to use.
H323Transport * transport = NULL ///< Transport over which to talk to gatekeeper.
);
/**Select and register with an explicit gatekeeper and zone.
This will use the specified transport and a string giving a transport
dependent address to locate a specific gatekeeper. The endpoint will
register with that gatekeeper and, if successful, set it as the current
gatekeeper used by this endpoint.
The gatekeeper identifier is set to the spplied parameter to allow the
gatekeeper to either allocate a zone or sub-zone, or refuse to register
if the zones do not match.
Note the transport being passed in will be deleted by this function or
the H323Gatekeeper object it becomes associated with. Also if transport
is NULL then a H323TransportUDP is created.
*/
PBoolean SetGatekeeperZone(
const PString & address, ///< Address of gatekeeper to use.
const PString & identifier, ///< Identifier of gatekeeper to use.
H323Transport * transport = NULL ///< Transport over which to talk to gatekeeper.
);
/**Locate and select gatekeeper.
This function will use the automatic gatekeeper discovery methods to
locate the gatekeeper on the particular transport that has the specified
gatekeeper identifier name. This is often the "Zone" for the gatekeeper.
Note the transport being passed in will be deleted becomes owned by the
H323Gatekeeper created by this function and will be deleted by it. Also
if transport is NULL then a H323TransportUDP is created.
*/
PBoolean LocateGatekeeper(
const PString & identifier, ///< Identifier of gatekeeper to locate.
H323Transport * transport = NULL ///< Transport over which to talk to gatekeeper.
);
/**Discover and select gatekeeper.
This function will use the automatic gatekeeper discovery methods to
locate the first gatekeeper on a particular transport.
Note the transport being passed in will be deleted becomes owned by the
H323Gatekeeper created by this function and will be deleted by it. Also
if transport is NULL then a H323TransportUDP is created.
*/
PBoolean DiscoverGatekeeper(
H323Transport * transport = NULL ///< Transport over which to talk to gatekeeper.
);
/**Create a gatekeeper.
This allows the application writer to have the gatekeeper as a
descendant of the H323Gatekeeper in order to add functionality to the
base capabilities in the library.
The default creates an instance of the H323Gatekeeper class.
*/
virtual H323Gatekeeper * CreateGatekeeper(
H323Transport * transport ///< Transport over which gatekeepers communicates.
);
/**Get the gatekeeper we are registered with.
*/
H323Gatekeeper * GetGatekeeper() const { return gatekeeper; }
/**Return if endpoint is registered with gatekeeper.
*/
PBoolean IsRegisteredWithGatekeeper() const;
/**Unregister and delete the gatekeeper we are registered with.
The return value indicates FALSE if there was an error during the
unregistration. However the gatekeeper is still removed and its
instance deleted regardless of this error.
*/
PBoolean RemoveGatekeeper(
int reason = -1 ///< Reason for gatekeeper removal
);
/**Force the endpoint to reregister with Gatekeeper
*/
void ForceGatekeeperReRegistration();
/**Set the H.235 password for the gatekeeper.
*/
virtual void SetGatekeeperPassword(
const PString & password
);
/**Get the H.235 password for the gatekeeper.
*/
virtual const PString & GetGatekeeperPassword() const { return gatekeeperPassword; }
/** Check the IP of the Gatekeeper on reregistration
Use this to check if Gatekeeper IP had changed (used for DDNS type registrations)
Default returns FALSE
*/
virtual PBoolean GatekeeperCheckIP(const H323TransportAddress & oldAddr,H323TransportAddress & newaddress);
/**Create priority list for Gatekeeper authenticators.
*/
virtual void SetAuthenticatorOrder(PStringList & names);
/**Create a list of authenticators for gatekeeper.
*/
virtual H235Authenticators CreateAuthenticators();
/**Called when sending a Admission Request to the gatekeeper
*/
virtual void OnAdmissionRequest(H323Connection & connection);
/**Called when the gatekeeper sends a GatekeeperConfirm
*/
virtual void OnGatekeeperConfirm();
/**Called when the gatekeeper sends a GatekeeperReject
*/
virtual void OnGatekeeperReject();
/**Called when the gatekeeper sends a RegistrationConfirm
*/
virtual void OnRegistrationConfirm(const H323TransportAddress & rasAddress);
/**Called when the gatekeeper sends a RegistrationReject
*/
virtual void OnRegistrationReject();
/**Called when Unregistered by Gatekeeper
*/
virtual void OnUnRegisterRequest();
/**Called when reply Unregister to Gatekeeper
*/
virtual void OnUnRegisterConfirm();
/**Called when TTL registration fails
*/
virtual void OnRegisterTTLFail();
/**When an IP address change has been detected
This will remove the listener and gatekeeper
and bind to the new detected IP address
*/
virtual PBoolean OnDetectedIPChange(PIPSocket::Address newIP = PIPSocket::Address::GetAny(4));
//@}
/**@name Connection management */
//@{
/**Add a listener to the endpoint.
This allows for the automatic creating of incoming call connections. An
application should use OnConnectionEstablished() to monitor when calls
have arrived and been successfully negotiated.
Note if this returns TRUE, then the endpoint is responsible for
deleting the H323Listener listener object. If FALSE is returned then
the object is not deleted and it is up to the caller to release the
memory allocated for the object.
If a listener already exists on the same transport address then it is
ignored, but TRUE is still returned. The caller does not need to delete
the object.
*/
PBoolean StartListener(
H323Listener * listener ///< Transport dependent listener.
);
/**Add a listener to the endpoint.
This allows for the automatic creating of incoming call connections. An
application should use OnConnectionEstablished() to monitor when calls
have arrived and been successfully negotiated.
If a listener already exists on the same address then it is ignored,
but TRUE is still returned.
If the iface string is empty then "*" is assumed which will listen on
the standard TCP port on INADDR_ANY.
*/
PBoolean StartListener(
const H323TransportAddress & iface ///< Address of interface to listen on.
);
/**Add listeners to the endpoint.
Set the collection of listeners which will allow the automatic
creating of incoming call connections. An application should use
OnConnectionEstablished() to monitor when calls have arrived and been
successfully negotiated.
If a listener already exists on the interface specified in the list
then it is ignored. If a listener does not yet exist a new one is
created and if a listener is running that is not in the list then it
is stopped and removed.
If the array is empty then the string "*" is assumed which will listen
on the standard TCP port on INADDR_ANY.
Returns TRUE if at least one interface was successfully started.
*/
PBoolean StartListeners(
const H323TransportAddressArray & ifaces ///< Interfaces to listen on.
);
/**Remove a listener from the endpoint.
If the listener parameter is NULL then all listeners are removed.
*/
PBoolean RemoveListener(
H323Listener * listener ///< Transport dependent listener.
);
/**Return a list of the transport addresses for all listeners on this endpoint
*/
H323TransportAddressArray GetInterfaceAddresses(
PBoolean excludeLocalHost = TRUE, ///< Flag to exclude 127.0.0.1
H323Transport * associatedTransport = NULL
///< Associated transport for precedence and translation
);
/**Make a Authenticated call to a remote party.
This Function sets Security Information to be included when calling
a EP which requires Authentication
*/
H323Connection * MakeAuthenticatedCall (
const PString & remoteParty, ///* Remote party to call
const PString & UserName, ///* UserName to Use (Default is LocalPartyName)
const PString & Password, ///* Password to Use (MUST NOT BE EMPTY)
PString & token, ///* String to receive token for connection
void * userData = NULL ///* user data to pass to CreateConnection
);
/**Make a Supplementary call to a remote party.
This Function makes a Non Call supplementary connection (lightweight call) for the purpose
of delivering H.450 & H.460 non call content such as instant messaging and messagebank messages
*/
H323Connection * MakeSupplimentaryCall (
const PString & remoteParty, ///* Remote party to call
PString & token, ///* String to receive token for connection
void * userData = NULL ///* user data to pass to CreateConnection
);
/**Make a call to a remote party. An appropriate transport is determined
from the remoteParty parameter. The general form for this parameter is
[alias@][transport$]host[:port] where the default alias is the same as
the host, the default transport is "ip" and the default port is 1720.
This function returns almost immediately with the call occurring in a
new background thread. Note that the call could be created and cleared
ie OnConnectionCleared is called BEFORE this function returns. It is
guaranteed that the token variable is set before OnConnectionCleared
called.
Note, the returned pointer to the connection is not locked and may be
deleted at any time. This is extremely unlikely immediately after the
function is called, but you should not keep this pointer beyond that
brief time. The the FindConnectionWithLock() function for future
references to the connection object. It is recommended that
MakeCallLocked() be usedin instead.
*/
H323Connection * MakeCall(
const PString & remoteParty, ///< Remote party to call
PString & token, ///< String to receive token for connection
void * userData = NULL, ///< user data to pass to CreateConnection
PBoolean supplementary = false ///< Whether the call is a supplementary call
);
/**Make a call to a remote party using the specified transport.
The remoteParty may be a hostname, alias or other user name that is to
be passed to the transport, if present.
If the transport parameter is NULL the transport is determined from the
remoteParty description.
This function returns almost immediately with the call occurring in a
new background thread. Note that the call could be created and cleared
ie OnConnectionCleared is called BEFORE this function returns. It is
guaranteed that the token variable is set before OnConnectionCleared
called.
Note, the returned pointer to the connection is not locked and may be
deleted at any time. This is extremely unlikely immediately after the
function is called, but you should not keep this pointer beyond that
brief time. The the FindConnectionWithLock() function for future
references to the connection object. It is recommended that
MakeCallLocked() be usedin instead.
*/
H323Connection * MakeCall(
const PString & remoteParty, ///< Remote party to call
H323Transport * transport, ///< Transport to use for call.
PString & token, ///< String to receive token for connection
void * userData = NULL, ///< user data to pass to CreateConnection
PBoolean supplementary = false ///< Whether the call is a supplementary call
);
/**Make a call to a remote party using the specified transport.
The remoteParty may be a hostname, alias or other user name that is to
be passed to the transport, if present.
If the transport parameter is NULL the transport is determined from the
remoteParty description.
This function returns almost immediately with the call occurring in a
new background thread. However the call will not progress very far
*/
H323Connection * MakeCallLocked(
const PString & remoteParty, ///< Remote party to call
PString & token, ///< String to receive token for connection
void * userData = NULL, ///< user data to pass to CreateConnection
H323Transport * transport = NULL ///< Transport to use for call.
);
#ifdef H323_H450
/**@name H.450.2 Call Transfer */
/**Setup the transfer of an existing call (connection) to a new remote party
using H.450.2. This sends a Call Transfer Setup Invoke message from the
B-Party (transferred endpoint) to the C-Party (transferred-to endpoint).
If the transport parameter is NULL the transport is determined from the
remoteParty description. The general form for this parameter is
[alias@][transport$]host[:port] where the default alias is the same as
the host, the default transport is "ip" and the default port is 1720.
This function returns almost immediately with the transfer occurring in a
new background thread.
Note, the returned pointer to the connection is not locked and may be
deleted at any time. This is extremely unlikely immediately after the
function is called, but you should not keep this pointer beyond that
brief time. The the FindConnectionWithLock() function for future
references to the connection object.
This function is declared virtual to allow an application to override
the function and get the new call token of the forwarded call.
*/
virtual H323Connection * SetupTransfer(
const PString & token, ///< Existing connection to be transferred
const PString & callIdentity, ///< Call identity of the secondary call (if it exists)
const PString & remoteParty, ///< Remote party to transfer the existing call to
PString & newToken, ///< String to receive token for the new connection
void * userData = NULL ///< user data to pass to CreateConnection
);
/**Initiate the transfer of an existing call (connection) to a new remote
party using H.450.2. This sends a Call Transfer Initiate Invoke
message from the A-Party (transferring endpoint) to the B-Party
(transferred endpoint).
*/
void TransferCall(
const PString & token, ///< Existing connection to be transferred
const PString & remoteParty, ///< Remote party to transfer the existing call to
const PString & callIdentity = PString::Empty()
///< Call Identity of secondary call if present
);
/**Transfer the call through consultation so the remote party in the
primary call is connected to the called party in the second call
using H.450.2. This sends a Call Transfer Identify Invoke message
from the A-Party (transferring endpoint) to the C-Party
(transferred-to endpoint).
*/
void ConsultationTransfer(
const PString & primaryCallToken, ///< Token of primary call
const PString & secondaryCallToken ///< Token of secondary call
);
/**Place the call on hold, suspending all media channels (H.450.4)
* NOTE: Only Local Hold is implemented so far.
*/
void HoldCall(
const PString & token, ///< Existing connection to be transferred
PBoolean localHold ///< true for Local Hold, false for Remote Hold
);
/** Initiate Call intrusion
Designed similar to MakeCall function
*/
H323Connection * IntrudeCall(
const PString & remoteParty, ///< Remote party to intrude call
PString & token, ///< String to receive token for connection
unsigned capabilityLevel, ///< Capability level
void * userData = NULL ///< user data to pass to CreateConnection
);
H323Connection * IntrudeCall(
const PString & remoteParty, ///< Remote party to intrude call
H323Transport * transport, ///< Transport to use for call.
PString & token, ///< String to receive token for connection
unsigned capabilityLevel, ///< Capability level
void * userData = NULL ///< user data to pass to CreateConnection
);
//@}
/**@name H.450.7 MWI */
/**Received a message wait indication.
Override to collect MWI messages.
default returns true.
return false indicates MWI rejected.
*/
virtual PBoolean OnReceivedMWI(const H323Connection::MWIInformation & mwiInfo);
/**Received a message wait indication Clear.
Override to remove any outstanding MWIs.
default returns true.
return false indicates MWI rejected.
*/
virtual PBoolean OnReceivedMWIClear(const PString & user);
/**Received a message wait indication request on a mail server (Interrogate).
This is used for enquiring on a mail server if
there are any active messages for the served user.
An implementer may populate a H323Connection::MWInformation struct and call
H323Connection::SetMWINonCallParameters to set the interrogate reply
default returns true. if SetMWINonCallParameters called the connect message
will contain a reply msg to the caller.
return false indicates MWI rejected.
*/
virtual PBoolean OnReceivedMWIRequest(
H323Connection * connection, ///< Connection the request came in on
const PString & user ///< User request made for
);
/** Get the Msg Centre name for H450.7 MWI service. */
const PString & GetMWIMessageCentre() { return mwiMsgCentre; }
/** Set the MWI MessageCentre Alias Address (Required when using H323plus as videoMail server for callback) */
void SetMWIMessageCentre(const PString & msgCtr) { mwiMsgCentre = msgCtr; }
//@}
#endif // H323_H450
/** Use DNS SRV and ENUM to resolve all the possible addresses a call party
can be found. Only effective if not registered with Gatekeeper
*/
PBoolean ResolveCallParty(
const PString & _remoteParty,
PStringList & addresses
);
/**Parse a party address into alias and transport components.
An appropriate transport is determined from the remoteParty parameter.
The general form for this parameter is [alias@][transport$]host[:port]
where the default alias is the same as the host, the default transport
is "ip" and the default port is 1720.
*/
virtual PBoolean ParsePartyName(
const PString & party, ///< Party name string.
PString & alias, ///< Parsed alias name
H323TransportAddress & address ///< Parsed transport address
);
/**Clear a current connection.
This hangs up the connection to a remote endpoint. Note that this function
is asynchronous
*/
virtual PBoolean ClearCall(
const PString & token, ///< Token for identifying connection
H323Connection::CallEndReason reason =
H323Connection::EndedByLocalUser ///< Reason for call clearing
);
/**Clearing a current connection.
A connection is being cleared callback. This can be used for PBX applications
to reallocate the line early without waiting for the cleaner thread to clean-up
the connection.
*/
virtual void OnCallClearing(H323Connection * connection, ///* Connection being Cleared
H323Connection::CallEndReason reason ///* Reason for call being cleared
);
/**Clear a current connection.
This hangs up the connection to a remote endpoint. Note that these functions
are synchronous
*/
virtual PBoolean ClearCallSynchronous(
const PString & token, ///< Token for identifying connection
H323Connection::CallEndReason reason =
H323Connection::EndedByLocalUser ///< Reason for call clearing
);
virtual PBoolean ClearCallSynchronous(
const PString & token, ///< Token for identifying connection
H323Connection::CallEndReason reason, ///< Reason for call clearing
PSyncPoint * sync
);
/**Clear all current connections.
This hangs up all the connections to remote endpoints. The wait
parameter is used to wait for all the calls to be cleared and their
memory usage cleaned up before returning. This is typically used in
the destructor for your descendant of H323EndPoint.
*/
virtual void ClearAllCalls(
H323Connection::CallEndReason reason =
H323Connection::EndedByLocalUser, ///< Reason for call clearing
PBoolean wait = TRUE ///< Flag for wait for calls to e cleared.
);
/**Determine if the connectionMutex will block
*/
virtual PBoolean WillConnectionMutexBlock();
/**Determine if a connection is active.
*/
virtual PBoolean HasConnection(
const PString & token ///< Token for identifying connection
);
/**Find a connection that uses the specified token.
This searches the endpoint for the connection that contains the token
as provided by functions such as MakeCall() (as built by the
BuildConnectionToken() function). if not found it will then search for
the string representation of the CallIdentifier for the connection, and
finally try for the string representation of the ConferenceIdentifier.
Note the caller of this function MUSt call the H323Connection::Unlock()
function if this function returns a non-NULL pointer. If it does not
then a deadlock can occur.
*/
H323Connection * FindConnectionWithLock(
const PString & token ///< Token to identify connection
);
/**Get all calls current on the endpoint.
*/
PStringList GetAllConnections();
/**Call back for incoming call.
This function is called from the OnReceivedSignalSetup() function
before it sends the Alerting PDU. It gives an opportunity for an
application to alter the reply before transmission to the other
endpoint.
If FALSE is returned the connection is aborted and a Release Complete
PDU is sent.
The default behaviour simply returns TRUE.
*/
virtual PBoolean OnIncomingCall(
H323Connection & connection, ///< Connection that was established
const H323SignalPDU & setupPDU, ///< Received setup PDU
H323SignalPDU & alertingPDU ///< Alerting PDU to send
);
virtual PBoolean OnIncomingCall(
H323Connection & connection, ///< Connection that was established
const H323SignalPDU & setupPDU, ///< Received setup PDU
H323SignalPDU & alertingPDU, ///< Alerting PDU to send
H323Connection::CallEndReason & reason ///< reason for call refusal, if returned false
);
/**Handle a connection transfer.
This gives the application an opportunity to abort the transfer.
The default behaviour just returns TRUE.
*/
virtual PBoolean OnCallTransferInitiate(
H323Connection & connection, ///< Connection to transfer
const PString & remoteParty ///< Party transferring to.
);
/**Handle a transfer via consultation.
This gives the transferred-to user an opportunity to abort the transfer.
The default behaviour just returns TRUE.
*/
virtual PBoolean OnCallTransferIdentify(
H323Connection & connection ///< Connection to transfer
);
/**
* Callback for ARQ send to a gatekeeper. This allows the endpoint
* to change or check fields in the ARQ before it is sent.
*/
virtual void OnSendARQ(
H323Connection & conn,
H225_AdmissionRequest & arq
);
/**
* Callback for ACF sent back from gatekeeper.
*/
virtual void OnReceivedACF(
H323Connection & conn,
const H225_AdmissionConfirm & acf
);
/**
* Callback for ARJ sent back from gatekeeper.
*/
virtual void OnReceivedARJ(
H323Connection & conn,
const H225_AdmissionReject & arj
);
/**Call back for answering an incoming call.
This function is called from the OnReceivedSignalSetup() function
before it sends the Connect PDU. It gives an opportunity for an
application to alter the reply before transmission to the other
endpoint.
It also gives an application time to wait for some event before
signalling to the endpoint that the connection is to proceed. For
example the user pressing an "Answer call" button.
If AnswerCallDenied is returned the connection is aborted and a Release
Complete PDU is sent. If AnswerCallNow is returned then the H.323
protocol proceeds. Finally if AnswerCallPending is returned then the
protocol negotiations are paused until the AnsweringCall() function is
called.
The default behaviour simply returns AnswerNow.
*/
virtual H323Connection::AnswerCallResponse OnAnswerCall(
H323Connection & connection, ///< Connection that was established
const PString & callerName, ///< Name of caller
const H323SignalPDU & setupPDU, ///< Received setup PDU
H323SignalPDU & connectPDU ///< Connect PDU to send.
);
/**Call back for remote party being alerted.
This function is called from the SendSignalSetup() function after it
receives the optional Alerting PDU from the remote endpoint. That is
when the remote "phone" is "ringing".
If FALSE is returned the connection is aborted and a Release Complete
PDU is sent.
The default behaviour simply returns TRUE.
*/
virtual PBoolean OnAlerting(
H323Connection & connection, ///< Connection that was established
const H323SignalPDU & alertingPDU, ///< Received Alerting PDU