OPAL  Version 3.18.8
DahdiLineInterfaceDevice Class Reference

#include <dahdi_ep.h>

Inheritance diagram for DahdiLineInterfaceDevice:
Collaboration diagram for DahdiLineInterfaceDevice:

Data Structures

struct  ChannelInfo
 
struct  FXSChannelInfo
 

Public Member Functions

 DahdiLineInterfaceDevice ()
 
virtual PString GetDeviceType () const
 
virtual PString GetDeviceName () const
 
virtual PStringArray GetAllNames () const
 
virtual PString GetDescription () const
 
virtual OpalMediaFormatList GetMediaFormats () const
 
virtual bool Open (const PString &device)
 
virtual bool Close ()
 
virtual unsigned GetLineCount () const
 
virtual bool IsLineTerminal (unsigned line)
 
virtual bool IsLineOffHook (unsigned line)
 
virtual bool SetLineOffHook (unsigned line, bool newState=true)
 
virtual bool PlayTone (unsigned line, CallProgressTones tone)
 
virtual bool IsTonePlaying (unsigned line)
 
virtual bool StopTone (unsigned line)
 
virtual char ReadDTMF (unsigned line)
 
virtual PINDEX GetReadFrameSize (unsigned line)
 
virtual PINDEX GetWriteFrameSize (unsigned line)
 
virtual bool SetReadFrameSize (unsigned line, PINDEX frameSize)
 
virtual bool SetWriteFrameSize (unsigned line, PINDEX frameSize)
 
virtual bool SetReadFormat (unsigned line, const OpalMediaFormat &mediaFormat)
 
virtual bool SetWriteFormat (unsigned line, const OpalMediaFormat &mediaFormat)
 
virtual bool StopReading (unsigned line)
 
virtual bool StopWriting (unsigned line)
 
virtual OpalMediaFormat GetReadFormat (unsigned line)
 
virtual OpalMediaFormat GetWriteFormat (unsigned line)
 
virtual bool EnableAudio (unsigned line, bool enable=true)
 
virtual bool ReadFrame (unsigned line, void *buf, PINDEX &count)
 
virtual bool WriteFrame (unsigned line, const void *buf, PINDEX count, PINDEX &written)
 
virtual bool SetRecordVolume (unsigned line, unsigned volume)
 
virtual bool SetPlayVolume (unsigned line, unsigned volume)
 
virtual bool GetRecordVolume (unsigned line, unsigned &volume)
 
virtual bool GetPlayVolume (unsigned line, unsigned &volume)
 
virtual bool IsAudioEnabled (unsigned line) const
 
virtual bool IsValidLine (unsigned line) const
 
void BuildPollFDs ()
 
void ThreadMain ()
 
- Public Member Functions inherited from OpalLineInterfaceDevice
 OpalLineInterfaceDevice ()
 
virtual PBoolean IsOpen () const
 
virtual PBoolean IsLinePresent (unsigned line, PBoolean force=false)
 
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 bool UsesRTP () const
 
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 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 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 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 bool IsDigitalSpan (dahdi_spaninfo &span)
 
- Static Public Member Functions inherited from OpalLineInterfaceDevice
static PString GetCountryCodeName (T35CountryCodes code)
 
static T35CountryCodes GetCountryCode (const PString &name)
 
static const T35CountryInfoGetCountryInfo (T35CountryCodes code)
 
static OpalLineInterfaceDeviceCreate (const PString &type, void *parameters=NULL)
 
static OpalLineInterfaceDeviceCreateAndOpen (const PString &descriptor, void *parameters=NULL)
 
static PStringList GetAllTypes ()
 
static PStringList GetAllDevices ()
 

Static Public Attributes

static const char * DeviceName
 

Protected Types

typedef std::vector
< ChannelInfo * > 
ChannelInfoList
 

Protected Attributes

int m_samplesPerBlock
 
PMutex m_mutex
 
ChannelInfoList m_channelInfoList
 
PThread * m_thread
 
bool m_running
 
std::vector< pollfd > m_pollFds
 
PMutex m_pollListMutex
 
bool m_pollListDirty
 
- Protected Attributes inherited from OpalLineInterfaceDevice
int m_osHandle
 
int m_osError
 
T35CountryCodes m_countryCode
 
PBYTEArray m_readDeblockingBuffer
 
PBYTEArray m_writeDeblockingBuffer
 
PINDEX m_readDeblockingOffset
 
PINDEX m_writeDeblockingOffset
 
std::vector< bool > m_LineAudioEnabled
 
PString m_callProgressTones [NumTones]
 

Additional Inherited Members

- Public Types inherited from OpalLineInterfaceDevice
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
}
 

Member Typedef Documentation

typedef std::vector<ChannelInfo *> DahdiLineInterfaceDevice::ChannelInfoList
protected

Constructor & Destructor Documentation

DahdiLineInterfaceDevice::DahdiLineInterfaceDevice ( )

Member Function Documentation

void DahdiLineInterfaceDevice::BuildPollFDs ( )
virtual bool DahdiLineInterfaceDevice::Close ( )
virtual

Close the line interface device.

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::EnableAudio ( unsigned  line,
bool  enable = true 
)
inlinevirtual
virtual PStringArray DahdiLineInterfaceDevice::GetAllNames ( ) const
inlinevirtual

Get all the possible devices that can be opened.

Implements OpalLineInterfaceDevice.

