📄 ixjlid.h
字号:
/* * ixjlid.h * * QuickNet Internet Phone/Line JACK codec interface * * Open H323 Library * * Copyright (c) 1999-2000 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 * Quicknet Technologies, Inc. http://www.quicknet.net. * * Contributor(s): ______________________________________. * * $Log: ixjlid.h,v $ * Revision 1.22 2000/06/22 02:47:12 craigs * Improved PSTN ring detection * * Revision 1.21 2000/06/17 09:34:45 robertj * Put back variables mistakenly thought to be Linux specific. * * Revision 1.20 2000/06/17 04:11:13 craigs * Fixed problem with potential codec startup problem in Linux IXJ driver * Moved Linux specific variables to Linux specific section * * Revision 1.19 2000/05/24 06:42:18 craigs * Added calls to get volume settings * * Revision 1.18 2000/05/02 04:32:24 robertj * Fixed copyright notice comment. * * Revision 1.17 2000/04/13 23:09:38 craigs * Fixed problem with callerId on some systems * * Revision 1.16 2000/04/06 20:36:25 robertj * Fixed some LineJACK compatbility problems (eg DTMF detect stopping). * * Revision 1.15 2000/04/06 19:37:50 craigs * Normalised bask to HAS_IXJ * * Revision 1.14 2000/04/06 19:29:04 craigs * Removed all vestiges of the old IXJ driver * * Revision 1.13 2000/04/06 17:49:40 craigs * Removed LINUX_TELEPHONY. Again. * * Revision 1.12 2000/04/05 18:04:12 robertj * Changed caller ID code for better portability. * * Revision 1.11 2000/04/05 16:28:05 craigs * Added caller ID function * * Revision 1.10 2000/03/29 20:46:47 robertj * Added function on LID to get available codecs. * * Revision 1.9 2000/03/28 03:47:12 craigs * Added stuff to stop tone playing from going wrong * * Revision 1.8 2000/03/22 17:18:48 robertj * Changed default DTMF tone string times. * * Revision 1.7 2000/03/17 20:58:51 robertj * Fixed line count to be xJACK card dependent. * * Revision 1.6 2000/03/14 11:20:49 rogerh * Compile the ixj code on FreeBSD. This is needed for openphone support. * * Revision 1.5 2000/02/22 09:44:33 robertj * Fixed compatibility with Linux systems not yet with the Linux Telephony code. * * Revision 1.4 2000/01/07 10:01:26 robertj * GCC/Linux compatibility * * Revision 1.3 2000/01/07 08:28:09 robertj * Additions and changes to line interface device base class. * * Revision 1.2 1999/12/24 00:28:03 robertj * Changes to IXJ interface to follow LID abstraction * * Revision 1.1 1999/12/23 23:02:35 robertj * File reorganision for separating RTP from H.323 and creation of LID for VPB support. * */#ifndef __IXJ_LID_H#define __IXJ_LID_H#include "lid.h"#include "h323caps.h"#ifdef HAS_IXJ#ifdef P_LINUX#include <linux/telephony.h>#include <linux/ixjuser.h>#endif#endif/**This class describes the xJack line interface device. */class OpalIxJDevice : public OpalLineInterfaceDevice{ PCLASSINFO(OpalIxJDevice, OpalLineInterfaceDevice); public: /**Create a new, closed, device for a xJack card. */ OpalIxJDevice(); /**Destroy line interface device. This calls Close() on the device. */ ~OpalIxJDevice() { Close(); } /**Open the xJack device. */ virtual BOOL Open( const PString & device /// Device identifier name. ); /**Close the xJack device. */ virtual BOOL Close(); /**Get the device name. */ virtual PString GetName() const; enum { POTSLine, PSTNLine, NumLines }; /**Get the total number of lines supported by this device. */ virtual unsigned GetLineCount(); /**Get the type of the line. */ virtual BOOL IsLineTerminal( unsigned line /// Number of line ) { return line == POTSLine; } /**Determine if a physical line is present on the logical line. */ virtual BOOL IsLinePresent( unsigned line /// Number of line ); /**Determine if line is currently off hook. This returns TRUE if GetLineState() is a state that implies the line is off hook (eg OffHook or LineBusy). */ virtual BOOL IsLineOffHook( unsigned line /// Number of line ); /**Set the state of the line. Note that not be possible on a given line. */ virtual BOOL SetLineOffHook( unsigned line, /// Number of line BOOL newState = TRUE /// New state to set ); /**Determine if line is ringing. */ virtual BOOL IsLineRinging( unsigned line, /// Number of line DWORD * cadence = NULL /// Cadence of incoming ring ); /**Begin ringing local phone set with specified cadence. If cadence is zero then stops ringing. */ virtual BOOL RingLine( unsigned line, /// Number of line DWORD cadence /// Cadence bit map for ring pattern ); /**Determine if line has been disconnected from a call. */ virtual BOOL IsLineDisconnected( unsigned line /// Number of line ); /**Directly connect the two lines. */ BOOL SetLineToLineDirect( unsigned line1, /// Number of first line unsigned line2, /// Number of second line BOOL connect /// Flag for connect/disconnect ); /**Determine if the two lines are directly connected. */ BOOL IsLineToLineDirect( unsigned line1, /// Number of first line unsigned line2 /// Number of second line ); /**Get the data formats this device is capable of using. */ virtual PIntArray GetPayloadTypes() const; /**Set the xJack codec for reading. */ virtual BOOL SetReadCodec( unsigned line, /// Number of line RTP_DataFrame::PayloadTypes codec /// Codec type ); /**Set the xJack codec for writing. */ virtual BOOL SetWriteCodec( unsigned line, /// Number of line RTP_DataFrame::PayloadTypes codec /// Codec type ); /**Stop the read codec. */ virtual BOOL StopReadCodec( unsigned line /// Number of line ); /**Stop the write codec. */ virtual BOOL StopWriteCodec( unsigned line /// Number of line ); /**Get the read frame size in bytes. All calls to ReadFrame() will return this number of bytes. */ virtual PINDEX GetReadFrameSize( unsigned line /// Number of line ); /**Get the write frame size in bytes. All calls to WriteFrame() must be this number of bytes. */ virtual PINDEX GetWriteFrameSize( unsigned line /// Number of line ); /**Low level read of a frame from the device. */ virtual BOOL ReadFrame( unsigned line, /// Number of line void * buf /// Pointer to a block of memory to receive the read bytes. ); /**Low level write frame to the device. */ virtual BOOL WriteFrame( unsigned line, /// Number of line const void * buf /// Pointer to a block of memory to write. ); /**Get average signal level in last frame. */ virtual unsigned GetAverageSignalLevel( unsigned line /// Number of line ); /**Enable audio for the line. */ virtual BOOL EnableAudio( unsigned line, /// Number of line BOOL enable = TRUE ); /**Set volume level for recording. */ BOOL SetRecordVolume( unsigned line, /// Number of line unsigned volume /// Volume level from 0 to 0x100 ); /**Set volume level for playing. */ BOOL SetPlayVolume( unsigned line, /// Number of line unsigned volume /// Volume level from 0 to 0x100 ); /**Get volume level for recording. */ BOOL GetRecordVolume( unsigned line, /// Number of line unsigned & volume /// Volume level from 0 to 0x100 ); /**Get volume level for playing. */ BOOL GetPlayVolume( unsigned line, /// Number of line unsigned & volume /// Volume level from 0 to 0x100 ); /**Set acoustic echo cancellation. */ AECLevels GetAEC( unsigned line /// Number of line ); /**Set acoustic echo cancellation. */ BOOL SetAEC( unsigned line, /// Number of line AECLevels level /// AEC level ); /**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 of the number field, the time/date and the name field separated by tabs ('\t'). */ virtual BOOL GetCallerID( unsigned line, /// Number of line PString & idString, /// ID string returned BOOL full = FALSE /// Get full information in idString ); /**Set Caller ID for use in next RingLine() call. The full data of the caller ID string consists of the number field, the time/date and the name field separated by tabs ('\t'). If the date field is missing (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. */ virtual BOOL SetCallerID( unsigned line, /// Number of line const PString & idString /// ID string to use ); /**Play a DTMF digit. Any characters that are not in the set 0-9, A-D, * or # will be ignored. */ virtual BOOL PlayDTMF( unsigned line, /// Number of line const char * digits, /// DTMF digits to be played DWORD onTime = DefaultDTMFOnTime, /// Number of milliseconds to play each DTMF digit DWORD offTime = DefaultDTMFOffTime /// Number of milliseconds between digits ); /**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. */ virtual char ReadDTMF( unsigned line /// Number of line ); /**Get DTMF removal mode. When set in this mode the DTMF tones detected are removed from the encoded data stream as returned by ReadFrame(). */ virtual BOOL GetRemoveDTMF( unsigned line /// Number of line ); /**Set DTMF removal mode. When set in this mode the DTMF tones detected are removed from the encoded data stream as returned by ReadFrame(). */ virtual BOOL SetRemoveDTMF( unsigned line, /// Number of line BOOL removeTones /// Flag for removing DTMF tones. ); /**See if a tone is detected. */ virtual CallProgressTones IsToneDetected( unsigned line /// Number of line ); /**Play a tone. */ virtual BOOL PlayTone( unsigned line, /// Number of line CallProgressTones tone /// Tone to be played ); /**Determine if a tone is still playing */ BOOL IsTonePlaying( unsigned line /// Number of line ); /**Stop playing a tone. */ virtual BOOL StopTone( unsigned line /// Number of line ); /**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. */ virtual BOOL SetCountryCode( T35CountryCodes country /// COuntry code for device ); /**Get all the xJack devices. */ static PStringArray GetDeviceNames(); protected: PString deviceName; DWORD dwCardType; PMutex readMutex, writeMutex; BOOL readStopped, writeStopped; PINDEX readFrameSize, writeFrameSize; AECLevels aecLevel; PTimer ringTimeout;#if defined(WIN32) BOOL InternalPlayTone(unsigned line, DWORD toneIndex, DWORD onTime, DWORD offTime, BOOL synchronous); BOOL IoControl(DWORD dwIoControlCode, DWORD inParam = 0, DWORD * outParam = NULL); BOOL IoControl(DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpdwBytesReturned, BOOL wait); HANDLE hDriver; DWORD lastDTMFDigit; PTimeInterval toneSendCompletionTime;#elif defined(HAS_IXJ) public: int GetOSHandle() { return os_handle; } protected: BOOL ConvertOSError(int err); void GetException(telephony_exception & exceptionBits); BOOL GetRingState(); unsigned readCodecType, writeCodecType; BOOL removeDTMF; PMutex toneMutex; BOOL tonePlaying; telephony_exception exceptionBits; PTimer lastRingTime;#ifdef IXJCTL_VMWI PHONE_CID callerIdInfo;#endif#endif};#endif // __IXJ_LID_H/////////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -