OpalLineInterfaceDevice Class Referenceabstract

`#include <lid.h>`

Inheritance diagram for OpalLineInterfaceDevice:

## Data Structures

struct | DialParams

## Public Types

enum | { MaxVolume = 100 }
enum | AECLevels { AECOff, AECLow, AECMedium, AECHigh, AECAuto, AECAGC, AECError }
enum | { DefaultDTMFOnTime = 150, DefaultDTMFOffTime = 50 }
enum | CallProgressTones { NoTone = -1, DialTone, RingTone, BusyTone, CongestionTone, ClearTone, MwiTone, RoutingTone, CNGTone, CEDTone, UserDefinedTone, NumTones }
enum | ToneMixingModes { SimpleTone, AddedTone, ModulatedTone }

enum

T35CountryCodes {
Japan, Albania, Algeria, AmericanSamoa,
Germany, Anguilla, AntiguaAndBarbuda, Argentina,
Ascension, Australia, Austria, Bahamas,
Bahrain, Bangladesh, Barbados, Belgium,
Belize, Benin, Bermudas, Bhutan,
Bolivia, Botswana, Brazil, BritishAntarcticTerritory,
BritishIndianOceanTerritory, BritishVirginIslands, BruneiDarussalam, Bulgaria,
Myanmar, Burundi, Byelorussia, Cameroon,
Canada, CapeVerde, CaymanIslands, CentralAfricanRepublic,
Chad, Chile, China, Colombia,
Comoros, Congo, CookIslands, CostaRica,
Cuba, Cyprus, Czechoslovakia, Cambodia,
DemocraticPeoplesRepublicOfKorea, Denmark, Djibouti, DominicanRepublic,
Dominica, Ecuador, Egypt, ElSalvador,
EquatorialGuinea, Ethiopia, FalklandIslands, Fiji,
Finland, France, FrenchPolynesia, FrenchSouthernAndAntarcticLands,
Gabon, Gambia, Germany2, Angola,
Ghana, Gibraltar, Greece, Grenada,
Guam, Guatemala, Guernsey, Guinea,
GuineaBissau, Guayana, Haiti, Honduras,
Hongkong, Hungary, Iceland, India,
Indonesia, Iran, Iraq, Ireland,
Israel, Italy, CotedIvoire, Jamaica,
Afghanistan, Jersey, Jordan, Kenya,
Kiribati, KoreaRepublic, Kuwait, Lao,
Lebanon, Lesotho, Liberia, Libya,
Liechtenstein, Luxemborg, Macao, Madagascar,
Malaysia, Malawi, Maldives, Mali,
Malta, Mauritania, Mauritius, Mexico,
Monaco, Mongolia, Montserrat, Morocco,
Mozambique, Nauru, Nepal, Netherlands,
NetherlandsAntilles, NewCaledonia, NewZealand, Nicaragua,
Niger, Nigeria, Norway, Oman,
Pakistan, Panama, PapuaNewGuinea, Paraguay,
Peru, Philippines, Poland, Portugal,
PuertoRico, Qatar, Romania, Rwanda,
SaintKittsAndNevis, SaintCroix, SaintHelenaAndAscension, SaintLucia,
SanMarino, SaintThomas, SaoTomeAndPrincipe, SaintVicentAndTheGrenadines,
SaudiArabia, Senegal, Seychelles, SierraLeone,
Singapore, SolomonIslands, Somalia, SouthAfrica,
Spain, SriLanka, Sudan, Suriname,
Swaziland, Sweden, Switzerland, Syria,
Tanzania, Thailand, Togo, Tonga,
TrinidadAndTobago, Tunisia, Turkey, TurksAndCaicosIslands,
Tuvalu, Uganda, Ukraine, UnitedArabEmirates,
UnitedKingdom, UnitedStates, BurkinaFaso, Uruguay,
USSR, Vanuatu, VaticanCityState, Venezuela,
VietNam, WallisAndFutuna, WesternSamoa, Yemen,
Yemen2, Yugoslavia, Zaire, Zambia,
Zimbabwe, NumCountryCodes, UnknownCountry = -1
}

## Public Member Functions

