OPAL
Version 3.10.10
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
lidep.h
Go to the documentation of this file.
1
/*
2
* lidep.h
3
*
4
* Line Interface Device EndPoint
5
*
6
* Open Phone Abstraction Library
7
*
8
* Copyright (c) 2001 Equivalence Pty. Ltd.
9
*
10
* The contents of this file are subject to the Mozilla Public License
11
* Version 1.0 (the "License"); you may not use this file except in
12
* compliance with the License. You may obtain a copy of the License at
13
* http://www.mozilla.org/MPL/
14
*
15
* Software distributed under the License is distributed on an "AS IS"
16
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17
* the License for the specific language governing rights and limitations
18
* under the License.
19
*
20
* The Original Code is Open H323 Library.
21
*
22
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23
*
24
* Portions of this code were written with the assisance of funding from
25
* Quicknet Technologies, Inc. http://www.quicknet.net.
26
*
27
* Contributor(s): ______________________________________.
28
*
29
* $Revision: 27149 $
30
* $Author: rjongbloed $
31
* $Date: 2012-03-07 18:32:36 -0600 (Wed, 07 Mar 2012) $
32
*/
33
34
#ifndef OPAL_LIDS_LIDEP_H
35
#define OPAL_LIDS_LIDEP_H
36
37
#ifdef P_USE_PRAGMA
38
#pragma interface
39
#endif
40
41
#include <
opal/buildopts.h
>
42
43
#include <
opal/endpoint.h
>
44
#include <
lids/lid.h
>
45
#include <
codec/silencedetect.h
>
46
47
48
class
OpalLineConnection
;
49
50
55
class
OpalLineEndPoint
:
public
OpalEndPoint
56
{
57
PCLASSINFO(
OpalLineEndPoint
,
OpalEndPoint
);
58
59
public
:
64
OpalLineEndPoint
(
65
OpalManager
&
manager
66
);
67
69
~OpalLineEndPoint
();
71
103
virtual
PSafePtr<OpalConnection>
MakeConnection
(
104
OpalCall
& call,
105
const
PString & party,
106
void
* userData = NULL,
107
unsigned
int
options = 0,
108
OpalConnection::StringOptions
* stringOptions = NULL
109
);
110
120
virtual
OpalMediaFormatList
GetMediaFormats
()
const
;
122
125
virtual
OpalLineConnection
*
CreateConnection
(
126
OpalCall
& call,
127
OpalLine
& line,
128
void
* userData,
129
const
PString & number
130
);
132
139
PSafePtr<OpalLineConnection>
GetLIDConnectionWithLock
(
140
const
PString & token,
141
PSafetyMode mode = PSafeReadWrite
142
) {
return
PSafePtrCast<OpalConnection, OpalLineConnection>(
GetConnectionWithLock
(token, mode)); }
143
151
PBoolean
AddLine
(
152
OpalLine
* line
153
);
154
158
void
RemoveLine
(
159
OpalLine
* line
160
);
161
162
167
const
PList<OpalLine> &
GetLines
()
const
{
return
lines
;};
168
172
void
RemoveLine
(
173
const
PString & token
174
);
175
180
void
RemoveAllLines
();
181
191
virtual
PBoolean
AddLinesFromDevice
(
192
OpalLineInterfaceDevice
& device
193
);
194
198
void
RemoveLinesFromDevice
(
199
OpalLineInterfaceDevice
& device
200
);
201
207
PBoolean
AddDeviceNames
(
208
const
PStringArray & descriptors
209
);
210
220
PBoolean
AddDeviceName
(
221
const
PString & descriptor
222
);
223
226
const
OpalLineInterfaceDevice
*
GetDeviceByName
(
227
const
PString & descriptor
228
);
229
241
virtual
PBoolean
AddDevice
(
242
OpalLineInterfaceDevice
* device
243
);
244
248
void
RemoveDevice
(
249
OpalLineInterfaceDevice
* device
250
);
251
254
void
RemoveDevices
() {
RemoveAllLines
(); }
255
263
OpalLine
*
GetLine
(
264
const
PString & lineName,
265
bool
enableAudio =
false
,
266
bool
terminating =
true
267
);
268
272
void
SetDefaultLine
(
273
const
PString & lineName
274
);
275
281
bool
SetCountryCode
(
282
OpalLineInterfaceDevice::T35CountryCodes
country
283
);
284
287
bool
SetCountryCodeName
(
288
const
PString & countryName
289
);
291
292
293
protected
:
294
PDECLARE_NOTIFIER
(PThread,
OpalLineEndPoint
, MonitorLines);
295
virtual
void
MonitorLine
(
OpalLine
& line);
296
297
OpalLIDList
devices
;
298
OpalLineList
lines
;
299
PString
defaultLine
;
300
PMutex
linesMutex
;
301
PThread *
monitorThread
;
302
PSyncPoint
exitFlag
;
303
};
304
305
308
class
OpalLineConnection
:
public
OpalConnection
309
{
310
PCLASSINFO(
OpalLineConnection
,
OpalConnection
);
311
312
public
:
317
OpalLineConnection
(
318
OpalCall
& call,
319
OpalLineEndPoint
&
endpoint
,
320
OpalLine
&
line
,
321
const
PString & number
322
);
324
329
virtual
PString
GetPrefixName
()
const
;
330
339
virtual
bool
IsNetworkConnection
()
const
{
return
!line.
IsTerminal
(); }
340
347
virtual
PBoolean
SetUpConnection
();
348
359
virtual
PBoolean
SetAlerting
(
360
const
PString & calleeName,
361
PBoolean withMedia
362
);
363
368
virtual
PBoolean
SetConnected
();
369
388
virtual
void
OnReleased
();
389
396
virtual
PString
GetDestinationAddress
();
397
404
virtual
OpalMediaFormatList
GetMediaFormats
()
const
;
405
420
virtual
OpalMediaStream
*
CreateMediaStream
(
421
const
OpalMediaFormat
& mediaFormat,
422
unsigned
sessionID,
423
PBoolean isSource
424
);
425
438
virtual
PBoolean
OnOpenMediaStream
(
439
OpalMediaStream
& stream
440
);
441
449
virtual
void
OnClosedMediaStream
(
450
const
OpalMediaStream
& stream
451
);
452
455
virtual
PBoolean
SetAudioVolume
(
456
PBoolean source,
457
unsigned
percentage
458
);
459
463
virtual
unsigned
GetAudioSignalLevel
(
464
PBoolean source
465
);
466
474
virtual
PBoolean
SendUserInputString
(
475
const
PString & value
476
);
477
484
virtual
PBoolean
SendUserInputTone
(
485
char
tone,
486
int
duration
487
);
488
495
virtual
PBoolean
PromptUserInput
(
496
PBoolean play
497
);
499
504
void
StartIncoming
();
505
508
virtual
void
Monitor
();
510
511
516
OpalLine
&
GetLine
() {
return
line
; }
517
521
OpalLineInterfaceDevice::CallProgressTones
GetPromptTone
()
const
{
return
m_promptTone
; }
522
525
void
SetPromptTone
(
OpalLineInterfaceDevice::CallProgressTones
tone) {
m_promptTone
= tone; }
526
529
void
setDialDelay
(
530
unsigned
int
uiDialDelay
531
) {
m_dialParams
.
m_dialStartDelay
= uiDialDelay;}
532
536
unsigned
int
getDialDelay
()
const
{
return
m_dialParams
.
m_dialStartDelay
; }
538
539
protected
:
540
OpalLineEndPoint
&
endpoint
;
541
OpalLine
&
line
;
542
bool
wasOffHook
;
543
unsigned
minimumRingCount
;
544
OpalLineInterfaceDevice::DialParams
m_dialParams
;
545
OpalLineInterfaceDevice::CallProgressTones
m_promptTone
;
546
547
PDECLARE_NOTIFIER
(PThread,
OpalLineConnection
, HandleIncoming);
548
PThread *
handlerThread
;
549
};
550
551
555
class
OpalLineMediaStream
:
public
OpalMediaStream
556
{
557
PCLASSINFO(
OpalLineMediaStream
,
OpalMediaStream
);
558
public
:
563
OpalLineMediaStream
(
564
OpalLineConnection
& conn,
565
const
OpalMediaFormat
&
mediaFormat
,
566
unsigned
sessionID
,
567
PBoolean
isSource
,
568
OpalLine
&
line
569
);
571
572
~OpalLineMediaStream
();
573
574
582
virtual
PBoolean
Open
();
583
589
virtual
PBoolean
ReadPacket
(
590
RTP_DataFrame
& packet
591
);
592
598
virtual
PBoolean
WritePacket
(
599
RTP_DataFrame
& packet
600
);
601
605
virtual
PBoolean
ReadData
(
606
BYTE * data,
607
PINDEX size,
608
PINDEX & length
609
);
610
614
virtual
PBoolean
WriteData
(
615
const
BYTE * data,
616
PINDEX length,
617
PINDEX & written
618
);
619
625
virtual
PBoolean
SetDataSize
(
626
PINDEX dataSize,
627
PINDEX frameTime
628
);
629
633
virtual
PBoolean
IsSynchronous
()
const
;
634
645
virtual
PBoolean
RequiresPatchThread
(
646
OpalMediaStream
* stream
647
)
const
;
649
654
OpalLine
&
GetLine
() {
return
line
; }
656
657
protected
:
658
virtual
void
InternalClose
();
659
660
OpalLine
&
line
;
661
bool
notUsingRTP
;
662
bool
useDeblocking
;
663
unsigned
missedCount
;
664
BYTE
lastSID
[4];
665
bool
lastFrameWasSignal
;
666
unsigned
directLineNumber
;
667
};
668
669
670
class
OpalLineSilenceDetector
:
public
OpalSilenceDetector
671
{
672
PCLASSINFO(
OpalLineSilenceDetector
,
OpalSilenceDetector
);
673
public
:
678
OpalLineSilenceDetector
(
679
OpalLine
&
line
,
680
const
Params
& newParam
681
);
683
694
virtual
unsigned
GetAverageSignalLevel
(
695
const
BYTE * buffer,
696
PINDEX size
697
);
699
700
protected
:
701
OpalLine
&
line
;
702
};
703
704
705
#endif // OPAL_LIDS_LIDEP_H
706
707
708
// End of File ///////////////////////////////////////////////////////////////
include
lids
lidep.h
Generated on Wed May 8 2013 05:17:33 for OPAL by
1.8.3.1