中间件标准版5.1git,去除基础模块

aglib.h 39KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  1. /*********************************************************************/
  2. /* EhangCom: API Head file
  3. *
  4. * FILE: aglib.h
  5. * DESCRIPTION: Header File for EhangCom analog library
  6. *
  7. * Copyright (c) 2004-2043 EhangCom Corp. All Rights Reserved
  8. *
  9. * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF EhangCom Corp.
  10. * The copyright notice above does not evidence any actual or
  11. * intended publication of such source code.
  12. */
  13. /*********************************************************************/
  14. #ifndef __AGLIB_H__
  15. #define __AGLIB_H__
  16. #include "IsxApi.h"
  17. #include "voclib.h"
  18. #define MAX_RING_GAP 7*1000 //Ring the maximum interval, if the interval exceeds this value, then re-calculate the number of rings
  19. #define MAX_RNGOFF_LEN 5*1000 //The default maximum length RINGOFF, unit: ms
  20. #ifndef AG_BRDTYPE_FXO
  21. #define AG_BRDTYPE_NULL -2 //The type of this daughter board is unknown now. Please re-query later.
  22. #define AG_BRDTYPE_FXO 0 //FXO daughter board. All channels of this daughter board are FXO ports.
  23. #define AG_BRDTYPE_FXS 1 //FXS daughter board. All channels of this daughter board are FXS ports.
  24. #define AG_BRDTYPE_AHR 2 //High impedance record board.
  25. #endif
  26. #define AG_ONHOOK 0 //On-hook
  27. #define AG_OFFHOOK 1 //Off-hook
  28. #define AG_CALLP 1 /* Turn on Call Analysis */
  29. #define MOEV_DIAL 0x100 /* Dial Completed */
  30. #define MOEV_CALLP 0x101 /* Call Progress Completed */
  31. #define MOEV_SETHOOK 0x103 /* SetHook Completed */
  32. #define AGEV_ERROR 0x104 /* Error Event */
  33. #define MSEV_RING 0x14D /* MSI Ring successful event */
  34. #define MSEV_NORING 0x14e /* MSI ring unsuccessful event */
  35. #define MSEV_SIGEVT 0x14f /* Signalling event generated */
  36. #define MOEV_WTRING 0x150 /* wait ring completed */
  37. #define MOEV_RINGS 0x151 /* FXO Rings received event */
  38. #define MOEV_RNGOFF 0x152 /* caller hang up event (incoming call is dropped before being accepted) */
  39. #define AGEV_DIGITS 0x153 /* Digit Received event */
  40. #define AGEV_SENDTONE 0x154 /* send tone complete */
  41. #define MOEV_RONHOOK 0x155 /* remote on hook */
  42. #define MOEV_RNGON 0x156 /* Incoming call */
  43. #define MSEV_RINGS 0x157 /* FXS Rings received event */
  44. #define MOEV_CALLERID 0x158 /* FXO CallerId event*/
  45. #define MHEV_SETHOOK 0x180 /* High impedance record board SetHook Completed*/
  46. #define AGEV_LAST 0x1ff
  47. #define MSEV_SIGMSK 0x140 /* Equate to be used in setevtmsk */
  48. /*
  49. * Message mask and event equates
  50. */
  51. #define MSMM_OFFHOOK 0x0001 /* Mask for channel went off hook */
  52. #define MSMM_RNGOFFHK 0x0002 /* Solicited off hook */
  53. #define MSMM_RNGSTOP 0x0004 /* User stopped ringing by stopfn() cmd */
  54. #define MSMM_ONHOOK 0x0008 /* Mask for channel went on hook */
  55. #define MSMM_HOOKFLASH 0x0010 /* Mask for hook flash detection */
  56. #define MSMM_TERM 0x00020 /* Mask for ring termination */
  57. //#define MSMM_FIRSTRING 0x0040 /* Mask for first ring off
  58. #define MOMM_RINGS 0x0080 /* Mask for fxo rings */
  59. #define MOMM_RNGOFF 0x0100 /* Mask for fxo caller hang up event */
  60. #define AGMM_DIGITS 0x0200 /* Mask for fxs/fxo digits */
  61. #define MSMM_RINGS 0x0400 /* Mask for fxs rings */
  62. #define MOMM_CALLERID 0x0800 /* Mask for fxo caller id event */
  63. #define MTF_RING 0x8a /* Stop Ringing */
  64. /*
  65. * Call Analysis termination type.
  66. */
  67. #define CR_SS_TELNUM 0 /* Send tele number succ. (weil) */
  68. #define CR_BUSY 7 /* Line busy */
  69. #define CR_NOANS 8 /* No answer */
  70. #define CR_NORB 9 /* No ringback */
  71. #define CR_CNCT 10 /* Call connected */
  72. #define CR_CEPT 11 /* Operator intercept */
  73. #define CR_STOPD 12 /* Call analysis stopped */
  74. #define CR_NODIALTONE 17 /* No dialtone detected */
  75. #define CR_FAXTONE 18 /* Fax tone detected */
  76. #define CR_SF_TELNUM 19 /* Send tele number fail. (weil) */
  77. #define CR_ERROR 0x100 /* Call analysis error */
  78. /*
  79. * Tone ID types
  80. */
  81. #define TONEID_FIRST 0
  82. #define TONEID_BUSY 0
  83. #define TONEID_DIAL 1
  84. #define TONEID_RINGBACK 2
  85. #define TONEID_HOWLER 3
  86. #define TONEID_BUSY1 4
  87. #define TONEID_RINGBACK2 5
  88. #define TONEID_FAX1 6
  89. #define TONEID_FAX2 7
  90. #define TONEID_HUMAN1 8
  91. #define TONEID_HUMAN2 9
  92. //...reserve
  93. #define TONEID_SYSEND 31
  94. #define TONEID_USER 32
  95. //User define TONE to do... 32~254
  96. #define TONEID_LAST 254
  97. #define TONEALL 0xff
  98. /*
  99. * GTD Defines
  100. */
  101. #ifndef DM_TONEON
  102. #define DM_TONEON 0x01 /* Tone ON Mask */
  103. #define DM_TONEOFF 0x02 /* Tone OFF Mask */
  104. #endif
  105. /*
  106. * Action values for ag_SetEvtMsk() function
  107. */
  108. #define AGACT_SETMSK 0 /* set all mask bits & clear all others */
  109. #define AGACT_ADDMSK 1 /* set all mask bits & ignore all others */
  110. #define AGACT_SUBMSK 2 /* clr all mask bits & ignore all others */
  111. /*
  112. * Equates for generic caller ID message type IDs
  113. */
  114. #define CLIDINFO_CMPLT 0x100 /* complete caller ID message */
  115. #define CLIDINFO_GENERAL 0x101 /* date,time,phone #,name */
  116. #define CLIDINFO_CALLID 0x102 /* caller ID */
  117. #define CLIDINFO_FRAMETYPE 0x103 /* see frame type equates */
  118. /*
  119. * Equates for CLASS
  120. */
  121. #define CLASSFRAME_SDM 0x04 /* Single Data Message caller ID frame */
  122. #define CLASSFRAME_MDM 0x80 /* Multiple Data Message caller ID frame */
  123. /* CLASS MDM message IDs */
  124. #define MCLASS_DATETIME 0x01 /* date and time w/o '/" & ':' */
  125. #define MCLASS_DN 0x02 /* calling line directory number */
  126. #define MCLASS_DDN 0x03 /* dialed number */
  127. #define MCLASS_ABSENCE1 0x04 /* caller ID absence: 'O' or 'P' */
  128. #define MCLASS_REDIRECT 0x05 /* call frwd-universal,busy,or unanswered */
  129. #define MCLASS_QUALIFIER 0x06 /* 'L' for long distance */
  130. #define MCLASS_NAME 0x07 /* caller name */
  131. #define MCLASS_ABSENCE2 0x08 /* name absence- 'O' or 'P' */
  132. /*
  133. * Equates for CLIP
  134. */
  135. #define CLIPFRAME_MDM 0x80 /* Multiple Data Message caller ID frame */
  136. /* CLIP message IDs */
  137. #define CLIP_DATETIME 0x01 /* date and time (w/o '/" & ':') */
  138. #define CLIP_DN 0x02 /* calling line directory number */
  139. #define CLIP_DDN 0x03 /* dialed number */
  140. #define CLIP_ABSENCE1 0x04 /* caller ID absence: 'O' or 'P' */
  141. #define CLIP_NAME 0x07 /* caller name */
  142. #define CLIP_ABSENCE2 0x08 /* name absence- 'O' or 'P' */
  143. #define CLIP_CALLTYPE 0x11 /* voice call,rng-bck-when-free call or msg waiting call */
  144. #define CLIP_NETMSG 0x13 /* no. of message waiting */
  145. /*
  146. * Equates for A-CLIP
  147. */
  148. #define ACLIPFRAME_SDM 0x04 /* Single Data Message caller ID frame */
  149. #define ACLIPFRAME_MDM 0x80 /* Multiple Data Message caller ID frame */
  150. /* A-CLIP MDM message IDs */
  151. #define MACLIP_DATETIME 0x01 /* date and time (w/o '/" & ':' */
  152. #define MACLIP_DN 0x02 /* calling line directory number */
  153. #define MACLIP_DDN 0x03 /* dialed number */
  154. #define MACLIP_ABSENCE1 0x04 /* caller ID absence: 'O' or 'P' */
  155. #define MACLIP_REDIRECT 0x05 /* call frwd-universal,busy,or unanswered */
  156. #define MACLIP_QUALIFIER 0x06 /* 'L' for long distance */
  157. #define MACLIP_NAME 0x07 /* caller name */
  158. #define MACLIP_ABSENCE2 0x08 /* name absence- 'O' or 'P' */
  159. /*
  160. * Equates for Japan Caller ID JCLIP
  161. */
  162. #define JCLIPFRAME_MDM 0x40 /* Multiple Data Message caller ID frame */
  163. #define JCLIP_DN 0x02 /* calling line directory number */
  164. #define JCLIP_DDN 0x09 /* dialed number */
  165. #define JCLIP_ABSENCE1 0x04 /* caller ID absence: 'O' or 'P' */
  166. #define JCLIP_ABSENCE2 0x08 /* name absence- 'O' or 'P' */
  167. /*
  168. * AG_CAP
  169. *
  170. * Call Analysis parameters
  171. * [NOTE: All user-accessible structures must be defined so as to be
  172. * unaffected by structure packing.]
  173. */
  174. typedef struct ag_cap {
  175. USHORT ca_nbrdna; /* # of rings before no answer. */
  176. USHORT ca_stdely; /* Delay after dialing before analysis. */
  177. USHORT ca_cnosig; /* Duration of no signal time out delay. */
  178. SHORT ca_lcdly; /* Delay after dial before lc drop connect */
  179. USHORT ca_lcdly1; /* Delay after lc drop con. before msg. */
  180. USHORT ca_hedge; /* Edge of answer to send connect message. */
  181. USHORT ca_cnosil; /* Initial continuous noise timeout delay. */
  182. USHORT ca_lo1tola; /* % acceptable pos. dev of SHORT low sig. */
  183. USHORT ca_lo1tolb; /* % acceptable neg. dev of SHORT low sig. */
  184. USHORT ca_lo2tola; /* % acceptable pos. dev of long low sig. */
  185. USHORT ca_lo2tolb; /* % acceptable neg. dev of long low sig. */
  186. USHORT ca_hi1tola; /* % acceptable pos. dev of high signal. */
  187. USHORT ca_hi1tolb; /* % acceptable neg. dev of high signal. */
  188. USHORT ca_lo1bmax; /* Maximum interval for shrt low for busy. */
  189. USHORT ca_lo2bmax; /* Maximum interval for long low for busy. */
  190. USHORT ca_hi1bmax; /* Maximum interval for 1st high for busy */
  191. USHORT ca_nsbusy; /* Num. of highs after nbrdna busy check. */
  192. USHORT ca_logltch; /* Silence deglitch duration. */
  193. USHORT ca_higltch; /* Non-silence deglitch duration. */
  194. USHORT ca_lo1rmax; /* Max. SHORT low dur. of double ring. */
  195. USHORT ca_lo2rmin; /* Min. long low dur. of double ring. */
  196. USHORT ca_intflg; /* Operator intercept mode. */
  197. USHORT ca_intfltr; /* Minimum signal to qualify freq. detect. */
  198. USHORT ca_1strngbak; /* No response in before, waiting for the first ringback tone maximum delay time (unit: 10ms), the default is 30 seconds */
  199. USHORT rfu2; /* reserved for future use */
  200. USHORT rfu3; /* reserved for future use */
  201. USHORT rfu4; /* reserved for future use */
  202. USHORT ca_hisiz; /* Used to determine which lowmax to use. */
  203. USHORT ca_alowmax; /* Max. low before con. if high >hisize. */
  204. USHORT ca_blowmax; /* Max. low before con. if high <hisize. */
  205. USHORT ca_nbrbeg; /* Number of rings before analysis begins. */
  206. USHORT ca_hi1ceil; /* Maximum 2nd high dur. for a retrain. */
  207. USHORT ca_lo1ceil; /* Maximum 1st low dur. for a retrain. */
  208. USHORT ca_lowerfrq; /* Lower allowable frequency in hz. */
  209. USHORT ca_upperfrq; /* Upper allowable frequency in hz. */
  210. USHORT ca_timefrq; /* Total duration of good signal required. */
  211. USHORT ca_rejctfrq; /* Allowable % of bad signal. */
  212. USHORT ca_cnct_t; /* After the ringback tone, FXO port is used to determine the maximum time CR_CNCT is switched on (default 50), unit: 10ms*/
  213. //USHORT ca_maxansr; /* Maximum duration of answer. ==ca_cnct_t*/
  214. USHORT ca_ansrdgl; /* Silence deglitching value for answer. */
  215. USHORT ca_mxtimefrq; /* max time for 1st freq to remain in bounds */
  216. USHORT ca_lower2frq; /* lower bound for second frequency */
  217. USHORT ca_upper2frq; /* upper bound for second frequency */
  218. USHORT ca_time2frq; /* min time for 2nd freq to remains in bounds */
  219. USHORT ca_mxtime2frq; /* max time for 2nd freq to remain in bounds */
  220. USHORT ca_lower3frq; /* lower bound for third frequency */
  221. USHORT ca_upper3frq; /* upper bound for third frequency */
  222. USHORT ca_time3frq; /* min time for 3rd freq to remains in bounds */
  223. USHORT ca_mxtime3frq; /* max time for 3rd freq to remain in bounds */
  224. USHORT ca_dtn_pres; /* Length of a valid dial tone (def=1sec) */
  225. USHORT ca_dtn_npres; /* Max time to wait for dial tone (def=5sec)*/ //v
  226. USHORT ca_dtn_deboff; /* The dialtone off debouncer (def=100ms) */
  227. USHORT ca_pamd_failtime; /* Wait for AMD/PVD after cadence break(default=4sec)*/
  228. USHORT ca_pamd_minring; /* min allowable ring duration (def=1.9sec)*/
  229. UCHAR ca_pamd_spdval; /* Set to 2 selects quick decision (def=1) */
  230. UCHAR ca_pamd_qtemp; /* The Qualification template to use for PAMD */
  231. USHORT ca_noanswer; /* time before no answer after first ring (default=30sec) */
  232. USHORT ca_maxintering; /* Max inter ring delay before connect (8 sec) */
  233. } AG_CAP;
  234. #ifdef __cplusplus
  235. extern "C" { // C Plus Plus function bindings
  236. #define extern
  237. #endif
  238. /*
  239. * Useful declaration specification.
  240. */
  241. /*
  242. * Module Definition file compatibility.
  243. */
  244. #if (defined (__BORLANDC__) || defined (__cplusplus) || defined( __STDC__ ))
  245. /* Function Prototypes - ANSI C & C++ */
  246. /************************************************************************/
  247. /* Function: ISX_ag_open()
  248. Description:
  249. The ISX_ag_open() function opens an analog line channel device. If the opening is successful,
  250. a device handle is returned. The analog line channel device can only be opened by one process.
  251. That is, if process A has opened an analog line channel device successfully and process B tries
  252. to open the same device, failure is returned, unless process A has closed the analog line channel device.
  253. The device handle returned by the function is defined by EhangCom itself, and it's not a standard
  254. operating system file handle. Therefore, using operating system commands such as read(), write()
  255. or ioctl() to operate the handle may cause unpredictable results.
  256. Return value:
  257. >0 returns the device handle
  258. -1 failure
  259. Parameter:
  260. -nodeno
  261. Node number
  262. -brdno
  263. Analog line daughter board number
  264. -channel
  265. Analog line channel number
  266. -iDspChH
  267. DSP voice channel device handle bound to this analog line channel. In case of no binding, it is set to -1.
  268. -usrattr
  269. Pointer to buffer where a user defined attribute is stored
  270. */
  271. /************************************************************************/
  272. #ifndef EHANG_ISXAPI_STD_C
  273. ISXAPI_FUNC_STDCL(INT) ISX_ag_open(CHAR nodenum, CHAR brdnum, CHAR channel, INT iDspChH=-1, VOID* pusrattr=NULL);
  274. #else
  275. ISXAPI_FUNC_STDCL(INT) ISX_ag_open(CHAR nodenum, CHAR brdnum, CHAR channel, INT iDspChH, VOID* pusrattr);
  276. #endif
  277. /************************************************************************/
  278. /* Function: ISX_ag_close()
  279. Description:
  280. The function closes an analog line channel device handle (that is returned after the device is
  281. opened by ISX_ag_open()). The function does not change any state of the device (such as switching
  282. state). It only releases the device handle and breaks the link between the calling process and the
  283. device.
  284. Note: After ISX_ipm_Close( ) runs successfully, it disables all events related to the device.
  285. Return value:
  286. 0 success
  287. -1 failure
  288. Parameter:
  289. -dev
  290. Specifies a valid device handle returned by ISX_ag_open()
  291. -oflags
  292. Reserved for future use. Currently, it is useless.
  293. */
  294. /************************************************************************/
  295. #ifndef EHANG_ISXAPI_STD_C
  296. ISXAPI_FUNC_STDCL(INT) ISX_ag_close(INT dev, INT oflags = 0);
  297. #else
  298. ISXAPI_FUNC_STDCL(INT) ISX_ag_close(INT dev, INT oflags);
  299. #endif
  300. /************************************************************************/
  301. /* Function: ISX_ag_getbrdtype()
  302. Description:
  303. The ISX_ag_getbrdtype( ) function queries the board type of a specified analog daughter board.
  304. Return value:
  305. -1: The function calling fails. Please check the parameters.
  306. AG_BRDTYPE_FXO: FXO daughter board. All channels of this daughter board are FXO ports.
  307. AG_BRDTYPE_FXS: FXS daughter board. All channels of this daughter board are FXS ports.
  308. AG_BRDTYPE_NULL: The type of this daughter board is unknown now. Please re-query later.
  309. Parameter:
  310. -ucIsxNo
  311. Node number
  312. -ucBrdNo
  313. Analog daughter board number
  314. */
  315. /************************************************************************/
  316. ISXAPI_FUNC_STDCL(INT) ISX_ag_getbrdtype(UCHAR ucIsxNo, UCHAR ucBrdNo);
  317. /************************************************************************/
  318. /* Function: ISX_ag_GetUsrAttr()
  319. Description:
  320. The ISX_ag_GetUsrAttr( ) function obtains the user-defined attributes (that are set through
  321. ISX_ag_open() and ISX_ag_SetUsrAttr()).
  322. Return value:
  323. 0 success
  324. <0 failure
  325. Parameter:
  326. -dev
  327. Valid analog line channel handle
  328. -usr_attrp
  329. Pointer to the address where the user attributes are obtained
  330. */
  331. /************************************************************************/
  332. ISXAPI_FUNC_STDCL(INT) ISX_ag_GetUsrAttr(INT dev, VOID **usr_attrp);
  333. /************************************************************************/
  334. /* Function: ISX_ag_SetUsrAttr()
  335. Description:
  336. The ISX_ag_SetUsrAttr( ) function sets channel attributes (user-defined). User attributes that
  337. are set by the user can be obtained through the ISX_ag_GetUsrAttr() function.
  338. Return value:
  339. 0 success
  340. <0 failure
  341. Parameter:
  342. -dev
  343. Valid analog line channel handle
  344. -usrattr
  345. User defined attributes that the application can obtain through the ISX_ag_GetUsrAttr() function.
  346. */
  347. /************************************************************************/
  348. ISXAPI_FUNC_STDCL(INT) ISX_ag_SetUsrAttr(INT dev, VOID *usr_attr);
  349. /************************************************************************/
  350. /* Function: ISX_ag_getxmitslot()
  351. Description:
  352. The ISX_ag_getxmitslot( ) function returns the time slot of the transmitting terminal of a specified
  353. analog line channel. Time slot information is stored in the SC_TSINFO structure.
  354. Return value:
  355. 0 success
  356. -1 failure
  357. Parameter:
  358. -dev
  359. Valid analog line channel device handle
  360. -sc_tsinfop
  361. Pointer to the SC_TSINFO structure to obtain time slot information
  362. */
  363. /************************************************************************/
  364. ISXAPI_FUNC_STDCL(INT) ISX_ag_getxmitslot(INT dev, SC_TSINFO *sc_tsinfop);
  365. /************************************************************************/
  366. /* Function: ISX_ag_listen()
  367. Description:
  368. The function establishes switching between the receiving terminal of the analog line
  369. channel device (receiving time slot) and a time slot (transmitting terminal of another
  370. device) so that this analog line channel can receive the data from this time slot and
  371. this function sets up a half-switching of the channel. Both switching devices must be
  372. located in the same node. Cross-node device switching must use the optical interface
  373. trunk channel. For details, refer to relevant documents.
  374. Return value:
  375. 0 success
  376. -1 failure
  377. Parameter:
  378. -dev
  379. Analog line channel device handle returned by the ISX_ag_open( ) function
  380. -sc_tsinfop
  381. Specifies a pointer to the SC_TSINFO structure
  382. */
  383. /************************************************************************/
  384. ISXAPI_FUNC_STDCL(INT) ISX_ag_listen(INT dev, SC_TSINFO *sc_tsinfop );
  385. /************************************************************************/
  386. /* Function: ISX_ag_unlisten()
  387. Description:
  388. This function interrupts the switching between the receiving terminal of the analog
  389. line channel device and the connected transmitting time slot.
  390. Return value:
  391. 0 success
  392. -1 failure
  393. Parameter:
  394. -dev
  395. Analog line channel device handle returned by the ISX_ag_open( ) function
  396. */
  397. /************************************************************************/
  398. ISXAPI_FUNC_STDCL(INT) ISX_ag_unlisten(INT dev );
  399. /************************************************************************/
  400. /* Function: ISX_ago_sethook()
  401. Description:
  402. This function performs off-hook or on-hook operation on a specified analog line channel.
  403. This function only applies to an FXO port line.
  404. Return value:
  405. 0 success
  406. -1 failure
  407. Parameter:
  408. -dev
  409. Analog line channel device handle ISX_ag_open( )
  410. -HookState
  411. Flag for off-hook and on-hook: It includes the following:
  412. AG_OFFHOOK: Off-hook
  413. AG_ONHOOK: On-hook
  414. -mode
  415. Synchronous/asynchronous mode:
  416. EV_SYNC: Synchronous
  417. EV_ASYNC: Asynchronous
  418. -ulOperIndex
  419. Operation number. In the asynchronous operation mode, the number can be obtained through the
  420. ISX_sr_getevtoperindex() function when MOEV_SETHOOK or AGEV_ERROR is generated upon the completion
  421. of the operation.
  422. */
  423. /************************************************************************/
  424. #ifndef EHANG_ISXAPI_STD_C
  425. ISXAPI_FUNC_STDCL(INT) ISX_ago_sethook(INT dev, INT HookState, USHORT mode=EV_ASYNC, UINT ulOperIndex=0);
  426. #else
  427. ISXAPI_FUNC_STDCL(INT) ISX_ago_sethook(INT dev, INT HookState, USHORT mode, UINT ulOperIndex);
  428. #endif
  429. /************************************************************************/
  430. /* Function: ISX_ago_dial()
  431. Description:
  432. The ISX_ago_dial( ) function activates a call on a specified analog line. This function only
  433. applies to an FXO port analog line.
  434. Return value:
  435. Asynchronous mode: 0 success, -1 failure
  436. Synchronous mode:
  437. -1: failure
  438. CR_SF_TELNUM: Sent number
  439. Parameter:
  440. -dev
  441. Analog line channel device handle returned by ISX_ag_open( )
  442. -dialstrp
  443. Dialing number that is a string ending in 0. The numbers are characters '0'-'9', 'a', 'b',
  444. 'c', 'd', '*', '#' and ','. Where, ',' is a space character that indicates an interval
  445. of 2.5s. The maximum number length shall not exceed MAX_AGTELNUM_LEN.
  446. -capp
  447. The call progress analysis parameter AG_CAP structure. Refer to the description of the structure.
  448. If it is NULL, the system default parameters are used.
  449. -iPrdDev
  450. PRD device handle. Currently, an analog daughter board is unable to generate DTMF and the dialing
  451. required by this function is achieved by a DSP voice channel playing a DTMF voice file. Therefore,
  452. the device handle of the PRD where the DTMF file is located must be set.
  453. -mode
  454. Call mode. Synchronous/asynchronous mode:
  455. AG_CALLP: Enables call progress analysis. Audio testing of signals such as dialing tones and busy
  456. tones can be performed only in this mode.
  457. EV_SYNC: Synchronous
  458. EV_ASYNC: Asynchronous
  459. -ulOperIndex
  460. Operation number. In the asynchronous operation mode, the number can be obtained through the
  461. ISX_sr_getevtoperindex() function when MOEV_CALLP or MOEV_DIAL is generated upon the completion
  462. of the operation.
  463. */
  464. /************************************************************************/
  465. #ifndef EHANG_ISXAPI_STD_C
  466. ISXAPI_FUNC_STDCL(INT) ISX_ago_dial(INT dev, const CHAR *dialstrp, const AG_CAP *capp, INT iPrdDev=-1, USHORT mode=EV_ASYNC, UINT ulOperIndex=0);
  467. #else
  468. ISXAPI_FUNC_STDCL(INT) ISX_ago_dial(INT dev, const CHAR *dialstrp, const AG_CAP *capp, INT iPrdDev, USHORT mode, UINT ulOperIndex);
  469. #endif
  470. /************************************************************************/
  471. /* Function: ISX_ago_wtring()
  472. Description:
  473. The function waits for a specified number of rings. If a specified number of rings
  474. is detected, the state is off-hook or on-hook state (that is decided by the HookState
  475. parameter). This function only applies to the FXO port analog line.
  476. Return value:
  477. 0 success
  478. -1 failure
  479. Parameter:
  480. -dev
  481. Analog line channel device handle returned by ISX_ag_open( )
  482. -numRings
  483. Waits for a specified number of rings
  484. -HookState
  485. Flag for off-hook and on-hook. If it is AG_OFFHOOK, off-hook is automatically performed after
  486. numRings is received. If it is AG_ONHOOK, off-hook is not performed and the on-hook state is
  487. kept after numRings is received.
  488. -timeout
  489. Timeout duration in ms. If it is -1, it indicates infinite waiting. It takes effect only in the
  490. synchronous mode.
  491. -mode
  492. Synchronous/asynchronous mode:
  493. EV_SYNC: Synchronous
  494. EV_ASYNC: Asynchronous
  495. -ulOperIndex
  496. Operation number. In the asynchronous operation mode, the number can be obtained through the
  497. ISX_sr_getevtoperindex() function when MOEV_WTRINGis generated upon the completion of the operation.
  498. */
  499. /************************************************************************/
  500. #ifndef EHANG_ISXAPI_STD_C
  501. ISXAPI_FUNC_STDCL(INT) ISX_ago_wtring(INT dev, INT numRings, INT HookState, INT timeout, USHORT mode=EV_ASYNC, UINT ulOperIndex=0);
  502. #else
  503. ISXAPI_FUNC_STDCL(INT) ISX_ago_wtring(INT dev, INT numRings, INT HookState, INT timeout, USHORT mode, UINT ulOperIndex);
  504. #endif
  505. /************************************************************************/
  506. /* Function: ISX_ago_gtcallid()
  507. Description:
  508. The ISX_ago_gtcallid( ) function obtains information about a calling number.
  509. The calling number is generally sent in the interval of the first ring.
  510. Return value:
  511. 0 success
  512. -1 failure
  513. Parameter:
  514. -dev
  515. Analog line channel device handle returned by ISX_ag_open( )
  516. -bufp
  517. Saves information about a calling number. The maximum length of the calling
  518. number information is MAX_CALLID_DATA_LEN.
  519. */
  520. /************************************************************************/
  521. ISXAPI_FUNC_STDCL(INT) ISX_ago_gtcallid( INT dev, CHAR *bufp);
  522. /************************************************************************/
  523. /* Function: ISX_ago_gtextcallid()
  524. Description:
  525. The ISX_ago_gtextcallid( ) function obtains information about CALLER ID. CALLER ID is
  526. generally sent in the interval of the first ring.
  527. Return value:
  528. 0 success
  529. -1 failure
  530. Parameter:
  531. -dev
  532. Analog line channel device handle returned by ISX_ag_open( )
  533. -infotype
  534. CALLER ID Information type
  535. CLIDINFO_CMPLT :
  536. Complete CALLERID information (including the information header and length) that is up to 240 bytes
  537. CLIDINFO_GENERAL:
  538. Ordinary CALLERID information (only including the date and time, calling number and user name)
  539. CLIDINFO_CALLID: Calling number
  540. CLIDINFO_FRAMETYPE: Frame type; not supported now
  541. -bufp
  542. Stores CALLER ID information. The maximum length of the information is MAX_CALLID_DATA_LEN.
  543. */
  544. /************************************************************************/
  545. ISXAPI_FUNC_STDCL(INT) ISX_ago_gtextcallid( INT dev, INT infotype, CHAR *bufp);
  546. /************************************************************************/
  547. /* Function: ISX_ags_RingParam()
  548. Description:
  549. The ISX_ags_RingParam( ) function sets ringing parameters. This function only applies
  550. to nodes with an analog line.
  551. Return value:
  552. 0 success
  553. -1 failure
  554. Parameter:
  555. -ucIsxNo
  556. Node number
  557. -usRingOnDuration
  558. Ringing duration in ms. It shall not be 0.
  559. -usRingOffDuration
  560. Interval between two rings in ms. It shall not be 0.
  561. */
  562. /************************************************************************/
  563. ISXAPI_FUNC_STDCL(INT) ISX_ags_RingParam(UCHAR ucIsxNo, USHORT usRingOnDuration, USHORT usRingOffDuration);
  564. /************************************************************************/
  565. /* Function: ISX_ags_SetHookParam()
  566. Description:
  567. The function ISX_ags_SetHookParam( ) sets a time interval for switchhook flash identification.
  568. That is, an event is a switchhook event if the time is within the defined duration; an event is
  569. an on-hook event if the time exceeds this duration. This function only applies to nodes with an
  570. analog line.
  571. Return value:
  572. 0 success
  573. -1 failure
  574. Parameter:
  575. -ucIsxNo
  576. Node number
  577. -usHookFlashTime
  578. Detects the switchhook flash time in 10ms. It shall not be 0.
  579. The default is 50 time units, i.e. 500ms.
  580. */
  581. /************************************************************************/
  582. #ifndef EHANG_ISXAPI_STD_C
  583. ISXAPI_FUNC_STDCL(INT) ISX_ags_SetHookParam(UCHAR ucIsxNo, USHORT usHookFlashTime=50); //10 msec units
  584. #else
  585. ISXAPI_FUNC_STDCL(INT) ISX_ags_SetHookParam(UCHAR ucIsxNo, USHORT usHookFlashTime); //10 msec units
  586. #endif
  587. /************************************************************************/
  588. /* Function: ISX_ags_genring()
  589. Description:
  590. The ISX_ags_genring( ) function performs ringing on a specified analog line.
  591. This function only applies to an FXS port analog line. If off-hook is performed during
  592. ringing, ringing is terminated. When the number ringings reaches a number specified by
  593. the len parameter, ringing is also automatically terminated.
  594. Return value:
  595. Asynchronous mode:
  596. 0 success, -1 failure
  597. Synchronous mode:
  598. -1: Failure
  599. MSMM_RNGOFFHK: Ringing termination due to off-hook
  600. MSMM_RNGSTOP: Ringing termination due to the calling of the ISX_ags_stopfn() function
  601. MSMM_TERM: Termination because the number of ringings is fulfilled
  602. Parameter:
  603. -dev
  604. Analog line channel device handle returned by ISX_ag_open( )
  605. -len
  606. Specifies the number of ringings. If it is 0xFFFF, the number of ringings is not restricted until off-hook is performed or the ISX_ags_stopfn() function is called.
  607. -mode
  608. Synchronous/asynchronous mode:
  609. EV_SYNC: Synchronous
  610. EV_ASYNC: Asynchronous
  611. -ulOperIndex
  612. Operation number. In the asynchronous operation mode, the number can be obtained through
  613. the ISX_sr_getevtoperindex() function when MSEV_RING or MSEV_NORING is generated upon the
  614. completion of the operation.
  615. */
  616. /************************************************************************/
  617. #ifndef EHANG_ISXAPI_STD_C
  618. ISXAPI_FUNC_STDCL(INT) ISX_ags_genring(INT dev, USHORT len, USHORT mode=EV_ASYNC, UINT ulOperIndex=0);
  619. #else
  620. ISXAPI_FUNC_STDCL(INT) ISX_ags_genring(INT dev, USHORT len, USHORT mode, UINT ulOperIndex);
  621. #endif
  622. /************************************************************************/
  623. /* Function: ISXE_ags_SendCallerID()
  624. Description:
  625. The ISX_ags_SendCallerID( ) function sends calling number information to a specified analog line
  626. through FSK during ringing. This function shall be used together with ISX_ags_genring() only.
  627. This function is called to send a calling number only when the first MSEV_RINGS event is received.
  628. Return value:
  629. 0 success
  630. -1 failure
  631. Parameter:
  632. -dev
  633. Analog line channel device handle returned by ISX_ag_open( )
  634. -OrigAddr
  635. Calling number that is an ASCII string. The maximum length is MAX_CALLID_DATA_LEN.
  636. -rfu
  637. Reserved. Currently, it is useless.
  638. */
  639. /************************************************************************/
  640. #ifndef EHANG_ISXAPI_STD_C
  641. ISXAPI_FUNC_STDCL(INT) ISX_ags_SendCallerID(INT dev, CHAR* OrigAddr, VOID* rfu=0);
  642. #else
  643. ISXAPI_FUNC_STDCL(INT) ISX_ags_SendCallerID(INT dev, CHAR* OrigAddr, VOID* rfu);
  644. #endif
  645. /************************************************************************/
  646. /* Function: ISX_ags_genringCallerID()
  647. Description:
  648. The function performs ringing on a specified analog line. This function only applies to an FXS
  649. port analog line. If off-hook is performed during ringing, ringing is terminated. When the number
  650. ringings reaches a number specified by the len parameter, ringing is also automatically terminated.
  651. The calling number information is sent through FSK during ringing.
  652. Return value:
  653. Asynchronous mode:
  654. 0 success,
  655. -1 failure
  656. Synchronous mode:
  657. -1: Failure
  658. MSMM_RNGOFFHK: Ringing termination due to off-hook
  659. MSMM_RNGSTOP: Ringing termination due to the calling of the ISX_ags_stopfn() function
  660. MSMM_TERM: Termination because the number of ringings is fulfilled
  661. Parameter:
  662. -dev
  663. Analog line channel device handle returned by ISX_ag_open( )
  664. -len
  665. Specifies the number of ringings. If it is 0xFFFF, the number of ringings is not restricted until
  666. off-hook is performed or the ISX_ags_stopfn() function is called.
  667. -mode
  668. Synchronous/asynchronous mode:
  669. EV_SYNC: Synchronous
  670. EV_ASYNC: Asynchronous
  671. -Cadid
  672. Ring rhythm. Reserved. Currently, it is useless.
  673. -OrigAddr
  674. Calling number that is an ASCII string. The maximum length is MAX_CALLID_DATA_LEN.
  675. -rfu
  676. Reserved. Currently, it is useless.
  677. -ulOperIndex
  678. Operation number. In the asynchronous operation mode, the number can be obtained through the
  679. ISX_sr_getevtoperindex() function when MSEV_RING or MSEV_NORING is generated upon the completion
  680. of the operation.
  681. */
  682. /************************************************************************/
  683. #ifndef EHANG_ISXAPI_STD_C
  684. ISXAPI_FUNC_STDCL(INT) ISX_ags_genringCallerID(INT dev, USHORT len, USHORT mode, USHORT Cadid, CHAR* OrigAddr, VOID* rfu=NULL, UINT ulOperIndex=0);
  685. #else
  686. ISXAPI_FUNC_STDCL(INT) ISX_ags_genringCallerID(INT dev, USHORT len, USHORT mode, USHORT Cadid, CHAR* OrigAddr, VOID* rfu, UINT ulOperIndex);
  687. #endif
  688. /************************************************************************/
  689. /* Function: ISX_ags_stopfn()
  690. Description:
  691. The ISX_ags_stopfn( ) function stops the asynchronous function operation.
  692. Return value:
  693. 0 success
  694. -1 failure
  695. Parameter:
  696. -dev
  697. Analog line channel device handle returned by ISX_ag_open( )
  698. -funcid
  699. Function ID to be stopped. Currently, only the ringing stopping (i.e. MTF_RING) is supported.
  700. -mode
  701. Synchronous or asynchronous mode:
  702. EV_SYNC: Synchronous
  703. EV_ASYNC: Asynchronous
  704. */
  705. /************************************************************************/
  706. #ifndef EHANG_ISXAPI_STD_C
  707. ISXAPI_FUNC_STDCL(INT) ISX_ags_stopfn(INT dev, UINT funcid, USHORT mode=EV_ASYNC);
  708. #else
  709. ISXAPI_FUNC_STDCL(INT) ISX_ags_stopfn(INT dev, UINT funcid, USHORT mode);
  710. #endif
  711. /************************************************************************/
  712. /* Function: ISX_ag_SetEvtMsk()
  713. Description:
  714. The function sets a channel event mask. If the mask of an event is cleared, this event is
  715. not sent to the application. For the default masks, refer to Table 1.
  716. Return value:
  717. 0 success
  718. -1 failure
  719. Parameter:
  720. -dev
  721. Analog line device handle
  722. -mask
  723. Event mask. Refer to Table 1.
  724. -action
  725. Flag for increase or clearing:
  726. AGACT_SETMSK: Enables receiving a specified event and disables an unspecified event.
  727. AGACT_ADDMSK: Enables receiving a specified event.
  728. AGACT_SUBMSK: Disables receiving a specified event.
  729. Table 1 Parameter masks
  730. --------------------------------------------------------------------------------------
  731. Type Description Default
  732. --------------------------------------------------------------------------------------
  733. MSMM_OFFHOOK Set whether to receive an MSEV_SIGEVT off-hook event Enabled
  734. MSMM_ONHOOK Set whether to receive an MSEV_SIGEVT on-hook event Enabled
  735. MSMM_HOOKFLASH Set whether to receive an MSEV_SIGEVT switchhook flash event Disabled
  736. AGMM_DIGITS Set whether to receive an AGEV_DIGITS event Disabled
  737. MOMM_RINGS Set whether to receive an MOEV_RINGS event Disabled
  738. MSMM_RINGS Set whether to receive an MSEV_RINGS event Disabled
  739. MOMM_CALLERID Set whether to receive an MOEV_CALLERID event Disabled
  740. --------------------------------------------------------------------------------------
  741. */
  742. /************************************************************************/
  743. ISXAPI_FUNC_STDCL(INT) ISX_ag_SetEvtMsk(INT dev, UINT mask, INT action);
  744. /************************************************************************/
  745. /* Function: ISX_ATAG_TERMMSK()
  746. Description:
  747. The ISX_ATAG_TERMMSK( ) function returns an integer containing the cause for
  748. the last I/O operation termination.
  749. Return value:
  750. The last termination cause (bitmask)
  751. AT_FAILURE error
  752. Parameter:
  753. -dev
  754. Analog line channel device handle
  755. -OperType
  756. Operation type. Refer to OPERATIONS.
  757. Termination causes are as follows:
  758. Potential termination causes for ISX_ags_genring():
  759. MSMM_RNGOFFHK: Ringing termination due to off-hook during the process of ringing of the FXS port.
  760. MSMM_RNGSTOP: Ringing termination due to the calling of ISX_ags_stopfn().
  761. MSMM_TERM: Normal ringing termination.
  762. Potential termination causes for ISX_ago_dial():
  763. CR_SS_TELNUM: Outgoing call termination due to successful sending of a telephone number.
  764. CR_SF_TELNUM: Outgoing call termination due to failure to send a telephone number.
  765. CR_BUSY: Busy line
  766. CR_NOANS: No answer
  767. CR_NORB: No ringback tone
  768. CR_CNCT: Answer
  769. CR_NODIALTONE: No dialing tone
  770. CR_FAXTONE: Fax
  771. Potential termination causes for ISX_ag_StartSendTone():
  772. TM_DIGIT: Specified digit is received
  773. TM_EOD: Data ends (For example, a file ends during play and voice data with a specified length is received during record)
  774. TM_ERROR: I/O device error
  775. TM_IDDTIME: Timeout between keys
  776. TM_MAXDTMF: A specified DTMF count is received
  777. TM_MAXTIME: The operation time specified by the function is exceeded
  778. TM_USRSTOP: The user stops the operation
  779. TM_BARGEIN: Playback is interrupted because a VAD is detected
  780. */
  781. /************************************************************************/
  782. #ifndef EHANG_ISXAPI_STD_C
  783. ISXAPI_FUNC_STDCL(INT) ISX_ATAG_TERMMSK(INT dev, INT OperType = OPER_UNKNOWN);
  784. #else
  785. ISXAPI_FUNC_STDCL(INT) ISX_ATAG_TERMMSK(INT dev, INT OperType);
  786. #endif
  787. /************************************************************************/
  788. /* Function: ISX_ag_StartSendTone()
  789. Description:
  790. The ISX_ag_StartSendTone( ) function sends a busy tone, ringback tone, howler tone, dialing tone,
  791. etc. An analog line channel must be bound to a DSP voice channel in order to call this function.
  792. For binding to a DSP voice channel, refer to the ISX_ag_open() function.
  793. Return value:
  794. 0 success
  795. -1 failure
  796. Parameter:
  797. -dev
  798. Specifies a valid voice channel device handle
  799. -iToneId
  800. TONE ID. It includes the following:
  801. TONEID_BUSY: Busy tone
  802. TONEID_DIAL: Dialing tone
  803. TONEID_RINGBACK: Ringback tone
  804. TONEID_HOWLER: Howler tone
  805. -tptp
  806. Pointer to the Termination Parameter Table (DV_TPT). The parameter specifies play termination conditions.
  807. For details, refer to the description of the DV_TPT structure. Note: In addition to DV_TPT termination
  808. conditions, the play operation may stop when play proceeds to the end of a file or the user calls the
  809. ISX_dx_stopch() function. For details, refer to the list of termination causes in the description of
  810. the ISX_ATDX_TERMMSK() and ISX_ATAG_TERMMSK() functions.
  811. -iPrdDev
  812. PRD device handle. Currently, TONE sending is achieved by playing files through a DSP voice channel.
  813. Therefore, this parameter specifies a PRD device handle where the TONE file is located.
  814. -Mode
  815. Specifies the synchronous/asynchronous mode:
  816. EV_ASYNC: Asynchronous mode
  817. EV_SYNC:Synchronous mode (default)
  818. -ulOperIndex
  819. Operation number. In the asynchronous operation mode, the number can be obtained through the
  820. ISX_sr_getevtoperindex() function when AGEV_SENDTONE or AGEV_ERROR is generated upon the completion
  821. of the operation.
  822. Note:
  823. 1.TPT conditions are subject to the historical keys and current key of the bound DSP voice channel.
  824. 2.Play can be stopped by calling the ISX_ag_StopSendTone(dev) function, but dev must be the analog line channel handle in the ISX_ag_StartSendTone(dev) function.
  825. 3.Play can be stopped by calling the ISX_dx_stopch(dev) function, but dev must be the bound DSP voice channel device handle.
  826. 4.If there is a key during play, key information can be obtained by calling the ISX_dx_getdig(dev) function, but dev must be the bound DSP voice channelk device handle.
  827. */
  828. /************************************************************************/
  829. #ifndef EHANG_ISXAPI_STD_C
  830. ISXAPI_FUNC_STDCL(INT) ISX_ag_StartSendTone(INT dev, const INT iToneId, const DV_TPT *tptp, INT iPrdDev=-1, USHORT mode=EV_ASYNC, UINT ulOperIndex=0);
  831. #else
  832. ISXAPI_FUNC_STDCL(INT) ISX_ag_StartSendTone(INT dev, const INT iToneId, const DV_TPT *tptp, INT iPrdDev, USHORT mode, UINT ulOperIndex);
  833. #endif
  834. /************************************************************************/
  835. /* Function:ISX_ag_StopSendTone()
  836. Description:
  837. The ISX_ag_StopSendTone( ) function stops the TONE sending operation activated by ISX_ag_StartSendTone().
  838. Return value:
  839. 0 success
  840. -1 failure
  841. Parameter:
  842. -dev
  843. Analog line channel device handle.
  844. -mode
  845. Synchronous/asynchronous mode:
  846. EV_SYNC: Synchronous
  847. EV_ASYNC: Asynchronous
  848. */
  849. /************************************************************************/
  850. #ifndef EHANG_ISXAPI_STD_C
  851. ISXAPI_FUNC_STDCL(INT) ISX_ag_StopSendTone(INT dev, USHORT mode=EV_ASYNC);
  852. #else
  853. ISXAPI_FUNC_STDCL(INT) ISX_ag_StopSendTone(INT dev, USHORT mode);
  854. #endif
  855. /*
  856. - Refer to ISX_dx_chgfreq()
  857. */
  858. ISXAPI_FUNC_STDCL(INT) ISX_ag_chgfreq( INT tonetype, INT fq1, INT dv1, INT fq2, INT dv2 );
  859. /*
  860. - Refer to ISX_dx_chgdur()
  861. */
  862. ISXAPI_FUNC_STDCL(INT) ISX_ag_chgdur( INT tonetype, INT on, INT ondv, INT off, INT offdv );
  863. #ifndef EHANG_ISXAPI_STD_C
  864. ISXAPI_FUNC_STDCL(INT) ISX_agh_startchk(INT dev, VOID* pRvr=0);
  865. #else
  866. ISXAPI_FUNC_STDCL(INT) ISX_agh_startchk(INT dev, VOID* pRvr);
  867. #endif
  868. #ifndef EHANG_ISXAPI_STD_C
  869. ISXAPI_FUNC_STDCL(INT) ISX_agh_stopchk(INT dev, VOID* pRvr=0);
  870. #else
  871. ISXAPI_FUNC_STDCL(INT) ISX_agh_stopchk(INT dev, VOID* pRvr);
  872. #endif
  873. #endif
  874. #ifdef __cplusplus
  875. } // C Plus Plus function bindings
  876. #undef extern
  877. #endif
  878. #endif