📄 ixjwin32.cxx
字号:
/*
* ixjwin32.cxx
*
* 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: ixjwin32.cxx,v $
* Revision 1.2 2007/06/04 16:06:30 joegenbaclor
* *** empty log message ***
*
* Revision 1.1 2006/06/26 03:03:21 joegenbaclor
* I have decided to include the latest development realease of OPAL tagged Deimos Devel 1 (June 8 2006) as inegrated classes to opensipstack to avoid future version conflicts due to the fast pace in OPAL development. This move is also aimed to reduce the size of projects using OPAL componets such as the soon to be relased OpenSIPPhone.
*
* Revision 2.12 2004/10/06 13:03:41 rjongbloed
* Added "configure" support for known LIDs
* Changed LID GetName() function to be normalised against the GetAllNames()
* return values and fixed the pre-factory registration system.
* Added a GetDescription() function to do what the previous GetName() did.
*
* Revision 2.11 2004/04/09 12:57:28 rjongbloed
* Fixed automatic loading of winmm.lib if this module included.
*
* Revision 2.10 2004/02/19 10:47:05 rjongbloed
* Merged OpenH323 version 1.13.1 changes.
*
* Revision 2.9 2003/03/24 07:18:29 robertj
* Added registration system for LIDs so can work with various LID types by
* name instead of class instance.
*
* Revision 2.8 2002/11/10 11:33:19 robertj
* Updated to OpenH323 v1.10.3
*
* Revision 2.7 2002/07/01 04:56:33 robertj
* Updated to OpenH323 v1.9.1
*
* Revision 2.6 2002/03/22 06:57:50 robertj
* Updated to OpenH323 version 1.8.2
*
* Revision 2.5 2002/02/11 09:32:13 robertj
* Updated to openH323 v1.8.0
*
* Revision 2.4 2002/01/14 06:35:58 robertj
* Updated to OpenH323 v1.7.9
*
* Revision 2.3 2001/10/05 00:22:14 robertj
* Updated to PWLib 1.2.0 and OpenH323 1.7.0
*
* Revision 2.2 2001/10/04 00:47:45 robertj
* Added flag bit for WIN32 error rather than C run time error.
*
* Revision 2.1 2001/08/01 05:21:21 robertj
* Made OpalMediaFormatList class global to help with documentation.
*
* Revision 1.114 2003/04/29 08:32:59 robertj
* Added new wink functions for Windows IxJ lid.
*
* Revision 1.113 2002/11/05 04:33:21 robertj
* Changed IsLineDisconnected() to work with POTSLine
*
* Revision 1.112 2002/11/05 04:27:58 robertj
* Imported RingLine() by array from OPAL.
*
* Revision 1.111 2002/10/30 05:54:17 craigs
* Fixed compatibilty problems with G.723.1 6k3 and 5k3
*
* Revision 1.110 2002/06/25 08:30:12 robertj
* Changes to differentiate between stright G.723.1 and G.723.1 Annex A using
* the OLC dataType silenceSuppression field so does not send SID frames
* to receiver codecs that do not understand them.
*
* Revision 1.109 2002/05/09 06:26:34 robertj
* Added fuction to get the current audio enable state for line in device.
* Changed IxJ EnableAudio() semantics so is exclusive, no direct switching
* from PSTN to POTS and vice versa without disabling the old one first.
*
* Revision 1.108 2002/03/21 02:37:33 robertj
* Fixed G.723.1 5.3k mode so receiver (playback) still accepts 6.3k data.
*
* Revision 1.107 2002/02/08 14:41:49 craigs
* Changed codec table to use mediatream #defines. Thanks to Roger Hardiman
*
* Revision 1.106 2001/12/11 04:27:28 craigs
* Added support for 5.3kbps G723.1
*
* Revision 1.105 2001/12/03 00:40:43 robertj
* Fixed problem with false off hook detect with LineJACK and no PSTN active.
*
* Revision 1.104 2001/10/11 00:48:08 robertj
* Changed so if stopping read/write also stops fax and vice versa.
*
* Revision 2.0 2001/07/27 15:48:25 robertj
* Conversion of OpenH323 to Open Phone Abstraction Library (OPAL)
*
* Revision 1.103 2001/09/25 01:12:06 robertj
* Changed check to v 5.5.141
*
* Revision 1.102 2001/09/24 12:31:35 robertj
* Added backward compatibility with old drivers.
*
* Revision 1.101 2001/09/10 08:22:16 robertj
* Fixed minor problems with error codes.
*
* Revision 1.100 2001/07/24 02:29:56 robertj
* Added setting of xJack filter coefficients for some frequencies,
* values taken from open source Linux driver.
*
* Revision 1.99 2001/07/19 05:54:30 robertj
* Updated interface to xJACK drivers to utilise cadence and filter functions
* for dial tone, busy tone and ringback tone detection.
*
* Revision 1.98 2001/07/06 03:44:35 robertj
* Oops, the WAVE output should ALWAYS be unmuted!
*
* Revision 1.97 2001/07/06 00:45:15 robertj
* Fixed accidentlaly unmuting microphone on audio output for LineJACKs.
*
* Revision 1.96 2001/06/12 00:12:23 craigs
* No longer looks for dialtone for end of call
*
* Revision 1.95 2001/05/30 04:06:26 robertj
* Fixed setting of LineJACK mixer mutes to AFTER setting of analague source
* as each source has different mixer settings in driver.
* Change start of codec (SetXXXFormat()) to explicitly stop codec.
*
* Revision 1.94 2001/05/25 02:19:53 robertj
* Fixed problem with codec data reblocking code not being reset when
* code is stopped and restarted, thanks Artis Kugevics
*
* Revision 1.93 2001/05/21 06:37:06 craigs
* Changed to allow optional wink detection for line disconnect
*
* Revision 1.92 2001/05/11 04:43:43 robertj
* Added variable names for standard PCM-16 media format name.
*
* Revision 1.91 2001/05/10 02:07:11 robertj
* Fixed possibility of output on POTS/PSTN being muted accidentally and
* thus not having any audio. Explicitly unmutes it on selection.
*
* Revision 1.90 2001/04/20 02:27:29 robertj
* Added extra mutex in SetReadFormat() for if it ever gets called without
* a StopCodec() beforehand.
*
* Revision 1.89 2001/04/18 02:31:58 craigs
* Fixed problem with illegal date in caller ID causing assert
*
* Revision 1.88 2001/04/09 08:46:16 robertj
* Added implementations to set mode for removing DTMF from media.
*
* Revision 1.87 2001/03/31 02:55:55 robertj
* Removed some interlocks on functions that are no longer required in current drivers.
*
* Revision 1.86 2001/03/30 05:46:09 robertj
* Added trace output of driver version number.
* Added check for PSTN line disconnect to include looking for tones.
*
* Revision 1.85 2001/03/29 23:40:46 robertj
* Added ability to get average signal level for both receive and transmit.
* Changed G.729A silence frames to be CNG frames to stop clicking sound.
*
* Revision 1.84 2001/03/24 00:52:34 robertj
* Fixed incorrect conditional on error trace for G.729B packet in G.729A mode.
*
* Revision 1.83 2001/03/23 05:38:09 robertj
* Added PTRACE_IF to output trace if a conditional is TRUE.
* Indicate if get sent a G.729B packet when in G.729A mode.
*
* Revision 1.82 2001/03/22 06:18:49 robertj
* Fixed very subtle problem with Quicknet cards under NT/2K, caused occassional
* blip in continuous audio due to the resolution of internal timers.
*
* Revision 1.81 2001/02/21 08:09:15 robertj
* Added more tones for characters 'e' through 'o'.
*
* Revision 1.80 2001/02/16 08:18:17 robertj
* Fixed IXJ interface to compensate for driver bug.
*
* Revision 1.79 2001/02/15 05:15:34 robertj
* Compensated for driver failing to return serial number on Win98.
*
* Revision 1.78 2001/02/07 05:02:58 robertj
* Temporary removal of code due to broken driver.
*
* Revision 1.77 2001/01/25 07:27:16 robertj
* Major changes to add more flexible OpalMediaFormat class to normalise
* all information about media types, especially codecs.
*
* Revision 1.76 2001/01/24 05:34:49 robertj
* Altered volume control range to be percentage, ie 100 is max volume.
*
* Revision 1.75 2001/01/11 05:39:44 robertj
* Fixed usage of G.723.1 CNG 1 byte frames.
*
* Revision 1.74 2000/12/18 21:56:13 robertj
* Fixed saving of POTS/PSTN link state when doing PSTN line test.
* Changed caller ID code to allow for single record protocol.
*
* Revision 1.73 2000/12/17 23:08:01 robertj
* Changed driver close so goes into POTS/PSTN pass through mode.
*
* Revision 1.72 2000/12/12 07:51:36 robertj
* Changed name to include word Internet as in Linux driver.
*
* Revision 1.71 2000/12/11 01:47:14 robertj
* Changed to use built PWLib class for overlapped I/O.
*
* Revision 1.70 2000/11/30 08:48:36 robertj
* Added functions to enable/disable Voice Activity Detection in LID's
*
* Revision 1.69 2000/11/30 05:59:57 robertj
* Changed raw mode transfer block size to 30ms blocks.
* Removed test of raw mode read/write as driver returns incorrect value.
* Added PTRACE of error code from driver when error occurs.
* Fixed bug in raw mode write, count of bytes too large if second write in loop.
*
* Revision 1.68 2000/11/28 01:59:53 robertj
* Removed usage of deprecated volume setting calls.
*
* Revision 1.67 2000/11/27 00:12:18 robertj
* Added WIN32 version of hook flash detection function.
*
* Revision 1.66 2000/11/24 10:58:47 robertj
* Added a raw PCM dta mode for generating/detecting standard tones.
* Modified the ReadFrame/WriteFrame functions to allow for variable length codecs.
* Fixed hook state debouncing.
* Added codec to explicitly set LineJACK mixer settings to avoid funny modes
* the driver/hardware gets into sometimes.
* Changed tone detection API slightly to allow detection of multiple
* simultaneous tones
*
* Revision 1.65 2000/11/06 06:33:26 robertj
* Changed hook state debounce so does not block for 200ms.
*
* Revision 1.64 2000/11/03 06:25:37 robertj
* Added flag to IsLinePresent() to force slow test, guarenteeing correct value.
*
* Revision 1.63 2000/10/26 12:24:56 robertj
* Added configurable G.729 codec usage, based on separate license.
*
* Revision 1.62 2000/10/19 04:04:04 robertj
* Added functions to get xJACK card type and serial number.
*
* Revision 1.61 2000/10/13 02:21:28 robertj
* Changed volume control code to set more mixer values on LineJACK.
*
* Revision 1.60 2000/09/26 02:17:35 robertj
* Fixed MSVC warning
*
* Revision 1.59 2000/09/26 01:48:36 robertj
* Removed now redundent AEC resetting when starting read/write codec.
*
* Revision 1.58 2000/09/23 06:55:24 robertj
* Put code back so gets driver default frame size instead of trying to set it. Caused lockups.
*
* Revision 1.57 2000/09/22 01:35:51 robertj
* Added support for handling LID's that only do symmetric codecs.
*
* Revision 1.56 2000/09/15 23:01:50 robertj
* Fixed choppy audio in som cases with PCM, explicitly set frame size now.
*
* Revision 1.55 2000/09/05 22:07:50 robertj
* Removed deprecated IOCTL_Idle_Idle.
*
* Revision 1.54 2000/09/04 05:45:03 robertj
* Added VMWI support and country codes to IXJ driver interface.
*
* Revision 1.53 2000/09/01 01:25:05 robertj
* Fixed incorrect class names and began country code setting of driver.
*
* Revision 1.52 2000/08/31 13:14:40 craigs
* Added functions to LID
* More bulletproofing to Linux driver
*
* Revision 1.51 2000/08/30 22:57:46 robertj
* Removed call to CancelIO, does not exist in Win95!
*
* Revision 1.50 2000/08/21 02:49:14 robertj
* Added timeout for driver read/write, should never block for long.
*
* Revision 1.49 2000/08/01 03:24:49 robertj
* Changed enumeration of Quicknet devices to use new technique for future Win2k drives.
*
* Revision 1.48 2000/07/28 06:29:20 robertj
* Fixed AEC under Win32 so can be changed from other processes.
*
* Revision 1.47 2000/07/25 02:07:34 robertj
* Reduced max range of device numbers as can get some low serial numbers.
*
* Revision 1.46 2000/07/14 14:12:06 robertj
* Added turning off of VAD which results in 1 byte G.723.1 frames that not
* everyone supports yet.
*
* Revision 1.45 2000/07/12 10:25:07 robertj
* Added PhoneCARD support on Win9x systems.
*
* Revision 1.44 2000/06/20 12:51:23 robertj
* Changed IXJ driver open so does not change selected line to PSTN.
*
* Revision 1.43 2000/06/20 02:22:41 robertj
* Fixed NT version so can still use serial number to open device.
*
* Revision 1.42 2000/06/19 00:31:30 robertj
* Changed NT device name to be a bit more user friendly.
*
* Revision 1.41 2000/06/08 02:33:25 robertj
* Fixed detection of correct xJack card type under NT.
* Added ability to use just "0" or "1" instead of "\\.\QTJackDevice0" as device name.
*
* Revision 1.40 2000/05/25 02:23:25 robertj
* Added calls to get volume settings
*
* Revision 1.39 2000/05/15 08:38:59 robertj
* Changed LineJACK PSTN check so is initiated only if state unknown.
*
* Revision 1.38 2000/05/02 04:32:27 robertj
* Fixed copyright notice comment.
*
* Revision 1.37 2000/04/30 04:00:33 robertj
* Changed determination of frame size to use driver ioctl for PCM, uLAw and ALaw.
*
* Revision 1.36 2000/04/28 07:00:26 robertj
* Fixed race condition causing RTP send thread to randomly shut down.
*
* Revision 1.35 2000/04/19 01:57:39 robertj
* Added mixer code to get volume control support on LineJACK;s.
* Attempt to prevent getting very occassional ReadFrame() failure causing tx channel stop.
*
* Revision 1.34 2000/04/12 23:56:37 robertj
* Fixed detection of PCI PhoneJACK on NT.
*
* Revision 1.33 2000/04/06 20:36:25 robertj
* Fixed some LineJACK compatbility problems (eg DTMF detect stopping).
*
* Revision 1.32 2000/04/05 20:55:41 robertj
* Added caller ID send, and fixed receive for multiple fields.
*
* Revision 1.31 2000/04/05 18:04:12 robertj
* Changed caller ID code for better portability.
*
* Revision 1.30 2000/03/30 01:55:13 robertj
* Added function so silence detection can work on xJack internetl codecs.
* Fixed length of G.728 codec frames
*
* Revision 1.29 2000/03/29 20:59:52 robertj
* Added function on LID to get available codecs.
* Improved consistency in "device name".
* Fixed codec table for G.729 codec
* Fixed lockup bug with tone/codec interaction.
*
* Revision 1.28 2000/03/23 02:48:49 robertj
* Added calling tone detection code.
*
* Revision 1.27 2000/03/17 20:59:42 robertj
* Fixed line count to be xJACK card dependent.
* Added support for more xJACK card types.
*
* Revision 1.26 2000/02/24 00:35:22 robertj
* Fixed problem with unresolved SetRemoveDTMF function when not using linux telephony.
*
* Revision 1.25 2000/02/16 04:04:37 robertj
* Fixed bug where IXJ POTS handset never returned off hook.
*
* Revision 1.24 2000/01/07 08:28:09 robertj
* Additions and changes to line interface device base class.
*
* Revision 1.23 1999/12/30 09:16:41 robertj
* Fixed initialisation of driver handle, prevent crash in Close().
*
* Revision 1.22 1999/12/23 23:02:36 robertj
* File reorganision for separating RTP from H.323 and creation of LID for VPB support.
*
* Revision 1.21 1999/11/29 04:50:11 robertj
* Added adaptive threshold calculation to silence detection.
*
* Revision 1.20 1999/11/20 04:38:03 robertj
* Removed potential driver lockups by doing overlapped I/O only on read/write ioctls.
*
* Revision 1.19 1999/11/19 09:17:15 robertj
* Fixed problems with aycnhronous shut down of logical channels.
*
* Revision 1.18 1999/11/16 12:43:02 robertj
* Dixed missing initialise of AEC variable.
*
* Revision 1.17 1999/11/16 11:32:06 robertj
* Added some calling tones.
*
* Revision 1.16 1999/11/12 02:25:01 robertj
* More NT support.
*
* Revision 1.15 1999/11/11 23:15:31 robertj
* Fixed bug where closed driver was not flagged as closed.
*
* Revision 1.14 1999/11/11 01:16:57 robertj
* Added NT support, debounce of phone hook state and wait for line test completion.
*
* Revision 1.13 1999/11/06 05:36:19 robertj
* Fixed problem with read/write locking up when stopping codec.
*
* Revision 1.12 1999/11/06 03:32:27 robertj
* Added volume control functions for record/playback.
*
* Revision 1.11 1999/11/05 12:53:40 robertj
* Fixed warnings on notrace version.
*
* Revision 1.10 1999/11/05 10:51:18 robertj
* Fixed problem with new ixj channel doing incorrect double initialise
*
* Revision 1.9 1999/11/05 08:54:41 robertj
* Rewrite of ixj interface code to fix support for arbitrary codecs.
*
* Revision 1.8 1999/11/02 00:24:29 robertj
* Added GetCallerID() function and implemented some LineJACK code.
*
* Revision 1.7 1999/11/01 01:20:26 robertj
* Added flunction to enabled/disable DTM detection
*
* Revision 1.6 1999/11/01 00:47:14 robertj
* Fixed problems with stopping codecs
*
* Revision 1.5 1999/10/30 12:43:25 robertj
* Fixed "lock up" problem, DTMF problem and added function to get line status.
*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -