divacapi.h 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361
  1. /*
  2. *
  3. Copyright (c) Eicon Networks, 2002.
  4. *
  5. This source file is supplied for the use with
  6. Eicon Networks range of DIVA Server Adapters.
  7. *
  8. Eicon File Revision : 2.1
  9. *
  10. This program is free software; you can redistribute it and/or modify
  11. it under the terms of the GNU General Public License as published by
  12. the Free Software Foundation; either version 2, or (at your option)
  13. any later version.
  14. *
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
  17. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. See the GNU General Public License for more details.
  19. *
  20. You should have received a copy of the GNU General Public License
  21. along with this program; if not, write to the Free Software
  22. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23. *
  24. */
  25. /*#define DEBUG */
  26. #define IMPLEMENT_DTMF 1
  27. #define IMPLEMENT_LINE_INTERCONNECT2 1
  28. #define IMPLEMENT_ECHO_CANCELLER 1
  29. #define IMPLEMENT_RTP 1
  30. #define IMPLEMENT_T38 1
  31. #define IMPLEMENT_FAX_SUB_SEP_PWD 1
  32. #define IMPLEMENT_V18 1
  33. #define IMPLEMENT_DTMF_TONE 1
  34. #define IMPLEMENT_PIAFS 1
  35. #define IMPLEMENT_FAX_PAPER_FORMATS 1
  36. #define IMPLEMENT_VOWN 1
  37. #define IMPLEMENT_CAPIDTMF 1
  38. #define IMPLEMENT_FAX_NONSTANDARD 1
  39. #define VSWITCH_SUPPORT 1
  40. #define IMPLEMENT_LINE_INTERCONNECT 0
  41. #define IMPLEMENT_MARKED_OK_AFTER_FC 1
  42. #include "capidtmf.h"
  43. /*------------------------------------------------------------------*/
  44. /* Common API internal definitions */
  45. /*------------------------------------------------------------------*/
  46. #define MAX_APPL 240
  47. #define MAX_NCCI 127
  48. #define MSG_IN_QUEUE_SIZE ((4096 + 3) & 0xfffc) /* must be multiple of 4 */
  49. #define MSG_IN_OVERHEAD sizeof(APPL *)
  50. #define MAX_NL_CHANNEL 255
  51. #define MAX_DATA_B3 8
  52. #define MAX_DATA_ACK MAX_DATA_B3
  53. #define MAX_MULTI_IE 6
  54. #define MAX_MSG_SIZE 256
  55. #define MAX_MSG_PARMS 10
  56. #define MAX_CPN_MASK_SIZE 16
  57. #define MAX_MSN_CONFIG 10
  58. #define EXT_CONTROLLER 0x80
  59. #define CODEC 0x01
  60. #define CODEC_PERMANENT 0x02
  61. #define ADV_VOICE 0x03
  62. #define MAX_CIP_TYPES 5 /* kind of CIP types for group optimization */
  63. #define C_IND_MASK_DWORDS ((MAX_APPL + 32) >> 5)
  64. #define FAX_CONNECT_INFO_BUFFER_SIZE 256
  65. #define NCPI_BUFFER_SIZE 256
  66. #define MAX_CHANNELS_PER_PLCI 8
  67. #define MAX_INTERNAL_COMMAND_LEVELS 4
  68. #define INTERNAL_REQ_BUFFER_SIZE 272
  69. #define INTERNAL_IND_BUFFER_SIZE 768
  70. #define DTMF_PARAMETER_BUFFER_SIZE 12
  71. #define ADV_VOICE_COEF_BUFFER_SIZE 50
  72. #define LI_PLCI_B_QUEUE_ENTRIES 256
  73. typedef struct _APPL APPL;
  74. typedef struct _PLCI PLCI;
  75. typedef struct _NCCI NCCI;
  76. typedef struct _DIVA_CAPI_ADAPTER DIVA_CAPI_ADAPTER;
  77. typedef struct _DATA_B3_DESC DATA_B3_DESC;
  78. typedef struct _DATA_ACK_DESC DATA_ACK_DESC;
  79. typedef struct manufacturer_profile_s MANUFACTURER_PROFILE;
  80. typedef struct fax_ncpi_s FAX_NCPI;
  81. typedef struct api_parse_s API_PARSE;
  82. typedef struct api_save_s API_SAVE;
  83. typedef struct msn_config_s MSN_CONFIG;
  84. typedef struct msn_config_max_s MSN_CONFIG_MAX;
  85. typedef struct msn_ld_s MSN_LD;
  86. struct manufacturer_profile_s {
  87. dword private_options;
  88. dword rtp_primary_payloads;
  89. dword rtp_additional_payloads;
  90. };
  91. struct fax_ncpi_s {
  92. word options;
  93. word format;
  94. };
  95. struct msn_config_s {
  96. byte msn[MAX_CPN_MASK_SIZE];
  97. };
  98. struct msn_config_max_s {
  99. MSN_CONFIG msn_conf[MAX_MSN_CONFIG];
  100. };
  101. struct msn_ld_s {
  102. dword low;
  103. dword high;
  104. };
  105. struct api_parse_s {
  106. word length;
  107. byte *info;
  108. };
  109. struct api_save_s {
  110. API_PARSE parms[MAX_MSG_PARMS + 1];
  111. byte info[MAX_MSG_SIZE];
  112. };
  113. struct _DATA_B3_DESC {
  114. word Handle;
  115. word Number;
  116. word Flags;
  117. word Length;
  118. void *P;
  119. };
  120. struct _DATA_ACK_DESC {
  121. word Handle;
  122. word Number;
  123. };
  124. typedef void (*t_std_internal_command)(dword Id, PLCI *plci, byte Rc);
  125. /************************************************************************/
  126. /* Don't forget to adapt dos.asm after changing the _APPL structure!!!! */
  127. struct _APPL {
  128. word Id;
  129. word NullCREnable;
  130. word CDEnable;
  131. dword S_Handle;
  132. LIST_ENTRY s_function;
  133. dword s_context;
  134. word s_count;
  135. APPL *s_next;
  136. byte *xbuffer_used;
  137. void **xbuffer_internal;
  138. void **xbuffer_ptr;
  139. byte *queue;
  140. word queue_size;
  141. word queue_free;
  142. word queue_read;
  143. word queue_write;
  144. word queue_signal;
  145. byte msg_lost;
  146. byte appl_flags;
  147. word Number;
  148. word MaxBuffer;
  149. byte MaxNCCI;
  150. byte MaxNCCIData;
  151. word MaxDataLength;
  152. word NCCIDataFlowCtrlTimer;
  153. byte *ReceiveBuffer;
  154. word *DataNCCI;
  155. word *DataFlags;
  156. };
  157. struct _PLCI {
  158. ENTITY Sig;
  159. ENTITY NL;
  160. word RNum;
  161. word RFlags;
  162. BUFFERS RData[2];
  163. BUFFERS XData[1];
  164. BUFFERS NData[2];
  165. DIVA_CAPI_ADAPTER *adapter;
  166. APPL *appl;
  167. PLCI *relatedPTYPLCI;
  168. byte Id;
  169. byte State;
  170. byte sig_req;
  171. byte nl_req;
  172. byte SuppState;
  173. byte channels;
  174. byte tel;
  175. byte B1_resource;
  176. byte B2_prot;
  177. byte B3_prot;
  178. word command;
  179. word m_command;
  180. word internal_command;
  181. word number;
  182. word req_in_start;
  183. word req_in;
  184. word req_out;
  185. word msg_in_write_pos;
  186. word msg_in_read_pos;
  187. word msg_in_wrap_pos;
  188. void *data_sent_ptr;
  189. byte data_sent;
  190. byte send_disc;
  191. byte sig_global_req;
  192. byte sig_remove_id;
  193. byte nl_global_req;
  194. byte nl_remove_id;
  195. byte b_channel;
  196. byte adv_nl;
  197. byte manufacturer;
  198. byte call_dir;
  199. byte hook_state;
  200. byte spoofed_msg;
  201. byte ptyState;
  202. byte cr_enquiry;
  203. word hangup_flow_ctrl_timer;
  204. word ncci_ring_list;
  205. byte inc_dis_ncci_table[MAX_CHANNELS_PER_PLCI];
  206. t_std_internal_command internal_command_queue[MAX_INTERNAL_COMMAND_LEVELS];
  207. dword c_ind_mask_table[C_IND_MASK_DWORDS];
  208. dword group_optimization_mask_table[C_IND_MASK_DWORDS];
  209. byte RBuffer[200];
  210. dword msg_in_queue[MSG_IN_QUEUE_SIZE/sizeof(dword)];
  211. API_SAVE saved_msg;
  212. API_SAVE B_protocol;
  213. byte fax_connect_info_length;
  214. byte fax_connect_info_buffer[FAX_CONNECT_INFO_BUFFER_SIZE];
  215. byte fax_edata_ack_length;
  216. word nsf_control_bits;
  217. byte ncpi_state;
  218. byte ncpi_buffer[NCPI_BUFFER_SIZE];
  219. byte internal_req_buffer[INTERNAL_REQ_BUFFER_SIZE];
  220. byte internal_ind_buffer[INTERNAL_IND_BUFFER_SIZE + 3];
  221. dword requested_options_conn;
  222. dword requested_options;
  223. word B1_facilities;
  224. API_SAVE *adjust_b_parms_msg;
  225. word adjust_b_facilities;
  226. word adjust_b_command;
  227. word adjust_b_ncci;
  228. word adjust_b_mode;
  229. word adjust_b_state;
  230. byte adjust_b_restore;
  231. byte dtmf_rec_active;
  232. word dtmf_rec_pulse_ms;
  233. word dtmf_rec_pause_ms;
  234. byte dtmf_send_requests;
  235. word dtmf_send_pulse_ms;
  236. word dtmf_send_pause_ms;
  237. word dtmf_cmd;
  238. word dtmf_msg_number_queue[8];
  239. byte dtmf_parameter_length;
  240. byte dtmf_parameter_buffer[DTMF_PARAMETER_BUFFER_SIZE];
  241. t_capidtmf_state capidtmf_state;
  242. byte li_bchannel_id; /* BRI: 1..2, PRI: 1..32 */
  243. byte li_channel_bits;
  244. byte li_notify_update;
  245. word li_cmd;
  246. word li_write_command;
  247. word li_write_channel;
  248. word li_plci_b_write_pos;
  249. word li_plci_b_read_pos;
  250. word li_plci_b_req_pos;
  251. dword li_plci_b_queue[LI_PLCI_B_QUEUE_ENTRIES];
  252. word ec_cmd;
  253. word ec_idi_options;
  254. word ec_tail_length;
  255. byte tone_last_indication_code;
  256. byte vswitchstate;
  257. byte vsprot;
  258. byte vsprotdialect;
  259. byte notifiedcall; /* Flag if it is a spoofed call */
  260. int rx_dma_descriptor;
  261. dword rx_dma_magic;
  262. };
  263. struct _NCCI {
  264. byte data_out;
  265. byte data_pending;
  266. byte data_ack_out;
  267. byte data_ack_pending;
  268. DATA_B3_DESC DBuffer[MAX_DATA_B3];
  269. DATA_ACK_DESC DataAck[MAX_DATA_ACK];
  270. };
  271. struct _DIVA_CAPI_ADAPTER {
  272. IDI_CALL request;
  273. byte Id;
  274. byte max_plci;
  275. byte max_listen;
  276. byte listen_active;
  277. PLCI *plci;
  278. byte ch_ncci[MAX_NL_CHANNEL + 1];
  279. byte ncci_ch[MAX_NCCI + 1];
  280. byte ncci_plci[MAX_NCCI + 1];
  281. byte ncci_state[MAX_NCCI + 1];
  282. byte ncci_next[MAX_NCCI + 1];
  283. NCCI ncci[MAX_NCCI + 1];
  284. byte ch_flow_control[MAX_NL_CHANNEL + 1]; /* Used by XON protocol */
  285. byte ch_flow_control_pending;
  286. byte ch_flow_plci[MAX_NL_CHANNEL + 1];
  287. int last_flow_control_ch;
  288. dword Info_Mask[MAX_APPL];
  289. dword CIP_Mask[MAX_APPL];
  290. dword Notification_Mask[MAX_APPL];
  291. PLCI *codec_listen[MAX_APPL];
  292. dword requested_options_table[MAX_APPL];
  293. API_PROFILE profile;
  294. MANUFACTURER_PROFILE man_profile;
  295. dword manufacturer_features;
  296. byte AdvCodecFLAG;
  297. PLCI *AdvCodecPLCI;
  298. PLCI *AdvSignalPLCI;
  299. APPL *AdvSignalAppl;
  300. byte TelOAD[23];
  301. byte TelOSA[23];
  302. byte scom_appl_disable;
  303. PLCI *automatic_lawPLCI;
  304. byte automatic_law;
  305. byte u_law;
  306. byte adv_voice_coef_length;
  307. byte adv_voice_coef_buffer[ADV_VOICE_COEF_BUFFER_SIZE];
  308. byte li_pri;
  309. byte li_channels;
  310. word li_base;
  311. byte adapter_disabled;
  312. byte group_optimization_enabled; /* use application groups if enabled */
  313. dword sdram_bar;
  314. byte flag_dynamic_l1_down; /* for hunt groups:down layer 1 if no appl present*/
  315. byte FlowControlIdTable[256];
  316. byte FlowControlSkipTable[256];
  317. void *os_card; /* pointer to associated OS dependent adapter structure */
  318. };
  319. /*------------------------------------------------------------------*/
  320. /* Application flags */
  321. /*------------------------------------------------------------------*/
  322. #define APPL_FLAG_OLD_LI_SPEC 0x01
  323. #define APPL_FLAG_PRIV_EC_SPEC 0x02
  324. /*------------------------------------------------------------------*/
  325. /* API parameter definitions */
  326. /*------------------------------------------------------------------*/
  327. #define X75_TTX 1 /* x.75 for ttx */
  328. #define TRF 2 /* transparent with hdlc framing */
  329. #define TRF_IN 3 /* transparent with hdlc fr. inc. */
  330. #define SDLC 4 /* sdlc, sna layer-2 */
  331. #define X75_BTX 5 /* x.75 for btx */
  332. #define LAPD 6 /* lapd (Q.921) */
  333. #define X25_L2 7 /* x.25 layer-2 */
  334. #define V120_L2 8 /* V.120 layer-2 protocol */
  335. #define V42_IN 9 /* V.42 layer-2 protocol, incoming */
  336. #define V42 10 /* V.42 layer-2 protocol */
  337. #define MDM_ATP 11 /* AT Parser built in the L2 */
  338. #define X75_V42BIS 12 /* ISO7776 (X.75 SLP) modified to support V.42 bis compression */
  339. #define RTPL2_IN 13 /* RTP layer-2 protocol, incoming */
  340. #define RTPL2 14 /* RTP layer-2 protocol */
  341. #define V120_V42BIS 15 /* V.120 layer-2 protocol supporting V.42 bis compression */
  342. #define T70NL 1
  343. #define X25PLP 2
  344. #define T70NLX 3
  345. #define TRANSPARENT_NL 4
  346. #define ISO8208 5
  347. #define T30 6
  348. /*------------------------------------------------------------------*/
  349. /* FAX interface to IDI */
  350. /*------------------------------------------------------------------*/
  351. #define CAPI_MAX_HEAD_LINE_SPACE 89
  352. #define CAPI_MAX_DATE_TIME_LENGTH 18
  353. #define T30_MAX_STATION_ID_LENGTH 20
  354. #define T30_MAX_SUBADDRESS_LENGTH 20
  355. #define T30_MAX_PASSWORD_LENGTH 20
  356. typedef struct t30_info_s T30_INFO;
  357. struct t30_info_s {
  358. byte code;
  359. byte rate_div_2400;
  360. byte resolution;
  361. byte data_format;
  362. byte pages_low;
  363. byte pages_high;
  364. byte operating_mode;
  365. byte control_bits_low;
  366. byte control_bits_high;
  367. byte feature_bits_low;
  368. byte feature_bits_high;
  369. byte recording_properties;
  370. byte universal_6;
  371. byte universal_7;
  372. byte station_id_len;
  373. byte head_line_len;
  374. byte station_id[T30_MAX_STATION_ID_LENGTH];
  375. /* byte head_line[]; */
  376. /* byte sub_sep_length; */
  377. /* byte sub_sep_field[]; */
  378. /* byte pwd_length; */
  379. /* byte pwd_field[]; */
  380. /* byte nsf_info_length; */
  381. /* byte nsf_info_field[]; */
  382. };
  383. #define T30_RESOLUTION_R8_0385 0x00
  384. #define T30_RESOLUTION_R8_0770_OR_200 0x01
  385. #define T30_RESOLUTION_R8_1540 0x02
  386. #define T30_RESOLUTION_R16_1540_OR_400 0x04
  387. #define T30_RESOLUTION_R4_0385_OR_100 0x08
  388. #define T30_RESOLUTION_300_300 0x10
  389. #define T30_RESOLUTION_INCH_BASED 0x40
  390. #define T30_RESOLUTION_METRIC_BASED 0x80
  391. #define T30_RECORDING_WIDTH_ISO_A4 0
  392. #define T30_RECORDING_WIDTH_ISO_B4 1
  393. #define T30_RECORDING_WIDTH_ISO_A3 2
  394. #define T30_RECORDING_WIDTH_COUNT 3
  395. #define T30_RECORDING_LENGTH_ISO_A4 0
  396. #define T30_RECORDING_LENGTH_ISO_B4 1
  397. #define T30_RECORDING_LENGTH_UNLIMITED 2
  398. #define T30_RECORDING_LENGTH_COUNT 3
  399. #define T30_MIN_SCANLINE_TIME_00_00_00 0
  400. #define T30_MIN_SCANLINE_TIME_05_05_05 1
  401. #define T30_MIN_SCANLINE_TIME_10_05_05 2
  402. #define T30_MIN_SCANLINE_TIME_10_10_10 3
  403. #define T30_MIN_SCANLINE_TIME_20_10_10 4
  404. #define T30_MIN_SCANLINE_TIME_20_20_20 5
  405. #define T30_MIN_SCANLINE_TIME_40_20_20 6
  406. #define T30_MIN_SCANLINE_TIME_40_40_40 7
  407. #define T30_MIN_SCANLINE_TIME_RES_8 8
  408. #define T30_MIN_SCANLINE_TIME_RES_9 9
  409. #define T30_MIN_SCANLINE_TIME_RES_10 10
  410. #define T30_MIN_SCANLINE_TIME_10_10_05 11
  411. #define T30_MIN_SCANLINE_TIME_20_10_05 12
  412. #define T30_MIN_SCANLINE_TIME_20_20_10 13
  413. #define T30_MIN_SCANLINE_TIME_40_20_10 14
  414. #define T30_MIN_SCANLINE_TIME_40_40_20 15
  415. #define T30_MIN_SCANLINE_TIME_COUNT 16
  416. #define T30_DATA_FORMAT_SFF 0
  417. #define T30_DATA_FORMAT_ASCII 1
  418. #define T30_DATA_FORMAT_NATIVE 2
  419. #define T30_DATA_FORMAT_COUNT 3
  420. #define T30_OPERATING_MODE_STANDARD 0
  421. #define T30_OPERATING_MODE_CLASS2 1
  422. #define T30_OPERATING_MODE_CLASS1 2
  423. #define T30_OPERATING_MODE_CAPI 3
  424. #define T30_OPERATING_MODE_CAPI_NEG 4
  425. #define T30_OPERATING_MODE_COUNT 5
  426. /* EDATA transmit messages */
  427. #define EDATA_T30_DIS 0x01
  428. #define EDATA_T30_FTT 0x02
  429. #define EDATA_T30_MCF 0x03
  430. #define EDATA_T30_PARAMETERS 0x04
  431. /* EDATA receive messages */
  432. #define EDATA_T30_DCS 0x81
  433. #define EDATA_T30_TRAIN_OK 0x82
  434. #define EDATA_T30_EOP 0x83
  435. #define EDATA_T30_MPS 0x84
  436. #define EDATA_T30_EOM 0x85
  437. #define EDATA_T30_DTC 0x86
  438. #define EDATA_T30_PAGE_END 0x87 /* Indicates end of page data. Reserved, but not implemented ! */
  439. #define EDATA_T30_EOP_CAPI 0x88
  440. #define T30_SUCCESS 0
  441. #define T30_ERR_NO_DIS_RECEIVED 1
  442. #define T30_ERR_TIMEOUT_NO_RESPONSE 2
  443. #define T30_ERR_RETRY_NO_RESPONSE 3
  444. #define T30_ERR_TOO_MANY_REPEATS 4
  445. #define T30_ERR_UNEXPECTED_MESSAGE 5
  446. #define T30_ERR_UNEXPECTED_DCN 6
  447. #define T30_ERR_DTC_UNSUPPORTED 7
  448. #define T30_ERR_ALL_RATES_FAILED 8
  449. #define T30_ERR_TOO_MANY_TRAINS 9
  450. #define T30_ERR_RECEIVE_CORRUPTED 10
  451. #define T30_ERR_UNEXPECTED_DISC 11
  452. #define T30_ERR_APPLICATION_DISC 12
  453. #define T30_ERR_INCOMPATIBLE_DIS 13
  454. #define T30_ERR_INCOMPATIBLE_DCS 14
  455. #define T30_ERR_TIMEOUT_NO_COMMAND 15
  456. #define T30_ERR_RETRY_NO_COMMAND 16
  457. #define T30_ERR_TIMEOUT_COMMAND_TOO_LONG 17
  458. #define T30_ERR_TIMEOUT_RESPONSE_TOO_LONG 18
  459. #define T30_ERR_NOT_IDENTIFIED 19
  460. #define T30_ERR_SUPERVISORY_TIMEOUT 20
  461. #define T30_ERR_TOO_LONG_SCAN_LINE 21
  462. /* #define T30_ERR_RETRY_NO_PAGE_AFTER_MPS 22 */
  463. #define T30_ERR_RETRY_NO_PAGE_RECEIVED 23
  464. #define T30_ERR_RETRY_NO_DCS_AFTER_FTT 24
  465. #define T30_ERR_RETRY_NO_DCS_AFTER_EOM 25
  466. #define T30_ERR_RETRY_NO_DCS_AFTER_MPS 26
  467. #define T30_ERR_RETRY_NO_DCN_AFTER_MCF 27
  468. #define T30_ERR_RETRY_NO_DCN_AFTER_RTN 28
  469. #define T30_ERR_RETRY_NO_CFR 29
  470. #define T30_ERR_RETRY_NO_MCF_AFTER_EOP 30
  471. #define T30_ERR_RETRY_NO_MCF_AFTER_EOM 31
  472. #define T30_ERR_RETRY_NO_MCF_AFTER_MPS 32
  473. #define T30_ERR_SUB_SEP_UNSUPPORTED 33
  474. #define T30_ERR_PWD_UNSUPPORTED 34
  475. #define T30_ERR_SUB_SEP_PWD_UNSUPPORTED 35
  476. #define T30_ERR_INVALID_COMMAND_FRAME 36
  477. #define T30_ERR_UNSUPPORTED_PAGE_CODING 37
  478. #define T30_ERR_INVALID_PAGE_CODING 38
  479. #define T30_ERR_INCOMPATIBLE_PAGE_CONFIG 39
  480. #define T30_ERR_TIMEOUT_FROM_APPLICATION 40
  481. #define T30_ERR_V34FAX_NO_REACTION_ON_MARK 41
  482. #define T30_ERR_V34FAX_TRAINING_TIMEOUT 42
  483. #define T30_ERR_V34FAX_UNEXPECTED_V21 43
  484. #define T30_ERR_V34FAX_PRIMARY_CTS_ON 44
  485. #define T30_ERR_V34FAX_TURNAROUND_POLLING 45
  486. #define T30_ERR_V34FAX_V8_INCOMPATIBILITY 46
  487. #define T30_CONTROL_BIT_DISABLE_FINE 0x0001
  488. #define T30_CONTROL_BIT_ENABLE_ECM 0x0002
  489. #define T30_CONTROL_BIT_ECM_64_BYTES 0x0004
  490. #define T30_CONTROL_BIT_ENABLE_2D_CODING 0x0008
  491. #define T30_CONTROL_BIT_ENABLE_T6_CODING 0x0010
  492. #define T30_CONTROL_BIT_ENABLE_UNCOMPR 0x0020
  493. #define T30_CONTROL_BIT_ACCEPT_POLLING 0x0040
  494. #define T30_CONTROL_BIT_REQUEST_POLLING 0x0080
  495. #define T30_CONTROL_BIT_MORE_DOCUMENTS 0x0100
  496. #define T30_CONTROL_BIT_ACCEPT_SUBADDRESS 0x0200
  497. #define T30_CONTROL_BIT_ACCEPT_SEL_POLLING 0x0400
  498. #define T30_CONTROL_BIT_ACCEPT_PASSWORD 0x0800
  499. #define T30_CONTROL_BIT_ENABLE_V34FAX 0x1000
  500. #define T30_CONTROL_BIT_EARLY_CONNECT 0x2000
  501. #define T30_CONTROL_BIT_ALL_FEATURES (T30_CONTROL_BIT_ENABLE_ECM | T30_CONTROL_BIT_ENABLE_2D_CODING | T30_CONTROL_BIT_ENABLE_T6_CODING | T30_CONTROL_BIT_ENABLE_UNCOMPR | T30_CONTROL_BIT_ENABLE_V34FAX)
  502. #define T30_FEATURE_BIT_FINE 0x0001
  503. #define T30_FEATURE_BIT_ECM 0x0002
  504. #define T30_FEATURE_BIT_ECM_64_BYTES 0x0004
  505. #define T30_FEATURE_BIT_2D_CODING 0x0008
  506. #define T30_FEATURE_BIT_T6_CODING 0x0010
  507. #define T30_FEATURE_BIT_UNCOMPR_ENABLED 0x0020
  508. #define T30_FEATURE_BIT_POLLING 0x0040
  509. #define T30_FEATURE_BIT_MORE_DOCUMENTS 0x0100
  510. #define T30_FEATURE_BIT_V34FAX 0x1000
  511. #define T30_NSF_CONTROL_BIT_ENABLE_NSF 0x0001
  512. #define T30_NSF_CONTROL_BIT_RAW_INFO 0x0002
  513. #define T30_NSF_CONTROL_BIT_NEGOTIATE_IND 0x0004
  514. #define T30_NSF_CONTROL_BIT_NEGOTIATE_RESP 0x0008
  515. #define T30_NSF_ELEMENT_NSF_FIF 0x00
  516. #define T30_NSF_ELEMENT_NSC_FIF 0x01
  517. #define T30_NSF_ELEMENT_NSS_FIF 0x02
  518. #define T30_NSF_ELEMENT_COMPANY_NAME 0x03
  519. /*------------------------------------------------------------------*/
  520. /* Analog modem definitions */
  521. /*------------------------------------------------------------------*/
  522. typedef struct async_s ASYNC_FORMAT;
  523. struct async_s {
  524. unsigned pe:1;
  525. unsigned parity:2;
  526. unsigned spare:2;
  527. unsigned stp:1;
  528. unsigned ch_len:2; /* 3th octett in CAI */
  529. };
  530. /*------------------------------------------------------------------*/
  531. /* PLCI/NCCI states */
  532. /*------------------------------------------------------------------*/
  533. #define IDLE 0
  534. #define OUTG_CON_PENDING 1
  535. #define INC_CON_PENDING 2
  536. #define INC_CON_ALERT 3
  537. #define INC_CON_ACCEPT 4
  538. #define INC_ACT_PENDING 5
  539. #define LISTENING 6
  540. #define CONNECTED 7
  541. #define OUTG_DIS_PENDING 8
  542. #define INC_DIS_PENDING 9
  543. #define LOCAL_CONNECT 10
  544. #define INC_RES_PENDING 11
  545. #define OUTG_RES_PENDING 12
  546. #define SUSPENDING 13
  547. #define ADVANCED_VOICE_SIG 14
  548. #define ADVANCED_VOICE_NOSIG 15
  549. #define RESUMING 16
  550. #define INC_CON_CONNECTED_ALERT 17
  551. #define OUTG_REJ_PENDING 18
  552. /*------------------------------------------------------------------*/
  553. /* auxiliary states for supplementary services */
  554. /*------------------------------------------------------------------*/
  555. #define IDLE 0
  556. #define HOLD_REQUEST 1
  557. #define HOLD_INDICATE 2
  558. #define CALL_HELD 3
  559. #define RETRIEVE_REQUEST 4
  560. #define RETRIEVE_INDICATION 5
  561. /*------------------------------------------------------------------*/
  562. /* Capi IE + Msg types */
  563. /*------------------------------------------------------------------*/
  564. #define ESC_CAUSE 0x800 | CAU /* Escape cause element */
  565. #define ESC_MSGTYPE 0x800 | MSGTYPEIE /* Escape message type */
  566. #define ESC_CHI 0x800 | CHI /* Escape channel id */
  567. #define ESC_LAW 0x800 | BC /* Escape law info */
  568. #define ESC_CR 0x800 | CRIE /* Escape CallReference */
  569. #define ESC_PROFILE 0x800 | PROFILEIE /* Escape profile */
  570. #define ESC_SSEXT 0x800 | SSEXTIE /* Escape Supplem. Serv.*/
  571. #define ESC_VSWITCH 0x800 | VSWITCHIE /* Escape VSwitch */
  572. #define CST 0x14 /* Call State i.e. */
  573. #define PI 0x1E /* Progress Indicator */
  574. #define NI 0x27 /* Notification Ind */
  575. #define CONN_NR 0x4C /* Connected Number */
  576. #define CONG_RNR 0xBF /* Congestion RNR */
  577. #define CONG_RR 0xB0 /* Congestion RR */
  578. #define RESERVED 0xFF /* Res. for future use */
  579. #define ON_BOARD_CODEC 0x02 /* external controller */
  580. #define HANDSET 0x04 /* Codec+Handset(Pro11) */
  581. #define HOOK_SUPPORT 0x01 /* activate Hook signal */
  582. #define SCR 0x7a /* unscreened number */
  583. #define HOOK_OFF_REQ 0x9001 /* internal conn req */
  584. #define HOOK_ON_REQ 0x9002 /* internal disc req */
  585. #define SUSPEND_REQ 0x9003 /* internal susp req */
  586. #define RESUME_REQ 0x9004 /* internal resume req */
  587. #define USELAW_REQ 0x9005 /* internal law req */
  588. #define LISTEN_SIG_ASSIGN_PEND 0x9006
  589. #define PERM_LIST_REQ 0x900a /* permanent conn DCE */
  590. #define C_HOLD_REQ 0x9011
  591. #define C_RETRIEVE_REQ 0x9012
  592. #define C_NCR_FAC_REQ 0x9013
  593. #define PERM_COD_ASSIGN 0x9014
  594. #define PERM_COD_CALL 0x9015
  595. #define PERM_COD_HOOK 0x9016
  596. #define PERM_COD_CONN_PEND 0x9017 /* wait for connect_con */
  597. #define PTY_REQ_PEND 0x9018
  598. #define CD_REQ_PEND 0x9019
  599. #define CF_START_PEND 0x901a
  600. #define CF_STOP_PEND 0x901b
  601. #define ECT_REQ_PEND 0x901c
  602. #define GETSERV_REQ_PEND 0x901d
  603. #define BLOCK_PLCI 0x901e
  604. #define INTERR_NUMBERS_REQ_PEND 0x901f
  605. #define INTERR_DIVERSION_REQ_PEND 0x9020
  606. #define MWI_ACTIVATE_REQ_PEND 0x9021
  607. #define MWI_DEACTIVATE_REQ_PEND 0x9022
  608. #define SSEXT_REQ_COMMAND 0x9023
  609. #define SSEXT_NC_REQ_COMMAND 0x9024
  610. #define START_L1_SIG_ASSIGN_PEND 0x9025
  611. #define REM_L1_SIG_ASSIGN_PEND 0x9026
  612. #define CONF_BEGIN_REQ_PEND 0x9027
  613. #define CONF_ADD_REQ_PEND 0x9028
  614. #define CONF_SPLIT_REQ_PEND 0x9029
  615. #define CONF_DROP_REQ_PEND 0x902a
  616. #define CONF_ISOLATE_REQ_PEND 0x902b
  617. #define CONF_REATTACH_REQ_PEND 0x902c
  618. #define VSWITCH_REQ_PEND 0x902d
  619. #define GET_MWI_STATE 0x902e
  620. #define CCBS_REQUEST_REQ_PEND 0x902f
  621. #define CCBS_DEACTIVATE_REQ_PEND 0x9030
  622. #define CCBS_INTERROGATE_REQ_PEND 0x9031
  623. #define NO_INTERNAL_COMMAND 0
  624. #define DTMF_COMMAND_1 1
  625. #define DTMF_COMMAND_2 2
  626. #define DTMF_COMMAND_3 3
  627. #define MIXER_COMMAND_1 4
  628. #define MIXER_COMMAND_2 5
  629. #define MIXER_COMMAND_3 6
  630. #define ADV_VOICE_COMMAND_CONNECT_1 7
  631. #define ADV_VOICE_COMMAND_CONNECT_2 8
  632. #define ADV_VOICE_COMMAND_CONNECT_3 9
  633. #define ADV_VOICE_COMMAND_DISCONNECT_1 10
  634. #define ADV_VOICE_COMMAND_DISCONNECT_2 11
  635. #define ADV_VOICE_COMMAND_DISCONNECT_3 12
  636. #define ADJUST_B_RESTORE_1 13
  637. #define ADJUST_B_RESTORE_2 14
  638. #define RESET_B3_COMMAND_1 15
  639. #define SELECT_B_COMMAND_1 16
  640. #define FAX_CONNECT_INFO_COMMAND_1 17
  641. #define FAX_CONNECT_INFO_COMMAND_2 18
  642. #define FAX_ADJUST_B23_COMMAND_1 19
  643. #define FAX_ADJUST_B23_COMMAND_2 20
  644. #define EC_COMMAND_1 21
  645. #define EC_COMMAND_2 22
  646. #define EC_COMMAND_3 23
  647. #define RTP_CONNECT_B3_REQ_COMMAND_1 24
  648. #define RTP_CONNECT_B3_REQ_COMMAND_2 25
  649. #define RTP_CONNECT_B3_REQ_COMMAND_3 26
  650. #define RTP_CONNECT_B3_RES_COMMAND_1 27
  651. #define RTP_CONNECT_B3_RES_COMMAND_2 28
  652. #define RTP_CONNECT_B3_RES_COMMAND_3 29
  653. #define HOLD_SAVE_COMMAND_1 30
  654. #define RETRIEVE_RESTORE_COMMAND_1 31
  655. #define FAX_DISCONNECT_COMMAND_1 32
  656. #define FAX_DISCONNECT_COMMAND_2 33
  657. #define FAX_DISCONNECT_COMMAND_3 34
  658. #define FAX_EDATA_ACK_COMMAND_1 35
  659. #define FAX_EDATA_ACK_COMMAND_2 36
  660. #define FAX_CONNECT_ACK_COMMAND_1 37
  661. #define FAX_CONNECT_ACK_COMMAND_2 38
  662. #define STD_INTERNAL_COMMAND_COUNT 39
  663. #define UID 0x2d /* User Id for Mgmt */
  664. #define CALL_DIR_OUT 0x01 /* call direction of initial call */
  665. #define CALL_DIR_IN 0x02
  666. #define CALL_DIR_ORIGINATE 0x04 /* DTE/DCE direction according to */
  667. #define CALL_DIR_ANSWER 0x08 /* state of B-Channel Operation */
  668. #define CALL_DIR_FORCE_OUTG_NL 0x10 /* for RESET_B3 reconnect, after DISC_B3... */
  669. #define AWAITING_MANUF_CON 0x80 /* command spoofing flags */
  670. #define SPOOFING_REQUIRED 0xff
  671. #define AWAITING_SELECT_B 0xef
  672. /*------------------------------------------------------------------*/
  673. /* B_CTRL / DSP_CTRL */
  674. /*------------------------------------------------------------------*/
  675. #define DSP_CTRL_OLD_SET_MIXER_COEFFICIENTS 0x01
  676. #define DSP_CTRL_SET_BCHANNEL_PASSIVATION_BRI 0x02
  677. #define DSP_CTRL_SET_DTMF_PARAMETERS 0x03
  678. #define MANUFACTURER_FEATURE_SLAVE_CODEC 0x00000001L
  679. #define MANUFACTURER_FEATURE_FAX_MORE_DOCUMENTS 0x00000002L
  680. #define MANUFACTURER_FEATURE_HARDDTMF 0x00000004L
  681. #define MANUFACTURER_FEATURE_SOFTDTMF_SEND 0x00000008L
  682. #define MANUFACTURER_FEATURE_DTMF_PARAMETERS 0x00000010L
  683. #define MANUFACTURER_FEATURE_SOFTDTMF_RECEIVE 0x00000020L
  684. #define MANUFACTURER_FEATURE_FAX_SUB_SEP_PWD 0x00000040L
  685. #define MANUFACTURER_FEATURE_V18 0x00000080L
  686. #define MANUFACTURER_FEATURE_MIXER_CH_CH 0x00000100L
  687. #define MANUFACTURER_FEATURE_MIXER_CH_PC 0x00000200L
  688. #define MANUFACTURER_FEATURE_MIXER_PC_CH 0x00000400L
  689. #define MANUFACTURER_FEATURE_MIXER_PC_PC 0x00000800L
  690. #define MANUFACTURER_FEATURE_ECHO_CANCELLER 0x00001000L
  691. #define MANUFACTURER_FEATURE_RTP 0x00002000L
  692. #define MANUFACTURER_FEATURE_T38 0x00004000L
  693. #define MANUFACTURER_FEATURE_TRANSP_DELIVERY_CONF 0x00008000L
  694. #define MANUFACTURER_FEATURE_XONOFF_FLOW_CONTROL 0x00010000L
  695. #define MANUFACTURER_FEATURE_OOB_CHANNEL 0x00020000L
  696. #define MANUFACTURER_FEATURE_IN_BAND_CHANNEL 0x00040000L
  697. #define MANUFACTURER_FEATURE_IN_BAND_FEATURE 0x00080000L
  698. #define MANUFACTURER_FEATURE_PIAFS 0x00100000L
  699. #define MANUFACTURER_FEATURE_DTMF_TONE 0x00200000L
  700. #define MANUFACTURER_FEATURE_FAX_PAPER_FORMATS 0x00400000L
  701. #define MANUFACTURER_FEATURE_OK_FC_LABEL 0x00800000L
  702. #define MANUFACTURER_FEATURE_VOWN 0x01000000L
  703. #define MANUFACTURER_FEATURE_XCONNECT 0x02000000L
  704. #define MANUFACTURER_FEATURE_DMACONNECT 0x04000000L
  705. #define MANUFACTURER_FEATURE_AUDIO_TAP 0x08000000L
  706. #define MANUFACTURER_FEATURE_FAX_NONSTANDARD 0x10000000L
  707. /*------------------------------------------------------------------*/
  708. /* DTMF interface to IDI */
  709. /*------------------------------------------------------------------*/
  710. #define DTMF_DIGIT_TONE_LOW_GROUP_697_HZ 0x00
  711. #define DTMF_DIGIT_TONE_LOW_GROUP_770_HZ 0x01
  712. #define DTMF_DIGIT_TONE_LOW_GROUP_852_HZ 0x02
  713. #define DTMF_DIGIT_TONE_LOW_GROUP_941_HZ 0x03
  714. #define DTMF_DIGIT_TONE_LOW_GROUP_MASK 0x03
  715. #define DTMF_DIGIT_TONE_HIGH_GROUP_1209_HZ 0x00
  716. #define DTMF_DIGIT_TONE_HIGH_GROUP_1336_HZ 0x04
  717. #define DTMF_DIGIT_TONE_HIGH_GROUP_1477_HZ 0x08
  718. #define DTMF_DIGIT_TONE_HIGH_GROUP_1633_HZ 0x0c
  719. #define DTMF_DIGIT_TONE_HIGH_GROUP_MASK 0x0c
  720. #define DTMF_DIGIT_TONE_CODE_0 0x07
  721. #define DTMF_DIGIT_TONE_CODE_1 0x00
  722. #define DTMF_DIGIT_TONE_CODE_2 0x04
  723. #define DTMF_DIGIT_TONE_CODE_3 0x08
  724. #define DTMF_DIGIT_TONE_CODE_4 0x01
  725. #define DTMF_DIGIT_TONE_CODE_5 0x05
  726. #define DTMF_DIGIT_TONE_CODE_6 0x09
  727. #define DTMF_DIGIT_TONE_CODE_7 0x02
  728. #define DTMF_DIGIT_TONE_CODE_8 0x06
  729. #define DTMF_DIGIT_TONE_CODE_9 0x0a
  730. #define DTMF_DIGIT_TONE_CODE_STAR 0x03
  731. #define DTMF_DIGIT_TONE_CODE_HASHMARK 0x0b
  732. #define DTMF_DIGIT_TONE_CODE_A 0x0c
  733. #define DTMF_DIGIT_TONE_CODE_B 0x0d
  734. #define DTMF_DIGIT_TONE_CODE_C 0x0e
  735. #define DTMF_DIGIT_TONE_CODE_D 0x0f
  736. #define DTMF_UDATA_REQUEST_SEND_DIGITS 16
  737. #define DTMF_UDATA_REQUEST_ENABLE_RECEIVER 17
  738. #define DTMF_UDATA_REQUEST_DISABLE_RECEIVER 18
  739. #define DTMF_UDATA_INDICATION_DIGITS_SENT 16
  740. #define DTMF_UDATA_INDICATION_DIGITS_RECEIVED 17
  741. #define DTMF_UDATA_INDICATION_MODEM_CALLING_TONE 18
  742. #define DTMF_UDATA_INDICATION_FAX_CALLING_TONE 19
  743. #define DTMF_UDATA_INDICATION_ANSWER_TONE 20
  744. #define UDATA_REQUEST_MIXER_TAP_DATA 27
  745. #define UDATA_INDICATION_MIXER_TAP_DATA 27
  746. #define DTMF_LISTEN_ACTIVE_FLAG 0x01
  747. #define DTMF_SEND_DIGIT_FLAG 0x01
  748. /*------------------------------------------------------------------*/
  749. /* Mixer interface to IDI */
  750. /*------------------------------------------------------------------*/
  751. #define LI2_FLAG_PCCONNECT_A_B 0x40000000
  752. #define LI2_FLAG_PCCONNECT_B_A 0x80000000
  753. #define MIXER_BCHANNELS_BRI 2
  754. #define MIXER_IC_CHANNELS_BRI MIXER_BCHANNELS_BRI
  755. #define MIXER_IC_CHANNEL_BASE MIXER_BCHANNELS_BRI
  756. #define MIXER_CHANNELS_BRI (MIXER_BCHANNELS_BRI + MIXER_IC_CHANNELS_BRI)
  757. #define MIXER_CHANNELS_PRI 32
  758. typedef struct li_config_s LI_CONFIG;
  759. struct xconnect_card_address_s {
  760. dword low;
  761. dword high;
  762. };
  763. struct xconnect_transfer_address_s {
  764. struct xconnect_card_address_s card_address;
  765. dword offset;
  766. };
  767. struct li_config_s {
  768. DIVA_CAPI_ADAPTER *adapter;
  769. PLCI *plci;
  770. struct xconnect_transfer_address_s send_b;
  771. struct xconnect_transfer_address_s send_pc;
  772. byte *flag_table; /* dword aligned and sized */
  773. byte *coef_table; /* dword aligned and sized */
  774. byte channel;
  775. byte curchnl;
  776. byte chflags;
  777. };
  778. extern LI_CONFIG *li_config_table;
  779. extern word li_total_channels;
  780. #define LI_CHANNEL_INVOLVED 0x01
  781. #define LI_CHANNEL_ACTIVE 0x02
  782. #define LI_CHANNEL_TX_DATA 0x04
  783. #define LI_CHANNEL_RX_DATA 0x08
  784. #define LI_CHANNEL_CONFERENCE 0x10
  785. #define LI_CHANNEL_ADDRESSES_SET 0x80
  786. #define LI_CHFLAG_MONITOR 0x01
  787. #define LI_CHFLAG_MIX 0x02
  788. #define LI_CHFLAG_LOOP 0x04
  789. #define LI_FLAG_INTERCONNECT 0x01
  790. #define LI_FLAG_MONITOR 0x02
  791. #define LI_FLAG_MIX 0x04
  792. #define LI_FLAG_PCCONNECT 0x08
  793. #define LI_FLAG_CONFERENCE 0x10
  794. #define LI_FLAG_ANNOUNCEMENT 0x20
  795. #define LI_COEF_CH_CH 0x01
  796. #define LI_COEF_CH_PC 0x02
  797. #define LI_COEF_PC_CH 0x04
  798. #define LI_COEF_PC_PC 0x08
  799. #define LI_COEF_CH_CH_SET 0x10
  800. #define LI_COEF_CH_PC_SET 0x20
  801. #define LI_COEF_PC_CH_SET 0x40
  802. #define LI_COEF_PC_PC_SET 0x80
  803. #define LI_REQ_SILENT_UPDATE 0xffff
  804. #define LI_PLCI_B_LAST_FLAG ((dword) 0x80000000L)
  805. #define LI_PLCI_B_DISC_FLAG ((dword) 0x40000000L)
  806. #define LI_PLCI_B_SKIP_FLAG ((dword) 0x20000000L)
  807. #define LI_PLCI_B_FLAG_MASK ((dword) 0xe0000000L)
  808. #define UDATA_REQUEST_SET_MIXER_COEFS_BRI 24
  809. #define UDATA_REQUEST_SET_MIXER_COEFS_PRI_SYNC 25
  810. #define UDATA_REQUEST_SET_MIXER_COEFS_PRI_ASYN 26
  811. #define UDATA_INDICATION_MIXER_COEFS_SET 24
  812. #define MIXER_FEATURE_ENABLE_TX_DATA 0x0001
  813. #define MIXER_FEATURE_ENABLE_RX_DATA 0x0002
  814. #define MIXER_COEF_LINE_CHANNEL_MASK 0x1f
  815. #define MIXER_COEF_LINE_FROM_PC_FLAG 0x20
  816. #define MIXER_COEF_LINE_TO_PC_FLAG 0x40
  817. #define MIXER_COEF_LINE_ROW_FLAG 0x80
  818. #define UDATA_REQUEST_XCONNECT_FROM 28
  819. #define UDATA_INDICATION_XCONNECT_FROM 28
  820. #define UDATA_REQUEST_XCONNECT_TO 29
  821. #define UDATA_INDICATION_XCONNECT_TO 29
  822. #define XCONNECT_CHANNEL_PORT_B 0x0000
  823. #define XCONNECT_CHANNEL_PORT_PC 0x8000
  824. #define XCONNECT_CHANNEL_PORT_MASK 0x8000
  825. #define XCONNECT_CHANNEL_NUMBER_MASK 0x7fff
  826. #define XCONNECT_CHANNEL_PORT_COUNT 2
  827. #define XCONNECT_SUCCESS 0x0000
  828. #define XCONNECT_ERROR 0x0001
  829. /*------------------------------------------------------------------*/
  830. /* Echo canceller interface to IDI */
  831. /*------------------------------------------------------------------*/
  832. #define PRIVATE_ECHO_CANCELLER 0
  833. #define PRIV_SELECTOR_ECHO_CANCELLER 255
  834. #define EC_ENABLE_OPERATION 1
  835. #define EC_DISABLE_OPERATION 2
  836. #define EC_FREEZE_COEFFICIENTS 3
  837. #define EC_RESUME_COEFFICIENT_UPDATE 4
  838. #define EC_RESET_COEFFICIENTS 5
  839. #define EC_DISABLE_NON_LINEAR_PROCESSING 0x0001
  840. #define EC_DO_NOT_REQUIRE_REVERSALS 0x0002
  841. #define EC_DETECT_DISABLE_TONE 0x0004
  842. #define EC_SUCCESS 0
  843. #define EC_UNSUPPORTED_OPERATION 1
  844. #define EC_BYPASS_DUE_TO_CONTINUOUS_2100HZ 1
  845. #define EC_BYPASS_DUE_TO_REVERSED_2100HZ 2
  846. #define EC_BYPASS_RELEASED 3
  847. #define DSP_CTRL_SET_LEC_PARAMETERS 0x05
  848. #define LEC_ENABLE_ECHO_CANCELLER 0x0001
  849. #define LEC_ENABLE_2100HZ_DETECTOR 0x0002
  850. #define LEC_REQUIRE_2100HZ_REVERSALS 0x0004
  851. #define LEC_MANUAL_DISABLE 0x0008
  852. #define LEC_ENABLE_NONLINEAR_PROCESSING 0x0010
  853. #define LEC_FREEZE_COEFFICIENTS 0x0020
  854. #define LEC_RESET_COEFFICIENTS 0x8000
  855. #define LEC_MAX_SUPPORTED_TAIL_LENGTH 32
  856. #define LEC_UDATA_INDICATION_DISABLE_DETECT 9
  857. #define LEC_DISABLE_TYPE_CONTIGNUOUS_2100HZ 0x00
  858. #define LEC_DISABLE_TYPE_REVERSED_2100HZ 0x01
  859. #define LEC_DISABLE_RELEASED 0x02
  860. /*------------------------------------------------------------------*/
  861. /* RTP interface to IDI */
  862. /*------------------------------------------------------------------*/
  863. #define B1_RTP 31
  864. #define B2_RTP 31
  865. #define B3_RTP 31
  866. #define PRIVATE_RTP 1
  867. #define RTP_PRIM_PAYLOAD_PCMU_8000 0
  868. #define RTP_PRIM_PAYLOAD_1016_8000 1
  869. #define RTP_PRIM_PAYLOAD_G726_32_8000 2
  870. #define RTP_PRIM_PAYLOAD_GSM_8000 3
  871. #define RTP_PRIM_PAYLOAD_G723_8000 4
  872. #define RTP_PRIM_PAYLOAD_DVI4_8000 5
  873. #define RTP_PRIM_PAYLOAD_DVI4_16000 6
  874. #define RTP_PRIM_PAYLOAD_LPC_8000 7
  875. #define RTP_PRIM_PAYLOAD_PCMA_8000 8
  876. #define RTP_PRIM_PAYLOAD_G722_16000 9
  877. #define RTP_PRIM_PAYLOAD_QCELP_8000 12
  878. #define RTP_PRIM_PAYLOAD_G728_8000 14
  879. #define RTP_PRIM_PAYLOAD_G729_8000 18
  880. #define RTP_PRIM_PAYLOAD_GSM_HR_8000 30
  881. #define RTP_PRIM_PAYLOAD_GSM_EFR_8000 31
  882. #define RTP_ADD_PAYLOAD_BASE 32
  883. #define RTP_ADD_PAYLOAD_RED 32
  884. #define RTP_ADD_PAYLOAD_CN_8000 33
  885. #define RTP_ADD_PAYLOAD_DTMF 34
  886. #define RTP_SUCCESS 0
  887. #define RTP_ERR_SSRC_OR_PAYLOAD_CHANGE 1
  888. #define UDATA_REQUEST_RTP_RECONFIGURE 64
  889. #define UDATA_INDICATION_RTP_CHANGE 65
  890. #define BUDATA_REQUEST_QUERY_RTCP_REPORT 1
  891. #define BUDATA_INDICATION_RTCP_REPORT 1
  892. #define RTP_CONNECT_OPTION_DISC_ON_SSRC_CHANGE 0x00000001L
  893. #define RTP_CONNECT_OPTION_DISC_ON_PT_CHANGE 0x00000002L
  894. #define RTP_CONNECT_OPTION_DISC_ON_UNKNOWN_PT 0x00000004L
  895. #define RTP_CONNECT_OPTION_NO_SILENCE_TRANSMIT 0x00010000L
  896. #define RTP_PAYLOAD_OPTION_VOICE_ACTIVITY_DETECT 0x0001
  897. #define RTP_PAYLOAD_OPTION_DISABLE_POST_FILTER 0x0002
  898. #define RTP_PAYLOAD_OPTION_G723_LOW_CODING_RATE 0x0100
  899. #define RTP_PACKET_FILTER_IGNORE_UNKNOWN_SSRC 0x00000001L
  900. #define RTP_CHANGE_FLAG_SSRC_CHANGE 0x00000001L
  901. #define RTP_CHANGE_FLAG_PAYLOAD_TYPE_CHANGE 0x00000002L
  902. #define RTP_CHANGE_FLAG_UNKNOWN_PAYLOAD_TYPE 0x00000004L
  903. /*------------------------------------------------------------------*/
  904. /* T.38 interface to IDI */
  905. /*------------------------------------------------------------------*/
  906. #define B1_T38 30
  907. #define B2_T38 30
  908. #define B3_T38 30
  909. #define PRIVATE_T38 2
  910. /*------------------------------------------------------------------*/
  911. /* PIAFS interface to IDI */
  912. /*------------------------------------------------------------------*/
  913. #define B1_PIAFS 29
  914. #define B2_PIAFS 29
  915. #define PRIVATE_PIAFS 29
  916. /*
  917. B2 configuration for PIAFS:
  918. +---------------------+------+-----------------------------------------+
  919. | PIAFS Protocol | byte | Bit 1 - Protocol Speed |
  920. | Speed configuration | | 0 - 32K |
  921. | | | 1 - 64K (default) |
  922. | | | Bit 2 - Variable Protocol Speed |
  923. | | | 0 - Speed is fix |
  924. | | | 1 - Speed is variable (default) |
  925. +---------------------+------+-----------------------------------------+
  926. | Direction | word | Enable compression/decompression for |
  927. | | | 0: All direction |
  928. | | | 1: disable outgoing data |
  929. | | | 2: disable incoming data |
  930. | | | 3: disable both direction (default) |
  931. +---------------------+------+-----------------------------------------+
  932. | Number of code | word | Parameter P1 of V.42bis in accordance |
  933. | words | | with V.42bis |
  934. +---------------------+------+-----------------------------------------+
  935. | Maximum String | word | Parameter P2 of V.42bis in accordance |
  936. | Length | | with V.42bis |
  937. +---------------------+------+-----------------------------------------+
  938. | control (UDATA) | byte | enable PIAFS control communication |
  939. | abilities | | |
  940. +---------------------+------+-----------------------------------------+
  941. */
  942. #define PIAFS_UDATA_ABILITIES 0x80
  943. /*------------------------------------------------------------------*/
  944. /* FAX SUB/SEP/PWD extension */
  945. /*------------------------------------------------------------------*/
  946. #define PRIVATE_FAX_SUB_SEP_PWD 3
  947. /*------------------------------------------------------------------*/
  948. /* V.18 extension */
  949. /*------------------------------------------------------------------*/
  950. #define PRIVATE_V18 4
  951. /*------------------------------------------------------------------*/
  952. /* DTMF TONE extension */
  953. /*------------------------------------------------------------------*/
  954. #define DTMF_GET_SUPPORTED_DETECT_CODES 0xf8
  955. #define DTMF_GET_SUPPORTED_SEND_CODES 0xf9
  956. #define DTMF_LISTEN_TONE_START 0xfa
  957. #define DTMF_LISTEN_TONE_STOP 0xfb
  958. #define DTMF_SEND_TONE 0xfc
  959. #define DTMF_LISTEN_MF_START 0xfd
  960. #define DTMF_LISTEN_MF_STOP 0xfe
  961. #define DTMF_SEND_MF 0xff
  962. #define DTMF_MF_DIGIT_TONE_CODE_1 0x10
  963. #define DTMF_MF_DIGIT_TONE_CODE_2 0x11
  964. #define DTMF_MF_DIGIT_TONE_CODE_3 0x12
  965. #define DTMF_MF_DIGIT_TONE_CODE_4 0x13
  966. #define DTMF_MF_DIGIT_TONE_CODE_5 0x14
  967. #define DTMF_MF_DIGIT_TONE_CODE_6 0x15
  968. #define DTMF_MF_DIGIT_TONE_CODE_7 0x16
  969. #define DTMF_MF_DIGIT_TONE_CODE_8 0x17
  970. #define DTMF_MF_DIGIT_TONE_CODE_9 0x18
  971. #define DTMF_MF_DIGIT_TONE_CODE_0 0x19
  972. #define DTMF_MF_DIGIT_TONE_CODE_K1 0x1a
  973. #define DTMF_MF_DIGIT_TONE_CODE_K2 0x1b
  974. #define DTMF_MF_DIGIT_TONE_CODE_KP 0x1c
  975. #define DTMF_MF_DIGIT_TONE_CODE_S1 0x1d
  976. #define DTMF_MF_DIGIT_TONE_CODE_ST 0x1e
  977. #define DTMF_DIGIT_CODE_COUNT 16
  978. #define DTMF_MF_DIGIT_CODE_BASE DSP_DTMF_DIGIT_CODE_COUNT
  979. #define DTMF_MF_DIGIT_CODE_COUNT 15
  980. #define DTMF_TOTAL_DIGIT_CODE_COUNT (DSP_MF_DIGIT_CODE_BASE + DSP_MF_DIGIT_CODE_COUNT)
  981. #define DTMF_TONE_DIGIT_BASE 0x80
  982. #define DTMF_SIGNAL_NO_TONE (DTMF_TONE_DIGIT_BASE + 0)
  983. #define DTMF_SIGNAL_UNIDENTIFIED_TONE (DTMF_TONE_DIGIT_BASE + 1)
  984. #define DTMF_SIGNAL_DIAL_TONE (DTMF_TONE_DIGIT_BASE + 2)
  985. #define DTMF_SIGNAL_PABX_INTERNAL_DIAL_TONE (DTMF_TONE_DIGIT_BASE + 3)
  986. #define DTMF_SIGNAL_SPECIAL_DIAL_TONE (DTMF_TONE_DIGIT_BASE + 4) /* stutter dial tone */
  987. #define DTMF_SIGNAL_SECOND_DIAL_TONE (DTMF_TONE_DIGIT_BASE + 5)
  988. #define DTMF_SIGNAL_RINGING_TONE (DTMF_TONE_DIGIT_BASE + 6)
  989. #define DTMF_SIGNAL_SPECIAL_RINGING_TONE (DTMF_TONE_DIGIT_BASE + 7)
  990. #define DTMF_SIGNAL_BUSY_TONE (DTMF_TONE_DIGIT_BASE + 8)
  991. #define DTMF_SIGNAL_CONGESTION_TONE (DTMF_TONE_DIGIT_BASE + 9) /* reorder tone */
  992. #define DTMF_SIGNAL_SPECIAL_INFORMATION_TONE (DTMF_TONE_DIGIT_BASE + 10)
  993. #define DTMF_SIGNAL_COMFORT_TONE (DTMF_TONE_DIGIT_BASE + 11)
  994. #define DTMF_SIGNAL_HOLD_TONE (DTMF_TONE_DIGIT_BASE + 12)
  995. #define DTMF_SIGNAL_RECORD_TONE (DTMF_TONE_DIGIT_BASE + 13)
  996. #define DTMF_SIGNAL_CALLER_WAITING_TONE (DTMF_TONE_DIGIT_BASE + 14)
  997. #define DTMF_SIGNAL_CALL_WAITING_TONE (DTMF_TONE_DIGIT_BASE + 15)
  998. #define DTMF_SIGNAL_PAY_TONE (DTMF_TONE_DIGIT_BASE + 16)
  999. #define DTMF_SIGNAL_POSITIVE_INDICATION_TONE (DTMF_TONE_DIGIT_BASE + 17)
  1000. #define DTMF_SIGNAL_NEGATIVE_INDICATION_TONE (DTMF_TONE_DIGIT_BASE + 18)
  1001. #define DTMF_SIGNAL_WARNING_TONE (DTMF_TONE_DIGIT_BASE + 19)
  1002. #define DTMF_SIGNAL_INTRUSION_TONE (DTMF_TONE_DIGIT_BASE + 20)
  1003. #define DTMF_SIGNAL_CALLING_CARD_SERVICE_TONE (DTMF_TONE_DIGIT_BASE + 21)
  1004. #define DTMF_SIGNAL_PAYPHONE_RECOGNITION_TONE (DTMF_TONE_DIGIT_BASE + 22)
  1005. #define DTMF_SIGNAL_CPE_ALERTING_SIGNAL (DTMF_TONE_DIGIT_BASE + 23)
  1006. #define DTMF_SIGNAL_OFF_HOOK_WARNING_TONE (DTMF_TONE_DIGIT_BASE + 24)
  1007. #define DTMF_SIGNAL_INTERCEPT_TONE (DTMF_TONE_DIGIT_BASE + 63)
  1008. #define DTMF_SIGNAL_MODEM_CALLING_TONE (DTMF_TONE_DIGIT_BASE + 64)
  1009. #define DTMF_SIGNAL_FAX_CALLING_TONE (DTMF_TONE_DIGIT_BASE + 65)
  1010. #define DTMF_SIGNAL_ANSWER_TONE (DTMF_TONE_DIGIT_BASE + 66)
  1011. #define DTMF_SIGNAL_REVERSED_ANSWER_TONE (DTMF_TONE_DIGIT_BASE + 67)
  1012. #define DTMF_SIGNAL_ANSAM_TONE (DTMF_TONE_DIGIT_BASE + 68)
  1013. #define DTMF_SIGNAL_REVERSED_ANSAM_TONE (DTMF_TONE_DIGIT_BASE + 69)
  1014. #define DTMF_SIGNAL_BELL103_ANSWER_TONE (DTMF_TONE_DIGIT_BASE + 70)
  1015. #define DTMF_SIGNAL_FAX_FLAGS (DTMF_TONE_DIGIT_BASE + 71)
  1016. #define DTMF_SIGNAL_G2_FAX_GROUP_ID (DTMF_TONE_DIGIT_BASE + 72)
  1017. #define DTMF_SIGNAL_HUMAN_SPEECH (DTMF_TONE_DIGIT_BASE + 73)
  1018. #define DTMF_SIGNAL_ANSWERING_MACHINE_390 (DTMF_TONE_DIGIT_BASE + 74)
  1019. #define DTMF_MF_LISTEN_ACTIVE_FLAG 0x02
  1020. #define DTMF_SEND_MF_FLAG 0x02
  1021. #define DTMF_TONE_LISTEN_ACTIVE_FLAG 0x04
  1022. #define DTMF_SEND_TONE_FLAG 0x04
  1023. #define PRIVATE_DTMF_TONE 5
  1024. /*------------------------------------------------------------------*/
  1025. /* FAX paper format extension */
  1026. /*------------------------------------------------------------------*/
  1027. #define PRIVATE_FAX_PAPER_FORMATS 6
  1028. /*------------------------------------------------------------------*/
  1029. /* V.OWN extension */
  1030. /*------------------------------------------------------------------*/
  1031. #define PRIVATE_VOWN 7
  1032. /*------------------------------------------------------------------*/
  1033. /* FAX non-standard facilities extension */
  1034. /*------------------------------------------------------------------*/
  1035. #define PRIVATE_FAX_NONSTANDARD 8
  1036. /*------------------------------------------------------------------*/
  1037. /* Advanced voice */
  1038. /*------------------------------------------------------------------*/
  1039. #define ADV_VOICE_WRITE_ACTIVATION 0
  1040. #define ADV_VOICE_WRITE_DEACTIVATION 1
  1041. #define ADV_VOICE_WRITE_UPDATE 2
  1042. #define ADV_VOICE_OLD_COEF_COUNT 6
  1043. #define ADV_VOICE_NEW_COEF_BASE (ADV_VOICE_OLD_COEF_COUNT * sizeof(word))
  1044. /*------------------------------------------------------------------*/
  1045. /* B1 resource switching */
  1046. /*------------------------------------------------------------------*/
  1047. #define B1_FACILITY_LOCAL 0x01
  1048. #define B1_FACILITY_MIXER 0x02
  1049. #define B1_FACILITY_DTMFX 0x04
  1050. #define B1_FACILITY_DTMFR 0x08
  1051. #define B1_FACILITY_VOICE 0x10
  1052. #define B1_FACILITY_EC 0x20
  1053. #define ADJUST_B_MODE_SAVE 0x0001
  1054. #define ADJUST_B_MODE_REMOVE_L23 0x0002
  1055. #define ADJUST_B_MODE_SWITCH_L1 0x0004
  1056. #define ADJUST_B_MODE_NO_RESOURCE 0x0008
  1057. #define ADJUST_B_MODE_ASSIGN_L23 0x0010
  1058. #define ADJUST_B_MODE_USER_CONNECT 0x0020
  1059. #define ADJUST_B_MODE_CONNECT 0x0040
  1060. #define ADJUST_B_MODE_RESTORE 0x0080
  1061. #define ADJUST_B_START 0
  1062. #define ADJUST_B_SAVE_MIXER_1 1
  1063. #define ADJUST_B_SAVE_DTMF_1 2
  1064. #define ADJUST_B_REMOVE_L23_1 3
  1065. #define ADJUST_B_REMOVE_L23_2 4
  1066. #define ADJUST_B_SAVE_EC_1 5
  1067. #define ADJUST_B_SAVE_DTMF_PARAMETER_1 6
  1068. #define ADJUST_B_SAVE_VOICE_1 7
  1069. #define ADJUST_B_SWITCH_L1_1 8
  1070. #define ADJUST_B_SWITCH_L1_2 9
  1071. #define ADJUST_B_RESTORE_VOICE_1 10
  1072. #define ADJUST_B_RESTORE_VOICE_2 11
  1073. #define ADJUST_B_RESTORE_DTMF_PARAMETER_1 12
  1074. #define ADJUST_B_RESTORE_DTMF_PARAMETER_2 13
  1075. #define ADJUST_B_RESTORE_EC_1 14
  1076. #define ADJUST_B_RESTORE_EC_2 15
  1077. #define ADJUST_B_ASSIGN_L23_1 16
  1078. #define ADJUST_B_ASSIGN_L23_2 17
  1079. #define ADJUST_B_CONNECT_1 18
  1080. #define ADJUST_B_CONNECT_2 19
  1081. #define ADJUST_B_CONNECT_3 20
  1082. #define ADJUST_B_CONNECT_4 21
  1083. #define ADJUST_B_RESTORE_DTMF_1 22
  1084. #define ADJUST_B_RESTORE_DTMF_2 23
  1085. #define ADJUST_B_RESTORE_MIXER_1 24
  1086. #define ADJUST_B_RESTORE_MIXER_2 25
  1087. #define ADJUST_B_RESTORE_MIXER_3 26
  1088. #define ADJUST_B_RESTORE_MIXER_4 27
  1089. #define ADJUST_B_RESTORE_MIXER_5 28
  1090. #define ADJUST_B_RESTORE_MIXER_6 29
  1091. #define ADJUST_B_RESTORE_MIXER_7 30
  1092. #define ADJUST_B_END 31
  1093. /*------------------------------------------------------------------*/
  1094. /* XON Protocol def's */
  1095. /*------------------------------------------------------------------*/
  1096. #define N_CH_XOFF 0x01
  1097. #define N_XON_SENT 0x02
  1098. #define N_XON_REQ 0x04
  1099. #define N_XON_CONNECT_IND 0x08
  1100. #define N_RX_FLOW_CONTROL_MASK 0x3f
  1101. #define N_OK_FC_PENDING 0x80
  1102. #define N_TX_FLOW_CONTROL_MASK 0xc0
  1103. /*------------------------------------------------------------------*/
  1104. /* NCPI state */
  1105. /*------------------------------------------------------------------*/
  1106. #define NCPI_VALID_CONNECT_B3_IND 0x01
  1107. #define NCPI_VALID_CONNECT_B3_ACT 0x02
  1108. #define NCPI_VALID_DISC_B3_IND 0x04
  1109. #define NCPI_CONNECT_B3_ACT_SENT 0x08
  1110. #define NCPI_NEGOTIATE_B3_SENT 0x10
  1111. #define NCPI_MDM_CTS_ON_RECEIVED 0x40
  1112. #define NCPI_MDM_DCD_ON_RECEIVED 0x80
  1113. /*------------------------------------------------------------------*/