| OpalLineInterfaceDevice ()
virtual PBoolean | Open (const PString &device)=0
virtual PBoolean | IsOpen () const
virtual PBoolean | Close ()
virtual PString | GetDeviceType () const =0
virtual PString | GetDeviceName () const =0
virtual PStringArray | GetAllNames () const =0
virtual PString | GetDescription () const =0
virtual unsigned | GetLineCount () const =0
virtual PBoolean | IsLineTerminal (unsigned line)=0
virtual PBoolean | IsLinePresent (unsigned line, PBoolean force=false)
virtual PBoolean | IsLineOffHook (unsigned line)=0
virtual PBoolean | SetLineOffHook (unsigned line, PBoolean newState=true)=0
virtual PBoolean | SetLineOnHook (unsigned line)
virtual PBoolean | HookFlash (unsigned line, unsigned flashTime=200)
virtual PBoolean | HasHookFlash (unsigned line)
virtual PBoolean | IsLineRinging (unsigned line, DWORD *cadence=NULL)
virtual PBoolean | RingLine (unsigned line, PINDEX nCadence, const unsigned *pattern=NULL, unsigned frequency=400)
virtual PBoolean | SetLineConnected (unsigned line)
virtual PBoolean | IsLineConnected (unsigned line)
virtual PBoolean | IsLineDisconnected (unsigned line, PBoolean checkForWink=true)
virtual PBoolean | SetLineToLineDirect (unsigned line1, unsigned line2, PBoolean connect)
virtual PBoolean | IsLineToLineDirect (unsigned line1, unsigned line2)
virtual OpalMediaFormatList | GetMediaFormats () const =0
virtual PBoolean | SetReadFormat (unsigned line, const OpalMediaFormat &mediaFormat)=0
virtual PBoolean | SetWriteFormat (unsigned line, const OpalMediaFormat &mediaFormat)=0
virtual OpalMediaFormat | GetReadFormat (unsigned line)=0
virtual OpalMediaFormat | GetWriteFormat (unsigned line)=0
virtual PBoolean | StopReading (unsigned line)
virtual PBoolean | StopWriting (unsigned line)
virtual bool | UsesRTP () const
virtual PBoolean | SetReadFrameSize (unsigned line, PINDEX frameSize)
virtual PBoolean | SetWriteFrameSize (unsigned line, PINDEX frameSize)
virtual PINDEX | GetReadFrameSize (unsigned line)
virtual PINDEX | GetWriteFrameSize (unsigned line)
virtual PBoolean | ReadFrame (unsigned line, void *buf, PINDEX &count)=0
virtual PBoolean | WriteFrame (unsigned line, const void *buf, PINDEX count, PINDEX &written)=0
virtual PBoolean | ReadBlock (unsigned line, void *buf, PINDEX count)
virtual PBoolean | WriteBlock (unsigned line, const void *buf, PINDEX count)
virtual unsigned | GetAverageSignalLevel (unsigned line, PBoolean playback)
virtual PBoolean | EnableAudio (unsigned line, PBoolean enable=true)
PBoolean | DisableAudio (unsigned line)
virtual PBoolean | IsAudioEnabled (unsigned line) const
virtual PBoolean | SetRecordVolume (unsigned line, unsigned volume)
virtual PBoolean | SetPlayVolume (unsigned line, unsigned volume)
virtual PBoolean | GetRecordVolume (unsigned line, unsigned &volume)
virtual PBoolean | GetPlayVolume (unsigned line, unsigned &volume)
virtual AECLevels | GetAEC (unsigned line) const
virtual PBoolean | SetAEC (unsigned line, AECLevels level)
virtual PBoolean | GetVAD (unsigned line) const
virtual PBoolean | SetVAD (unsigned line, PBoolean enable)
virtual PBoolean | GetCallerID (unsigned line, PString &idString, PBoolean full=false)
virtual PBoolean | SetCallerID (unsigned line, const PString &idString)
virtual PBoolean | SendVisualMessageWaitingIndicator (unsigned line, PBoolean on)
virtual PBoolean | PlayDTMF (unsigned line, const char *digits, DWORD onTime=DefaultDTMFOnTime, DWORD offTime=DefaultDTMFOffTime)
virtual char | ReadDTMF (unsigned line)
virtual PBoolean | GetRemoveDTMF (unsigned line)
virtual PBoolean | SetRemoveDTMF (unsigned line, PBoolean removeTones)
virtual CallProgressTones | IsToneDetected (unsigned line)
virtual CallProgressTones | WaitForToneDetect (unsigned line, unsigned timeout=3000)
virtual PBoolean | WaitForTone (unsigned line, CallProgressTones tone, unsigned timeout=3000)
virtual bool | SetToneDescription (unsigned line, CallProgressTones tone, const PString &description)
virtual bool | SetToneParameters (unsigned line, CallProgressTones tone, unsigned frequency1, unsigned frequency2, ToneMixingModes mode, PINDEX numCadences, const unsigned *onTimes, const unsigned *offTimes)
virtual PBoolean | PlayTone (unsigned line, CallProgressTones tone)
virtual PBoolean | IsTonePlaying (unsigned line)
virtual PBoolean | StopTone (unsigned line)
virtual CallProgressTones | DialOut (unsigned line, const PString &number, const DialParams &params=DialParams())
virtual unsigned | GetWinkDuration (unsigned line)
virtual PBoolean | SetWinkDuration (unsigned line, unsigned winkDuration)
T35CountryCodes | GetCountryCode () const
PString | GetCountryCodeName () const
virtual PBoolean | SetCountryCode (T35CountryCodes country)
virtual PBoolean | SetCountryCodeName (const PString &countryName)
virtual PStringList | GetCountryCodeNameList () const
virtual PBoolean | PlayAudio (unsigned line, const PString &filename)
virtual PBoolean | StopAudio (unsigned line)
virtual PBoolean | RecordAudioStart (unsigned line, const PString &filename)
virtual PBoolean | RecordAudioStop (unsigned line)
int | GetErrorNumber () const
PString | GetErrorText () const
virtual void | PrintOn (ostream &strm) const

## Static Public Member Functions

static PString | GetCountryCodeName (T35CountryCodes code)
static T35CountryCodes | GetCountryCode (const PString &name)
static OpalLineInterfaceDevice * | Create (const PString &type, void *parameters=NULL)
static OpalLineInterfaceDevice * | CreateAndOpen (const PString &descriptor, void *parameters=NULL)
static PStringList | GetAllTypes ()
static PStringList | GetAllDevices ()

## Protected Attributes

int | os_handle
int | osError
T35CountryCodes | countryCode
PBYTEArray | m_readDeblockingBuffer
PBYTEArray | m_writeDeblockingBuffer
PINDEX | m_readDeblockingOffset
PINDEX | m_writeDeblockingOffset
std::vector< bool > | m_LineAudioEnabled
PString | m_callProgressTones [NumTones]

## Detailed Description

Line Interface Device abstraction. Note all functions in this device abstraction are assumed to be thread atomic.

## Member Enumeration Documentation

anonymous enum

Enumerator
MaxVolume |

anonymous enum

Enumerator
DefaultDTMFOnTime |
DefaultDTMFOffTime |

enum OpalLineInterfaceDevice::AECLevels

Enumerator
AECOff |
AECLow |
AECMedium |
AECHigh |
AECAuto |
AECAGC |
AECError |

enum OpalLineInterfaceDevice::CallProgressTones

Enumerator
NoTone |
DialTone |
RingTone |
BusyTone |
CongestionTone |
ClearTone |
MwiTone |
RoutingTone |
CNGTone |
CEDTone |
UserDefinedTone |
NumTones |

enum OpalLineInterfaceDevice::T35CountryCodes

Enumerator
Japan |
Albania |
Algeria |
AmericanSamoa |
Germany |
Anguilla |
AntiguaAndBarbuda |
Argentina |
Ascension |
Australia |
Austria |
Bahamas |
Bahrain |
Bangladesh |
Barbados |
Belgium |
Belize |
Benin |
Bermudas |
Bhutan |
Bolivia |
Botswana |
Brazil |
BritishAntarcticTerritory |
BritishIndianOceanTerritory |
BritishVirginIslands |
BruneiDarussalam |
Bulgaria |
Myanmar |
Burundi |
Byelorussia |
Cameroon |
Canada |
CapeVerde |
CaymanIslands |
CentralAfricanRepublic |
Chad |
Chile |
China |
Colombia |
Comoros |
Congo |
CookIslands |
CostaRica |
Cuba |
Cyprus |
Czechoslovakia |
Cambodia |
DemocraticPeoplesRepublicOfKorea |
Denmark |
Djibouti |
DominicanRepublic |
Dominica |
Ecuador |
Egypt |
ElSalvador |
EquatorialGuinea |
Ethiopia |
FalklandIslands |
Fiji |
Finland |
France |
FrenchPolynesia |
FrenchSouthernAndAntarcticLands |
Gabon |
Gambia |
Germany2 |
Angola |
Ghana |
Gibraltar |
Greece |
Grenada |
Guam |
Guatemala |
Guernsey |
Guinea |
GuineaBissau |
Guayana |
Haiti |
Honduras |
Hongkong |
Hungary |
Iceland |
India |
Indonesia |
Iran |
Iraq |
Ireland |
Israel |
Italy |
CotedIvoire |
Jamaica |
Afghanistan |
Jersey |
Jordan |
Kenya |
Kiribati |
KoreaRepublic |
Kuwait |
Lao |
Lebanon |
Lesotho |
Liberia |
Libya |
Liechtenstein |
Luxemborg |
Macao |
Madagascar |
Malaysia |
Malawi |
Maldives |
Mali |
Malta |
Mauritania |
Mauritius |
Mexico |
Monaco |
Mongolia |
Montserrat |
Morocco |
Mozambique |
Nauru |
Nepal |
Netherlands |
NetherlandsAntilles |
NewCaledonia |
NewZealand |
Nicaragua |
Niger |
Nigeria |
Norway |
Oman |
Pakistan |
Panama |
PapuaNewGuinea |
Paraguay |
Peru |
Philippines |
Poland |
Portugal |
PuertoRico |
Qatar |
Romania |
Rwanda |
SaintKittsAndNevis |
SaintCroix |
SaintHelenaAndAscension |
SaintLucia |
SanMarino |
SaintThomas |
SaoTomeAndPrincipe |
SaintVicentAndTheGrenadines |
SaudiArabia |
Senegal |
Seychelles |
SierraLeone |
Singapore |
SolomonIslands |
Somalia |
SouthAfrica |
Spain |
SriLanka |
Sudan |
Suriname |
Swaziland |
Sweden |
Switzerland |
Syria |
Tanzania |
Thailand |
Togo |
Tonga |
TrinidadAndTobago |
Tunisia |
Turkey |
TurksAndCaicosIslands |
Tuvalu |
Uganda |
Ukraine |
UnitedArabEmirates |
UnitedKingdom |
UnitedStates |
BurkinaFaso |
Uruguay |
USSR |
Vanuatu |
VaticanCityState |
Venezuela |
VietNam |
WallisAndFutuna |
WesternSamoa |
Yemen |
Yemen2 |
Yugoslavia |
Zaire |
Zambia |
Zimbabwe |
NumCountryCodes |
UnknownCountry |

enum OpalLineInterfaceDevice::ToneMixingModes

Enumerator
SimpleTone |
AddedTone |
ModulatedTone |

## Constructor & Destructor Documentation

OpalLineInterfaceDevice::OpalLineInterfaceDevice | ( |  | ) |

Construct a new line interface device.

## Member Function Documentation

virtual PBoolean OpalLineInterfaceDevice::Close | ( |  | ) |

virtual

Close the line interface device.

Reimplemented in OpalPluginLID.

static OpalLineInterfaceDevice* OpalLineInterfaceDevice::Create | ( | const PString & | type,
|  | void * | parameters = `NULL`
| ) |  |

static

Create a new device from the registration string

Parameters

  type | Type of device to create
  parameters | Arbitrary parameters for the LID

static OpalLineInterfaceDevice* OpalLineInterfaceDevice::CreateAndOpen | ( | const PString & | descriptor,
|  | void * | parameters = `NULL`
| ) |  |

static

Create a new device and open it given the descriptor string. The descriptor consists of the device type, a ':' character and then the specific device name.

Parameters

  descriptor | Type of device to create
  parameters | Arbitrary parameters for the LID

virtual CallProgressTones OpalLineInterfaceDevice::DialOut | ( | unsigned | line,
|  | const PString & | number,
|  | const DialParams & | params = `DialParams()`
| ) |  |

virtual

Dial a number on network line. The takes the line off hook, waits for dial tone, and transmits the specified number as DTMF tones.

If the requireTones flag is true the call is aborted of the call progress tones are not detected. Otherwise the call proceeds with short delays while it tries to detect the call progress tones.

The return code indicates the following: DialTone No dial tone detected RingTone Dial was successful BusyTone The remote phone was busy ClearTone Dial failed (usually means rang out) NoTone There was an internal error making the call

Parameters

  line | Number of line
  number | Number to dial
  params | Optional parameters for dial out.

Reimplemented in OpalPluginLID.

Referenced by OpalLine::DialOut().

PBoolean OpalLineInterfaceDevice::DisableAudio | ( | unsigned | line | ) |

inline

Disable audio for the line.

Parameters

  line | Number of line

References EnableAudio().

virtual PBoolean OpalLineInterfaceDevice::EnableAudio | ( | unsigned | line,
|  | PBoolean | enable = `true`
| ) |  |

virtual

Enable audio for the line.

Parameters

  line | Number of line
  enable | Enable/disable audio

Reimplemented in OpalPluginLID.

Referenced by DisableAudio(), and OpalLine::EnableAudio().

virtual AECLevels OpalLineInterfaceDevice::GetAEC | ( | unsigned | line | ) | const

virtual

Get acoustic echo cancellation. Note, not all devices may support this function.

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::GetAEC().

static PStringList OpalLineInterfaceDevice::GetAllDevices | ( |  | ) |

static

Return an array of all the LID types registered and all of the possible devices each one can open. Each string will be of the form "type: name" eg "Quicknet: 3211FFFF"

virtual PStringArray OpalLineInterfaceDevice::GetAllNames | ( |  | ) | const

pure virtual

Get all the possible devices that can be opened.

Implemented in OpalPluginLID.

static PStringList OpalLineInterfaceDevice::GetAllTypes | ( |  | ) |

static

Return an array of all the LID types registered.

virtual unsigned OpalLineInterfaceDevice::GetAverageSignalLevel | ( | unsigned | line,
|  | PBoolean | playback
| ) |  |

virtual

Get average signal level in last frame.

Parameters

  line | Number of line
  playback | Get average playback or record level.

Reimplemented in OpalPluginLID.

Referenced by OpalLine::GetAverageSignalLevel().

virtual PBoolean OpalLineInterfaceDevice::GetCallerID | ( | unsigned | line,
|  | PString & | idString,
|  | PBoolean | full = `false`
| ) |  |

virtual

Get Caller ID from the last incoming ring. The idString parameter is either simply the "number" field of the caller ID data, or if full is true, all of the fields in the caller ID data.

The full data of the caller ID string consists fields separated by tab characters ('\t'), the first three are always the Calling Line Identity (CLI or calling number), the date and the Calling Line Name field. Other fields may follow and are the of the form name=value. The values are LID dependent.

A false is returned if there is no Caller ID information available, e.g. if no ring has occurred.

Parameters

  line | Number of line
  idString | ID string returned
  full | Get full information in idString

Reimplemented in OpalPluginLID.

Referenced by OpalLine::GetCallerID().

T35CountryCodes OpalLineInterfaceDevice::GetCountryCode | ( |  | ) | const

inline

Get the country code set for the device.

References countryCode.

static T35CountryCodes OpalLineInterfaceDevice::GetCountryCode | ( | const PString & | name | ) |

static

PString OpalLineInterfaceDevice::GetCountryCodeName | ( |  | ) | const

Get the country code set for the device as a string.

static PString OpalLineInterfaceDevice::GetCountryCodeName | ( | T35CountryCodes | code | ) |

static

Get the country code set for the device as a string.

virtual PStringList OpalLineInterfaceDevice::GetCountryCodeNameList | ( |  | ) | const

virtual

Get the list of countries actually supported by the device

Reimplemented in OpalPluginLID.

virtual PString OpalLineInterfaceDevice::GetDescription | ( |  | ) | const

pure virtual

Get the description of the line interface device. This is a string indication of the card type for user interface display purposes or device specific control. The device should be as detailed as possible eg "Quicknet LineJACK".

Implemented in OpalPluginLID.

virtual PString OpalLineInterfaceDevice::GetDeviceName | ( |  | ) | const

pure virtual

Get the device name, as used to open the device. Note the format of this name should be as is returned from GetAllName() and must be able to be used in a subsequent Open() call.

Implemented in OpalPluginLID.

virtual PString OpalLineInterfaceDevice::GetDeviceType | ( |  | ) | const

pure virtual

Get the device type identifier. This is as is used in the factory registration.

Implemented in OpalPluginLID.

int OpalLineInterfaceDevice::GetErrorNumber | ( |  | ) | const

inline

Return number for last error.

References osError.

PString OpalLineInterfaceDevice::GetErrorText | ( |  | ) | const

Return text for last error.

virtual unsigned OpalLineInterfaceDevice::GetLineCount | ( |  | ) | const

pure virtual

Get the total number of lines supported by this device.

Implemented in OpalPluginLID.

virtual OpalMediaFormatList OpalLineInterfaceDevice::GetMediaFormats | ( |  | ) | const

pure virtual

Get the media formats this device is capable of using.

Implemented in OpalPluginLID.

virtual PBoolean OpalLineInterfaceDevice::GetPlayVolume | ( | unsigned | line,
|  | unsigned & | volume
| ) |  |

virtual

Set volume level for playing. A value of 100 is the maximum volume possible for the hardware. A value of 0 is the minimum volume possible for the hardware.

Parameters

  line | Number of line
  volume | Volume level from 0 to 100%

Reimplemented in OpalPluginLID.

Referenced by OpalLine::GetPlayVolume().

virtual OpalMediaFormat OpalLineInterfaceDevice::GetReadFormat | ( | unsigned | line | ) |

pure virtual

Get the media format (codec) for reading on the specified line.

Parameters

  line | Number of line

Implemented in OpalPluginLID.

Referenced by OpalLine::GetReadFormat().

virtual PINDEX OpalLineInterfaceDevice::GetReadFrameSize | ( | unsigned | line | ) |

virtual

Get the read frame size in bytes. All calls to ReadFrame() will return this number of bytes.

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::GetReadFrameSize().

virtual PBoolean OpalLineInterfaceDevice::GetRecordVolume | ( | unsigned | line,
|  | unsigned & | volume
| ) |  |

virtual

Get volume level for recording. A value of 100 is the maximum volume possible for the hardware. A value of 0 is the minimum volume possible for the hardware.

Parameters

  line | Number of line
  volume | Volume level from 0 to 100%

Reimplemented in OpalPluginLID.

Referenced by OpalLine::GetRecordVolume().

virtual PBoolean OpalLineInterfaceDevice::GetRemoveDTMF | ( | unsigned | line | ) |

virtual

Get DTMF removal mode. When set in this mode the DTMF tones detected are removed from the encoded data stream as returned by ReadFrame().

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::GetRemoveDTMF().

virtual PBoolean OpalLineInterfaceDevice::GetVAD | ( | unsigned | line | ) | const

virtual

Get voice activity detection. Note, not all devices, or selected codecs, may support this function.

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::GetVAD().

virtual unsigned OpalLineInterfaceDevice::GetWinkDuration | ( | unsigned | line | ) |

virtual

Get wink detect minimum duration. This is the signal used by telcos to end PSTN call.

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

virtual OpalMediaFormat OpalLineInterfaceDevice::GetWriteFormat | ( | unsigned | line | ) |

pure virtual

Get the media format (codec) for writing on the specified line.

Parameters

  line | Number of line

Implemented in OpalPluginLID.

Referenced by OpalLine::GetWriteFormat().

virtual PINDEX OpalLineInterfaceDevice::GetWriteFrameSize | ( | unsigned | line | ) |

virtual

Get the write frame size in bytes. All calls to WriteFrame() must be this number of bytes.

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::GetWriteFrameSize().

virtual PBoolean OpalLineInterfaceDevice::HasHookFlash | ( | unsigned | line | ) |

virtual

Return true if a hook flash has been detected

Reimplemented in OpalPluginLID.

Referenced by OpalLine::HasHookFlash().

virtual PBoolean OpalLineInterfaceDevice::HookFlash | ( | unsigned | line,
|  | unsigned | flashTime = `200`
| ) |  |

virtual

Set the hook state off then straight back on again. This will only operate if the line is currently off hook.

Parameters

  line | Number of line
  flashTime | Time for hook flash in milliseconds

Reimplemented in OpalPluginLID.

Referenced by OpalLine::HookFlash().

virtual PBoolean OpalLineInterfaceDevice::IsAudioEnabled | ( | unsigned | line | ) | const

virtual

Determine if audio for the line is enabled.

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::IsAudioEnabled().

virtual PBoolean OpalLineInterfaceDevice::IsLineConnected | ( | unsigned | line | ) |

virtual

Determine if remote has answered call on line. This uses the hardware (and country) dependent means for determining if the remote end of a PSTN connection has answered. Typically this is a "polarity reversal" but other techniques may be used.

It should be noted that IsLineConnected() is not exactly the same thing as !IsLineDisconnected().

For a POTS port this is equivalent to IsLineOffHook().

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::IsConnected().

virtual PBoolean OpalLineInterfaceDevice::IsLineDisconnected | ( | unsigned | line,
|  | PBoolean | checkForWink = `true`
| ) |  |

virtual

Determine if line has been disconnected from a call. This uses the hardware (and country) dependent means for determining if the remote end of a PSTN connection has hung up. For example a "wink" or "K break" which is a short drop in line voltage similar to (though opposite in sense) toa hook flash.

It should be noted that IsLineDisconnected() is not exactly the same thing as !IsLineConnected().

For a POTS port this is equivalent to !IsLineOffHook().

Parameters

  line | Number of line
  checkForWink | Flag to check for remote hang up

Reimplemented in OpalPluginLID.

Referenced by OpalLine::IsDisconnected().

virtual PBoolean OpalLineInterfaceDevice::IsLineOffHook | ( | unsigned | line | ) |

pure virtual

Determine if line is currently off hook. This function implies that the state is debounced and that a return value of true indicates that the phone is really off hook. That is hook flashes and winks are masked out.

Parameters

  line | Number of line

Implemented in OpalPluginLID.

Referenced by OpalLine::IsOffHook().

virtual PBoolean OpalLineInterfaceDevice::IsLinePresent | ( | unsigned | line,
|  | PBoolean | force = `false`
| ) |  |

virtual

Determine if a physical line is present on the logical line.

Parameters

  line | Number of line
  force | Force test, do not optimise

Reimplemented in OpalPluginLID.

Referenced by OpalLine::IsPresent().

virtual PBoolean OpalLineInterfaceDevice::IsLineRinging | ( | unsigned | line,
|  | DWORD * | cadence = `NULL`
| ) |  |

virtual

Determine if line is ringing. This function implies that the state is "debounced" and that a return value of true indicates that the phone is still ringing and it is not simply a pause in the ring cadence.

If cadence is not NULL then it is set with the bit pattern for the incoming ringing. Note that in this case the funtion may take a full sequence to return. If it is NULL it can be assumed that the function will return quickly.

Parameters

  line | Number of line
  cadence | Cadence of incoming ring

Reimplemented in OpalPluginLID.

virtual PBoolean OpalLineInterfaceDevice::IsLineTerminal | ( | unsigned | line | ) |

pure virtual

Get the type of the line. A "terminal" line is one where a call may terminate. For example a POTS line with a standard telephone handset on it would be a terminal line. The alternative is a "network" line, that is one connected to switched network eg the standard PSTN.

Parameters

  line | Number of line

Implemented in OpalPluginLID.

Referenced by OpalLine::IsTerminal().

virtual PBoolean OpalLineInterfaceDevice::IsLineToLineDirect | ( | unsigned | line1,
|  | unsigned | line2
| ) |  |

virtual

Determine if the two lines are directly connected.

Parameters

  line1 | Number of first line
  line2 | Number of second line

Reimplemented in OpalPluginLID.

virtual PBoolean OpalLineInterfaceDevice::IsOpen | ( |  | ) | const

virtual

Determine if the line interface device is open.

virtual CallProgressTones OpalLineInterfaceDevice::IsToneDetected | ( | unsigned | line | ) |

virtual

See if any tone is detected.

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::IsToneDetected().

virtual PBoolean OpalLineInterfaceDevice::IsTonePlaying | ( | unsigned | line | ) |

virtual

Determine if a tone is still playing

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::IsTonePlaying().

virtual PBoolean OpalLineInterfaceDevice::Open | ( | const PString & | device | ) |

pure virtual

Open the line interface device.

Parameters

  device | Device identifier name.

Implemented in OpalPluginLID.

virtual PBoolean OpalLineInterfaceDevice::PlayAudio | ( | unsigned | line,
|  | const PString & | filename
| ) |  |

virtual

Play a wav file

Parameters

  line | Number of line
  filename | File Name

virtual PBoolean OpalLineInterfaceDevice::PlayDTMF | ( | unsigned | line,
|  | const char * | digits,
|  | DWORD | onTime = `DefaultDTMFOnTime`,
|  | DWORD | offTime = `DefaultDTMFOffTime`
| ) |  |

virtual

Play a DTMF digit. Any characters that are not in the set 0-9, A-D, * or # will be ignored.

Parameters

  line | Number of line
  digits | DTMF digits to be played
  onTime | Number of milliseconds to play each DTMF digit
  offTime | Number of milliseconds between digits

Reimplemented in OpalPluginLID.

Referenced by OpalLine::PlayDTMF().

virtual PBoolean OpalLineInterfaceDevice::PlayTone | ( | unsigned | line,
|  | CallProgressTones | tone
| ) |  |

virtual

Play a tone.

Parameters

  line | Number of line
  tone | Tone to be played

Reimplemented in OpalPluginLID.

Referenced by OpalLine::PlayTone().

virtual void OpalLineInterfaceDevice::PrintOn | ( | ostream & | strm | ) | const

virtual

virtual PBoolean OpalLineInterfaceDevice::ReadBlock | ( | unsigned | line,
|  | void * | buf,
|  | PINDEX | count
| ) |  |

virtual

High level read of audio data from the device. This version will allow non-integral number of frames to be read.

Parameters

  line | Number of line
  buf | Pointer to a block of memory to receive the read bytes.
  count | Count of bytes to read.

Referenced by OpalLine::ReadBlock().

virtual char OpalLineInterfaceDevice::ReadDTMF | ( | unsigned | line | ) |

virtual

Read a DTMF digit detected. This may be characters from the set 0-9, A-D, * or #. A null ('\0') character indicates that there are no tones in the queue. Characters E through P indicate the following tones:

E = 800 F = 1000 G = 1250 H = 950 I = 1100 J = 1400 K = 1500 L = 1600 M = 1800 N = 2100 O = 1300 P = 2450

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::ReadDTMF().

virtual PBoolean OpalLineInterfaceDevice::ReadFrame | ( | unsigned | line,
|  | void * | buf,
|  | PINDEX & | count
| ) |  |

pure virtual

Low level read of a frame from the device.

Parameters

  line | Number of line
  buf | Pointer to a block of memory to receive data.
  count | Number of bytes read, <= GetReadFrameSize()

Implemented in OpalPluginLID.

Referenced by OpalLine::ReadFrame().

virtual PBoolean OpalLineInterfaceDevice::RecordAudioStart | ( | unsigned | line,
|  | const PString & | filename
| ) |  |

virtual

start recording audio

Parameters

  line | line
  filename | File Name

virtual PBoolean OpalLineInterfaceDevice::RecordAudioStop | ( | unsigned | line | ) |

virtual

stop recording audio

Parameters

  line | line

virtual PBoolean OpalLineInterfaceDevice::RingLine | ( | unsigned | line,
|  | PINDEX | nCadence,
|  | const unsigned * | pattern = `NULL`,
|  | unsigned | frequency = `400`
| ) |  |

virtual

Begin ringing local phone set with specified cadence. If nCadence is zero then stops ringing.

Note that this may not be possible on a given line, for example on a PSTN line the ring state is determined by external hardware and cannot be changed by the software.

Also note that the cadence may be ignored by particular hardware driver so that only the zero or non-zero values are significant.

The ring pattern is an array of millisecond times for on and off parts of the cadence. Thus the Australian ring cadence would be represented by the array unsigned AusRing[] = { 400, 200, 400, 2000 }

If the nCadence in non-zero and the pattern parameter is NULL, then the standard ring pattern for the selected country is used.

Parameters

  line | Number of line
  nCadence | Number of entries in cadence array
  pattern | Ring pattern times
  frequency | Frequency of ring (if relevant)

Reimplemented in OpalPluginLID.

Referenced by OpalLine::Ring().

virtual PBoolean OpalLineInterfaceDevice::SendVisualMessageWaitingIndicator | ( | unsigned | line,
|  | PBoolean | on
| ) |  |

virtual

Send a Visual Message Waiting Indicator

Parameters

  line | Number of line
  on | Flag for VMWI on/off

Reimplemented in OpalPluginLID.

Referenced by OpalLine::SendVisualMessageWaitingIndicator().

virtual PBoolean OpalLineInterfaceDevice::SetAEC | ( | unsigned | line,
|  | AECLevels | level
| ) |  |

virtual

Set acoustic echo cancellation. Note, not all devices may support this function.

Parameters

  line | Number of line
  level | AEC level

Reimplemented in OpalPluginLID.

Referenced by OpalLine::SetAEC().

virtual PBoolean OpalLineInterfaceDevice::SetCallerID | ( | unsigned | line,
|  | const PString & | idString
| ) |  |

virtual

Set Caller ID information. The idString must be as a minimum a number fields for the Calling Line Identity.

The full data of the caller ID string consists fields separated by tab characters ('\t'), the first three are always the Calling Line Identity (CLI or calling number), the date and the Calling Line Name field. Other fields may follow and are the of the form name=value. The values are LID dependent.

If the date field is missing (e.g. two consecutive tabs) then the current time and date is used. Using an empty string will clear the caller ID so that no caller ID is sent on the next RingLine() call.

if the line is on hook then this information is sent when the next RingLine() function is called to start a ring cycle. Note that if the Ring cycle had already been started then this function may return false.