virtual PString DahdiLineInterfaceDevice::GetDescription ( ) const
inlinevirtual

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".

Implements OpalLineInterfaceDevice.

virtual PString DahdiLineInterfaceDevice::GetDeviceName ( ) const
inlinevirtual

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.

Implements OpalLineInterfaceDevice.

virtual PString DahdiLineInterfaceDevice::GetDeviceType ( ) const
inlinevirtual

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

Implements OpalLineInterfaceDevice.

virtual unsigned DahdiLineInterfaceDevice::GetLineCount ( ) const
inlinevirtual

Get the total number of lines supported by this device.

Implements OpalLineInterfaceDevice.

virtual OpalMediaFormatList DahdiLineInterfaceDevice::GetMediaFormats ( ) const
inlinevirtual

Get the media formats this device is capable of using.

Implements OpalLineInterfaceDevice.

References OpalPCM16.

virtual bool DahdiLineInterfaceDevice::GetPlayVolume ( unsigned  line,
unsigned &  volume 
)
inlinevirtual

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.

Reimplemented from OpalLineInterfaceDevice.

virtual OpalMediaFormat DahdiLineInterfaceDevice::GetReadFormat ( unsigned  line)
inlinevirtual

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

Implements OpalLineInterfaceDevice.

References OpalG711ALaw.

virtual PINDEX DahdiLineInterfaceDevice::GetReadFrameSize ( unsigned  line)
inlinevirtual

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

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::GetRecordVolume ( unsigned  line,
unsigned &  volume 
)
inlinevirtual

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.

Reimplemented from OpalLineInterfaceDevice.

virtual OpalMediaFormat DahdiLineInterfaceDevice::GetWriteFormat ( unsigned  line)
inlinevirtual

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

Implements OpalLineInterfaceDevice.

References OpalG711ALaw.

virtual PINDEX DahdiLineInterfaceDevice::GetWriteFrameSize ( unsigned  line)
inlinevirtual

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

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::IsAudioEnabled ( unsigned  line) const
inlinevirtual

Determine if audio for the line is enabled.

Reimplemented from OpalLineInterfaceDevice.

static bool DahdiLineInterfaceDevice::IsDigitalSpan ( dahdi_spaninfo &  span)
inlinestatic
virtual bool DahdiLineInterfaceDevice::IsLineOffHook ( unsigned  line)
inlinevirtual

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.

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::IsLineTerminal ( unsigned  line)
inlinevirtual

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.

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::IsTonePlaying ( unsigned  line)
inlinevirtual

Determine if a tone is still playing

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::IsValidLine ( unsigned  line) const
inlinevirtual
virtual bool DahdiLineInterfaceDevice::Open ( const PString &  device)
virtual

Open the line interface device.

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::PlayTone ( unsigned  line,
CallProgressTones  tone 
)
inlinevirtual

Play a tone.

Reimplemented from OpalLineInterfaceDevice.

virtual char DahdiLineInterfaceDevice::ReadDTMF ( unsigned  line)
inlinevirtual

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

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::ReadFrame ( unsigned  line,
void *  buf,
PINDEX &  count 
)
inlinevirtual

Low level read of a frame from the device.

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::SetLineOffHook ( unsigned  line,
bool  newState = true 
)
inlinevirtual
virtual bool DahdiLineInterfaceDevice::SetPlayVolume ( unsigned  line,
unsigned  volume 
)
inlinevirtual

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.

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::SetReadFormat ( unsigned  line,
const OpalMediaFormat mediaFormat 
)
virtual

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

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::SetReadFrameSize ( unsigned  line,
PINDEX  frameSize 
)
inlinevirtual

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

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::SetRecordVolume ( unsigned  line,
unsigned  volume 
)
inlinevirtual

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.

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::SetWriteFormat ( unsigned  line,
const OpalMediaFormat mediaFormat 
)
virtual

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

Implements OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::SetWriteFrameSize ( unsigned  line,
PINDEX  frameSize 
)
inlinevirtual

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

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::StopReading ( unsigned  line)
virtual

Stop the read codec.

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::StopTone ( unsigned  line)
inlinevirtual

Stop playing a tone.

Reimplemented from OpalLineInterfaceDevice.

virtual bool DahdiLineInterfaceDevice::StopWriting ( unsigned  line)
virtual

Stop the write codec.

Reimplemented from OpalLineInterfaceDevice.

void DahdiLineInterfaceDevice::ThreadMain ( )
virtual bool DahdiLineInterfaceDevice::WriteFrame ( unsigned  line,
const void *  buf,
PINDEX  count,
PINDEX &  written 
)
inlinevirtual

Low level write frame to the device.

Implements OpalLineInterfaceDevice.

Field Documentation

const char* DahdiLineInterfaceDevice::DeviceName
static
ChannelInfoList DahdiLineInterfaceDevice::m_channelInfoList
protected
PMutex DahdiLineInterfaceDevice::m_mutex
protected
std::vector<pollfd> DahdiLineInterfaceDevice::m_pollFds
protected
bool DahdiLineInterfaceDevice::m_pollListDirty
protected
PMutex DahdiLineInterfaceDevice::m_pollListMutex
protected
bool DahdiLineInterfaceDevice::m_running
protected
int DahdiLineInterfaceDevice::m_samplesPerBlock
protected
PThread* DahdiLineInterfaceDevice::m_thread
protected

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