telephony.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. /******************************************************************************
  2. *
  3. * telephony.h
  4. *
  5. * Basic Linux Telephony Interface
  6. *
  7. * (c) Copyright 1999-2001 Quicknet Technologies, Inc.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version
  12. * 2 of the License, or (at your option) any later version.
  13. *
  14. * Authors: Ed Okerson, <eokerson@quicknet.net>
  15. * Greg Herlein, <gherlein@quicknet.net>
  16. *
  17. * Contributors: Alan Cox, <alan@lxorguk.ukuu.org.uk>
  18. * David W. Erhart, <derhart@quicknet.net>
  19. *
  20. * IN NO EVENT SHALL QUICKNET TECHNOLOGIES, INC. BE LIABLE TO ANY PARTY FOR
  21. * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  22. * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF QUICKNET
  23. * TECHNOLOGIES, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. *
  25. * QUICKNET TECHNOLOGIES, INC. SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  26. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  27. * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
  28. * ON AN "AS IS" BASIS, AND QUICKNET TECHNOLOGIES, INC. HAS NO OBLIGATION
  29. * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  30. *
  31. *****************************************************************************/
  32. #ifndef TELEPHONY_H
  33. #define TELEPHONY_H
  34. #define TELEPHONY_VERSION 3013
  35. #define PHONE_VENDOR_IXJ 1
  36. #define PHONE_VENDOR_QUICKNET PHONE_VENDOR_IXJ
  37. #define PHONE_VENDOR_VOICETRONIX 2
  38. #define PHONE_VENDOR_ACULAB 3
  39. #define PHONE_VENDOR_DIGI 4
  40. #define PHONE_VENDOR_FRANKLIN 5
  41. /******************************************************************************
  42. * Vendor Summary Information Area
  43. *
  44. * Quicknet Technologies, Inc. - makes low density analog telephony cards
  45. * with audio compression, POTS and PSTN interfaces (www.quicknet.net)
  46. *
  47. * (other vendors following this API shuld add a short description of
  48. * the telephony products they support under Linux)
  49. *
  50. *****************************************************************************/
  51. #define QTI_PHONEJACK 100
  52. #define QTI_LINEJACK 300
  53. #define QTI_PHONEJACK_LITE 400
  54. #define QTI_PHONEJACK_PCI 500
  55. #define QTI_PHONECARD 600
  56. /******************************************************************************
  57. *
  58. * The capabilities ioctls can inform you of the capabilities of each phone
  59. * device installed in your system. The PHONECTL_CAPABILITIES ioctl
  60. * returns an integer value indicating the number of capabilities the
  61. * device has. The PHONECTL_CAPABILITIES_LIST will fill an array of
  62. * capability structs with all of its capabilities. The
  63. * PHONECTL_CAPABILITIES_CHECK takes a single capability struct and returns
  64. * a TRUE if the device has that capability, otherwise it returns false.
  65. *
  66. ******************************************************************************/
  67. typedef enum {
  68. vendor = 0,
  69. device,
  70. port,
  71. codec,
  72. dsp
  73. } phone_cap;
  74. struct phone_capability {
  75. char desc[80];
  76. phone_cap captype;
  77. int cap;
  78. int handle;
  79. };
  80. typedef enum {
  81. pots = 0,
  82. pstn,
  83. handset,
  84. speaker
  85. } phone_ports;
  86. #define PHONE_CAPABILITIES _IO ('q', 0x80)
  87. #define PHONE_CAPABILITIES_LIST _IOR ('q', 0x81, struct phone_capability *)
  88. #define PHONE_CAPABILITIES_CHECK _IOW ('q', 0x82, struct phone_capability *)
  89. typedef struct {
  90. char month[3];
  91. char day[3];
  92. char hour[3];
  93. char min[3];
  94. int numlen;
  95. char number[11];
  96. int namelen;
  97. char name[80];
  98. } PHONE_CID;
  99. #define PHONE_RING _IO ('q', 0x83)
  100. #define PHONE_HOOKSTATE _IO ('q', 0x84)
  101. #define PHONE_MAXRINGS _IOW ('q', 0x85, char)
  102. #define PHONE_RING_CADENCE _IOW ('q', 0x86, short)
  103. #define OLD_PHONE_RING_START _IO ('q', 0x87)
  104. #define PHONE_RING_START _IOW ('q', 0x87, PHONE_CID *)
  105. #define PHONE_RING_STOP _IO ('q', 0x88)
  106. #define USA_RING_CADENCE 0xC0C0
  107. #define PHONE_REC_CODEC _IOW ('q', 0x89, int)
  108. #define PHONE_REC_START _IO ('q', 0x8A)
  109. #define PHONE_REC_STOP _IO ('q', 0x8B)
  110. #define PHONE_REC_DEPTH _IOW ('q', 0x8C, int)
  111. #define PHONE_FRAME _IOW ('q', 0x8D, int)
  112. #define PHONE_REC_VOLUME _IOW ('q', 0x8E, int)
  113. #define PHONE_REC_VOLUME_LINEAR _IOW ('q', 0xDB, int)
  114. #define PHONE_REC_LEVEL _IO ('q', 0x8F)
  115. #define PHONE_PLAY_CODEC _IOW ('q', 0x90, int)
  116. #define PHONE_PLAY_START _IO ('q', 0x91)
  117. #define PHONE_PLAY_STOP _IO ('q', 0x92)
  118. #define PHONE_PLAY_DEPTH _IOW ('q', 0x93, int)
  119. #define PHONE_PLAY_VOLUME _IOW ('q', 0x94, int)
  120. #define PHONE_PLAY_VOLUME_LINEAR _IOW ('q', 0xDC, int)
  121. #define PHONE_PLAY_LEVEL _IO ('q', 0x95)
  122. #define PHONE_DTMF_READY _IOR ('q', 0x96, int)
  123. #define PHONE_GET_DTMF _IOR ('q', 0x97, int)
  124. #define PHONE_GET_DTMF_ASCII _IOR ('q', 0x98, int)
  125. #define PHONE_DTMF_OOB _IOW ('q', 0x99, int)
  126. #define PHONE_EXCEPTION _IOR ('q', 0x9A, int)
  127. #define PHONE_PLAY_TONE _IOW ('q', 0x9B, char)
  128. #define PHONE_SET_TONE_ON_TIME _IOW ('q', 0x9C, int)
  129. #define PHONE_SET_TONE_OFF_TIME _IOW ('q', 0x9D, int)
  130. #define PHONE_GET_TONE_ON_TIME _IO ('q', 0x9E)
  131. #define PHONE_GET_TONE_OFF_TIME _IO ('q', 0x9F)
  132. #define PHONE_GET_TONE_STATE _IO ('q', 0xA0)
  133. #define PHONE_BUSY _IO ('q', 0xA1)
  134. #define PHONE_RINGBACK _IO ('q', 0xA2)
  135. #define PHONE_DIALTONE _IO ('q', 0xA3)
  136. #define PHONE_CPT_STOP _IO ('q', 0xA4)
  137. #define PHONE_PSTN_SET_STATE _IOW ('q', 0xA4, int)
  138. #define PHONE_PSTN_GET_STATE _IO ('q', 0xA5)
  139. #define PSTN_ON_HOOK 0
  140. #define PSTN_RINGING 1
  141. #define PSTN_OFF_HOOK 2
  142. #define PSTN_PULSE_DIAL 3
  143. /******************************************************************************
  144. *
  145. * The wink duration is tunable with this ioctl. The default wink duration
  146. * is 320ms. You do not need to use this ioctl if you do not require a
  147. * different wink duration.
  148. *
  149. ******************************************************************************/
  150. #define PHONE_WINK_DURATION _IOW ('q', 0xA6, int)
  151. #define PHONE_WINK _IOW ('q', 0xAA, int)
  152. /******************************************************************************
  153. *
  154. * Codec Definitions
  155. *
  156. ******************************************************************************/
  157. typedef enum {
  158. G723_63 = 1,
  159. G723_53 = 2,
  160. TS85 = 3,
  161. TS48 = 4,
  162. TS41 = 5,
  163. G728 = 6,
  164. G729 = 7,
  165. ULAW = 8,
  166. ALAW = 9,
  167. LINEAR16 = 10,
  168. LINEAR8 = 11,
  169. WSS = 12,
  170. G729B = 13
  171. } phone_codec;
  172. struct phone_codec_data
  173. {
  174. phone_codec type;
  175. unsigned short buf_min, buf_opt, buf_max;
  176. };
  177. #define PHONE_QUERY_CODEC _IOWR ('q', 0xA7, struct phone_codec_data *)
  178. #define PHONE_PSTN_LINETEST _IO ('q', 0xA8)
  179. /******************************************************************************
  180. *
  181. * This controls the VAD/CNG functionality of G.723.1. The driver will
  182. * always pass full size frames, any unused bytes will be padded with zeros,
  183. * and frames passed to the driver should also be padded with zeros. The
  184. * frame type is encoded in the least significant two bits of the first
  185. * WORD of the frame as follows:
  186. *
  187. * bits 1-0 Frame Type Data Rate Significant Words
  188. * 00 0 G.723.1 6.3 12
  189. * 01 1 G.723.1 5.3 10
  190. * 10 2 VAD/CNG 2
  191. * 11 3 Repeat last CNG 2 bits
  192. *
  193. ******************************************************************************/
  194. #define PHONE_VAD _IOW ('q', 0xA9, int)
  195. /******************************************************************************
  196. *
  197. * The exception structure allows us to multiplex multiple events onto the
  198. * select() exception set. If any of these flags are set select() will
  199. * return with a positive indication on the exception set. The dtmf_ready
  200. * bit indicates if there is data waiting in the DTMF buffer. The
  201. * hookstate bit is set if there is a change in hookstate status, it does not
  202. * indicate the current state of the hookswitch. The pstn_ring bit
  203. * indicates that the DAA on a LineJACK card has detected ring voltage on
  204. * the PSTN port. The caller_id bit indicates that caller_id data has been
  205. * received and is available. The pstn_wink bit indicates that the DAA on
  206. * the LineJACK has received a wink from the telco switch. The f0, f1, f2
  207. * and f3 bits indicate that the filter has been triggered by detecting the
  208. * frequency programmed into that filter.
  209. *
  210. * The remaining bits should be set to zero. They will become defined over time
  211. * for other interface cards and their needs.
  212. *
  213. ******************************************************************************/
  214. struct phone_except
  215. {
  216. unsigned int dtmf_ready:1;
  217. unsigned int hookstate:1;
  218. unsigned int pstn_ring:1;
  219. unsigned int caller_id:1;
  220. unsigned int pstn_wink:1;
  221. unsigned int f0:1;
  222. unsigned int f1:1;
  223. unsigned int f2:1;
  224. unsigned int f3:1;
  225. unsigned int flash:1;
  226. unsigned int fc0:1;
  227. unsigned int fc1:1;
  228. unsigned int fc2:1;
  229. unsigned int fc3:1;
  230. unsigned int reserved:18;
  231. };
  232. union telephony_exception {
  233. struct phone_except bits;
  234. unsigned int bytes;
  235. };
  236. #endif /* TELEPHONY_H */