If the line is off hook, then a Caller ID on Message Waiting is sent, if supported by the LID, otherwise false is returned.

Parameters

  line | Number of line
  idString | ID string to use

Reimplemented in OpalPluginLID.

Referenced by OpalLine::SetCallerID().

virtual PBoolean OpalLineInterfaceDevice::SetCountryCode | ( | T35CountryCodes | country | ) |

virtual

Set the country code set for the device. This may change the line analogue coefficients, ring detect, call disconnect detect and call progress tones to fit the countries telephone network.

Parameters

  country | COuntry code for device

Reimplemented in OpalPluginLID.

virtual PBoolean OpalLineInterfaceDevice::SetCountryCodeName | ( | const PString & | countryName | ) |

virtual

Set the country code set for the device.

Parameters

  countryName | COuntry code for device

virtual PBoolean OpalLineInterfaceDevice::SetLineConnected | ( | unsigned | line | ) |

virtual

Indicate to the POTS handset that the call is connected. This uses the hardware (and country) dependent means to indicate to the remote end of a POTS connection that we have answerd. Typically this is a "polarity reversal" but other techniques may be used.

The "connected" state remains in force till the remote disconnects the call, though hanging up.

Returns true if successful, always returns false for PSTN lines.

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::SetConnected().

virtual PBoolean OpalLineInterfaceDevice::SetLineOffHook | ( | unsigned | line,
|  | PBoolean | newState = `true`
| ) |  |

pure virtual

Set the hook state of the line. Note that not be possible on a given line, for example a POTS line with a standard telephone handset. The hook state is determined by external hardware and cannot be changed by the software.

Parameters

  line | Number of line
  newState | New state to set

Implemented in OpalPluginLID.

Referenced by SetLineOnHook(), OpalLine::SetOffHook(), and OpalLine::SetOnHook().

virtual PBoolean OpalLineInterfaceDevice::SetLineOnHook | ( | unsigned | line | ) |

inline virtual

Set the hook state of the line. This is the complement of SetLineOffHook().

Parameters

  line | Number of line

References SetLineOffHook().

virtual PBoolean OpalLineInterfaceDevice::SetLineToLineDirect | ( | unsigned | line1,
|  | unsigned | line2,
|  | PBoolean | connect
| ) |  |

virtual

Directly connect the two lines.

Parameters

  line1 | Number of first line
  line2 | Number of second line
  connect | Flag for connect/disconnect

Reimplemented in OpalPluginLID.

virtual PBoolean OpalLineInterfaceDevice::SetPlayVolume | ( | unsigned | line,
|  | unsigned | volume
| ) |  |

virtual

Set volume level for playing. A value of 100 is the maximum volume possible for the hardware. A value of 0 is the minimum volume possible for the hardware.

Parameters

  line | Number of line
  volume | Volume level from 0 to 100%

Reimplemented in OpalPluginLID.

Referenced by OpalLine::SetPlayVolume().

virtual PBoolean OpalLineInterfaceDevice::SetReadFormat | ( | unsigned | line,
|  | const OpalMediaFormat & | mediaFormat
| ) |  |

pure virtual

Set the media format (codec) for reading on the specified line.

Parameters

  line | Number of line
  mediaFormat | Codec type

Implemented in OpalPluginLID.

Referenced by OpalLine::SetReadFormat().

virtual PBoolean OpalLineInterfaceDevice::SetReadFrameSize | ( | unsigned | line,
|  | PINDEX | frameSize
| ) |  |

virtual

Set the read frame size in bytes. Note that a LID may ignore this value so always use GetReadFrameSize() for I/O.

Parameters

  line | Number of line
  frameSize | New frame size

Reimplemented in OpalPluginLID.

Referenced by OpalLine::SetReadFrameSize().

virtual PBoolean OpalLineInterfaceDevice::SetRecordVolume | ( | unsigned | line,
|  | unsigned | volume
| ) |  |

virtual

Set volume level for recording. A value of 100 is the maximum volume possible for the hardware. A value of 0 is the minimum volume possible for the hardware.

Parameters

  line | Number of line
  volume | Volume level from 0 to 100%

Reimplemented in OpalPluginLID.

Referenced by OpalLine::SetRecordVolume().

virtual PBoolean OpalLineInterfaceDevice::SetRemoveDTMF | ( | unsigned | line,
|  | PBoolean | removeTones
| ) |  |

virtual

Set DTMF removal mode. When set in this mode the DTMF tones detected are removed from the encoded data stream as returned by ReadFrame().

Parameters

  line | Number of line
  removeTones | Flag for removing DTMF tones.

Reimplemented in OpalPluginLID.

Referenced by OpalLine::SetRemoveDTMF().

virtual bool OpalLineInterfaceDevice::SetToneDescription | ( | unsigned | line,
|  | CallProgressTones | tone,
|  | const PString & | description
| ) |  |

virtual

Set a calling tones description. This sets the calling tone infromation for both wtah is emitted by PlayTone and what is detected by IsToneDetected().

The description string is of the form frequency ':' cadence where frequency is either frequency play tone, detect +/- 5% low '-' high play tone halfway, but detect anything in range low '+' high play both tones, detect anything in range low 'x' high play tone1 modulated by tone2, detect twice modulation range and cadence is mintime ontime '-' offtime ontime '-' offtime '-' ontime '-' offtime examples: 300:0.25 300Hz for minimum 250ms 1100:0.4-0.4 1100Hz with cadence 400ms on, 400ms off 900-1300:1.5 900Hz to 1300Hz for minimum of 1.5 seconds 425:0.4-0.2-0.4-2 425Hz with cadence 400ms on, 200ms off, 400ms on, 2 seconds off

Parameters

  line | Number of line
  tone | Tone filter to change
  description | Description of filter parameters

