Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


telephony.h
001: /******************************************************************************
002:  *
003:  *              telephony.h
004:  *
005:  *              Basic Linux Telephony Interface
006:  *
007:  *              (c) Copyright 1999-2001 Quicknet Technologies, Inc.
008:  *
009:  *              This program is free software; you can redistribute it and/or
010:  *              modify it under the terms of the GNU General Public License
011:  *              as published by the Free Software Foundation; either version
012:  *              2 of the License, or (at your option) any later version.
013:  *
014:  *    Authors:       Ed Okerson, <eokerson@quicknet.net>
015:  *                   Greg Herlein, <gherlein@quicknet.net>
016:  *
017:  *    Contributors:  Alan Cox, <alan@lxorguk.ukuu.org.uk>
018:  *                   David W. Erhart, <derhart@quicknet.net>
019:  *
020:  * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR
021:  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
022:  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET
023:  * TECHNOLOGIES, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
024:  *
025:  * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
026:  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
027:  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
028:  * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION
029:  * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
030:  *
031:  *****************************************************************************/
032: 
033: #ifndef TELEPHONY_H
034: #define TELEPHONY_H
035: 
036: #define TELEPHONY_VERSION 3013
037: 
038: #define PHONE_VENDOR_IXJ          1
039: #define PHONE_VENDOR_QUICKNET     PHONE_VENDOR_IXJ
040: #define PHONE_VENDOR_VOICETRONIX  2
041: #define PHONE_VENDOR_ACULAB       3
042: #define PHONE_VENDOR_DIGI         4
043: #define PHONE_VENDOR_FRANKLIN     5
044: 
045: /******************************************************************************
046:  *  Vendor Summary Information Area
047:  *
048:  *  Quicknet Technologies, Inc. - makes low density analog telephony cards
049:  *    with audio compression, POTS and PSTN interfaces (www.quicknet.net)
050:  *
051:  *  (other vendors following this API shuld add a short description of
052:  *  the telephony products they support under Linux)
053:  *
054:  *****************************************************************************/
055: #define QTI_PHONEJACK           100
056: #define QTI_LINEJACK            300
057: #define QTI_PHONEJACK_LITE      400
058: #define QTI_PHONEJACK_PCI       500
059: #define QTI_PHONECARD           600
060: 
061: /******************************************************************************
062: *
063: * The capabilities ioctls can inform you of the capabilities of each phone
064: * device installed in your system.  The PHONECTL_CAPABILITIES ioctl
065: * returns an integer value indicating the number of capabilities the   
066: * device has.  The PHONECTL_CAPABILITIES_LIST will fill an array of 
067: * capability structs with all of its capabilities.  The
068: * PHONECTL_CAPABILITIES_CHECK takes a single capability struct and returns
069: * a TRUE if the device has that capability, otherwise it returns false.
070: * 
071: ******************************************************************************/
072: typedef enum {
073:         vendor = 0,
074:         device,
075:         port,
076:         codec,
077:         dsp
078: } phone_cap;
079: 
080: struct phone_capability {
081:         char desc[80];
082:         phone_cap captype;
083:         int cap;
084:         int handle;
085: };
086: 
087: typedef enum {
088:         pots = 0,
089:         pstn,
090:         handset,
091:         speaker
092: } phone_ports;
093: 
094: #define PHONE_CAPABILITIES              _IO  ('q', 0x80)
095: #define PHONE_CAPABILITIES_LIST         _IOR ('q', 0x81, struct phone_capability *)
096: #define PHONE_CAPABILITIES_CHECK        _IOW ('q', 0x82, struct phone_capability *)
097: 
098: typedef struct {
099:         char month[3];
100:         char day[3];
101:         char hour[3];
102:         char min[3];
103:         int numlen;
104:         char number[11];
105:         int namelen;
106:         char name[80];
107: } PHONE_CID;
108:  
109: #define PHONE_RING                      _IO  ('q', 0x83)
110: #define PHONE_HOOKSTATE                 _IO  ('q', 0x84)
111: #define PHONE_MAXRINGS                  _IOW ('q', 0x85, char)
112: #define PHONE_RING_CADENCE              _IOW ('q', 0x86, short)
113: #define OLD_PHONE_RING_START            _IO  ('q', 0x87)
114: #define PHONE_RING_START                _IOW ('q', 0x87, PHONE_CID *)
115: #define PHONE_RING_STOP                 _IO  ('q', 0x88)
116: 
117: #define USA_RING_CADENCE         0xC0C0
118: 
119: #define PHONE_REC_CODEC                 _IOW ('q', 0x89, int)
120: #define PHONE_REC_START                 _IO  ('q', 0x8A)
121: #define PHONE_REC_STOP                  _IO  ('q', 0x8B)
122: #define PHONE_REC_DEPTH                 _IOW ('q', 0x8C, int)
123: #define PHONE_FRAME                     _IOW ('q', 0x8D, int)
124: #define PHONE_REC_VOLUME                _IOW ('q', 0x8E, int)
125: #define PHONE_REC_VOLUME_LINEAR         _IOW ('q', 0xDB, int)
126: #define PHONE_REC_LEVEL                 _IO  ('q', 0x8F)
127: 
128: #define PHONE_PLAY_CODEC                _IOW ('q', 0x90, int)
129: #define PHONE_PLAY_START                _IO  ('q', 0x91)
130: #define PHONE_PLAY_STOP                 _IO  ('q', 0x92)
131: #define PHONE_PLAY_DEPTH                _IOW ('q', 0x93, int)
132: #define PHONE_PLAY_VOLUME               _IOW ('q', 0x94, int)
133: #define PHONE_PLAY_VOLUME_LINEAR        _IOW ('q', 0xDC, int)
134: #define PHONE_PLAY_LEVEL                _IO  ('q', 0x95)
135: #define PHONE_DTMF_READY                _IOR ('q', 0x96, int)
136: #define PHONE_GET_DTMF                  _IOR ('q', 0x97, int)
137: #define PHONE_GET_DTMF_ASCII            _IOR ('q', 0x98, int)
138: #define PHONE_DTMF_OOB                  _IOW ('q', 0x99, int)
139: #define PHONE_EXCEPTION                 _IOR ('q', 0x9A, int)
140: #define PHONE_PLAY_TONE                 _IOW ('q', 0x9B, char)
141: #define PHONE_SET_TONE_ON_TIME          _IOW ('q', 0x9C, int)
142: #define PHONE_SET_TONE_OFF_TIME         _IOW ('q', 0x9D, int)
143: #define PHONE_GET_TONE_ON_TIME          _IO  ('q', 0x9E)
144: #define PHONE_GET_TONE_OFF_TIME         _IO  ('q', 0x9F)
145: #define PHONE_GET_TONE_STATE            _IO  ('q', 0xA0)
146: #define PHONE_BUSY                      _IO  ('q', 0xA1)
147: #define PHONE_RINGBACK                  _IO  ('q', 0xA2)
148: #define PHONE_DIALTONE                  _IO  ('q', 0xA3)
149: #define PHONE_CPT_STOP                  _IO  ('q', 0xA4)
150: 
151: #define PHONE_PSTN_SET_STATE            _IOW ('q', 0xA4, int)
152: #define PHONE_PSTN_GET_STATE            _IO  ('q', 0xA5)
153: 
154: #define PSTN_ON_HOOK            0
155: #define PSTN_RINGING            1
156: #define PSTN_OFF_HOOK           2
157: #define PSTN_PULSE_DIAL         3
158: 
159: /******************************************************************************
160: * 
161: * The wink duration is tunable with this ioctl.  The default wink duration  
162: * is 320ms.  You do not need to use this ioctl if you do not require a
163: * different wink duration.
164: * 
165: ******************************************************************************/
166: #define PHONE_WINK_DURATION             _IOW ('q', 0xA6, int)
167: #define PHONE_WINK                      _IOW ('q', 0xAA, int)
168: 
169: /******************************************************************************
170: * 
171: *  Codec Definitions
172: * 
173: ******************************************************************************/
174: typedef enum {
175:         G723_63 = 1,
176:         G723_53 = 2,
177:         TS85 = 3,
178:         TS48 = 4,
179:         TS41 = 5,
180:         G728 = 6,
181:         G729 = 7,
182:         ULAW = 8,
183:         ALAW = 9,
184:         LINEAR16 = 10,
185:         LINEAR8 = 11,
186:         WSS = 12,
187:         G729B = 13
188: } phone_codec;
189: 
190: struct phone_codec_data
191: {
192:         phone_codec type;
193:         unsigned short buf_min, buf_opt, buf_max;
194: };
195: 
196: #define PHONE_QUERY_CODEC               _IOWR ('q', 0xA7, struct phone_codec_data *)
197: #define PHONE_PSTN_LINETEST             _IO ('q', 0xA8)
198: 
199: /******************************************************************************
200: * 
201: * This controls the VAD/CNG functionality of G.723.1.  The driver will
202: * always pass full size frames, any unused bytes will be padded with zeros,
203: * and frames passed to the driver should also be padded with zeros.  The
204: * frame type is encoded in the least significant two bits of the first
205: * WORD of the frame as follows:
206: *
207: * bits 1-0      Frame Type      Data Rate               Significant Words
208: * 00            0               G.723.1 6.3             12
209: * 01            1               G.723.1 5.3             10
210: * 10            2               VAD/CNG                  2
211: * 11            3               Repeat last CNG          2 bits
212: * 
213: ******************************************************************************/
214: #define PHONE_VAD                       _IOW ('q', 0xA9, int)
215: 
216: 
217: /******************************************************************************
218: *
219: * The exception structure allows us to multiplex multiple events onto the
220: * select() exception set.  If any of these flags are set select() will
221: * return with a positive indication on the exception set.  The dtmf_ready
222: * bit indicates if there is data waiting in the DTMF buffer.  The
223: * hookstate bit is set if there is a change in hookstate status, it does not
224: * indicate the current state of the hookswitch.  The pstn_ring bit
225: * indicates that the DAA on a LineJACK card has detected ring voltage on
226: * the PSTN port.  The caller_id bit indicates that caller_id data has been
227: * received and is available.  The pstn_wink bit indicates that the DAA on
228: * the LineJACK has received a wink from the telco switch.  The f0, f1, f2
229: * and f3 bits indicate that the filter has been triggered by detecting the
230: * frequency programmed into that filter.
231: *
232: * The remaining bits should be set to zero. They will become defined over time
233: * for other interface cards and their needs.
234: *
235: ******************************************************************************/
236: struct phone_except
237: {
238:         unsigned int dtmf_ready:1;
239:         unsigned int hookstate:1;
240:         unsigned int pstn_ring:1;
241:         unsigned int caller_id:1;
242:         unsigned int pstn_wink:1;
243:         unsigned int f0:1;
244:         unsigned int f1:1;
245:         unsigned int f2:1;
246:         unsigned int f3:1;
247:         unsigned int flash:1;
248:         unsigned int fc0:1;
249:         unsigned int fc1:1;
250:         unsigned int fc2:1;
251:         unsigned int fc3:1;
252:         unsigned int reserved:18;
253: };
254: 
255: union telephony_exception {
256:         struct phone_except bits;
257:         unsigned int bytes;
258: };
259: 
260: 
261: #endif          /* TELEPHONY_H */
262: 
263: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/