virtual bool OpalLineInterfaceDevice::SetToneParameters | ( | unsigned | line,
|  | CallProgressTones | tone,
|  | unsigned | frequency1,
|  | unsigned | frequency2,
|  | ToneMixingModes | mode,
|  | PINDEX | numCadences,
|  | const unsigned * | onTimes,
|  | const unsigned * | offTimes
| ) |  |

virtual

Set calling tones filter parameters. Note this function is misnamed as it can also set the calling tone to be output by PlayTone().

Parameters

  line | Number of line
  tone | Tone filter to change
  frequency1 | Usually low frequency
  frequency2 | Usually high frequency
  mode | Mode for how freqencies are mixed, -1 is
  numCadences | Number of cadence times
  onTimes | Cadence ON times
  offTimes | Cadence OFF times

Reimplemented in OpalPluginLID.

virtual PBoolean OpalLineInterfaceDevice::SetVAD | ( | unsigned | line,
|  | PBoolean | enable
| ) |  |

virtual

Set voice activity detection. Note, not all devices, or selected codecs, may support this function.

Parameters

  line | Number of line
  enable | Flag for enabling VAD

Reimplemented in OpalPluginLID.

Referenced by OpalLine::SetVAD().

virtual PBoolean OpalLineInterfaceDevice::SetWinkDuration | ( | unsigned | line,
|  | unsigned | winkDuration
| ) |  |

virtual

Set wink detect minimum duration. This is the signal used by telcos to end PSTN call.

Parameters

  line | Number of line
  winkDuration | New minimum duration

Reimplemented in OpalPluginLID.

virtual PBoolean OpalLineInterfaceDevice::SetWriteFormat | ( | unsigned | line,
|  | const OpalMediaFormat & | mediaFormat
| ) |  |

pure virtual

Set the media format (codec) for writing on the specified line.

Parameters

  line | Number of line
  mediaFormat | Codec type

Implemented in OpalPluginLID.

Referenced by OpalLine::SetWriteFormat().

virtual PBoolean OpalLineInterfaceDevice::SetWriteFrameSize | ( | unsigned | line,
|  | PINDEX | frameSize
| ) |  |

virtual

Set the write frame size in bytes. Note that a LID may ignore this value so always use GetReadFrameSize() for I/O.

Parameters

  line | Number of line
  frameSize | New frame size

Reimplemented in OpalPluginLID.

Referenced by OpalLine::SetWriteFrameSize().

virtual PBoolean OpalLineInterfaceDevice::StopAudio | ( | unsigned | line | ) |

virtual

Stop playing the Wave File

Parameters

  line | Number of line

virtual PBoolean OpalLineInterfaceDevice::StopReading | ( | unsigned | line | ) |

virtual

Stop the read codec.

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::StopReading().

virtual PBoolean OpalLineInterfaceDevice::StopTone | ( | unsigned | line | ) |

virtual

Stop playing a tone.

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::StopTone().

virtual PBoolean OpalLineInterfaceDevice::StopWriting | ( | unsigned | line | ) |

virtual

Stop the write codec.

Parameters

  line | Number of line

Reimplemented in OpalPluginLID.

Referenced by OpalLine::StopWriting().

virtual bool OpalLineInterfaceDevice::UsesRTP | ( |  | ) | const

virtual

Indicate that ReadFrame() & WriteFrame() take whole RTP packets. Note that if this returns true, SetReadFrameSize(), SetWriteFrameSize(), GetReadFrameSize() and GetWriteFrameSize() are no longer relevant.

virtual PBoolean OpalLineInterfaceDevice::WaitForTone | ( | unsigned | line,
|  | CallProgressTones | tone,
|  | unsigned | timeout = `3000`
| ) |  |

virtual

See if a specific tone is detected.

Parameters

  line | Number of line
  tone | Tone to wait for
  timeout | Milliseconds to wait for

Reimplemented in OpalPluginLID.

Referenced by OpalLine::WaitForTone().

virtual CallProgressTones OpalLineInterfaceDevice::WaitForToneDetect | ( | unsigned | line,
|  | unsigned | timeout = `3000`
| ) |  |

virtual

See if any tone is detected.

Parameters

  line | Number of line
  timeout | Milliseconds to wait for

Reimplemented in OpalPluginLID.

Referenced by OpalLine::WaitForToneDetect().

virtual PBoolean OpalLineInterfaceDevice::WriteBlock | ( | unsigned | line,
|  | const void * | buf,
|  | PINDEX | count
| ) |  |

virtual

High level write audio data to the device.

Parameters

  line | Number of line
  buf | Pointer to a block of memory to write.
  count | Count of bytes to write.

Referenced by OpalLine::WriteBlock().

virtual PBoolean OpalLineInterfaceDevice::WriteFrame | ( | unsigned | line,
|  | const void * | buf,
|  | PINDEX | count,
|  | PINDEX & | written
| ) |  |

pure virtual

Low level write frame to the device.

Parameters

  line | Number of line
  buf | Pointer to a block of memory to write.
  count | Number of bytes to write, <= GetWriteFrameSize()
  written | Number of bytes written, <= GetWriteFrameSize()

Implemented in OpalPluginLID.

Referenced by OpalLine::WriteFrame().

## Field Documentation

T35CountryCodes OpalLineInterfaceDevice::countryCode

protected

Referenced by GetCountryCode().

PString OpalLineInterfaceDevice::m_callProgressTones[NumTones]

protected

std::vector<bool> OpalLineInterfaceDevice::m_LineAudioEnabled

protected

PBYTEArray OpalLineInterfaceDevice::m_readDeblockingBuffer

protected

PINDEX OpalLineInterfaceDevice::m_readDeblockingOffset

protected

PBYTEArray OpalLineInterfaceDevice::m_writeDeblockingBuffer

protected

PINDEX OpalLineInterfaceDevice::m_writeDeblockingOffset

protected

int OpalLineInterfaceDevice::os_handle

protected

int OpalLineInterfaceDevice::osError

mutable protected

Referenced by GetErrorNumber().

The documentation for this class was generated from the following file:

- lid.h