Intel 05 1832 002 Voice API For Windows Operating Systems Library Reference User Manual To The E6ccd898 69d1 4115 A1fc 164da215e5ee
User Manual: Intel 05-1832-002 to the manual
Open the PDF directly: View PDF
.
Page Count: 564
| Download | |
| Open PDF In Browser | View PDF |
Voice API for Windows Operating Systems Library Reference November 2003 05-1832-002 INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL® PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. Intel products are not intended for use in medical, life saving, or life sustaining applications. Intel may make changes to specifications and product descriptions at any time, without notice. This Voice API for Windows Operating Systems Library Reference as well as the software described in it is furnished under license and may only be used or copied in accordance with the terms of the license. The information in this manual is furnished for informational use only, is subject to change without notice, and should not be construed as a commitment by Intel Corporation. Intel Corporation assumes no responsibility or liability for any errors or inaccuracies that may appear in this document or any software that may be provided in association with this document. Except as permitted by such license, no part of this document may be reproduced, stored in a retrieval system, or transmitted in any form or by any means without express written consent of Intel Corporation. Copyright © 2002-2003, Intel Corporation AnyPoint, BoardWatch, BunnyPeople, CablePort, Celeron, Chips, CT Media, Dialogic, DM3, EtherExpress, ETOX, FlashFile, i386, i486, i960, iCOMP, InstantIP, Intel, Intel Centrino, Intel Centrino logo, Intel logo, Intel386, Intel486, Intel740, IntelDX2, IntelDX4, IntelSX2, Intel InBusiness, Intel Inside, Intel Inside logo, Intel NetBurst, Intel NetMerge, Intel NetStructure, Intel SingleDriver, Intel SpeedStep, Intel StrataFlash, Intel TeamStation, Intel Xeon, Intel XScale, IPLink, Itanium, MCS, MMX, MMX logo, Optimizer logo, OverDrive, Paragon, PDCharm, Pentium, Pentium II Xeon, Pentium III Xeon, Performance at Your Command, RemoteExpress, SmartDie, Solutions960, Sound Mark, StorageExpress, The Computer Inside., The Journey Inside, TokenExpress, VoiceBrick, VTune, and Xircom are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. * Other names and brands may be claimed as the property of others. Publication Date: November 2003 Document Number: 05-1832-002 Intel Converged Communications, Inc. 1515 Route 10 Parsippany, NJ 07054 For Technical Support, visit the Intel Telecom Support Resources website at: http://developer.intel.com/design/telecom/support For Products and Services Information, visit the Intel Telecom Products website at: http://www.intel.com/design/network/products/telecom For Sales Offices and other contact information, visit the Where to Buy Intel Telecom Products page at: http://www.intel.com/buy/wtb/wtb1028.htm Voice API for Windows Operating Systems Library Reference – November 2003 Contents Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 About This Publication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Intended Audience. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . How to Use This Publication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Related Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Function Summary by Category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20 1.21 1.22 1.23 2 13 13 13 13 14 Device Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Configuration Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I/O Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I/O Convenience Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Streaming to Board Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Analog Display Services Interface (ADSI) Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . Audio Input Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Transaction Record Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cached Prompt Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Call Status Transition (CST) Event Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TDM Routing Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Global Tone Detection (GTD) Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Global Tone Generation (GTG) Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . R2/MF Convenience Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Speed and Volume Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Call Progress Analysis Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Caller ID Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . File Manipulation Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Echo Cancellation Resource Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Structure Clearance Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Syntellect License Automated Attendant Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Extended Attribute Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Voice Function Support by Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 16 17 19 19 20 20 20 21 21 21 23 23 24 24 25 26 26 26 27 27 27 29 Function Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2.1 Function Syntax Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ag_getctinfo( ) – get information about an analog device. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ag_getxmitslot( ) – get TDM bus time slot number of analog transmit channel . . . . . . . . . . . . . . ag_listen( ) – connect analog receive channel to TDM bus time slot . . . . . . . . . . . . . . . . . . . . . . ag_unlisten( ) – disconnect analog receive channel from TDM bus . . . . . . . . . . . . . . . . . . . . . . . ai_close( ) – close an audio input device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ai_getxmitslot( ) – get TDM bus time slot number of audio input transmit channel . . . . . . . . . . . ai_open( ) – open an audio input device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ATDX_ANSRSIZ( ) – return the duration of the answer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ATDX_BDNAMEP( ) – return a pointer to the board device name . . . . . . . . . . . . . . . . . . . . . . . . ATDX_BDTYPE( ) – return the board type for the device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Voice API for Windows Operating Systems Library Reference – November 2003 35 36 38 41 44 46 48 50 52 54 56 3 Contents ATDX_BUFDIGS( ) – return the number of uncollected digits . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 ATDX_CHNAMES( ) – retrieve all channel names for a board . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 ATDX_CHNUM( ) – return the channel number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 ATDX_CONNTYPE( ) – return the connection type for a completed call . . . . . . . . . . . . . . . . . . . 64 ATDX_CPERROR( ) – return the call progress analysis error . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 ATDX_CPTERM( ) – return the last result of call progress analysis termination . . . . . . . . . . . . . 70 ATDX_CRTNID( ) – return the last call progress analysis termination . . . . . . . . . . . . . . . . . . . . . 73 ATDX_DEVTYPE( ) – return the device type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 ATDX_DTNFAIL( ) – return character for dial tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 ATDX_FRQDUR( ) – return the duration of the first SIT sequence. . . . . . . . . . . . . . . . . . . . . . . . 81 ATDX_FRQDUR2( ) – return the duration of the second SIT sequence . . . . . . . . . . . . . . . . . . . . 83 ATDX_FRQDUR3( ) – return the duration of the third SIT sequence . . . . . . . . . . . . . . . . . . . . . . 85 ATDX_FRQHZ( ) – return the frequency of the first SIT sequence . . . . . . . . . . . . . . . . . . . . . . . . 87 ATDX_FRQHZ2( ) – return the frequency of the second SIT sequence . . . . . . . . . . . . . . . . . . . . 89 ATDX_FRQHZ3( ) – return the frequency of the third SIT sequence . . . . . . . . . . . . . . . . . . . . . . 91 ATDX_FRQOUT( ) – return percentage of time SIT tone was out of bounds . . . . . . . . . . . . . . . . 93 ATDX_FWVER( ) – return the voice firmware version number . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 ATDX_HOOKST( ) – return the current hook-switch state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 ATDX_LINEST( ) – return the current activity on the channel. . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 ATDX_LONGLOW( ) – return duration of longer silence detected . . . . . . . . . . . . . . . . . . . . . . . 101 ATDX_PHYADDR( ) – return the physical board address. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 ATDX_SHORTLOW( ) – return duration of shorter silence detected . . . . . . . . . . . . . . . . . . . . . 105 ATDX_SIZEHI( ) – return duration of initial non-silence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 ATDX_STATE( ) – return the current state of the channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 ATDX_TERMMSK( ) – return the reason for the last I/O function termination . . . . . . . . . . . . . . 111 ATDX_TONEID( ) – return user-defined tone ID that terminated I/O function. . . . . . . . . . . . . . . 115 ATDX_TRCOUNT( ) – return the byte count for the last I/O transfer . . . . . . . . . . . . . . . . . . . . . 118 dx_addspddig( ) – set a DTMF digit to adjust speed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 dx_addtone( ) – add a user-defined tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 dx_addvoldig( ) – set a DTMF digit to adjust volume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 dx_adjsv( ) – adjust speed or volume immediately . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 dx_blddt( ) – define a user-defined dual-frequency tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 dx_blddtcad( ) – define a user-defined dual frequency cadenced tone. . . . . . . . . . . . . . . . . . . . 139 dx_bldst( ) – define a user-defined single-frequency tone. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 dx_bldstcad( ) – define a user-defined single-frequency cadenced tone . . . . . . . . . . . . . . . . . . 145 dx_bldtngen( ) – define a tone for generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 dx_cacheprompt( ) – download a cached prompt from multiple sources . . . . . . . . . . . . . . . . . . 151 dx_chgdur( ) – change the duration definition for a tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 dx_chgfreq( ) – change the frequency definition for a tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 dx_chgrepcnt( ) – change the repetition definition for a tone . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 dx_close( ) – close a channel or board device handle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 dx_CloseStreamBuffer( ) – delete a circular stream buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 dx_clrcap( ) – clear all fields in a DX_CAP structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 dx_clrdigbuf( ) – clear all digits in the firmware digit buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 dx_clrsvcond( ) – clear all speed or volume adjustment conditions . . . . . . . . . . . . . . . . . . . . . . 175 dx_clrtpt( ) – clear all fields in a DV_TPT structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 4 Voice API for Windows Operating Systems Library Reference – November 2003 Contents dx_createtone( ) – create a new tone definition for a specific call progress tone . . . . . . . . . . . . dx_deletetone( ) – delete a specific call progress tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_deltones( ) – delete all user-defined tones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_dial( ) – dial an ASCIIZ string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_distone( ) – disable detection of a user-defined tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_enbtone( ) – enable detection of a user-defined tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_fileclose( ) – close a file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_fileerrno( ) – return the system error value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_fileopen( ) – open a file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_fileread( ) – read data from a file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_fileseek( ) – move a file pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_filewrite( ) – write data from a buffer into a file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_getcachesize( ) – get size of on-board memory for cached prompts . . . . . . . . . . . . . . . . . . dx_getctinfo( ) – get information about a voice device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_getcursv( ) – return the specified current speed and volume settings . . . . . . . . . . . . . . . . . dx_getdig( ) – collect digits from a channel digit buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_GetDllVersion( ) – retrieve the voice DLL version number . . . . . . . . . . . . . . . . . . . . . . . . . . dx_getevt( ) – monitor channel events synchronously . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_getfeaturelist( ) – retrieve feature support information for the device . . . . . . . . . . . . . . . . . . dx_getparm( ) – get the current parameter settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_GetRscStatus( ) – return assignment status of a shared resource . . . . . . . . . . . . . . . . . . . . dx_GetStreamInfo( ) – retrieve information about the circular stream buffer . . . . . . . . . . . . . . . dx_getsvmt( ) – return the current speed or volume modification table . . . . . . . . . . . . . . . . . . . dx_getxmitslot( ) – get TDM bus time slot number of voice transmit channel . . . . . . . . . . . . . . dx_getxmitslotecr( ) – get echo cancellation resource transmit time slot number . . . . . . . . . . . dx_gtcallid( ) – return the calling line Directory Number. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_gtextcallid( ) – retrieve a caller ID message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_gtsernum( ) – retrieve the board serial number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_initcallp( ) – initialize and activate call progress analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_libinit( ) – initialize the voice library DLL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_listen( ) – connect a voice listen channel to TDM bus time slot . . . . . . . . . . . . . . . . . . . . . . dx_listenecr( ) – enable echo cancellation resource mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_listenecrex( ) – modify characteristics of the echo canceller . . . . . . . . . . . . . . . . . . . . . . . . dx_mreciottdata( ) – record voice data from two TDM bus time slots . . . . . . . . . . . . . . . . . . . . dx_open( ) – open a voice device and return a unique device handle . . . . . . . . . . . . . . . . . . . . dx_OpenStreamBuffer( ) – create and initialize a circular stream buffer . . . . . . . . . . . . . . . . . . dx_pause( ) – pause on-going play . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_play( ) – play recorded voice data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_playf( ) – synchronously play voice data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_playiottdata( ) – play back recorded voice data from multiple sources . . . . . . . . . . . . . . . . . dx_playtone( ) – play tone defined by TN_GEN structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_playtoneEx( ) – play the cadenced tone defined by TN_GENCAD. . . . . . . . . . . . . . . . . . . . dx_playvox( ) – play voice data stored in a single VOX file . . . . . . . . . . . . . . . . . . . . . . . . . . . . dx_playwav( ) – play voice data stored in a single WAVE file . . . . . . . . . . . . . . . . . . . . . . . . . . dx_PutStreamData( ) – place data into a circular stream buffer. . . . . . . . . . . . . . . . . . . . . . . . . dx_querytone( ) – get tone information for a specific call progress tone . . . . . . . . . . . . . . . . . . Voice API for Windows Operating Systems Library Reference – November 2003 179 183 186 188 197 200 203 205 208 210 213 216 219 221 223 226 232 234 237 242 245 247 249 252 255 258 262 270 272 275 277 280 283 286 292 295 297 299 307 310 315 319 324 327 330 333 5 Contents dx_rec( ) – record voice data from a single channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 dx_recf( ) – record voice data to a single file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 dx_reciottdata( ) – record voice data to multiple destinations . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 dx_recvox( ) – record voice data to a single VOX file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 dx_recwav( ) – record voice data to a single WAVE file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 dx_ResetStreamBuffer( ) – reset internal data for a circular stream buffer . . . . . . . . . . . . . . . . . 357 dx_resume( ) – resume paused play . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 dx_RxIottData( ) – receive data on a specified channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 dx_sendevt( ) – allow inter-process event communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 dx_setchxfercnt( ) – set the bulk queue buffer size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 dx_setdevuio( ) – install and retrieve user-defined I/O functions. . . . . . . . . . . . . . . . . . . . . . . . . 369 dx_setdigbuf( ) – set the digit buffering mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 dx_setdigtyp( ) – control the types of digits detected by the voice channel. . . . . . . . . . . . . . . . . 374 dx_setevtmsk( ) – enable detection of call status transition (CST) events . . . . . . . . . . . . . . . . . 377 dx_setgtdamp( ) – set up the tone detection amplitudes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 dx_sethook( ) – provide control of the hook switch status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 dx_setparm( ) – set physical parameters of a channel or board device . . . . . . . . . . . . . . . . . . . 388 dx_SetRecordNotifyBeepTone( ) – specify the template of the cadenced tone . . . . . . . . . . . . . 399 dx_setsvcond( ) – set conditions that adjust speed or volume of play . . . . . . . . . . . . . . . . . . . . 401 dx_setsvmt( ) – change default values of the speed or volume modification table . . . . . . . . . . . 405 dx_settonelen( ) – change the duration of the built-in beep tone . . . . . . . . . . . . . . . . . . . . . . . . 409 dx_setuio( ) – install user-defined I/O functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 dx_SetWaterMark( ) – set water mark for the circular stream buffer. . . . . . . . . . . . . . . . . . . . . . 415 dx_stopch( ) – force termination of currently active I/O functions . . . . . . . . . . . . . . . . . . . . . . . . 417 dx_TSFStatus( ) – return the status of tone set file loading . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 dx_TxIottData( ) – transmit data on a specified channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 dx_TxRxIottData( ) – start a transmit-initiated reception of data . . . . . . . . . . . . . . . . . . . . . . . . . 426 dx_unlisten( ) – disconnect voice receive channel from TDM bus . . . . . . . . . . . . . . . . . . . . . . . 431 dx_unlistenecr( ) – disable echo cancellation resource (ECR) mode . . . . . . . . . . . . . . . . . . . . . 433 dx_wink( ) – generate an outbound wink. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 dx_wtcallid( ) – wait for rings and report caller ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 dx_wtring( ) – wait for a specified number of rings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 li_attendant( ) – perform the actions of an automated attendant. . . . . . . . . . . . . . . . . . . . . . . . . 446 li_islicensed_syntellect( ) – verify Syntellect patent license on board . . . . . . . . . . . . . . . . . . . . . 450 nr_scroute( ) – make a full or half-duplex connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 nr_scunroute( ) – break a full or half-duplex connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 r2_creatfsig( ) – create R2/MF forward signal tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 r2_playbsig( ) – play R2/MF backward signal tone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 3 Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 3.1 3.2 3.3 3.4 4 Overview of Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 Termination Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 Unsolicited Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 Call Status Transition (CST) Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 ADSI_XFERSTRUC – ADSI 2-way FSK data transfer buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . 478 6 Voice API for Windows Operating Systems Library Reference – November 2003 Contents CT_DEVINFO – channel/time slot device information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DV_DIGIT – user digit buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DV_TPT – termination parameter table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DX_ATTENDANT – Syntellect License Automated Attendant . . . . . . . . . . . . . . . . . . . . . . . . . . DX_CAP – call progress analysis parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DX_CST – call status transition (CST) information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DX_EBLK – call status transition event block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DX_ECRCT – echo cancellation resource (ECR) characteristics . . . . . . . . . . . . . . . . . . . . . . . DX_IOTT – input/output transfer table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DX_STREAMSTAT – status of stream buffer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DX_SVCB – speed and volume adjustment condition block . . . . . . . . . . . . . . . . . . . . . . . . . . . DX_SVMT – speed and volume modification tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DX_UIO – user-defined input/output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DX_XPB – input/output transfer parameter block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . FEATURE_TABLE – feature information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SC_TSINFO – TDM bus time slot information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TN_GEN – tone generation template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TN_GENCAD – cadenced tone generation template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TONE_DATA – tone information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 483 485 493 496 504 506 508 509 512 514 517 519 520 525 529 530 531 533 5 Error Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 6 Supplementary Reference Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 6.1 6.2 DTMF and MF Tone Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 DTMF and MF Detection Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551 Voice API for Windows Operating Systems Library Reference – November 2003 7 Contents Figures 1 8 Format of General Caller ID Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Voice API for Windows Operating Systems Library Reference – November 2003 Contents Tables 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Voice Function Support by Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Valid Dial String Characters (DM3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Valid Dial String Characters (Springware) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 System Error Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 Caller ID Common Message Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Caller ID CLASS Message Types (Multiple Data Message) . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Caller ID ACLIP Message Types (Multiple Data Message) . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Caller ID CLIP Message Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Caller ID JCLIP Message Types (Multiple Data Message) . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Play Mode Selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 Record Mode Selections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 Voice Board Parameters (DM3). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 Voice Board Parameters (Springware) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 Voice Channel Parameters (DM3). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 Voice Channel Parameters (Springware) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 DV_TPT Field Settings Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 G.711 Voice Coder Support Fields (DM3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 G.721 Voice Coder Support Fields (DM3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522 Linear PCM Voice Coder Support Fields (DM3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522 OKI ADPCM Voice Coder Support Fields (DM3). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522 G.726 Voice Coder Support Fields (DM3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 522 GSM Voice Coder Support Fields (DM3). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 TrueSpeech Voice Coder Support Fields (DM3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 IMA ADPCM Voice Coder Support Fields (DM3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 G.726 Voice Coder Support Fields (Springware) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 GSM Voice Coder Support Fields (Springware) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 DTMF Tone Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 MF Tone Specifications (CCITT R1 Tone Plan) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 Detecting MF Digits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 Detecting DTMF Digits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 Voice API for Windows Operating Systems Library Reference – November 2003 9 Revision History This revision history summarizes the changes made in each published version of this document. Document No. Publication Date Description of Revisions 05-1832-002 November 2003 Function Summary by Category chapter : Added functions to I/O Functions category; added a section for Streaming to Board category; added functions to the Call Progress Analysis category; added a function to the Configuration category. Voice Function Support by Platform table: Added new functions to table. dx_cacheprompt( ) function reference: Removed statement from the Cautions section about cached prompts not being flushed and added new information. dx_close( ) function reference: Removed oflags parameter. dx_CloseStreamBuffer( ) function reference: New function. dx_createtone( ) function reference: New function. dx_deletetone( ) function reference: New function. dx_getfeaturelist( ) function reference: Added support for board device as an argument in addition to channel device. Added new bullet item in the Cautions section about returning front end information. dx_GetStreamInfo( ) function reference: New function. dx_OpenStreamBuffer( ) function reference: New function. dx_pause( ) function reference: New function. dx_PutStreamData( ) function reference: New function. dx_querytone( ) function reference: New function. dx_ResetStreamBuffer( ) function reference: New function. dx_resume( ) function reference: New function. dx_RxIottData( ) function reference: Added caution for Springware boards in Cautions section. dx_setevtmsk( ) function reference: Added DM_UNDERRUN bitmask for streaming to board feature. dx_setparm( ) function reference: Added parameters for ETSI Compliant Frequency Shift Keying (FSK) and automatic gain control (AGC) in Voice Channel Parameters (DM3) table. dx_SetRecordNotifyBeepTone( ) function reference: New function. dx_SetWaterMark( ) function reference: New function. dx_setsvcond( ) function reference: Added support for pause/resume play feature. CT_DEVINFO data structure: Revised structure with new fields. DV_TPT data structure: In tp_termno field description, added restriction on use of DX_IDDTIME on DM3 boards; added usage note on DX_MAXTIME and DX_IDDTIME. In tp_flags field description, indicated that TF_SETINIT is now supported on DM3 boards; added new TF_IMMEDIATE bit for DM3 boards only. DX_IOTT data structure: New io_type field value for streaming to board feature. DX_STREAMSTAT data structure: New data structure for streaming to board feature. DX_SVCB data structure: Added new values for pause/resume play feature. DX_XPB data structure: Added 8 kHz linear PCM to Linear PCM Voice Coder Support Fields (DM3) table. Voice API for Windows Operating Systems Library Reference — November 2003 10 Revision History Document No. Publication Date Description of Revisions 05-1832-002 November 2003 TONE_DATA data structure: New data structure for call progress analysis enhancements. Events chapter : Added section for unsolicited events returned by streaming to board functions. 05-1832-001 November 2002 Initial version of document. Much of the information contained in this document was previously published in the Voice Software Reference Programmer's Guide for Windows, document number 05-1456-003. Voice API for Windows Operating Systems Library Reference — November 2003 11 Revision History 12 Voice API for Windows Operating Systems Library Reference — November 2003 About This Publication The following topics provide information about this publication: • Purpose • Intended Audience • How to Use This Publication • Related Information Purpose This publication provides a reference to all voice functions, parameters and data structures in the voice API, also called the R4 voice API, supported on Windows* operating systems. It is a companion document to the Voice API Programming Guide, the Standard Runtime Library API Programming Guide, and the Standard Runtime Library API Library Reference. Intended Audience This information is intended for: • Distributors • System Integrators • Toolkit Developers • Independent Software Vendors (ISVs) • Value Added Resellers (VARs) • Original Equipment Manufacturers (OEMs) How to Use This Publication This document assumes that you are familiar with and have prior experience with Windows* operating systems and the C programming language. Use this document together with the following: the Voice API Programming Guide, the Standard Runtime Library API Programming Guide, and the Standard Runtime Library API Library Reference. The information in this guide is organized as follows: • Chapter 1, “Function Summary by Category” introduces the various categories of voice functions and provides a brief description of each function. • Chapter 2, “Function Information” provides an alphabetical reference to all voice functions. Voice API for Windows Operating Systems Library Reference — November 2003 13 About This Publication • Chapter 3, “Events” provides an alphabetical reference to events that may be returned by the voice software. • Chapter 4, “Data Structures” provides an alphabetical reference to all voice data structures. • Chapter 5, “Error Codes” presents a listing of error codes that may be returned by the voice software. • Chapter 6, “Supplementary Reference Information” provides additional reference information on topics such as DTMF Tone Specifications, and MF Tone Specifications. A glossary and index are provided for your reference. Related Information See the following for more information: • For information about voice library features and guidelines for building applications using voice software, see the Voice API Programming Guide. • For details on the Standard Runtime Library, supported programming models, and programming guidelines for building all applications, see the Standard Runtime Library API Programming Guide. The Standard Runtime Library is a device-independent library that consists of event management functions and standard attribute functions. • For details on all functions and data structures in the Standard Runtime Library library, see the Standard Runtime Library API Library Reference. • For information on the system release, system requirements, software and hardware features, supported hardware, and release documentation, see the Release Guide for the system release you are using. • For details on compatibility issues, restrictions and limitations, known problems, and late- breaking updates or corrections to the release documentation, see the Release Update. Be sure to check the Release Update for the system release you are using for any updates or corrections to this publication. Release Updates are available on the Telecom Support Resources website at http://resource.intel.com/telecom/support/releases/index.html. • For details on installing the system software, see the System Release Installation Guide. • For guidelines on building applications using Global Call software (a common signaling interface for network-enabled applications, regardless of the signaling protocol needed to connect to the local telephone network), see the Global Call API Programming Guide. • For details on all functions and data structures in the Global Call library, see the Global Call API Library Reference. • For details on configuration files (including FCD/PCD files) and instructions for configuring products, see the Configuration Guide for your product or product family. • For technical support, see http://developer.intel.com/design/telecom/support/. This website contains developer support information, downloads, release documentation, technical notes, application notes, a user discussion forum, and more. • For product and services information, see http://www.intel.com/network/csp/. 14 Voice API for Windows Operating Systems Library Reference — November 2003 Function Summary by Category 1. 1 This chapter describes the categories into which the voice library functions can be logically grouped. This chapter also includes a table listing function support on various platforms (DM3, Springware) as well as synchronous/asynchronous support. • Device Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 • Configuration Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 • I/O Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 • I/O Convenience Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 • Streaming to Board Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 • Analog Display Services Interface (ADSI) Functions. . . . . . . . . . . . . . . . . . . . . . . . . . 20 • Audio Input Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 • Transaction Record Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 • Cached Prompt Management Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 • Call Status Transition (CST) Event Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 • TDM Routing Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 • Global Tone Detection (GTD) Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 • Global Tone Generation (GTG) Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 • R2/MF Convenience Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 • Speed and Volume Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 • Call Progress Analysis Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 • Caller ID Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 • File Manipulation Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 • Echo Cancellation Resource Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 • Structure Clearance Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 • Syntellect License Automated Attendant Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 • Extended Attribute Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 • Voice Function Support by Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 1.1 Device Management Functions Device management functions open and close devices, which include boards and channels. Voice API for Windows Operating Systems Library Reference — November 2003 15 Function Summary by Category Before you can call any other library function on a device, that device must be opened using a device management function. The dx_open( ) function returns a unique voice device handle. This handle is the only way the device can be identified once it has been opened. The dx_close( ) function closes a device via its handle. A set of device management functions exists for each Intel® Dialogic® library, such as fax (fx_ functions), modular station interface (ms_ functions), and conferencing (dcb_ functions). See the appropriate API Library Reference for more information on these functions. Device management functions do not cause a device to be busy. In addition, these functions will work on a device whether the device is busy or idle. For more information about opening and using voice devices, particularly on DM3 boards, see the Voice API Programming Guide. Also see this guide for more information about naming conventions for board and channel devices. Use Standard Runtime Library device mapper functions to return information about the structure of the system, such as a list of all physical boards, a list of all virtual boards on a physical board, and a list of all subdevices on a virtual board. This device information is used as input to device management functions. For more information on device mapper functions, see the Standard Runtime Library API Library Reference. The device management functions are: dx_close( ) closes a board or channel device handle dx_open( ) opens a board or channel device handle 1.2 Configuration Functions Configuration functions allow you to alter, examine, and control the physical configuration of an open device. In general, configuration functions operate on an idle device. Configuration functions cause a device to be busy and return the device to an idle state when the configuration is complete. See the Voice API Programming Guide for information about busy and idle states. The configuration functions are: dx_clrdigbuf( ) clears all digits in the firmware digit buffer dx_GetDllVersion( ) returns the voice dynamic link library (DLL) version number dx_getfeaturelist( ) returns information about the features supported on the device dx_getparm( ) gets the current parameter settings for an open device 16 Voice API for Windows Operating Systems Library Reference — November 2003 Function Summary by Category dx_GetRscStatus( ) returns the assignment status of a shared resource for the specified channel dx_gtsernum( ) returns the board serial number dx_libinit( ) initializes the voice dynamic link library (DLL) dx_setchxfercnt( ) sets the bulk queue buffer size for the channel dx_setdigbuf( ) sets the digit buffering mode dx_setdigtyp( ) controls the types of digits detected by the device dx_sethook( ) sets the hook switch state dx_setparm( ) sets physical parameters for the device dx_SetRecordNotifyBeepTone( ) specifies the template of the cadenced tone for record notification beep tone dx_settonelen( ) changes the duration of the built-in beep tone (pre-record beep) dx_TSFStatus( ) returns the status of tone set file loading dx_wtring( ) waits for a specified number of rings Note: 1.3 The dx_sethook( ) and dx_setdigbuf( ) functions can also be classified as an I/O function and all I/O characteristics apply. I/O Functions An I/O function transfers data to and from an open, idle channel. All I/O functions cause a channel to be busy while data transfer is taking place and return the channel to an idle state when data transfer is complete. I/O functions can be run synchronously or asynchronously, with some exceptions (for example, dx_setuio( ) can be run synchronously only). When running synchronously, they return after completing successfully or after an error. When running asynchronously, they return immediately to indicate successful initiation (or an error), and continue processing until a termination condition is satisfied. See the Standard Runtime Library API Programming Guide for more information on asynchronous and synchronous operation. A set of termination conditions can be specified for I/O functions, except for dx_stopch( ) and dx_wink( ). These conditions dictate what events will cause an I/O function to terminate. The Voice API for Windows Operating Systems Library Reference — November 2003 17 Function Summary by Category termination conditions are specified just before the I/O function call is made. Obtain termination reasons for I/O functions by calling the extended attribute function ATDX_TERMMSK( ). See the Voice API Programming Guide for information about I/O terminations. Note: To send and receive FSK data from an Analog Display Services Interface (ADSI) device, see Section 1.6, “Analog Display Services Interface (ADSI) Functions”, on page 20. The I/O functions are: dx_dial( ) dials an ASCIIZ string of digits dx_getdig( ) collects digits from a channel digit buffer (for up to 31 digits plus the null terminator) dx_pause( ) pauses on-going play dx_play( ) plays voice data from any combination of data files, memory, or custom devices dx_playiottdata( ) plays voice data from any combination of data files, memory, or custom devices, and lets the user specify format information dx_rec( ) records voice data to any combination of data files, memory, or custom devices dx_reciottdata( ) records voice data to any combination of data files, memory, or custom devices, and lets the user specify format information dx_resume( ) resumes paused play dx_setdevuio( ) installs and retrieves user-defined I/O functions in your application dx_setuio( ) installs user-defined I/O functions in your application dx_stopch( ) forces termination of currently active I/O functions dx_wink( ) generates an outbound wink Notes: 1. The dx_playtone( ) function, which is grouped with global tone generation functions, can also be classified as an I/O function and all I/O characteristics apply. 2. The dx_playvox( ) and dx_recvox( ) functions, which are grouped with I/O convenience functions, can also be classified as I/O functions and all I/O characteristics apply. 18 Voice API for Windows Operating Systems Library Reference — November 2003 Function Summary by Category 1.4 I/O Convenience Functions Convenience functions enable you to easily implement certain basic functionality of the library functions. I/O convenience functions simplify synchronous play and record. The dx_playf( ) function performs a playback from a single file by specifying the filename. The same operation can be done by using dx_play( ) and supplying a DX_IOTT structure with only one entry for that file. Using dx_playf( ) is more convenient for a single file playback because you do not have to set up a DX_IOTT structure for the one file and the application does not need to open the file. dx_recf( ) provides the same single-file convenience for the dx_rec( ) function. The dx_playvox( ) function also plays voice data stored in a single VOX file. This function internally calls dx_playiottdata( ). Similarly, dx_recvox( ) records VOX files using dx_reciottdata( ). The I/O convenience functions are: dx_playf( ) plays voice data from a single VOX file without the need to specify DX_IOTT dx_playvox( ) plays voice data from a single VOX file using dx_playiottdata( ) dx_playwav( ) plays voice data stored in a single WAVE file dx_recf( ) records voice data from a channel to a single VOX file without the need to specify DX_IOTT dx_recvox( ) records voice data from a channel to a single VOX file using dx_reciottdata( ) dx_recwav( ) records voice data to a single WAVE file 1.5 Streaming to Board Functions The streaming to board feature enables real time data streaming to the board. Streaming to board functions allow you to create, maintain, and delete a circular stream buffer within the library. These functions also provide notification when high and low water marks are reached. See the Voice API Programming Guide for more information about the streaming to board feature. The streaming to board functions include: dx_CloseStreamBuffer( ) deletes a circular stream buffer dx_GetStreamInfo( ) retrieves information about the circular stream buffer dx_OpenStreamBuffer( ) creates and initializes a circular stream buffer Voice API for Windows Operating Systems Library Reference — November 2003 19 Function Summary by Category dx_PutStreamData( ) places data into the circular stream buffer dx_ResetStreamBuffer( ) resets internal data for a circular stream buffer dx_SetWaterMark( ) sets high and low water marks for the circular stream buffer 1.6 Analog Display Services Interface (ADSI) Functions The send and receive frequency shift keying (FSK) data interface is used for Analog Display Services Interface (ADSI) and fixed line short message service (SMS). Frequency shift keying is a frequency modulation technique to send digital data over voiced band telephone lines. The functions listed here support both one-way and two-way frequency shift keying (FSK). See the Voice API Programming Guide for more information about ADSI, two-way FSK, and SMS. dx_RxIottData( ) receives data on a specified channel dx_TxIottData( ) transmits data on a specified channel dx_TxRxIottData( ) starts a transmit-initiated reception of data 1.7 Audio Input Functions The Audio Input (AI) functions are used to provide music or other information on-hold. ai_open( ) opens an audio input device ai_close( ) closes an audio input device ai_getxmitslot( ) gets the TDM bus time slot number of the audio input transmit channel 1.8 Transaction Record Functions Transaction record enables the recording of a two-party conversation by allowing data from two time division multiplexing (TDM) bus time slots from a single channel to be recorded. dx_mreciottdata( ) records voice data from two TDM bus time slots to a data file, memory or custom device 20 Voice API for Windows Operating Systems Library Reference — November 2003 Function Summary by Category 1.9 Cached Prompt Management Functions The cached prompt management feature enables you to store prompts in on-board memory and play them from this location rather than from the host disk drive. See the Voice API Programming Guide for more information about cached prompt management. dx_cacheprompt( ) downloads voice data (prompts) from multiple sources to the on-board memory dx_getcachesize( ) returns the size of the on-board memory used to store cached prompts 1.10 Call Status Transition (CST) Event Functions Call status transition (CST) event functions set and monitor CST events that can occur on a device. CST events indicate changes in the status of the call, such as rings or a tone detected, or the line going on-hook or off-hook. See the call status transition structure (DX_CST) description for a full list of CST events. The dx_getevt( ) function retrieves CST events in a synchronous environment. To retrieve CST events in an asynchronous environment, use the Standard Runtime Library event management functions. dx_setevtmsk( ) enables detection of CST event(s). User-defined tones are CST events, but detection for these events is enabled using dx_addtone( ) or dx_enbtone( ), which are global tone detection functions. The call status transition event functions are: dx_getevt( ) gets a CST event in a synchronous environment dx_sendevt( ) allows inter-process event communication and sends a specified CST event to a specified device dx_setevtmsk( ) enables detection of CST events 1.11 TDM Routing Functions TDM routing functions are used in time division multiplexing (TDM) bus configurations, which include the CT Bus and SCbus. A TDM bus is resource sharing bus that allows information to be transmitted and received among resources over multiple time slots. TDM routing functions enable the application to make or break a connection between voice, telephone network interface, and other resource channels connected via TDM bus time slots. Each device connected to the bus has a transmit component that can transmit on a time slot and a receive component that can listen to a time slot. Voice API for Windows Operating Systems Library Reference — November 2003 21 Function Summary by Category The transmit component of each channel of a device is assigned to a time slot at system initialization and download. To listen to other devices on the bus, the receive component of the device channel is connected to any one time slot. Any number of device channels can listen to a time slot. Note: When you see references to the SCbus or SCbus routing, this information also applies to the CT Bus. That is, the physical interboard connection can be either SCbus or CT Bus. The SCbus protocol is used and the SCbus routing API applies to all the boards regardless of whether they use an SCbus or CT Bus physical interboard connection. A set of TDM routing functions exist for each Intel® Dialogic library, such as fax (fx_ functions), modular station interface (ms_ functions), and conferencing (dcb_ functions). See the appropriate API Library Reference for more information on these functions. TDM routing convenience functions, nr_scroute( ) and nr_scunroute( ), are provided to make or break a half or full-duplex connection between any two channels transmitting on the bus. These functions are not a part of any library but are provided in a separate C source file called sctools.c. The functions are defined in sctools.h. The TDM routing functions are: ag_getctinfo( ) returns information about an analog device connected to the TDM bus ag_getxmitslot( ) returns the number of the TDM bus time slot connected to the transmit component of an analog channel ag_listen( ) connects the listen (receive) component of an analog channel to the TDM bus time slot ag_unlisten( ) disconnects the listen (receive) component of an analog channel from the TDM bus time slot dx_getctinfo( ) returns information about voice device connected to TDM bus dx_getxmitslot( ) returns the number of the TDM bus time slot connected to the transmit component of a voice channel dx_listen( ) connects the listen (receive) component of a voice channel to a TDM bus time slot dx_unlisten( ) disconnects the listen (receive) component of a voice channel from TDM bus time slot nr_scroute( ) makes a half or full-duplex connection between two channels transmitting on the TDM bus nr_scunroute( ) breaks a half or full-duplex connection between two TDM bus devices 22 Voice API for Windows Operating Systems Library Reference — November 2003 Function Summary by Category 1.12 Global Tone Detection (GTD) Functions The global tone detection (GTD) functions define and enable detection of single and dual frequency tones that fall outside the range of those automatically provided with the voice driver. They include tones outside the standard DTMF range of 0-9, a-d, *, and #. The GTD dx_blddt( ), dx_blddtcad( ), dx_bldst( ), and dx_bldstcad( ) functions define tones which can then be added to the channel using dx_addtone( ). This enables detection of the tone on that channel. See the Voice API Programming Guide for a full description of global tone detection. The global tone detection functions are: dx_addtone( ) adds a user-defined tone dx_blddt( ) builds a user-defined dual frequency tone description dx_blddtcad( ) builds a user-defined dual frequency tone cadence description dx_bldst( ) builds a user-defined single frequency tone description dx_bldstcad( ) builds a user-defined single frequency tone cadence description dx_deltones( ) deletes all user-defined tones dx_distone( ) disables detection of user-defined tones dx_enbtone( ) enables detection of user-defined tones dx_setgtdamp( ) sets amplitudes used by global tone detection (GTD) 1.13 Global Tone Generation (GTG) Functions Global tone generation (GTG) functions define and play single and dual tones that fall outside the range of those automatically provided with the voice driver. The dx_bldtngen( ) function defines a tone template structure, TN_GEN. The dx_playtone( ) function can then be used to generate the tone. See the Voice API Programming Guide for a full description of global tone generation. The global tone generation functions are: dx_bldtngen( ) builds a user-defined tone template structure, TN_GEN Voice API for Windows Operating Systems Library Reference — November 2003 23 Function Summary by Category dx_playtone( ) plays a user-defined tone as defined in TN_GEN structure dx_playtoneEx( ) plays the cadenced tone defined by TN_GENCAD structure Note: 1.14 The dx_playtone( ) and dx_playtoneEx( ) functions can also be classified as an I/O function and all I/O characteristics apply. R2/MF Convenience Functions R2/MF convenience functions enable detection of R2/MF forward signals on a channel, and play R2/MF backward signals in response. For more information about voice support for R2/MF, see the Voice API Programming Guide. Note: R2/MF signaling is typically accomplished through the Global Call API. For more information, see the Global Call documentation set. The R2/MF functions listed here are provided for backward compatibility only and should not be used for R2/MF signaling. r2_creatfsig( ) creates R2/MF forward signal tone r2_playbsig( ) plays R2/MF backward signal tone 1.15 Speed and Volume Functions Speed and volume functions adjust the speed and volume of the play. A speed modification table and volume modification table are associated with each channel, and can be used for increasing or decreasing the speed or volume. These tables have default values which can be changed using the dx_setsvmt( ) function. The dx_addspddig( ) and dx_addvoldig( ) functions are convenience functions that specify a digit and an adjustment to occur on that digit, without having to set any data structures. These functions use the default settings of the speed and volume modification tables. See the Voice API Programming Guide for more information about the speed and volume feature in general, and speed and volume modification tables in particular. The speed and volume functions are: dx_adjsv( ) adjusts speed or volume immediately dx_addspddig( ) sets a dual tone multi-frequency (DTMF) digit for speed adjustment dx_addvoldig( ) adds a dual tone multi-frequency (DTMF) digit for volume adjustment 24 Voice API for Windows Operating Systems Library Reference — November 2003 Function Summary by Category dx_clrsvcond( ) clears speed or volume conditions dx_getcursv( ) returns current speed and volume settings dx_getsvmt( ) returns current speed or volume modification table dx_setsvcond( ) sets conditions (such as digit) for speed or volume adjustment; also sets conditions for play (pause and resume) dx_setsvmt( ) changes default values of speed or volume modification table 1.16 Call Progress Analysis Functions Call progress analysis functions are used to enable the call progress analysis feature and change the default definition of call progress analysis tones. See the Voice API Programming Guide for more information about call progress analysis. Notes: 1. Two forms of call progress analysis exist: basic and PerfectCall (formerly called “enhanced call analysis”). PerfectCall call progress analysis uses an improved method of signal identification and can detect fax machines and answering machines. Basic call progress analysis provides backward compatibility for older applications written before PerfectCall call progress analysis became available. 2. Throughout this document, call progress analysis refers to PerfectCall call progress analysis unless otherwise noted. The call progress analysis functions are: dx_chgdur( ) changes the default call progress analysis signal duration dx_chgfreq( ) changes the default call progress analysis signal frequency dx_chgrepcnt( ) changes the default call progress analysis signal repetition count dx_initcallp( ) initializes call progress analysis on a channel dx_createtone( ) creates a new tone definition for a specific call progress tone dx_deletetone( ) deletes a specific call progress tone dx_querytone( ) returns tone information for a specific call progress tone Voice API for Windows Operating Systems Library Reference — November 2003 25 Function Summary by Category 1.17 Caller ID Functions Caller ID functions are used to handle caller ID requests. Caller ID is enabled by setting a channelbased parameter in dx_setparm( ). See the Voice API Programming Guide for more information about caller ID. dx_gtcallid( ) returns the calling line directory number (DN) dx_gtextcallid( ) returns the requested caller ID message by specifying the message type ID dx_wtcallid( ) waits for rings and reports caller ID, if available 1.18 File Manipulation Functions These file manipulation functions map to C run-time functions, and can only be used if the file is opened with the dx_fileopen( ) function. The arguments for these Intel® Dialogic® functions are identical to the equivalent Microsoft* Visual C++ run-time functions. dx_fileclose( ) closes the file associated with the handle dx_fileerrno( ) obtains the system error value dx_fileopen( ) opens the file specified by filep dx_fileread( ) reads data from the file associated with the handle dx_fileseek( ) moves a file pointer associated with the handle dx_filewrite( ) writes data from a buffer into a file associated with the handle 1.19 Echo Cancellation Resource Functions The echo cancellation resource (ECR) feature is a voice channel mode that reduces the echo component in an external TDM bus time slot signal. The echo cancellation resource functions enable use of the ECR feature. Note: The ECR functions have been replaced by the continuous speech processing (CSP) API functions. CSP provides enhanced echo cancellation. For more information, see the Continuous Speech Processing API Programming Guide and Continuous Speech Processing API Programming Guide. dx_getxmitslotecr( ) provides the TDM bus transmit time-slot number of the specified voice channel device when in ECR mode 26 Voice API for Windows Operating Systems Library Reference — November 2003 Function Summary by Category dx_listenecr( ) enables echo cancellation on a specified voice channel and connects the voice channel to the echo-referenced signal on the specified TDM bus time slot (ECR mode) dx_listenecrex( ) performs identically to dx_listenecr( ) and also provides the ability to modify the characteristics of the echo canceller dx_unlistenecr( ) disables echo cancellation on a specified voice channel and disconnects the voice channel from the echo-referenced signal (SVP mode) 1.20 Structure Clearance Functions These functions do not affect a device. The dx_clrcap( ) and dx_clrtpt( ) functions provide a convenient method for clearing the DX_CAP and DV_TPT data structures. These structures are discussed in Chapter 4, “Data Structures”. dx_clrcap( ) clears all fields in a DX_CAP structure dx_clrtpt( ) clears all fields in a DV_TPT structure 1.21 Syntellect License Automated Attendant Functions These functions are used with Intel® Dialogic® products that are licensed for specific telephony patents held by Syntellect Technology Corporation. For more information, see the Voice API Programming Guide. li_attendant( ) performs the actions of an automated attendant li_islicensed_syntellect( ) verifies Syntellect patent license on board 1.22 Extended Attribute Functions Voice library extended attribute functions return information specific to the voice device specified in the function call. ATDX_ANSRSIZ( ) returns the duration of the answer detected during call progress analysis ATDX_BDNAMEP( ) returns a pointer to the board device name string ATDX_BDTYPE( ) returns the board type for the device Voice API for Windows Operating Systems Library Reference — November 2003 27 Function Summary by Category ATDX_BUFDIGS( ) returns the number of digits in the firmware since the last dx_getdig( ) for a given channel ATDX_CHNAMES( ) returns a pointer to an array of channel name strings ATDX_CHNUM( ) returns the channel number on board associated with the channel device handle ATDX_CONNTYPE( ) returns the connection type for a completed call ATDX_CPERROR( ) returns call progress analysis error ATDX_CPTERM( ) returns last call progress analysis termination ATDX_CRTNID( ) returns the identifier of the tone that caused the most recent call progress analysis termination ATDX_DEVTYPE( ) returns device type (board or channel) ATDX_DTNFAIL( ) returns the dial tone character that indicates which dial tone call progress analysis failed to detect ATDX_FRQDUR( ) returns the duration of the first special information tone (SIT) frequency ATDX_FRQDUR2( ) returns the duration of the second special information tone (SIT) frequency ATDX_FRQDUR3( ) returns the duration of the third special information tone (SIT) frequency ATDX_FRQHZ( ) returns the frequency of the first detected SIT ATDX_FRQHZ2( ) returns the frequency of the second detected SIT ATDX_FRQHZ3( ) returns the frequency of the third detected SIT ATDX_FRQOUT( ) returns the percentage of frequency out of bounds detected during call progress analysis ATDX_FWVER( ) returns the firmware version ATDX_HOOKST( ) returns the current hook state of the channel ATDX_LINEST( ) returns the current line status of the channel ATDX_LONGLOW( ) returns the duration of longer silence detected during call progress analysis 28 Voice API for Windows Operating Systems Library Reference — November 2003 Function Summary by Category ATDX_PHYADDR( ) returns the physical address of board ATDX_SHORTLOW( ) returns the duration of shorter silence detected during call progress analysis ATDX_SIZEHI( ) returns the duration of non-silence detected during call progress analysis ATDX_STATE( ) returns the current state of the device ATDX_TERMMSK( ) returns the reason for last I/O function termination in a bitmap ATDX_TONEID( ) returns the tone ID (used in global tone detection) ATDX_TRCOUNT( ) returns the last record or play transfer count 1.23 Voice Function Support by Platform Table 1 provides an alphabetical listing of voice API functions. The table indicates which platforms (DM3 or Springware) are supported for each of the functions. DM3 boards refers to products based on the Intel® DM3 mediastream architecture. Typically DM3 board names have the prefix “DM,” such as Intel® NetStructure™ DM/V2400A-PCI. Springware boards refer to boards based on earlier-generation architecture. Typically Springware board names have the prefix “D,” such as Intel® Dialogic® D/240JCT-T1. Although a function may be supported on both DM3 and Springware boards, there may be some restrictions on its use. For example, some parameters or parameter values may not be supported. For details, see the function reference descriptions in Chapter 2, “Function Information”. Table 1. Voice Function Support by Platform Function DM3 Springware ag_getctinfo( ) NS S ag_getxmitslot( ) NS S ag_listen( ) NS S ag_unlisten( ) NS S ai_close( ) S NS ai_getxmitslot( ) S NS NS = Not supported S = Supported * = Variances between platforms; refer to the function reference for more information. † = Asynchronous and synchronous mode supported (all other functions support synchronous mode only) ‡ = On DM3, call progress analysis is available directly through dx_dial( ). Voice API for Windows Operating Systems Library Reference — November 2003 29 Function Summary by Category Table 1. Voice Function Support by Platform (Continued) Function DM3 Springware ATDX_ANSRSIZ( ) NS S ATDX_BDNAMEP( ) S S ATDX_BDTYPE( ) S S ATDX_BUFDIGS( ) S S ATDX_CHNAMES( ) S S ATDX_CHNUM( ) S S ATDX_CONNTYPE( ) S S ATDX_CPERROR( ) S S ATDX_CPTERM( ) S S ATDX_CRTNID( ) NS S ATDX_DEVTYPE( ) S S ATDX_DTNFAIL( ) NS S ATDX_FRQDUR( ) NS S ATDX_FRQDUR2( ) NS S ATDX_FRQDUR3( ) NS S ATDX_FRQHZ( ) NS S ATDX_FRQHZ2( ) NS S ATDX_FRQHZ3( ) NS S ATDX_FRQOUT( ) NS S ATDX_FWVER( ) NS S ATDX_HOOKST( ) NS S ATDX_LINEST( ) NS S ATDX_LONGLOW( ) NS S ATDX_PHYADDR( ) NS S ATDX_SHORTLOW( ) NS S ATDX_SIZEHI( ) NS S ATDX_STATE( ) S S ATDX_TERMMSK( ) S S ATDX_TONEID( ) S S ATDX_TRCOUNT( ) S S dx_addspddig( ) S* S dx_addtone( ) S* S NS = Not supported S = Supported * = Variances between platforms; refer to the function reference for more information. † = Asynchronous and synchronous mode supported (all other functions support synchronous mode only) ‡ = On DM3, call progress analysis is available directly through dx_dial( ). 30 Voice API for Windows Operating Systems Library Reference — November 2003 Function Summary by Category Table 1. Voice Function Support by Platform (Continued) Function DM3 Springware dx_addvoldig( ) S* S dx_adjsv( ) S S dx_blddt( ) S S dx_blddtcad( ) S S dx_bldst( ) S S dx_bldstcad( ) S S dx_bldtngen( ) S S dx_cacheprompt( ) † S NS dx_chgdur( ) NS S dx_chgfreq( ) NS S dx_chgrepcnt( ) NS S dx_close( ) S S dx_CloseStreamBuffer( ) S NS dx_clrcap( ) S S dx_clrdigbuf( ) S S dx_clrsvcond( ) S S dx_clrtpt( ) S S dx_createtone( ) † S NS dx_deletetone( ) † S NS dx_deltones( ) S S dx_dial( ) † S S dx_distone( ) S S dx_enbtone( ) S S dx_fileclose( ) S S dx_fileopen( ) S S dx_fileerrno( ) S S dx_fileread( ) S S dx_fileseek( ) S S dx_filewrite( ) S S dx_getcachesize( ) S NS dx_getctinfo( ) S S dx_getcursv( ) S S NS = Not supported S = Supported * = Variances between platforms; refer to the function reference for more information. † = Asynchronous and synchronous mode supported (all other functions support synchronous mode only) ‡ = On DM3, call progress analysis is available directly through dx_dial( ). Voice API for Windows Operating Systems Library Reference — November 2003 31 Function Summary by Category Table 1. Voice Function Support by Platform (Continued) Function DM3 Springware dx_getdig( ) † S S dx_GetDllVersion( ) S S dx_getevt( ) S S dx_getfeaturelist( ) S S dx_getparm( ) S S dx_GetRscStatus( ) NS S dx_GetStreamInfo( ) S NS dx_getsvmt( ) S S dx_getxmitslot( ) S* S dx_getxmitslotecr( ) NS S dx_gtcallid( ) NS S dx_gtextcallid( ) NS S dx_gtsernum( ) S S dx_initcallp( ) ‡ NS S dx_libinit( ) S S dx_listen( ) S* S dx_listenecr( ) NS S dx_listenecrex( ) NS S dx_open( ) S S dx_OpenStreamBuffer( ) S NS dx_mreciottdata( ) S S dx_pause( ) S NS dx_play( ) † S S dx_playf( ) S S dx_playiottdata( ) † S S dx_playtone( ) † S S dx_playtoneEx( ) † S S dx_playwav( ) S S dx_PutStreamData( ) S NS dx_querytone( ) † S NS dx_rec( ) † S* S dx_recf( ) S S NS = Not supported S = Supported * = Variances between platforms; refer to the function reference for more information. † = Asynchronous and synchronous mode supported (all other functions support synchronous mode only) ‡ = On DM3, call progress analysis is available directly through dx_dial( ). 32 Voice API for Windows Operating Systems Library Reference — November 2003 Function Summary by Category Table 1. Voice Function Support by Platform (Continued) Function DM3 Springware dx_reciottdata( ) † S* S dx_recvox( ) S S dx_recwav( ) S S dx_ResetStreamBuffer( ) S NS dx_resume( ) S NS dx_RxIottData( ) † S S dx_sendevt( ) NS S dx_setchxfercnt( ) S S dx_setdevuio( ) S S dx_setdigbuf( ) NS S dx_setdigtyp( ) S* S dx_setevtmsk( ) S* S dx_setgtdamp( ) S S dx_sethook( ) † NS S dx_setparm( ) S* S dx_SetRecordNotifyBeepTone( ) S NS dx_setsvcond( ) S* S dx_setsvmt( ) S S dx_settonelen( ) NS S dx_setuio( ) S S dx_SetWaterMark( ) S NS dx_stopch( ) † S S dx_TSFStatus( ) NS S dx_TxIottData( ) † S S dx_TxRxIottData( ) † S S dx_unlisten( ) S* S dx_unlistenecr( ) NS S dx_wink( ) † NS S dx_wtcallid( ) NS S dx_wtring( ) NS S li_attendant( ) NS S li_islicensed_syntellect( ) NS S NS = Not supported S = Supported * = Variances between platforms; refer to the function reference for more information. † = Asynchronous and synchronous mode supported (all other functions support synchronous mode only) ‡ = On DM3, call progress analysis is available directly through dx_dial( ). Voice API for Windows Operating Systems Library Reference — November 2003 33 Function Summary by Category Table 1. Voice Function Support by Platform (Continued) Function DM3 Springware nr_scroute( ) S* S nr_scunroute( ) S* S r2_creatfsig( ) NS S r2_playbsig( ) † NS S NS = Not supported S = Supported * = Variances between platforms; refer to the function reference for more information. † = Asynchronous and synchronous mode supported (all other functions support synchronous mode only) ‡ = On DM3, call progress analysis is available directly through dx_dial( ). 34 Voice API for Windows Operating Systems Library Reference — November 2003 Function Information 2. 2 This chapter provides an alphabetical reference to the functions in the voice library. 2.1 Function Syntax Conventions The voice functions use the following syntax: data_type voice_function(device_handle, parameter1, ... parameterN) where: data type refers to the data type, such as integer, long or void voice_function represents the function name. Typically, voice functions begin with “dx” although there are exceptions. Extended attribute functions begin with “ATDX.” device_handle represents the device handle, which is a numerical reference to a device, obtained when a device is opened. The device handle is used for all operations on that device. parameter1 represents the first parameter parameterN represents the last parameter Voice API for Windows Operating Systems Library Reference — November 2003 35 ag_getctinfo( ) — get information about an analog device ag_getctinfo( ) get information about an analog device Name: int ag_getctinfo(chdev, ct_devinfop) Inputs: int chdev • valid analog channel device handle CT_DEVINFO *ct_devinfop • pointer to device information structure Returns: 0 on success -1 on error Includes: srllib.h dxxxlib.h Category: Routing Mode: synchronous Platform: Springware ! Description The ag_getctinfo( ) function returns information about an analog channel on an analog device. This information is contained in a CT_DEVINFO structure. Parameter Description chdev specifies the valid analog channel handle obtained when the channel was opened using dx_open( ) ct_devinfop specifies a pointer to the data structure CT_DEVINFO ! Cautions This function will fail if an invalid channel handle is specified. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Parameter error EDX_SH_BADEXTTS TDM bus time slot is not supported at current clock rate EDX_SH_BADINDX Invalid Switch Handler library index number EDX_SH_BADTYPE Invalid channel type (voice, analog, etc.) 36 Voice API for Windows Operating Systems Library Reference — November 2003 get information about an analog device — ag_getctinfo( ) EDX_SH_CMDBLOCK Blocking command is in progress EDX_SH_LIBBSY Switch Handler library is busy EDX_SH_LIBNOTINIT Switch Handler library is uninitialized EDX_SH_MISSING Switch Handler is not present EDX_SH_NOCLK Switch Handler clock fallback failed EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example #include#include main() { int chdev; CT_DEVINFO ct_devinfo; /* Channel device handle */ /* Device information structure */ /* Open board 1 channel 1 devices */ if ((chdev = dx_open("dxxxB1C1", 0)) == -1) { /* process error */ } /* Get Device Information */ if (ag_getctinfo(chdev, &ct_devinfo) == -1) { printf("Error message = %s", ATDV_ERRMSGP(chdev)); exit(1); } printf("%s Product Id = 0x%x, Family = %d, Mode = %d, Network = %d, Bus mode = %d, Encoding = %d", ATDV_NAMEP(chdev), ct_devinfo.ct_prodid, ct_devinfo.ct_devfamily, ct_devinfo.ct_devmode, ct_devinfo.ct_nettype, ct_devinfo.ct_busmode, ct_devinfo.ct_busencoding); } ! See Also • dt_getctinfo( ) in the Digital Network Interface Software Reference • dx_getctinfo( ) Voice API for Windows Operating Systems Library Reference — November 2003 37 ag_getxmitslot( ) — get TDM bus time slot number of analog transmit channel ag_getxmitslot( ) get TDM bus time slot number of analog transmit channel Name: int ag_getxmitslot(chdev, sc_tsinfop) Inputs: int chdev • valid analog channel device handle SC_TSINFO *sc_tsinfop • pointer to TDM bus time slot information structure Returns: 0 on success -1 on error Includes: srllib.h dxxxlib.h Category: Routing Mode: synchronous Platform: Springware ! Description The ag_getxmitslot( ) function provides the TDM bus time slot number of the analog transmit channel. This information is contained in an SC_TSINFO structure that also includes the number of the time slot connected to the analog transmit channel. For more information on this structure, see SC_TSINFO, on page 529. Note: Routing convenience function nr_scroute( ) includes ag_getxmitslot( ) functionality. Parameter Description chdev specifies the valid analog channel handle obtained when the channel was opened using dx_open( ) sc_tsinfop specifies a pointer to the data structure SC_TSINFO An analog channel can transmit on only one TDM bus time slot. ! Cautions This function fails if an invalid channel device handle is specified. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Parameter error EDX_SH_BADCMD Command is not supported in current bus configuration 38 Voice API for Windows Operating Systems Library Reference — November 2003 get TDM bus time slot number of analog transmit channel — ag_getxmitslot( ) EDX_SH_BADINDX Invalid Switch Handler library index number EDX_SH_BADLCTS Invalid channel number EDX_SH_BADMODE Function is not supported in current bus configuration EDX_SH_BADTYPE Invalid channel type (voice, analog, etc.) number EDX_SH_CMDBLOCK Blocking command is in progress EDX_SH_LCLDSCNCT Channel is already disconnected from TDM bus time slot EDX_SH_LIBBSY Switch Handler library is busy EDX_SH_LIBNOTINIT Switch Handler library is uninitialized EDX_SH_MISSING Switch Handler is not present EDX_SH_NOCLK Switch Handler clock fallback failed EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example #include #include #include main() { int chdev; SC_TSINFO sc_tsinfo; long scts; /* Channel device handle */ /* Time slot information structure */ /* TDM bus time slot */ /* Open board 1 channel 1 devices */ if ((chdev = dx_open("dxxxB1C1", 0)) == -1) { /* process error */ } /* Fill in the TDM bus time slot information */ sc_tsinfo.sc_numts = 1; sc_tsinfo.sc_tsarrayp = &scts; /* Get TDM bus time slot connected to transmit of analog channel 1 on board ...1 */ if (ag_getxmitslot(chdev, &sc_tsinfo) == -1) { printf("Error message = %s", ATDV_ERRMSGP(chdev)); exit(1); } printf("%s is transmitting on TDM bus time slot %d", ATDV_NAMEP(chdev), ...scts); } Voice API for Windows Operating Systems Library Reference — November 2003 39 ag_getxmitslot( ) — get TDM bus time slot number of analog transmit channel ! See Also 40 • ag_listen( ) • dt_listen( ) in the Digital Network Interface Software Reference • dx_listen( ) • fx_listen( ) in the Fax Software Reference • ms_listen( ) in the Modular Station Interface API Library Reference Voice API for Windows Operating Systems Library Reference — November 2003 connect analog receive channel to TDM bus time slot — ag_listen( ) ag_listen( ) connect analog receive channel to TDM bus time slot Name: int ag_listen (chdev, sc_tsinfop) Inputs: int chdev • valid analog channel device handle SC_TSINFO *sc_tsinfop • pointer to TDM bus time slot information structure Returns: 0 on success -1 on error Includes: srllib.h dxxxlib.h Category: Routing Mode: synchronous Platform: Springware ! Description The ag_listen( ) function connects an analog receive channel to a TDM bus time slot. This function uses the information stored in the SC_TSINFO data structure to connect the analog receive (listen) channel to a TDM bus time slot. This function sets up a half-duplex connection. For a full-duplex connection, the receive (listen) channel of the other device must be connected to the analog transmit channel. Due to analog signal processing on voice boards with on-board analog devices, a voice device and its corresponding analog device (analog device 1 to voice device 1, etc.) comprise a single channel. At system initialization, default TDM bus routing is to connect these devices in full-duplex communications. Note: Routing convenience function nr_scroute( ) includes ag_listen( ) functionality. Parameter Description chdev specifies the valid analog channel device handle obtained when the channel was opened using dx_open( ) sc_tsinfop specifies a pointer to the SC_TSINFO structure. For more information on this structure, see SC_TSINFO, on page 529. Although multiple analog channels may listen (be connected) to the same TDM bus time slot, the analog receive (listen) channel can connect to only one TDM bus time slot. ! Cautions This function will fail when an invalid channel handle or invalid TDM bus time slot number is specified. Voice API for Windows Operating Systems Library Reference — November 2003 41 ag_listen( ) — connect analog receive channel to TDM bus time slot ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Parameter error EDX_SH_BADCMD Command is not supported in current bus configuration EDX_SH_BADEXTTS TDM bus time slot is not supported at current clock rate EDX_SH_BADINDX Invalid Switch Handler index number EDX_SH_BADLCLTS Invalid channel number EDX_SH_BADMODE Function is not supported in current bus configuration EDX_SH_BADTYPE Invalid channel local time slot type (voice, analog, etc.) EDX_SH_CMDBLOCK Blocking command is in progress EDX_SH_LCLTSCNCT Channel is already connected to TDM bus time slot EDX_SH_LIBBSY Switch Handler library is busy EDX_SH_LIBNOTINIT Switch Handler library is uninitialized EDX_SH_NOCLK Switch Handler clock fallback failed EDX_SYSTEM System error ! Example #include #include #include #include #include main() { int chdev; /* Voice Channel handle */ /* Open board 1 channel 1 device */ if ((chdev = dx_open("dxxxB1C1", 0)) == -1) { /* process error */ } /* Disconnect receive of board 1, channel 1 from TDM bus time slot */ if (ag_unlisten(chdev) == -1) { printf("Error message = %s", ATDV_ERRMSGP(chdev)); exit(1); } } ! See Also • ag_listen( ) Voice API for Windows Operating Systems Library Reference — November 2003 45 ai_close( ) — close an audio input device ai_close( ) close an audio input device Name: int ai_close(devh) Inputs: int devh • valid audio input device handle Returns: 0 if successful -1 if failure Includes: srllib.h dxxxlib.h Category: Audio Input Mode: synchronous Platform: DM3 ! Description The ai_close( ) function closes an audio input device that was previously opened using ai_open( ). This function releases the handle and breaks any link between the calling process and the device. Parameter Description devh specifies the valid device handle obtained when an audio input device is opened using ai_open( ) ! Cautions This function fails when an invalid channel device handle is specified. ! Errors If this function returns -1 to indicate failure, a system error has occurred; use dx_fileerrno( ) to obtain the system error value. Refer to the dx_fileerrno( ) function for a list of the possible system error values. ! Example #include #include #include #include int main() { int SC_TSINFO long 46 aidev; sc_tsinfo; scts; /* Audio input device handle */ /* Time slot information structure */ /* TDM bus time slot */ Voice API for Windows Operating Systems Library Reference — November 2003 close an audio input device — ai_close( ) /* Open audio input device aiB1 */ if ((aidev = ai_open("aiB1")) < 0) { /* process error */ } /* Fill in the TDM bus time slot information */ sc_tsinfo.sc_numts = 1; sc_tsinfo.sc_tsarrayp = &scts; /* Get TDM bus time slot connected to transmit of audio input device */ if (ai_getxmitslot(aidev, &sc_tsinfo) < 0) { /* process error */ } else { printf("%s is transmitting on TDM time slot %d", ATDV_NAMEP(aidev), scts); } /* Close audio input device */ if (ai_close(aidev) < 0) { /* process error */ } return 0; } ! See Also • ai_getxmitslot( ) • ai_open( ) Voice API for Windows Operating Systems Library Reference — November 2003 47 ai_getxmitslot( ) — get TDM bus time slot number of audio input transmit channel ai_getxmitslot( ) get TDM bus time slot number of audio input transmit channel Name: int ai_getxmitslot(devh, sc_tsinfop) Inputs: int devh • valid audio input device handle SC_TSINFO *sc_tsinfop • pointer to TDM bus time slot information structure Returns: 0 on success -1 on error Includes: srllib.h dxxxlib.h Category: Audio Input Mode: synchronous Platform: DM3 ! Description The ai_getxmitslot( ) function returns the TDM bus time slot number of the audio input transmit channel. The TDM bus time slot information is contained in an SC_TSINFO structure. Parameter Description devh specifies the valid device handle obtained when the audio input device is opened using ai_open( ) sc_tsinfop specifies a pointer to the TDM bus time slot information structure, SC_TSINFO. The sc_numts field of the SC_TSINFO structure must be initialized with the number of TDM bus time slots requested (1). The sc_tsarrayp field of the SC_TSINFO structure must be initialized with a valid pointer to a long variable. Upon successful return from the function, the long variable will contain the number of the time slot on which the audio input device transmits. For more information on this structure, see SC_TSINFO, on page 529. ! Cautions This function fails when an invalid channel device handle is specified. ! Errors If the function returns -1, use the SRL Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. 48 Voice API for Windows Operating Systems Library Reference — November 2003 get TDM bus time slot number of audio input transmit channel — ai_getxmitslot( ) ! Example #include #include #include #include int main() { int SC_TSINFO long aidev; sc_tsinfo; scts; /* Audio input device handle */ /* Time slot information structure */ /* TDM bus time slot */ /* Open audio input device aiB1 */ if ((aidev = ai_open("aiB1")) < 0) { /* process error */ } /* Fill in the TDM bus time slot information */ sc_tsinfo.sc_numts = 1; sc_tsinfo.sc_tsarrayp = &scts; /* Get TDM bus time slot connected to transmit of audio input device */ if (ai_getxmitslot(aidev, &sc_tsinfo) < 0) { /* process error */ } else { printf("%s is transmitting on TDM time slot %d", ATDV_NAMEP(aidev), scts); } /* Close audio input device */ if (ai_close(aidev) < 0) { /* process error */ } return 0; } ! See Also • ai_open( ) • ai_close( ) Voice API for Windows Operating Systems Library Reference — November 2003 49 ai_open( ) — open an audio input device ai_open( ) open an audio input device Name: int ai_open(namep) Inputs: const char *namep • pointer to an ASCIIZ string that contains the name of a valid audio input device Returns: audio input device handle if successful -1 if failure Includes: srllib.h dxxxlib.h Category: Audio Input Mode: synchronous Platform: DM3 ! Description The ai_open( ) function opens an audio input device and returns a unique device handle to identify the device. Until the device is closed, all subsequent references to the opened device must be made using the handle. Parameter Description namep points to an ASCIIZ string that contains the name of the valid audio input device, in the form aiBn, where n is the audio input device number ! Cautions This function will fail and return -1 if: • The device name is invalid. • A hardware error on the board or channel is discovered. ! Errors If this function returns -1 to indicate failure, a system error has occurred; use dx_fileerrno( ) to obtain the system error value. Refer to the dx_fileerrno( ) function for a list of the possible system error values. ! Example #include #include #include #include 50 Voice API for Windows Operating Systems Library Reference — November 2003 open an audio input device — ai_open( ) int main() { int SC_TSINFO long aidev; sc_tsinfo; scts; /* Audio input device handle */ /* Time slot information structure */ /* TDM bus time slot */ /* Open audio input device aiB1 */ if ((aidev = ai_open("aiB1")) < 0) { /* process error */ } /* Fill in the TDM bus time slot information */ sc_tsinfo.sc_numts = 1; sc_tsinfo.sc_tsarrayp = &scts; /* Get TDM bus time slot connected to transmit of audio input device */ if (ai_getxmitslot(aidev, &sc_tsinfo) < 0) { /* process error */ } else { printf("%s is transmitting on TDM time slot %d", ATDV_NAMEP(aidev), scts); } /* Close audio input device */ if (ai_close(aidev) < 0) { /* process error */ } return 0; } ! See Also • ai_close( ) • ai_getxmitslot( ) • sr_getboardcnt( ) Voice API for Windows Operating Systems Library Reference — November 2003 51 ATDX_ANSRSIZ( ) — return the duration of the answer ATDX_ANSRSIZ( ) return the duration of the answer Name: long ATDX_ANSRSIZ(chdev) Inputs: int chdev • valid channel device handle Returns: answer duration in 10 msec units if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_ANSRSIZ( ) function returns the duration of the answer that occurs when dx_dial( ) with Basic call progress analysis enabled is called on a channel. An answer is considered the period of non-silence that begins after cadence is broken and a connection is made. This measurement is taken before a connect event is returned. The duration of the answer can be used to determine if the call was answered by a person or an answering machine. This feature is based on the assumption that an answering machine typically answers a call with a longer greeting than a live person does. See the Voice API Programming Guide for information about call progress analysis. Also see this guide for information about how cadence detection parameters affect a connect and are used to distinguish between a live voice and a voice recorded on an answering machine. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example /* Call Progress Analysis with user-specified parameters */ #include #include #include 52 Voice API for Windows Operating Systems Library Reference — November 2003 return the duration of the answer — ATDX_ANSRSIZ( ) main() { int cares, chdev; DX_CAP capp; . . /* open the channel using dx_open( ). Obtain channel device descriptor in * chdev */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* take the phone off-hook */ if (dx_sethook(chdev,DX_OFFHOOK,EV_SYNC) == -1) { /* process error */ } /* Set the DX_CAP structure as needed for call progress analysis. Perform the * outbound dial with call progress analysis enabled */ if ((cares = dx_dial(chdev,"5551212",&capp,DX_CALLP|EV_SYNC)) == -1) { /* perform error routine */ } switch (cares) { case CR_CNCT: /* Call Connected, get some additional info */ printf("\nDuration of short low - %ld ms",ATDX_SHORTLOW(chdev)*10); printf("\nDuration of long low - %ld ms",ATDX_LONGLOW(chdev)*10); printf("\nDuration of answer - %ld ms",ATDX_ANSRSIZ(chdev)*10); break; case CR_CEPT: /* Operator Intercept detected */ printf("\nFrequency detected - %ld Hz",ATDX_FRQHZ(chdev)); printf("\n%% of Frequency out of bounds - %ld Hz",ATDX_FRQOUT(chdev)); break; case CR_BUSY: . . } } ! See Also • dx_dial( ) • DX_CAP data structure Voice API for Windows Operating Systems Library Reference — November 2003 53 ATDX_BDNAMEP( ) — return a pointer to the board device name ATDX_BDNAMEP( ) return a pointer to the board device name Name: char * ATDX_BDNAMEP(chdev) Inputs: int chdev • valid channel device handle Returns: pointer to board device name string if successful pointer to ASCIIZ string “Unknown device” if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_BDNAMEP( ) function returns a pointer to the board device name on which the channel accessed by chdev resides. As illustrated in the example, this may be used to open the board device that corresponds to a particular channel device prior to setting board parameters. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function will fail and return a pointer to “Unknown device” if an invalid channel device handle is specified in chdev. ! Example #include #include #include main() { int chdev, bddev; char *bdnamep; . 54 Voice API for Windows Operating Systems Library Reference — November 2003 return a pointer to the board device name — ATDX_BDNAMEP( ) . /* Open the channel device */ if ((chdev = dx_open("dxxxB1C1", NULL)) == -1) { /* Process error */ } /* Display board name */ bdnamep = ATDX_BDNAMEP(chdev); printf("The board device is: %s\n", bdnamep); /* Open the board device */ if ((bddev = dx_open(bdnamep, NULL)) == -1) { /* Process error */ } . . } ! See Also None. Voice API for Windows Operating Systems Library Reference — November 2003 55 ATDX_BDTYPE( ) — return the board type for the device ATDX_BDTYPE( ) return the board type for the device Name: long ATDX_BDTYPE(dev) Inputs: int dev • valid board or channel device handle Returns: board or channel device type if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_BDTYPE( ) function returns the board type for the device specified in dev. A typical use would be to determine whether or not the device can support particular features, such as call progress analysis. Parameter Description dev specifies the valid device handle obtained when a board or channel was opened using dx_open( ) Possible return values are the following: DI_D41BD D/41 Board Device. This value represents the “dxxxBn type” devices (virtual boards). DI_D41CH D/41 Channel Device. This value represents the “dxxxBnCm” type devices (channel device). The values DI_41BD and DI_41CH will be returned for any D/41 board, and any board which emulates the voice resources of multiple D/41 boards. ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid board or channel device handle is specified in dev. 56 Voice API for Windows Operating Systems Library Reference — November 2003 return the board type for the device — ATDX_BDTYPE( ) ! Example #include #include #include #define ON 1 main() { int bddev; long bdtype; int call_analysis=0; /* Open the board device */ if ((bddev = dx_open("dxxxB1",NULL)) == -1) { /* Process error */ } if((bdtype = ATDX_BDTYPE(bddev)) == AT_FAILURE) { /* Process error */ } if(bdtype == DI_D41BD) { printf("Device is a D/41 Board\n"); call_analysis = ON; } . . } ! See Also None. Voice API for Windows Operating Systems Library Reference — November 2003 57 ATDX_BUFDIGS( ) — return the number of uncollected digits ATDX_BUFDIGS( ) return the number of uncollected digits Name: long ATDX_BUFDIGS(chdev) Inputs: int chdev • valid channel device handle Returns: number of uncollected digits in the firmware buffer if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_BUFDIGS( ) function returns the number of uncollected digits in the firmware buffer for channel chdev. This is the number of digits that have arrived since the last call to dx_getdig( ) or the last time the buffer was cleared using dx_clrdigbuf( ). The digit buffer contains a maximum of 31 digits and a null terminator. This function is supported on DM3 boards but must be manually enabled. You must enable the function before the application is loaded in memory. To enable this function, set parameter SupportForSignalCounting to 1 in Key HKEY_LOCAL_MACHINE\SOFTWARE\Dialogic\Cheetah\CC. To subsequently disable this function, set this parameter to 0. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions Digits that adjust speed and volume (see dx_setsvcond( )) will not be passed to the digit buffer. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example #include #include #include 58 Voice API for Windows Operating Systems Library Reference — November 2003 return the number of uncollected digits — ATDX_BUFDIGS( ) main() { int chdev; long bufdigs; DX_IOTT iott; DV_TPT tpt[2]; /* Open the device using dx_open( ). Get channel device descriptor in * chdev. */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* set up DX_IOTT */ iott.io_type = IO_DEV|IO_EOT; iott.io_bufp = 0; iott.io_offset = 0; iott.io_length = -1; /* play till end of file */ if((iott.io_fhandle = dx_fileopen("prompt.vox", O_RDONLY)) == -1) /* process error */ } /* set up DV_TPT */ dx_clrtpt(tpt,2); tpt[0].tp_type = IO_CONT; tpt[0].tp_termno = DX_MAXDTMF; tpt[0].tp_length = 4; tpt[0].tp_flags = TF_MAXDTMF; tpt[1].tp_type = IO_EOT; tpt[1].tp_termno = DX_DIGMASK; tpt[1].tp_length = DM_5; tpt[1].tp_flags = TF_DIGMASK; { /* Maximum digits */ /* terminate on 4 digits */ /* Use the default flags */ /* Digit termination */ /* terminate on the digit "5" */ /* Use the default flags */ /* Play a voice file. Terminate on receiving 4 digits, the digit "5" or * at end of file.*/ if (dx_play(chdev,&iott,tpt,EV_SYNC) == -1) { /* process error */ } /* Check # of digits collected and continue processing. */ if((bufdigs=ATDX_BUFDIGS(chdev))==AT_FAILURE) { /* process error */ } . . . } ! See Also • dx_getdig( ) • dx_clrdigbuf( ) Voice API for Windows Operating Systems Library Reference — November 2003 59 ATDX_CHNAMES( ) — retrieve all channel names for a board ATDX_CHNAMES( ) retrieve all channel names for a board Name: char ** ATDX_CHNAMES(bddev) Inputs: int bddev • valid board device handle Returns: pointer to array of channel names if successful pointer to array of pointers that point to “Unknown device” if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_CHNAMES( ) function returns a pointer to an array of channel names associated with the specified board device handle, bddev. A possible use for this attribute is to display the names of the channel devices associated with a particular board device. Parameter Description bddev specifies the valid board device handle obtained when the board was opened using dx_open( ) ! Cautions None. ! Errors This function will fail and return the address of a pointer to “Unknown device” if an invalid board device handle is specified in bddev. ! Example #include #include #include main() { int bddev, cnt; char **chnames; long subdevs; . . /* Open the board device */ if ((bddev = dx_open("dxxxB1",NULL)) == -1) { 60 Voice API for Windows Operating Systems Library Reference — November 2003 retrieve all channel names for a board — ATDX_CHNAMES( ) /* Process error */ } . . /* Display channels on board */ chnames = ATDX_CHNAMES(bddev); subdevs = ATDV_SUBDEVS(bddev); /* number of sub-devices on board */ printf("Channels on this board are:\n"); for(cnt=0; cnt #include main() { int chdev; long chno; . . /* Open the channel device */ if ((chdev = dx_open("dxxxB1C1", NULL)) == -1) { /* Process error */ } /* Get Channel number */ 62 Voice API for Windows Operating Systems Library Reference — November 2003 return the channel number — ATDX_CHNUM( ) if((chno = ATDX_CHNUM(chdev)) == AT_FAILURE) { /* Process error */ } /* Use chno for application-specific purposes */ . . } ! See Also None. Voice API for Windows Operating Systems Library Reference — November 2003 63 ATDX_CONNTYPE( ) — return the connection type for a completed call ATDX_CONNTYPE( ) return the connection type for a completed call Name: long ATDX_CONNTYPE(chdev) Inputs: int chdev • valid channel device handle Returns: connection type if success AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_CONNTYPE( ) function returns the connection type for a completed call on the channel device chdev. Use this function when a CR_CNCT (called line connected) is returned by ATDX_CPTERM( ) after termination of dx_dial( ) with call progress analysis enabled. See the Voice API Programming Guide for more information about call progress analysis. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) On DM3 boards, possible return values are the following: CON_CAD Connection due to cadence break CON_PVD Connection due to positive voice detection CON_PAMD Connection due to positive answering machine detection On Springware boards, possible return values are the following: CON_CAD Connection due to cadence break CON_LPC Connection due to loop current CON_PVD Connection due to positive voice detection CON_PAMD Connection due to positive answering machine detection 64 Voice API for Windows Operating Systems Library Reference — November 2003 return the connection type for a completed call — ATDX_CONNTYPE( ) ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example #include #include #include main() { int int dxxxdev; cares; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", NULL) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Delete any previous tones */ if ( dx_deltones(dxxxdev) < 0 ) { /* handle error */ } /* * Now enable call progress analysis with above changed settings. */ if (dx_initcallp( dxxxdev )) { /* handle error */ } /* * Take the phone off-hook */ if ( dx_sethook( dxxxdev, DX_OFFHOOK, EV_SYNC ) == -1 ) { printf( "Unable to set the phone off-hook\n" ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Perform an outbound dial with call progress analysis, using * the default call progress analysis parameters. */ if ((cares=dx_dial( dxxxdev, ",84",(DX_CAP *)NULL, DX_CALLP ) ) == -1 ) { printf( "Outbound dial failed - reason = %d\n", ATDX_CPERROR( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } Voice API for Windows Operating Systems Library Reference — November 2003 65 ATDX_CONNTYPE( ) — return the connection type for a completed call printf( "call progress analysis returned %d\n", cares ); if ( cares == CR_CNCT ) { switch ( ATDX_CONNTYPE( dxxxdev ) ) { case CON_CAD: printf( "Cadence Break\n" ); break; case CON_LPC: printf( "Loop Current Drop\n" ); break; case CON_PVD: printf( "Positive Voice Detection\n" ); break; case CON_PAMD: printf( "Positive Answering Machine Detection\n" ); break; default: printf( "Unknown connection type\n" ); break; } } /* * Continue Processing * . * . * . */ /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also 66 • dx_dial( ) • ATDX_CPTERM( ) • DX_CAP data structure Voice API for Windows Operating Systems Library Reference — November 2003 return the call progress analysis error — ATDX_CPERROR( ) ATDX_CPERROR( ) return the call progress analysis error Name: long ATDX_CPERROR(chdev) Inputs: int chdev • valid channel device handle Returns: call progress analysis error if success AT_FAILURE if function fails Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_CPERROR( ) function returns the call progress analysis error that caused dx_dial( ) to terminate when checking for operator intercept Special Information Tone (SIT) sequences. See the Voice API Programming Guide for more information about call progress analysis. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors When dx_dial( ) terminates due to a call progress analysis error, CR_ERROR is returned by ATDX_CPTERM( ). If CR_ERROR is returned, use ATDX_CPERROR( ) to determine the call progress analysis error. One of the following values will be returned: CR_LGTUERR lower frequency greater than upper frequency CR_MEMERR out of memory trying to create temporary Special Information Tone (SIT) tone templates (exceeds maximum number of templates) CR_MXFRQERR invalid ca_maxtimefrq field in DX_CAP. If the ca_mxtimefrq parameter for each SIT is nonzero, it must have a value greater than or equal to the ca_timefrq parameter for the same SIT. Voice API for Windows Operating Systems Library Reference — November 2003 67 ATDX_CPERROR( ) — return the call progress analysis error CR_OVRLPERR overlap in selected SIT tones CR_TMOUTOFF timeout waiting for SIT tone to terminate (exceeds a ca_mxtimefrq parameter) CR_TMOUTON timeout waiting for SIT tone to commence CR_UNEXPTN unexpected SIT tone (the sequence of detected tones did not correspond to the SIT sequence) CR_UPFRQERR invalid upper frequency selection. This value must be nonzero for detection of any SIT. ! Example #include #include #include main() { int int dxxxdev; cares; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", NULL) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Take the phone off-hook */ if ( dx_sethook( dxxxdev, DX_OFFHOOK, EV_SYNC ) == -1 ) { printf( "Unable to set the phone off-hook\n" ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Perform an outbound dial with call progress analysis, using * the default call progress analysis parameters. */ if((cares = dx_dial( dxxxdev,",84",(DX_CAP *) NULL, DX_CALLP )) == -1 ) { printf( "Outbound dial failed - reason = %d\n", ATDX_CPERROR( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Continue Processing * . * . * . */ 68 Voice API for Windows Operating Systems Library Reference — November 2003 return the call progress analysis error — ATDX_CPERROR( ) /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also • dx_dial( ) • ATDX_CPTERM( ) • DX_CAP data structure Voice API for Windows Operating Systems Library Reference — November 2003 69 ATDX_CPTERM( ) — return the last result of call progress analysis termination ATDX_CPTERM( ) return the last result of call progress analysis termination Name: long ATDX_CPTERM(chdev) Inputs: int chdev • valid channel device handle Returns: last call progress analysis termination if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_CPTERM( ) function returns the last result of call progress analysis termination on the channel chdev. Call this function to determine the call status after dialing out with call progress analysis enabled. See the Voice API Programming Guide for more information about call progress analysis. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) Possible return values are the following: CR_BUSY Called line was busy. CR_CEPT Called line received Operator Intercept (SIT). Extended attribute functions provide information on detected frequencies and duration. CR_CNCT Called line was connected. CR_FAXTONE Called line was answered by fax machine or modem. CR_NOANS Called line did not answer. CR_NODIALTONE Timeout occurred while waiting for dial tone. This return value is not supported on DM3 boards. CR_NORB No ringback on called line. 70 Voice API for Windows Operating Systems Library Reference — November 2003 return the last result of call progress analysis termination — ATDX_CPTERM( ) CR_STOPD Call progress analysis stopped due to dx_stopch( ). CR_ERROR Call progress analysis error occurred. Use ATDX_CPERROR( ) to return the type of error. ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example /* Call progress analysis with user-specified parameters */ #include #include main() { int chdev; DX_CAP capp; . . /* open the channel using dx_open( ). Obtain channel device descriptor * in chdev */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* take the phone off-hook */ if (dx_sethook(chdev,DX_OFFHOOK,EV_SYNC) == -1) { /* process error */ } else { /* Clear DX_CAP structure */ dx_clrcap(&capp); /* Set the DX_CAP structure as needed for call progress analysis. * Allow 3 rings before no answer. */ capp.ca_nbrdna = 3; /* Perform the outbound dial with call progress analysis enabled. */ if (dx_dial(chdev,"5551212",&capp,DX_CALLP|EV_SYNC) == -1) { /* perform error routine */ } } . . /* Examine last call progress termination on the device */ switch (ATDX_CPTERM(chdev)) { case CR_CNCT: /* Call Connected, get some additional info */ . . break; case CR_CEPT: /* Operator Intercept detected */ Voice API for Windows Operating Systems Library Reference — November 2003 71 ATDX_CPTERM( ) — return the last result of call progress analysis termination . . break; . . case AT_FAILURE: } /* Error */ } ! See Also 72 • dx_dial( ) • DX_CAP data structure Voice API for Windows Operating Systems Library Reference — November 2003 return the last call progress analysis termination — ATDX_CRTNID( ) ATDX_CRTNID( ) return the last call progress analysis termination Name: long ATDX_CRTNID(chdev) Inputs: int chdev • valid channel device handle Returns: identifier of the tone that caused the most recent call progress analysis termination, if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_CRTNID( ) function returns the last call progress analysis termination of the tone that caused the most recent call progress analysis termination of the channel device. See the Voice API Programming Guide for a description of call progress analysis. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) Possible return values are the following: TID_BUSY1 First signal busy TID_BUSY2 Second signal busy TID_DIAL_INTL International dial tone TID_DIAL_LCL Local dial tone TID_DIAL_XTRA Special (“Extra”) dial tone TID_DISCONNECT Disconnect tone (post-connect) TID_FAX1 First fax or modem tone TID_FAX2 Second fax or modem tone Voice API for Windows Operating Systems Library Reference — November 2003 73 ATDX_CRTNID( ) — return the last call progress analysis termination TID_RNGBK1 Ringback (detected as single tone) TID_RNGBK2 Ringback (detected as dual tone) ! Cautions None. ! Errors This function fails and returns AT_FAILURE if an invalid device handle is specified. ! Example #include #include #include main() { DX_CAP cap_s; int ddd, car; char *chnam, *dialstrg; chnam = "dxxxB1C1"; dialstrg = "L1234"; /* * Open channel */ if ((ddd = dx_open( chnam, NULL )) == -1 ) { /* handle error */ } /* * Delete any previous tones */ if ( dx_deltones(ddd) < 0 ) { /* handle error */ } /* * Now enable call progress analysis with above changed settings. */ if (dx_initcallp( ddd )) { /* handle error */ } /* * Set off Hook */ if ((dx_sethook( ddd, DX_OFFHOOK, EV_SYNC )) == -1) { /* handle error */ } 74 Voice API for Windows Operating Systems Library Reference — November 2003 return the last call progress analysis termination — ATDX_CRTNID( ) /* * Dial */ printf("Dialing %s\n", dialstrg ); car = dx_dial(ddd,dialstrg,(DX_CAP *)&cap_s,DX_CALLP|EV_SYNC); if (car == -1) { /* handle error */ } switch( car ) { case CR_NODIALTONE: switch( ATDX_DTNFAIL(ddd) case 'L': printf(" Unable to get break; case 'I': printf(" Unable to get break; case 'X': printf(" Unable to get break; } break; ) { Local dial tone\n"); International dial tone\n"); special eXtra dial tone\n"); case CR_BUSY: printf(" %s engaged - %s detected\n", dialstrg, (ATDX_CRTNID(ddd) == TID_BUSY1 ? "Busy 1" : "Busy 2") ); break; case CR_CNCT: printf(" Successful connection to %s\n", dialstrg ); break; default: break; } /* * Set on Hook */ if ((dx_sethook( ddd, DX_ONHOOK, EV_SYNC )) == -1) { /* handle error */ } dx_close( ddd ); } ! See Also None. Voice API for Windows Operating Systems Library Reference — November 2003 75 ATDX_DEVTYPE( ) — return the device type ATDX_DEVTYPE( ) return the device type Name: long ATDX_DEVTYPE(dev) Inputs: int dev • valid board or channel device handle Returns: device type if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_DEVTYPE( ) function returns the device type of the board or channel dev. Parameter Description dev specifies the valid device handle obtained when a board or channel was opened using dx_open( ) Possible return values are the following: DT_DXBD Board device (indicates virtual board) DT_DXCH Channel device DT_PHYBD Physical board device ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid board or channel device handle is specified in dev. 76 Voice API for Windows Operating Systems Library Reference — November 2003 return the device type — ATDX_DEVTYPE( ) ! Example #include #include #include main() { int bddev; long devtype; /* Open the board device */ if ((bddev = dx_open("dxxxB1",NULL)) == -1) { /* Process error */ } if((devtype = ATDX_DEVTYPE(bddev)) == AT_FAILURE) { /* Process error */ } if(devtype == DT_DXBD) { printf("Device is a Board\n"); } /* Continue processing */ . . } ! See Also None. Voice API for Windows Operating Systems Library Reference — November 2003 77 ATDX_DTNFAIL( ) — return character for dial tone ATDX_DTNFAIL( ) return character for dial tone Name: long ATDX_DTNFAIL(chdev) Inputs: int chdev • valid channel device handle Returns: code for the dial tone that failed to appear AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_DTNFAIL( ) function returns the dial tone character that indicates which dial tone call progress analysis failed to detect. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) Possible return values are the following: L Local dial tone I International dial tone X Special (“extra”) dial tone ! Cautions None. ! Errors This function fails and returns AT_FAILURE if an invalid device handle is specified. ! Example #include #include #include 78 Voice API for Windows Operating Systems Library Reference — November 2003 return character for dial tone — ATDX_DTNFAIL( ) main() { DX_CAP int char cap_s; ddd, car; *chnam, *dialstrg; chnam = "dxxxB1C1"; dialstrg = "L1234"; /* * Open channel */ if ((ddd = dx_open( chnam, NULL )) == -1 ) { /* handle error */ } /* * Delete any previous tones */ if ( dx_deltones(ddd) < 0 ) { /* handle error */ } /* * Now enable call progress analysis with above changed settings. */ if (dx_initcallp( ddd )) { /* handle error */ } /* * Set off Hook */ if ((dx_sethook( ddd, DX_OFFHOOK, EV_SYNC )) == -1) { /* handle error */ } /* * Dial */ printf("Dialing %s\n", dialstrg ); car = dx_dial(ddd,dialstrg,(DX_CAP *)&cap_s,DX_CALLP|EV_SYNC); if (car == -1) { /* handle error */ } switch( car ) { case CR_NODIALTONE: switch( ATDX_DTNFAIL(ddd) case 'L': printf(" Unable to get break; case 'I': printf(" Unable to get break; case 'X': printf(" Unable to get break; } break; ) { Local dial tone\n"); International dial tone\n"); special eXtra dial tone\n"); case CR_BUSY: printf(" %s engaged - %s detected\n", dialstrg, ATDX_CRTNID(ddd) == TID_BUSY1 ? "Busy 1" : "Busy 2") ); break; Voice API for Windows Operating Systems Library Reference — November 2003 79 ATDX_DTNFAIL( ) — return character for dial tone case CR_CNCT: printf(" Successful connection to %s\n", dialstrg ); break; default: break; } /* * Set on Hook */ if ((dx_sethook( ddd, DX_ONHOOK, EV_SYNC )) == -1) { /* handle error */ } dx_close( ddd ); } ! See Also None. 80 Voice API for Windows Operating Systems Library Reference — November 2003 return the duration of the first SIT sequence — ATDX_FRQDUR( ) ATDX_FRQDUR( ) return the duration of the first SIT sequence Name: long ATDX_FRQDUR(chdev) Inputs: int chdev • valid channel device handle Returns: first frequency duration in 10 msec units if success AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_FRQDUR( ) function returns the duration of the first Special Information Tone (SIT) sequence in 10 msec units after dx_dial( ) terminated due to an Operator Intercept. Termination due to Operator Intercept is indicated by ATDX_CPTERM( ) returning CR_CEPT. For information on SIT frequency detection, see the Voice API Programming Guide. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function fails and returns AT_FAILURE if an invalid channel device handle is specified. ! Example This example illustrates ATDX_FRQDUR( ), ATDX_FRQDUR2( ), and ATDX_FRQDUR3( ). /* Call progress analysis with user-specified parameters */ #include #include #include main() { int cares, chdev; DX_CAP capp; . . Voice API for Windows Operating Systems Library Reference — November 2003 81 ATDX_FRQDUR( ) — return the duration of the first SIT sequence /* open the channel using dx_open( ). Obtain channel device descriptor in * chdev */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* take the phone off-hook */ if (dx_sethook(chdev,DX_OFFHOOK,EV_SYNC) == -1) { /* process error */ } /* Set the DX_CAP structure as needed for call progress analysis. Perform the * outbound dial with call progress analysis enabled */ if ((cares = dx_dial(chdev,"5551212",&capp,DX_CALLP|EV_SYNC)) == -1) { /* perform error routine */ } switch (cares) { case CR_CNCT: /* Call Connected, get some additional info */ printf("\nDuration of short low - %ld ms",ATDX_SHORTLOW(chdev)*10); printf("\nDuration of long low - %ld ms",ATDX_LONGLOW(chdev)*10); printf("\nDuration of answer - %ld ms",ATDX_ANSRSIZ(chdev)*10); break; case CR_CEPT: /* Operator Intercept detected */ printf("\nFirst frequency detected - %ld Hz",ATDX_FRQHZ(chdev)); printf("\nSecond frequency detected - %ld Hz", ATDX_FRQHZ2(chdev)); printf("\nThird frequency detected - %ld Hz", ATDX_FRQHZ3(chdev)); printf("\nDuration of first frequency - %ld ms", ATDX_FRQDUR(chdev)); printf("\nDuration of second frequency - %ld ms", ATDX_FRQDUR2(chdev)); printf("\nDuration of third frequency - %ld ms", ATDX_FRQDUR3(chdev)); break; case CR_BUSY: break; . . } } ! See Also 82 • dx_dial( ) • ATDX_CPTERM( ) • DX_CAP data structure • call progress analysis topic in the Voice API Programming Guide • ATDX_FRQDUR2( ) • ATDX_FRQDUR3( ) • ATDX_FRQHZ( ) • ATDX_FRQHZ2( ) • ATDX_FRQHZ3( ) Voice API for Windows Operating Systems Library Reference — November 2003 return the duration of the second SIT sequence — ATDX_FRQDUR2( ) ATDX_FRQDUR2( ) return the duration of the second SIT sequence Name: long ATDX_FRQDUR2(chdev) Inputs: int chdev • valid channel device handle Returns: second frequency duration in 10 msec units if success AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_FRQDUR2( ) function returns the duration of the second Special Information Tone (SIT) sequence in 10 msec units after dx_dial( ) terminated due to an Operator Intercept. Termination due to Operator Intercept is indicated by ATDX_CPTERM( ) returning CR_CEPT. For information on SIT frequency detection, see the Voice API Programming Guide. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function fails and returns AT_FAILURE if an invalid channel device handle is specified. ! Example See the example for ATDX_FRQDUR( ). ! See Also • dx_dial( ) • ATDX_CPTERM( ) • DX_CAP data structure • call progress analysis topic in the Voice API Programming Guide • ATDX_FRQDUR( ) Voice API for Windows Operating Systems Library Reference — November 2003 83 ATDX_FRQDUR2( ) — return the duration of the second SIT sequence 84 • ATDX_FRQDUR3( ) • ATDX_FRQHZ( ) • ATDX_FRQHZ2( ) • ATDX_FRQHZ3( ) Voice API for Windows Operating Systems Library Reference — November 2003 return the duration of the third SIT sequence — ATDX_FRQDUR3( ) ATDX_FRQDUR3( ) return the duration of the third SIT sequence Name: long ATDX_FRQDUR3(chdev) Inputs: int chdev • valid channel device handle Returns: third frequency duration in 10 msec units if success AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_FRQDUR3( ) function returns the duration of the third Special Information Tone (SIT) sequence in 10 msec units after dx_dial( ) terminated due to an Operator Intercept. Termination due to Operator Intercept is indicated by ATDX_CPTERM( ) returning CR_CEPT. For information on SIT frequency detection, see the Voice API Programming Guide. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function fails and returns AT_FAILURE if an invalid channel device handle is specified. ! Example See the example for ATDX_FRQDUR( ). ! See Also • dx_dial( ) • ATDX_CPTERM( ) • DX_CAP data structure • call progress analysis topic in Voice API Programming Guide • ATDX_FRQDUR( ) Voice API for Windows Operating Systems Library Reference — November 2003 85 ATDX_FRQDUR3( ) — return the duration of the third SIT sequence 86 • ATDX_FRQDUR2( ) • ATDX_FRQHZ( ) • ATDX_FRQHZ2( ) • ATDX_FRQHZ3( ) Voice API for Windows Operating Systems Library Reference — November 2003 return the frequency of the first SIT sequence — ATDX_FRQHZ( ) ATDX_FRQHZ( ) return the frequency of the first SIT sequence Name: long ATDX_FRQHZ(chdev) Inputs: int chdev • valid channel device handle Returns: first tone frequency in Hz if success AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_FRQHZ( ) function returns the frequency in Hz of the first Special Information Tone (SIT) sequence after dx_dial( )has terminated due to an Operator Intercept. Termination due to Operator Intercept is indicated by ATDX_CPTERM( ) returning CR_CEPT. For information on SIT frequency detection, see the Voice API Programming Guide. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function fails and returns AT_FAILURE if an invalid channel device handle is specified. ! Example This example illustrates the use of ATDX_FRQHZ( ), ATDX_FRQHZ2( ), and ATDX_FRQHZ3( ). /* Call progress analysis with user-specified parameters */ #include #include #include main() { int cares, chdev; DX_CAP capp; . Voice API for Windows Operating Systems Library Reference — November 2003 87 ATDX_FRQHZ( ) — return the frequency of the first SIT sequence . /* open the channel using dx_open( ). Obtain channel device descriptor in * chdev */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* take the phone off-hook */ if (dx_sethook(chdev,DX_OFFHOOK,EV_SYNC) == -1) { /* process error */ } /* Set the DX_CAP structure as needed for call progress analysis. Perform the * outbound dial with call progress analysis enabled */ if ((cares = dx_dial(chdev,"5551212",&capp,DX_CALLP|EV_SYNC)) == -1) { /* perform error routine */ } switch (cares) { case CR_CNCT: /* Call Connected, get some additional info */ printf("\nDuration of short low - %ld ms",ATDX_SHORTLOW(chdev)*10); printf("\nDuration of long low - %ld ms",ATDX_LONGLOW(chdev)*10); printf("\nDuration of answer - %ld ms",ATDX_ANSRSIZ(chdev)*10); break; case CR_CEPT: /* Operator Intercept detected */ printf("\nFirst frequency detected - %ld Hz",ATDX_FRQHZ(chdev)); printf("\nSecond frequency detected - %ld Hz", ATDX_FRQHZ2(chdev)); printf("\nThird frequency detected - %ld Hz", ATDX_FRQHZ3(chdev)); printf("\nDuration of first frequency - %ld ms", ATDX_FRQDUR(chdev)); printf("\nDuration of second frequency - %ld ms", ATDX_FRQDUR2(chdev)); printf("\nDuration of third frequency - %ld ms", ATDX_FRQDUR3(chdev)); break; case CR_BUSY: break; . . } } ! See Also 88 • dx_dial( ) • ATDX_CPTERM( ) • DX_CAP data structure • call progress analysis topic in the Voice API Programming Guide • ATDX_FRQHZ2( ) • ATDX_FRQHZ3( ) • ATDX_FRQDUR( ) • ATDX_FRQDUR2( ) • ATDX_FRQDUR3( ) Voice API for Windows Operating Systems Library Reference — November 2003 return the frequency of the second SIT sequence — ATDX_FRQHZ2( ) ATDX_FRQHZ2( ) return the frequency of the second SIT sequence Name: long ATDX_FRQHZ2(chdev) Inputs: int chdev • valid channel device handle Returns: second tone frequency in Hz if success AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_FRQHZ2( ) function returns the frequency in Hz of the second Special Information Tone (SIT) sequence after dx_dial( ) has terminated due to an Operator Intercept. Termination due to Operator Intercept is indicated by ATDX_CPTERM( ) returning CR_CEPT. For information on SIT frequency detection, see the Voice API Programming Guide. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function fails and returns AT_FAILURE if an invalid channel device handle is specified. ! Example See the example for ATDX_FRQHZ( ). ! See Also • dx_dial( ) • ATDX_CPTERM( ) • DX_CAP data structure • call progress analysis topic in the Voice API Programming Guide • ATDX_FRQHZ( ) Voice API for Windows Operating Systems Library Reference — November 2003 89 ATDX_FRQHZ2( ) — return the frequency of the second SIT sequence 90 • ATDX_FRQHZ3( ) • ATDX_FRQDUR( ) • ATDX_FRQDUR2( ) • ATDX_FRQDUR3( ) Voice API for Windows Operating Systems Library Reference — November 2003 return the frequency of the third SIT sequence — ATDX_FRQHZ3( ) ATDX_FRQHZ3( ) return the frequency of the third SIT sequence Name: long ATDX_FRQHZ3(chdev) Inputs: int chdev • valid channel device handle Returns: third tone frequency in Hz if success AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_FRQHZ3( ) function returns the frequency in Hz of the third Special Information Tone (SIT) sequence after dx_dial( ) has terminated due to an Operator Intercept. Termination due to Operator Intercept is indicated by ATDX_CPTERM( ) returning CR_CEPT. For information on SIT frequency detection, see the Voice API Programming Guide. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function fails and returns AT_FAILURE if an invalid channel device handle is specified. ! Example See the example for ATDX_FRQHZ( ). ! See Also • dx_dial( ) • ATDX_CPTERM( ) • DX_CAP structure • call progress analysis topic in the Voice API Programming Guide • ATDX_FRQHZ( ) Voice API for Windows Operating Systems Library Reference — November 2003 91 ATDX_FRQHZ3( ) — return the frequency of the third SIT sequence 92 • ATDX_FRQHZ2( ) • ATDX_FRQDUR( ) • ATDX_FRQDUR2( ) • ATDX_FRQDUR3( ) Voice API for Windows Operating Systems Library Reference — November 2003 return percentage of time SIT tone was out of bounds — ATDX_FRQOUT( ) ATDX_FRQOUT( ) return percentage of time SIT tone was out of bounds Name: long ATDX_FRQOUT(chdev) Inputs: int chdev • valid channel device handle Returns: percentage frequency out-of bounds AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_FRQOUT( ) function returns percentage of time SIT tone was out of bounds as specified by the range in the DX_CAP structure. Upon detection of a frequency within the range specified in the DX_CAP structure ca_upperfrq and lower ca_lowerfrq, use this function to optimize the ca_rejctfrq parameter (which sets the percentage of time that the frequency can be out of bounds). For information on SIT frequency detection, see the Voice API Programming Guide. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions This function is only for use with non-DSP boards. If you call it on a DSP board, it will return zero. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example /* Call progress analysis with user-specified parameters */ #include #include #include Voice API for Windows Operating Systems Library Reference — November 2003 93 ATDX_FRQOUT( ) — return percentage of time SIT tone was out of bounds main() { int cares, chdev; DX_CAP capp; . . /* open the channel using dx_open( ). Obtain channel device descriptor in * chdev */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* take the phone off-hook */ if (dx_sethook(chdev,DX_OFFHOOK,EV_SYNC) == -1) { /* process error */ } /* Set the DX_CAP structure as needed for call progress analysis. Perform the * outbound dial with call progress analysis enabled. */ if ((cares = dx_dial(chdev,"5551212",&capp,DX_CALLP|EV_SYNC)) == -1) { /* perform error routine */ } switch (cares) { case CR_CNCT: /* Call Connected, get some additional info */ printf("\nDuration of short low - %ld ms",ATDX_SHORTLOW(chdev)*10); printf("\nDuration of long low - %ld ms",ATDX_LONGLOW(chdev)*10); printf("\nDuration of answer - %ld ms",ATDX_ANSRSIZ(chdev)*10); break; case CR_CEPT: /* Operator Intercept detected */ printf("\nFrequency detected - %ld Hz",ATDX_FRQHZ(chdev)); printf("\n%% of Frequency out of bounds - %ld Hz",ATDX_FRQOUT(chdev)); break; case CR_BUSY: break; . . } } ! See Also 94 • dx_dial( ) • ATDX_CPTERM( ) • DX_CAP data structure • call progress analysis topic in the Voice API Programming Guide Voice API for Windows Operating Systems Library Reference — November 2003 return the voice firmware version number — ATDX_FWVER( ) ATDX_FWVER( ) return the voice firmware version number Name: long ATDX_FWVER(bddev) Inputs: int bddev • valid board device handle Returns: D/4x Firmware version if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_FWVER( ) function returns the voice firmware version number or emulated D/4x firmware version number. Parameter Description bddev specifies the valid board device handle obtained when the board was opened using dx_open( ) This function returns a 32-bit value in the following format. TTTT|MMMM|mmmmmmmm|AAAAAAAA|aaaaaaaa where each letter represents one bit of data with the following meanings: Letter Description T Type of Release. Decimal values have the following meanings (example: 0010 for Alpha release): • 0 – Production • 1 – Beta • 2 – Alpha • 3 – Experimental • 4 – Special M Major version number for a production release in BCD format. Example: 0011 for version “3” m Minor version number for a production release in BCD format. Example: 00000001 for “.10” A Major version number for a non-production release in BCD format. Example: 00000100 for version “4” a Minor version number for a non-production release in BCD format. Example: 00000010 for version “.02” Voice API for Windows Operating Systems Library Reference — November 2003 95 ATDX_FWVER( ) — return the voice firmware version number Example: 0000 0010 0001 0101 0000 0000 0000 0000 (Production v2.15) ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid device handle is specified in bddev. ! Example #include #include #include #include void GetFwlVersion(char *, long); main() { int bddev; char *bdname, FWVersion[50]; long fwver; bdname = "dxxxB1"; /* * Open board device */ if ((bddev = dx_open(bdname, NULL)) == -1) { /* Handle error */ } if ((fwver = ATDX_FWVER(bddev)) == AT_FAILURE) { /* Handle error */ } /* * Parse fw version */ GetFwlVersion(FWVersion, fwver); printf("%s\n", FWVersion"); } /* end main */ ! See Also None. 96 Voice API for Windows Operating Systems Library Reference — November 2003 return the current hook-switch state — ATDX_HOOKST( ) ATDX_HOOKST( ) return the current hook-switch state Name: long ATDX_HOOKST(chdev) Inputs: int chdev • valid channel device handle Returns: current hook state of channel if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_HOOKST( ) function returns the current hook-switch state of the channel chdev. Note: This function is not supported on digital interfaces. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) Possible return values are the following: DX_OFFHOOK Channel is off-hook DX_ONHOOK Channel is on-hook ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example #include #include Voice API for Windows Operating Systems Library Reference — November 2003 97 ATDX_HOOKST( ) — return the current hook-switch state main() { int chdev; long hookst; /* Open the channel device */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* Process error */ } . . /* Examine Hook state of the channel. Perform application specific action */ if((hookst = ATDX_HOOKST(chdev)) == AT_FAILURE) { /* Process error */ } if(hookst == DX_OFFHOOK) { /* Channel is Off-hook */ } . . } ! See Also 98 • dx_sethook( ) • DX_CST structure • dx_setevtmsk( ) for enabling hook state (call status transition events) • sr_getevt( ) for synchronous call status transition event detection • DX_EBLK for asynchronous call status transition event detection • sr_getevtdatap( ) in the Standard Runtime Library API Library Reference Voice API for Windows Operating Systems Library Reference — November 2003 return the current activity on the channel — ATDX_LINEST( ) ATDX_LINEST( ) return the current activity on the channel Name: long ATDX_LINEST(chdev) Inputs: int chdev • valid channel device handle Returns: current line status of channel if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_LINEST( ) function returns the current activity on the channel specified in chdev. The information is returned in a bitmap. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) Possible return values are the following: RLS_DTMF DTMF signal present RLS_HOOK Channel is on-hook RLS_LCSENSE Loop current not present RLS_RING Ring not present RLS_RINGBK Audible ringback detected RLS_SILENCE Silence on the line ! Cautions None. Voice API for Windows Operating Systems Library Reference — November 2003 99 ATDX_LINEST( ) — return the current activity on the channel ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example #include #include main() { int chdev; long linest; /* Open the channel device */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* Process error */ } /* Examine line status bitmap of the channel. Perform application-specific * action */ if((linest = ATDX_LINEST(chdev)) == AT_FAILURE) { /* Process error */ } if(linest & RLS_LCSENSE) { /* No loop current */ } . . } ! See Also None. 100 Voice API for Windows Operating Systems Library Reference — November 2003 return duration of longer silence detected — ATDX_LONGLOW( ) ATDX_LONGLOW( ) return duration of longer silence detected Name: long ATDX_LONGLOW(chdev) Inputs: int chdev • valid channel device handle Returns: duration of longer silence if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_LONGLOW( ) function returns duration of longer silence duration in 10 msec units for the initial signal that occurred during call progress analysis on the channel chdev. This function can be used in conjunction with ATDX_SIZEHI( ) and ATDX_SHORTLOW( ) to determine the elements of an established cadence. See the Voice API Programming Guide for more information on call progress analysis and cadence detection. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example /* Call progress analysis with user-specified parameters */ #include #include #include main() { int cares, chdev; DX_CAP capp; . Voice API for Windows Operating Systems Library Reference — November 2003 101 ATDX_LONGLOW( ) — return duration of longer silence detected . /* open the channel using dx_open( ). Obtain channel device descriptor in * chdev */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* take the phone off-hook */ if (dx_sethook(chdev,DX_OFFHOOK,EV_SYNC) == -1) { /* process error */ } /* Set the DX_CAP structure as needed for call progress analysis. Perform the * outbound dial with call progress analysis enabled */ if ((cares = dx_dial(chdev,"5551212",&capp,DX_CALLP|EV_SYNC)) == -1) { /* perform error routine */ } switch (cares) { case CR_CNCT: /* Call Connected, get some additional info */ printf("\nDuration of short low - %ld ms",ATDX_SHORTLOW(chdev)*10); printf("\nDuration of long low - %ld ms",ATDX_LONGLOW(chdev)*10); printf("\nDuration of answer - %ld ms",ATDX_ANSRSIZ(chdev)*10); break; case CR_CEPT: /* Operator Intercept detected */ printf("\nFrequency detected - %ld Hz",ATDX_FRQHZ(chdev)); printf("\n%% of Frequency out of bounds - %ld Hz",ATDX_FRQOUT(chdev)); break; case CR_BUSY: . . } } ! See Also 102 • dx_dial( ) • ATDX_CPTERM( ) • ATDX_SIZEHI( ) • ATDX_SHORTLOW( ) • DX_CAP data structure • call progress analysis in the Voice API Programming Guide • cadence detection in the Voice API Programming Guide Voice API for Windows Operating Systems Library Reference — November 2003 return the physical board address — ATDX_PHYADDR( ) ATDX_PHYADDR( ) return the physical board address Name: long ATDX_PHYADDR(bddev) Inputs: int bddev • valid board device handle Returns: physical address of board if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_PHYADDR( ) function returns the physical board address for the board device bddev. Parameter Description bddev specifies the valid board device handle obtained when the board was opened using dx_open( ) ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid board device handle is specified in bddev. ! Example #include #include #include main() { int bddev; long phyaddr; /* Open the board device */ if ((bddev = dx_open("dxxxB1",NULL)) == -1) { /* Process error */ } if((phyaddr = ATDX_PHYADDR(bddev)) == AT_FAILURE) { /* Process error */ } Voice API for Windows Operating Systems Library Reference — November 2003 103 ATDX_PHYADDR( ) — return the physical board address printf("Board is at address %X\n",phyaddr); . . } ! See Also None. 104 Voice API for Windows Operating Systems Library Reference — November 2003 return duration of shorter silence detected — ATDX_SHORTLOW( ) ATDX_SHORTLOW( ) return duration of shorter silence detected Name: long ATDX_SHORTLOW(chdev) Inputs: int chdev • valid channel device handle Returns: duration of shorter silence if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_SHORTLOW( ) function returns duration of shorter silence in 10 msec units for the initial signal that occurred during call progress analysis on the channel chdev. This function can be used in conjunction with ATDX_SIZEHI( ) and ATDX_LONGLOW( ) to determine the elements of an established cadence. See the Voice API Programming Guide for more information on call progress analysis and cadence detection. Compare the results of this function with the field ca_lo2rmin in the DX_CAP data structure to determine whether the cadence is a double or single ring: • If the result of ATDX_SHORTLOW( ) is less than the ca_lo2rmin field, this indicates a double ring cadence. • If the result of ATDX_SHORTLOW( ) is greater than the ca_lo2rmin field, this indicates a single ring. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. Voice API for Windows Operating Systems Library Reference — November 2003 105 ATDX_SHORTLOW( ) — return duration of shorter silence detected ! Example /* Call progress analysis with user-specified parameters */ #include #include #include main() { int cares, chdev; DX_CAP capp; . . /* open the channel using dx_open( ). Obtain channel device descriptor * in chdev */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* take the phone off-hook */ if (dx_sethook(chdev,DX_OFFHOOK,EV_SYNC) == -1) { /* process error */ } /* Set the DX_CAP structure as needed for call progress analysis. Perform the * outbound dial with call progress analysis enabled */ if ((cares = dx_dial(chdev,"5551212",&capp,DX_CALLP|EV_SYNC)) == -1) { /* perform error routine */ } switch (cares) { case CR_CNCT: /* Call Connected, get some additional info */ printf("\nDuration of short low - %ld ms",ATDX_SHORTLOW(chdev)*10); printf("\nDuration of long low - %ld ms",ATDX_LONGLOW(chdev)*10); printf("\nDuration of answer - %ld ms",ATDX_ANSRSIZ(chdev)*10); break; case CR_CEPT: /* Operator Intercept detected */ printf("\nFrequency detected - %ld Hz",ATDX_FRQHZ(chdev)); printf("\n%% of Frequency out of bounds - %ld Hz",ATDX_FRQOUT(chdev)); break; case CR_BUSY: . . } } ! See Also 106 • dx_dial( ) • ATDX_LONGLOW( ) • ATDX_SIZEHI( ) • ATDX_CPTERM( ) • DX_CAP data structure • call progress analysis in the Voice API Programming Guide • cadence detection in the Voice API Programming Guide Voice API for Windows Operating Systems Library Reference — November 2003 return duration of initial non-silence — ATDX_SIZEHI( ) ATDX_SIZEHI( ) return duration of initial non-silence Name: long ATDX_SIZEHI(chdev) Inputs: int chdev • valid channel device handle Returns: non-silence duration in 10 msec units if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: Springware ! Description The ATDX_SIZEHI( ) function returns duration of initial non-silence in 10 msec units that occurred during call progress analysis on the channel chdev. This function can be used in conjunction with ATDX_SHORTLOW( ) and ATDX_LONGLOW( ) to determine the elements of an established cadence. See the Voice API Programming Guide for more information on call progress analysis and cadence detection. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example /* Call progress analysis with user-specified parameters */ #include #include #include main() { int cares, chdev; DX_CAP capp; . Voice API for Windows Operating Systems Library Reference — November 2003 107 ATDX_SIZEHI( ) — return duration of initial non-silence . /* open the channel using dx_open( ). Obtain channel device descriptor * in chdev */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* take the phone off-hook */ if (dx_sethook(chdev,DX_OFFHOOK,EV_SYNC) == -1) { /* process error */ } /* Set the DX_CAP structure as needed for call progress analysis. Perform the * outbound dial with call progress analysis enabled */ if ((cares = dx_dial(chdev,"5551212",&capp,DX_CALLP|EV_SYNC)) == -1) { /* perform error routine */ } switch (cares) { case CR_CNCT: /* Call Connected, get some additional info */ printf("\nDuration of short low - %ld ms",ATDX_SHORTLOW(chdev)*10); printf("\nDuration of long low - %ld ms",ATDX_LONGLOW(chdev)*10); printf("\nDuration of non-silence - %ld ms",ATDX_SIZEHI(chdev)*10); break; case CR_CEPT: /* Operator Intercept detected */ printf("\nFrequency detected - %ld Hz",ATDX_FRQHZ(chdev)); printf("\n%% of Frequency out of bounds - %ld Hz",ATDX_FRQOUT(chdev)); break; case CR_BUSY: . . } } ! See Also 108 • dx_dial( ) • ATDX_LONGLOW( ) • ATDX_SHORTLOW( ) • ATDX_CPTERM( ) • DX_CAP data structure • call progress analysis in the Voice API Programming Guide • cadence detection in the Voice API Programming Guide Voice API for Windows Operating Systems Library Reference — November 2003 return the current state of the channel — ATDX_STATE( ) ATDX_STATE( ) return the current state of the channel Name: long ATDX_STATE(chdev) Inputs: int chdev • valid channel device handle Returns: current state of channel if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_STATE( ) function returns the current state of the channel chdev. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) Possible return values are the following: CS_DIAL Dial state CS_CALL Call state CS_GTDIG Get Digit state CS_HOOK Hook state CS_IDLE Idle state CS_PLAY Play state CS_RECD Record state CS_STOPD Stopped state CS_TONE Playing tone state Voice API for Windows Operating Systems Library Reference — November 2003 109 ATDX_STATE( ) — return the current state of the channel CS_WINK Wink state When a VFX combined resource board is being used to send and receive faxes the following states may be returned: CS_SENDFAX Channel is in a fax transmission state. CS_RECVFAX Channel is in a fax reception state. Note: A device is idle if there is no I/O function active on it. ! Cautions This function extracts the current state from the driver and requires the same processing resources as many other functions. For this reason, applications should not base their state machines on this function. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example #include #include #include main() { int chdev; long chstate; /* Open the channel device */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* Process error */ } . . /* Examine state of the channel. Perform application specific action based * on state of the channel */ if((chstate = ATDX_STATE(chdev)) == AT_FAILURE) { /* Process error */ } printf("current state of channel %s = %ld\n", ATDX_NAMEP(chdev), chstate); . . } ! See Also None. 110 Voice API for Windows Operating Systems Library Reference — November 2003 return the reason for the last I/O function termination — ATDX_TERMMSK( ) ATDX_TERMMSK( ) return the reason for the last I/O function termination Name: long ATDX_TERMMSK(chdev) Inputs: int chdev • valid channel device handle Returns: channel’s last termination bitmap if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_TERMMSK( ) function returns a bitmap containing the reason for the last I/O function termination on the channel chdev. The bitmap is set when an I/O function terminates. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) On DM3 boards, possible return values are the following: TM_DIGIT Specific digit received TM_EOD End of data reached (on playback, receive) TM_ERROR I/O device error TM_IDDTIME Inter-digit delay TM_MAXDATA Maximum data reached; returned when the last I/O function terminates on DX_MAXDATA TM_MAXDTMF Maximum DTMF count TM_MAXNOSIL Maximum period of non-silence TM_MAXSIL Maximum period of silence TM_MAXTIME Maximum function time exceeded Voice API for Windows Operating Systems Library Reference — November 2003 111 ATDX_TERMMSK( ) — return the reason for the last I/O function termination TM_NORMTERM Normal termination (for dx_dial( ), dx_sethook( )) TM_TONE Tone-on/off event TM_USRSTOP Function stopped by user On Springware boards, possible return values are the following: TM_DIGIT Specific digit received TM_EOD End of data reached (on playback, receive) TM_ERROR I/O device error TM_IDDTIME Inter-digit delay TM_LCOFF Loop current off. TM_MAXDATA Maximum data reached; returned when the last I/O function terminates on DX_MAXDATA TM_MAXDTMF Maximum DTMF count TM_MAXNOSIL Maximum period of non-silence TM_MAXSIL Maximum period of silence TM_MAXTIME Maximum function time exceeded TM_NORMTERM Normal termination (for dx_dial( ), dx_sethook( )) TM_PATTERN Pattern matched silence off TM_TONE Tone-on/off event TM_USRSTOP Function stopped by user ! Cautions • 112 If several termination conditions are met at the same time, several bits will be set in the termination bitmap. Voice API for Windows Operating Systems Library Reference — November 2003 return the reason for the last I/O function termination — ATDX_TERMMSK( ) • On DM3 boards, when both DX_MAXDTMF and DX_DIGMASK termination conditions are specified in the DV_TPT structure, and both conditions are satisfied, the ATDX_TERMMSK( ) function will return the TM_MAXDTMF termination event only. For example, with a DX_MAXDTMF condition of 2 digits maximum and a DX_DIGMASK condition of digit “1”, if the digit string “21” is received, both conditions are satisfied but only TM_MAXDTMF will be reported by ATDX_TERMMSK( ). This behavior differs from Springware products, where both TM_MAXDTMF and TM_DIGIT will be returned when both DX_MAXDTMF and DX_DIGMASK termination conditions are specified in the DV_TPT structure and both are satisfied by the user input. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example #include #include #include #include #include main() { int chdev; long term; DX_IOTT iott; DV_TPT tpt[4]; /* Open the channel device */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* Process error */ } /* Record a voice file. Terminate on receiving a digit, silence, loop * current drop, max time, or reaching a byte count of 50000 bytes. */ /* set up DX_IOTT */ iott.io_type = IO_DEV|IO_EOT; iott.io_bufp = 0; iott.io_offset = 0; iott.io_length = 50000; if((iott.io_fhandle = dx_fileopen("file.vox", O_RDWR)) == -1) /* process error */ } { /* set up DV_TPTs for the required terminating conditions */ dx_clrtpt(tpt,4); tpt[0].tp_type = IO_CONT; tpt[0].tp_termno = DX_MAXDTMF; /* Maximum digits */ tpt[0].tp_length = 1; * terminate on the first digit */ tpt[0].tp_flags = TF_MAXDTMF; /* Use the default flags */ tpt[1].tp_type = IO_CONT; tpt[1].tp_termno = DX_MAXTIME; /* Maximum time */ tpt[1].tp_length = 100; /* terminate after 10 secs */ tpt[1].tp_flags = TF_MAXTIME; /* Use the default flags */ tpt[2].tp_type = IO_CONT; Voice API for Windows Operating Systems Library Reference — November 2003 113 ATDX_TERMMSK( ) — return the reason for the last I/O function termination tpt[2].tp_termno tpt[2].tp_length tpt[2].tp_flags tpt[3].tp_type tpt[3].tp_termno tpt[3].tp_length tpt[3].tp_flags = = = = = = = DX_MAXSIL; 30; TF_MAXSIL; IO_EOT; DX_LCOFF; 10; TF_LCOFF; /* /* /* /* /* /* /* Maximum Silence */ terminate on 3 sec silence */ Use the default flags */ last entry in the table */ terminate on loop current drop */ terminate on 1 sec silence */ Use the default flags */ /* Now record to the file */ if (dx_rec(chdev,&iott,tpt,EV_SYNC) == -1) { /* process error */ } /* Examine bitmap to determine if digits caused termination */ if((term = ATDX_TERMMSK(chdev)) == AT_FAILURE) { /* Process error */ } if(term & TM_MAXDTMF) { printf("Terminated on digits\n"); . . } } ! See Also 114 • DV_TPT data structure to set termination conditions • Event Management functions to retrieve termination events asynchronously (in the Standard Runtime Library API Programming Guide and Standard Runtime Library API Library Reference) • ATEC_TERMMSK( ) in the Continuous Speech Processing API Library Reference Voice API for Windows Operating Systems Library Reference — November 2003 return user-defined tone ID that terminated I/O function — ATDX_TONEID( ) ATDX_TONEID( ) return user-defined tone ID that terminated I/O function Name: long ATDX_TONEID(chdev) Inputs: int chdev • valid channel device handle Returns: user-defined tone ID if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_TONEID( ) function returns the user-defined tone ID that terminated an I/O function. This termination is indicated by ATDX_TERMMSK( ) returning TM_TONE. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example #include #include #include #include #define TID_1 main() { TN_GEN DV_TPT int 101 tngen; tpt[ 5 ]; chdev; Voice API for Windows Operating Systems Library Reference — November 2003 115 ATDX_TONEID( ) — return user-defined tone ID that terminated I/O function /* * Open the D/xxx Channel Device and Enable a Handler */ if ( ( chdev = dx_open( "dxxxB1C1", NULL ) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Describe a Simple Dual Tone Frequency Tone of 950* 1050 Hz and 475-525 Hz using leading edge detection. */ if ( dx_blddt( TID_1, 1000, 50, 500, 25, TN_LEADING )== -1 ) { printf( "Unable to build a Dual Tone Template\n" ); } /* * Add the Tone to the Channel */ if ( dx_addtone( chdev, NULL, 0 ) == -1 ) { printf( "Unable to Add the Tone %d\n", TID_1 ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( chdev ), ATDV_ERRMSGP( chdev ) ); dx_close( chdev ); exit( 1 ); } /* * Build a Tone Generation Template. * This template has Frequency1 = 1140, * Frequency2 = 1020, amplitute at -10dB for * both frequencies and duration of 100 * 10 msecs. */ dx_bldtngen( &tngen, 1140, 1020, -10, -10, 100 ); /* * Set up the Terminating Conditions */ tpt[0].tp_type = IO_CONT; tpt[0].tp_termno = DX_TONE; tpt[0].tp_length = TID_1; tpt[0].tp_flags = TF_TONE; tpt[0].tp_data = DX_TONEON; tpt[1].tp_type = IO_CONT; tpt[1].tp_termno = DX_TONE; tpt[1].tp_length = TID_1; tpt[1].tp_flags = TF_TONE; tpt[1].tp_data = DX_TONEOFF; tpt[2].tp_type = IO_EOT; tpt[2].tp_termno = DX_MAXTIME; tpt[2].tp_length = 6000; tpt[2].tp_flags = TF_MAXTIME; if (dx_playtone( chdev, &tngen, tpt, EV_SYNC ) == -1 ){ printf( "Unable to Play the Tone\n" ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( chdev ), ATDV_ERRMSGP( chdev ) ); dx_close( chdev ); exit( 1 ); } if ( ATDX_TERMMSK( chdev ) & TM_TONE ) { printf( "Terminated by Tone Id = %d\n", ATDX_TONEID( chdev ) ); } 116 Voice API for Windows Operating Systems Library Reference — November 2003 return user-defined tone ID that terminated I/O function — ATDX_TONEID( ) /* * Continue Processing * . * . * . */ /* * Close the opened D/xxx Channel Device */ if ( dx_close( chdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also None. Voice API for Windows Operating Systems Library Reference — November 2003 117 ATDX_TRCOUNT( ) — return the byte count for the last I/O transfer ATDX_TRCOUNT( ) return the byte count for the last I/O transfer Name: long ATDX_TRCOUNT(chdev) Inputs: int chdev • valid channel device handle Returns: last play/record transfer count if successful AT_FAILURE if error Includes: srllib.h dxxxlib.h Category: Extended Attribute Mode: synchronous Platform: DM3, Springware ! Description The ATDX_TRCOUNT( ) function returns the number of bytes transferred during the last play or record on the channel chdev. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev. ! Example #include #include #include #include #include main() { int chdev; long trcount; DX_IOTT iott; DV_TPT tpt[2]; /* Open the channel device */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* Process error */ } 118 Voice API for Windows Operating Systems Library Reference — November 2003 return the byte count for the last I/O transfer — ATDX_TRCOUNT( ) /* Record a voice file. Terminate on receiving a digit, max time, * or reaching a byte count of 50000 bytes. */ . . /* set up DX_IOTT */ iott.io_type = IO_DEV|IO_EOT; iott.io_bufp = 0; iott.io_offset = 0L; iott.io_length = 50000L; if((iott.io_fhandle = dx_fileopen("file.vox", O_RDWR)) == -1) { /* process error */ } /* set up DV_TPTs for the required dx_clrtpt(tpt,2); tpt[0].tp_type = IO_CONT; tpt[0].tp_termno = DX_MAXDTMF; tpt[0].tp_length = 1; tpt[0].tp_flags = TF_MAXDTMF; tpt[1].tp_type = IO_EOT; tpt[1].tp_termno = DX_MAXTIME; tpt[1].tp_length = 100; tpt[1].tp_flags = TF_MAXTIME; terminating conditions */ /* Maximum digits */ /* terminate on the first digit */ /* Use the default flags */ /* Maximum time */ /* terminate after 10 secs */ /* Use the default flags */ /* Now record to the file */ if (dx_rec(chdev,&iott,tpt,EV_SYNC) == -1) { /* process error */ } /* Examine transfer count */ if((trcount = ATDX_TRCOUNT(chdev)) == AT_FAILURE) { /* Process error */ } printf("%ld bytes recorded\n", trcount); . . } ! See Also None. Voice API for Windows Operating Systems Library Reference — November 2003 119 dx_addspddig( ) — set a DTMF digit to adjust speed dx_addspddig( ) set a DTMF digit to adjust speed Name: int dx_addspddig(chdev, digit, adjval) Inputs: int chdev • valid channel device handle char digit • DTMF digit short adjval • speed adjustment value Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Speed and Volume Mode: synchronous Platform: DM3, Springware ! Description The dx_addspddig( ) function is a convenience function that sets a DTMF digit to adjust speed by a specified amount, immediately and for all subsequent plays on the specified channel (until changed or cancelled). This function assumes that the speed modification table has not been modified using the dx_setsvmt( ) function. For more information about speed and volume control as well as speed and volume modification tables, see the Voice API Programming Guide. For information about speed and volume data structures, see the DX_SVMT and the DX_SVCB data structures. 120 Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) Voice API for Windows Operating Systems Library Reference — November 2003 set a DTMF digit to adjust speed — dx_addspddig( ) Parameter Description digit specifies a DTMF digit (0-9, *,#) that will modify speed by the amount specified in adjval adjval specifies a speed adjustment value to take effect whenever the digit specified in digit occurs: On DM3 boards, the following are valid values: • SV_ADD10PCT – increase play speed by 10% • SV_NORMAL – set play speed to origin (regular speed) when the play begins. digit must be set to NULL. • SV_SUB10PCT – decrease play speed by 10% On Springware boards, the following are valid values: • SV_ADD10PCT – increase play speed by 10% • SV_ADD20PCT – increase play speed by 20% • SV_ADD30PCT – increase play speed by 30% • SV_ADD40PCT – increase play speed by 40% • SV_ADD50PCT – increase play speed by 50% • SV_NORMAL – set play speed to origin (regular speed) when the play begins. digit must be set to NULL. • SV_SUB10PCT – decrease play speed by 10% • SV_SUB20PCT – decrease play speed by 20% • SV_SUB30PCT – decrease play speed by 30% • SV_SUB40PCT – decrease play speed by 40% To start play speed at the origin, set digit to NULL and set adjval to SV_NORMAL. ! Cautions • On DM3 boards, speed control is supported only at the 8 kHz sampling rate using the PCM voice coder with A-law or mu-law coding, or the OKI ADPCM voice coder. • On DM3 boards, digits that are used for play adjustment may also be used as a terminating condition. If a digit is defined as both, then both actions are applied upon detection of that digit. • On Springware boards, digits that are used for play adjustment will not be used as a terminating condition. If a digit is defined as both, then the play adjustment will take priority. • Calls to this function are cumulative. To reset or remove any condition, you should clear all adjustment conditionswith dx_clrsvcond( ), and reset if required. For example, if DTMF digit “1” has already been set to increase play speed by one step, a second call that attempts to redefine digit “1” to the origin will have no effect on speed or volume, but will be added to the array of conditions; the digit will retain its original setting. • The digit that causes the play adjustment will not be passed to the digit buffer, so it cannot be retrieved using dx_getdig( ) or ATDX_BUFDIGS( ). Voice API for Windows Operating Systems Library Reference — November 2003 121 dx_addspddig( ) — set a DTMF digit to adjust speed ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BADPROD Function not supported on this board EDX_SVADJBLK Invalid number of play adjustment blocks EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example #include #include #include #include /* * Global Variables */ main() { int dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", NULL) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Add a Speed Adjustment Condition - increase the * playback speed by 30% whenever DTMF key 1 is pressed. */ if ( dx_addspddig( dxxxdev, '1', SV_ADD30PCT ) == -1 ) { printf("Unable to Add a Speed Adjustment Condition\n"); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Continue Processing * . * . * . */ 122 Voice API for Windows Operating Systems Library Reference — November 2003 set a DTMF digit to adjust speed — dx_addspddig( ) /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also • dx_addvoldig( ) • dx_adjsv( ) • dx_clrsvcond( ) • dx_getcursv( ) • dx_getsvmt( ) • dx_setsvcond( ) • dx_setsvmt( ) • speed and volume modification tables in the Voice API Programming Guide • DX_SVMT data structure • DX_SVCB data structure Voice API for Windows Operating Systems Library Reference — November 2003 123 dx_addtone( ) — add a user-defined tone dx_addtone( ) add a user-defined tone Name: int dx_addtone(chdev, digit, digtype) Inputs: int chdev • valid channel device handle unsigned char digit • optional digit associated with the bound tone unsigned char digtype • digit type Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Global Tone Detection Mode: synchronous Platform: DM3, Springware ! Description The dx_addtone( ) function adds a user-defined tone that was defined by the most recent dx_blddt( ) (or other global tone detection build-tone) function call, to the specified channel. Adding a user-defined tone to a channel downloads it to the board and enables detection of tone-on and tone-off events for that tone by default. Use dx_distone( ) to disable detection of the tone, without removing the tone from the channel. Detection can be enabled again using dx_enbtone( ). For example, if you only want to be notified of tone-on events, you should call dx_distone( ) to disable detection of tone-off events. For more information on user-defined tones and global tone detection (GTD), see the Voice API Programming Guide. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) digit specifies an optional digit to associate with the tone. When the tone is detected, the digit will be placed in the DV_DIGIT digit buffer. These digits can be retrieved using dx_getdig( ) (they can be used in the same way as DTMF digits, for example). If you do not specify a digit, the tone will be indicated by a DE_TONEON event or DE_TONEOFF event. 124 Voice API for Windows Operating Systems Library Reference — November 2003 add a user-defined tone — dx_addtone( ) Parameter Description digtype specifies the type of digit the channel will detect On DM3 boards, the valid value is: • DG_USER1 On Springware boards, valid values are: • DG_USER1 • DG_USER2 • DG_USER3 • DG_USER4 • DG_USER5 Up to twenty digits can be associated with each of these digit types. Note: These types can be specified in addition to the digit types already defined for the voice library (DTMF, MF) which are specified using dx_setdigtyp( ). ! Cautions • Ensure that dx_blddt( ) (or another appropriate “build tone” function) has been called to define a tone prior to adding it to the channel using dx_addtone( ), otherwise an error will occur. • Do not use dx_addtone( ) to change a tone that has previously been added. • There are limitations to the number of tones or tone templates that can be added to a channel, depending on the type of board and other factors. See the global tone detection topic in the Voice API Programming Guide for details. • When using this function in a multi-threaded application, use critical sections or a semaphore around the function call to ensure a thread-safe application. Failure to do so will result in “Bad Tone Template ID” errors. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_ASCII Invalid ASCII value in tone template description EDX_BADPARM Invalid parameter EDX_BADPROD Function not supported on this board EDX_CADENCE Invalid cadence component value EDX_DIGTYPE Invalid dg_type value in tone template description Voice API for Windows Operating Systems Library Reference — November 2003 125 dx_addtone( ) — add a user-defined tone EDX_FREQDET Invalid tone frequency EDX_INVSUBCMD Invalid sub-command EDX_MAXTMPLT Maximum number of user-defined tones for the board EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value EDX_TONEID Invalid tone template ID ! Example #include #include #include #include #define #define #define #define TID_1 TID_2 TID_3 TID_4 101 102 103 104 main() { int dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", NULL) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Describe a Simple Dual Tone Frequency Tone of 950* 1050 Hz and 475-525 Hz using leading edge detection. */ if ( dx_blddt( TID_1, 1000, 50, 500, 25, TN_LEADING ) == -1 ) { printf( "Unable to build a Dual Tone Template\n" ); } /* * Bind the Tone to the Channel */ if ( dx_addtone( dxxxdev, NULL, 0 ) == -1 ) { printf( "Unable to Bind the Tone %d\n", TID_1 ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev )); dx_close( dxxxdev ); exit( 1 ); } 126 Voice API for Windows Operating Systems Library Reference — November 2003 add a user-defined tone — dx_addtone( ) /* * Describe a Dual Tone Frequency Tone of 950-1050 Hz * and 475-525 Hz. On between 190-210 msecs and off * 990-1010 msecs and a cadence of 3. */ if ( dx_blddtcad( TID_2, 1000, 50, 500, 25, 20, 1, 100, 1, 3 ) == -1 ) { printf("Unable to build a Dual Tone Cadence Template\n" ); } /* * Bind the Tone to the Channel */ if ( dx_addtone( dxxxdev, 'A', DG_USER1 ) == -1 ) { printf( "Unable to Bind the Tone %d\n", TID_2 ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev )); dx_close( dxxxdev ); exit( 1 ); } /* * Describe a Simple Single Tone Frequency Tone of * 950-1050 Hz using trailing edge detection. */ if ( dx_bldst( TID_3, 1000, 50, TN_TRAILING ) == -1 ) { printf( "Unable to build a Single Tone Template\n" ); } /* * Bind the Tone to the Channel */ if ( dx_addtone( dxxxdev, 'D', DG_USER2 ) == -1 ) { printf( "Unable to Bind the Tone %d\n", TID_3 ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Describe a Single Tone Frequency Tone of 950-1050 Hz. * On between 190-210 msecs and off 990-1010 msecs and * a cadence of 3. */ if ( dx_bldstcad( TID_4, 1000, 50, 20, 1, 100, 1, 3 ) == -1 ) { printf("Unable to build a Single Tone Cadence Template\n"); } /* * Bind the Tone to the Channel */ if ( dx_addtone( dxxxdev, NULL, 0 ) == -1 ) { printf( "Unable to Bind the Tone %d\n", TID_4 ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Continue Processing * . * . * . */ Voice API for Windows Operating Systems Library Reference — November 2003 127 dx_addtone( ) — add a user-defined tone /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also 128 • dx_blddt( ), dx_bldst( ), dx_blddtcad( ), dx_bldstcad( ) • dx_distone( ) • dx_enbtone( ) • global tone detection in the Voice API Programming Guide • dx_getevt( ) • DX_CST data structure • sr_getevtdatap( ) in the Standard Runtime Library API Library Reference • dx_getdig( ) • dx_setdigtyp( ) • DV_DIGIT data structure Voice API for Windows Operating Systems Library Reference — November 2003 set a DTMF digit to adjust volume — dx_addvoldig( ) dx_addvoldig( ) set a DTMF digit to adjust volume Name: int dx_addvoldig(chdev, digit, adjval) Inputs: int chdev • valid channel device handle char digit • DTMF digit short adjval • volume adjustment value Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Speed and Volume Mode: synchronous Platform: DM3, Springware ! Description The dx_addvoldig( ) function is a convenience function that sets a DTMF digit to adjust volume by a specified amount, immediately and for all subsequent plays on the specified channel (until changed or cancelled). This function assumes that the volume modification table has not been modified using the dx_setsvmt( ) function. For more information about speed and volume control as well as speed and volume modification tables, see the Voice API Programming Guide. For information about speed and volume data structures, see the DX_SVMT and the DX_SVCB data structures. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) digit specifies a DTMF digit (0-9, *, #) that will modify volume by the amount specified in adjval Voice API for Windows Operating Systems Library Reference — November 2003 129 dx_addvoldig( ) — set a DTMF digit to adjust volume Parameter Description adjval specifies a speed adjustment value to take effect whenever the digit specified in digit occurs On DM3 boards, the following are valid values: • SV_ADD2DB – increase play volume by 2 dB • SV_SUB2DB – decrease play volume by 2 dB • SV_NORMAL – set play volume to origin when the play begins (digit must be set to NULL) On Springware boards, the following are valid values: • SV_ADD2DB – increase play volume by 2 dB • SV_ADD4DB – increase play volume by 4 dB • SV_ADD6DB – increase play volume by 6 dB • SV_ADD8DB – increase play volume by 8 dB • SV_SUB2DB – decrease play volume by 2 dB • SV_SUB4DB – decrease play volume by 4 dB • SV_SUB6DB – decrease play volume by 6 dB • SV_SUB8DB – decrease play volume by 8 dB • SV_NORMAL – set play volume to origin when the play begins (digit must be set to NULL) To start play volume at the origin, set digit to NULL and set adjval to SV_NORMAL. ! Cautions • Calls to this function are cumulative. To reset or remove any condition, you should clear all adjustment conditions and reset if required. For example, if DTMF digit “1” has already been set to increase play volume by one step, a second call that attempts to redefine digit “1” to the origin will have no effect on the volume, but will be added to the array of conditions; the digit will retain its original setting. • The digit that causes the play adjustment will not be passed to the digit buffer, so it cannot be retrieved using dx_getdig( ) and will not be included in the result of ATDX_BUFDIGS( ) which retrieves the number of digits in the buffer. • On DM3 boards, digits that are used for play adjustment may also be used as a terminating condition. If a digit is defined as both, then both actions are applied upon detection of that digit. • On Springware boards, digits that are used for play adjustment will not be used as a terminating condition. If a digit is defined as both, then the play adjustment will take priority. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BADPROD Function not supported on this board 130 Voice API for Windows Operating Systems Library Reference — November 2003 set a DTMF digit to adjust volume — dx_addvoldig( ) EDX_SVADJBLKS Invalid number of play adjustment blocks EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example #include #include #include #include /* * Global Variables */ main() { int dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", NULL) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Add a Speed Adjustment Condition - decrease the * playback volume by 2dB whenever DTMF key 2 is pressed. if ( dx_addvoldig( dxxxdev, '2', SV_SUB2DB ) == -1 ) { printf( "Unable to Add a Volume Adjustment" ); printf( " Condition\n"); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } */ /* * Continue Processing * . * . * . */ /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also • dx_addspddig( ) • dx_adjsv( ) • dx_clrsvcond( ) Voice API for Windows Operating Systems Library Reference — November 2003 131 dx_addvoldig( ) — set a DTMF digit to adjust volume 132 • dx_getcursv( ) • dx_getsvmt( ) • dx_setsvcond( ) • dx_setsvmt( ) Voice API for Windows Operating Systems Library Reference — November 2003 adjust speed or volume immediately — dx_adjsv( ) dx_adjsv( ) adjust speed or volume immediately Name: int dx_adjsv(chdev, tabletype, action, adjsize) Inputs: int chdev • valid channel device handle unsigned short tabletype • type of table to set (speed or volume) unsigned short action • how to adjust (absolute position, relative change, or toggle) unsigned short adjsize • adjustment size Returns: 0 if successful -1 if failure Includes: srllib.h dxxxlib.h Category: Speed and Volume Mode: synchronous Platform: DM3, Springware ! Description The dx_adjsv( ) function adjusts speed or volume immediately, and for all subsequent plays on a specified channel (until changed or cancelled). The speed or the volume can be set to a specific value, adjusted incrementally, or can be set to toggle. See the action parameter description for information. The dx_adjsv( ) function uses the speed and volume modification tables to make adjustments to play speed or play volume. These tables have 21 entries that represent different levels of speed or volume. There are up to ten levels above and below the regular speed or volume. These tables can be set with explicit values using dx_setsvmt( ) or default values can be used. See the Voice API Programming Guide for detailed information about these tables. Notes: 1. This function is similar to dx_setsvcond( ). Use dx_adjsv( ) to explicitly adjust the play immediately, and use dx_setsvcond( ) to adjust the play in response to specified conditions. See the description of dx_setsvcond( ) for more information. 2. Whenever a play is started, its speed and volume are based on the most recent modification. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) tabletype specifies whether to modify the playback using a value from the speed or the volume modification table • SV_SPEEDTBL – use the speed modification table • SV_VOLUMETBL – use the volume modification table Voice API for Windows Operating Systems Library Reference — November 2003 133 dx_adjsv( ) — adjust speed or volume immediately Parameter action Description specifies the type of adjustment to make. Set to one of the following: • SV_ABSPOS – set speed or volume to a specified position in the appropriate table. (The position is set using the adjsize parameter.) • SV_RELCURPOS – adjust speed or volume by the number of steps specified using the adjsize parameter • SV_TOGGLE – toggle between values specified using the adjsize parameter adjsize specifies the size of the adjustment. The adjsize parameter has a different value depending on how the adjustment type is set using the action parameter. • If action is SV_ABSPOS, adjsize specifies the position between -10 to +10 in the Speed or Volume Modification Table that contains the required speed or volume adjustment. The origin (regular speed or volume) has a value of 0 in the table. • If action is SV_RELCURPOS, adjsize specifies the number of positive or negative steps in the Speed or Volume Modification Table by which to adjust the speed or volume. For example, specify -2 to lower the speed or volume by 2 steps in the Speed or Volume Modification Table. • If action is SV_TOGGLE, adjsize specifies the values between which speed or volume will toggle. SV_CURLASTMOD sets the current speed/volume to the last modified speed volume level. SV_CURORIGIN resets the current speed/volume level to the origin (that is, regular speed/volume). SV_RESETORIG resets the current speed/volume to the origin and the last modified speed/volume to the origin. SV_TOGORIGIN sets the speed/volume to toggle between the origin and the last modified level of speed/volume. ! Cautions None. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BADPROD Function not supported on this board EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value 134 Voice API for Windows Operating Systems Library Reference — November 2003 adjust speed or volume immediately — dx_adjsv( ) ! Example #include #include #include #include main() { int dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", 0 ) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Modify the Volume of the playback so that it is 4dB * higher than normal. */ if ( dx_adjsv( dxxxdev, SV_VOLUMETBL, SV_ABSPOS, SV_ADD4DB ) == -1 ) { printf( "Unable to Increase Volume by 4dB\n" ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Continue Processing * . * . * . */ /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also • dx_setsvcond( ) • dx_clrsvcond( ) • dx_getcursv( ) • dx_getsvmt( ) • speed and volume modification tables in the Voice API Programming Guide • DX_SVMT data structure Voice API for Windows Operating Systems Library Reference — November 2003 135 dx_blddt( ) — define a user-defined dual-frequency tone dx_blddt( ) define a user-defined dual-frequency tone Name: int dx_blddt(tid, freq1, fq1dev, freq2, fq2dev, mode) Inputs: unsigned int tid • tone ID to assign unsigned int freq1 • frequency 1 in Hz unsigned int fq1dev • frequency 1 deviation in Hz unsigned int freq2 • frequency 2 in Hz unsigned int fq2dev • frequency 2 deviation in Hz unsigned int mode • leading or trailing edge Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Global Tone Detection Mode: synchronous Platform: DM3, Springware ! Description The dx_blddt( ) function defines a user-defined dual-frequency tone. Subsequent calls to dx_addtone( ) will enable detection of this tone, until another tone is defined. Issuing dx_blddt( ) defines a new tone. You must use dx_addtone( ) to add the tone to the channel and enable its detection. For more information about global tone detection, see the Voice API Programming Guide. Parameter Description tid specifies a unique identifier for the tone. See Cautions for more information about the tone ID. freq1 specifies the first frequency (in Hz) for the tone frq1dev specifies the allowable deviation (in Hz) for the first frequency freq2 specifies the second frequency (in Hz) for the tone frq2dev specifies the allowable deviation (in Hz) for the second frequency mode specifies whether tone detection notification will occur on the leading or trailing edge of the tone. Set to one of the following: • TN_LEADING • TN_TRAILING 136 Voice API for Windows Operating Systems Library Reference — November 2003 define a user-defined dual-frequency tone — dx_blddt( ) ! Cautions • Only one tone per process can be defined at any time. Ensure that dx_blddt( ) is called for each dx_addtone( ). The tone is not created until dx_addtone( ) is called, and a second consecutive call to dx_blddt( ) will replace the previous tone definition for the channel. If you call dx_addtone( ) without calling dx_blddt( ) an error will occur. • Do not use tone IDs 261, 262 and 263; they are reserved for library use. • If you are using R2/MF tone detection, reserve the use of tone IDs 101 to 115 for the R2/MF tones. See r2_creatfsig( ) for further information. • When using this function in a multi-threaded application, use critical sections or a semaphore around the function call to ensure a thread-safe application. Failure to do so will result in “Bad Tone Template ID” errors. ! Errors For a list of error codes, see the Error Codes chapter. ! Example #include #include #include #include #define TID_1 main() { int 101 dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", 0 ) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Describe a Simple Dual Tone Frequency Tone of 950* 1050 Hz and 475-525 Hz using leading edge detection. */ if ( dx_blddt( TID_1, 1000, 50, 500, 25, TN_LEADING ) == -1 ) { printf( "Unable to build a Dual Tone Template\n" ); } /* * Continue Processing * . * . * . */ /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } Voice API for Windows Operating Systems Library Reference — November 2003 137 dx_blddt( ) — define a user-defined dual-frequency tone /* Terminate the Program */ exit( 0 ); } ! See Also 138 • global tone detection topic in Voice API Programming Guide • dx_bldst( ) • dx_blddtcad( ) • dx_bldstcad( ) • dx_addtone( ) • dx_distone( ) • dx_enbtone( ) • r2_creatfsig( ) • r2_playbsig( ) Voice API for Windows Operating Systems Library Reference — November 2003 define a user-defined dual frequency cadenced tone — dx_blddtcad( ) dx_blddtcad( ) define a user-defined dual frequency cadenced tone Name: int dx_blddtcad(tid, freq1, fq1dev, freq2, fq2dev, ontime, ontdev, offtime, offtdev, repcnt) Inputs: unsigned int tid • tone ID to assign unsigned int freq1 • frequency 1 in Hz unsigned int fq1dev • frequency 1 deviation in Hz unsigned int freq2 • frequency 2 in Hz unsigned int fq2dev • frequency 2 deviation in Hz unsigned int ontime • tone-on time in 10 msec unsigned int ontdev • tone-on time deviation in 10 msec unsigned int offtime • tone-off time in 10 msec unsigned int offtdev • tone-off time deviation in 10 msec unsigned int repcnt • number of repetitions if cadence Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Global Tone Detection Mode: synchronous Platform: DM3, Springware ! Description The dx_blddtcad( ) function defines a user-defined dual frequency cadenced tone. Subsequent calls to dx_addtone( ) will use this tone, until another tone is defined. A dual frequency cadence tone has dual frequency signals with specific on/off characteristics. Issuing dx_blddtcad( ) defines a new tone. You must use dx_addtone( ) to add the tone to the channel and enable its detection. For more information about global tone detection, see the Voice API Programming Guide. Parameter Description tid specifies a unique identifier for the tone. See Cautions for more information on the tone ID. freq1 specifies the first frequency (in Hz) for the tone frq1dev specifies the allowable deviation (in Hz) for the first frequency freq2 specifies the second frequency (in Hz) for the tone frq2dev specifies the allowable deviation (in Hz) for the second frequency Voice API for Windows Operating Systems Library Reference — November 2003 139 dx_blddtcad( ) — define a user-defined dual frequency cadenced tone Parameter Description ontime specifies the length of time for which the cadence is on (in 10 msec units) ontdev specifies the allowable deviation for on time (in 10 msec units) offtime specifies the length of time for which the cadence is off (in 10 msec units) offtdev specifies the allowable deviation for off time (in 10 msec units) repcnt specifies the number of repetitions for the cadence (that is, the number of times that an on/off signal is repeated) ! Cautions • Only one user-defined tone per process can be defined at any time. dx_blddtcad( ) will replace the previous user-defined tone definition. • Do not use tone IDs 261, 262 and 263; they are reserved for library use. • If you are using R2/MF tone detection, reserve the use of tone IDs 101 to 115 for the R2/MF tones. See r2_creatfsig( ) for further information. • When using this function in a multi-threaded application, use critical sections or a semaphore around the function call to ensure a thread-safe application. Failure to do so will result in “Bad Tone Template ID” errors. ! Errors None. ! Example #include #include #include #include #define TID_2 main() { int 102 dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", 0 ) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Describe a Dual Tone Frequency Tone of 950-1050 Hz * and 475-525 Hz. On between 190-210 msecs and off * 990-1010 msecs and a cadence of 3. */ if ( dx_blddtcad( TID_2, 1000, 50, 500, 25, 20, 1, 100, 1, 3 ) == -1 ) { printf( "Unable to build a Dual Tone Cadence" ); printf( " Template\n"); } 140 Voice API for Windows Operating Systems Library Reference — November 2003 define a user-defined dual frequency cadenced tone — dx_blddtcad( ) /* * Continue Processing * . * . */ /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also • global tone detection topic in Voice API Programming Guide • dx_bldst( ) • dx_blddt( ) • dx_bldstcad( ) • dx_addtone( ) • dx_distone( ) • dx_enbtone( ) • r2_creatfsig( ) • r2_playbsig( ) Voice API for Windows Operating Systems Library Reference — November 2003 141 dx_bldst( ) — define a user-defined single-frequency tone dx_bldst( ) define a user-defined single-frequency tone Name: int dx_bldst(tid, freq, fqdev, mode) Inputs: unsigned int tid • tone ID to assign unsigned int freq • frequency in Hz unsigned int fqdev • frequency deviation in Hz unsigned int mode • leading or trailing edge Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Global Tone Detection Mode: synchronous Platform: DM3, Springware ! Description The dx_bldst( ) function defines a user-defined single-frequency tone. Subsequent calls to dx_addtone( ) will use this tone, until another tone is defined. Issuing a dx_bldst( ) defines a new tone. You must use dx_addtone( ) to add the tone to the channel and enable its detection. For more information about global tone detection, see the Voice API Programming Guide. Parameter Description tid specifies a unique identifier for the tone. See Cautions for more information about the tone ID. freq specifies the frequency (in Hz) for the tone frqdev specifies the allowable deviation (in Hz) for the frequency mode specifies whether detection is on the leading or trailing edge of the tone. Set to one of the following: • TN_LEADING • TN_TRAILING ! Cautions 142 • Only one tone per application may be defined at any time. dx_bldst( ) will replace the previous user-defined tone definition. • Do not use tone IDs 261, 262 and 263; they are reserved for library use. Voice API for Windows Operating Systems Library Reference — November 2003 define a user-defined single-frequency tone — dx_bldst( ) • If you are using R2/MF tone detection, reserve the use of tone IDs 101 to 115 for the R2/MF tones. See r2_creatfsig( ) for further information. • When using this function in a multi-threaded application, use critical sections or a semaphore around the function call to ensure a thread-safe application. Failure to do so will result in “Bad Tone Template ID” errors. ! Errors None. ! Example #include #include #include #include #define TID_3 main() { int 103 dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", 0 ) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Describe a Simple Single Tone Frequency Tone of * 950-1050 Hz using trailing edge detection. */ if ( dx_bldst( TID_3, 1000, 50, TN_TRAILING ) == -1 ) { printf( "Unable to build a Single Tone Template\n" ); } /* * Continue Processing * . * . * . */ /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also • global tone detection topic in Voice API Programming Guide • dx_blddtcad( ) Voice API for Windows Operating Systems Library Reference — November 2003 143 dx_bldst( ) — define a user-defined single-frequency tone 144 • dx_blddt( ) • dx_bldstcad( ) • dx_addtone( ) • dx_distone( ) • dx_enbtone( ) • r2_creatfsig( ) • r2_playbsig( ) Voice API for Windows Operating Systems Library Reference — November 2003 define a user-defined single-frequency cadenced tone — dx_bldstcad( ) dx_bldstcad( ) define a user-defined single-frequency cadenced tone Name: int dx_bldstcad(tid, freq, fqdev, ontime, ontdev, offtime, offtdev, repcnt) Inputs: unsigned int tid • tone ID to assign unsigned int freq • frequency in Hz unsigned int fqdev • frequency deviation in Hz unsigned int ontime • tone on time in 10 msec unsigned int ontdev • on time deviation in 10 msec unsigned int offtime • tone off time in 10 msec unsigned int offtdev • off time deviation in 10 msec unsigned int repcnt • repetitions if cadence Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Global Tone Detection Mode: synchronous Platform: DM3, Springware ! Description The dx_bldstcad( ) function defines a user-defined, single-frequency, cadenced tone. Subsequent calls to dx_addtone( ) will use this tone, until another tone is defined. A single-frequency cadence tone has single-frequency signals with specific on/off characteristics. Issuing a dx_bldstcad( ) defines a new tone. You must use dx_addtone( ) to add the tone to the channel and enable its detection. For more information about global tone detection, see the Voice API Programming Guide. Parameter Description tid specifies a unique identifier for the tone. See Cautions for more information about the tone ID. freq specifies the frequency (in Hz) for the tone frqdev specifies the allowable deviation (in Hz) for the frequency ontime specifies the length of time for which the cadence is on (in 10 msec units) ontdev specifies the allowable deviation for on time (in 10 msec units) offtime specifies the length of time for which the cadence is off (in 10 msec units) Voice API for Windows Operating Systems Library Reference — November 2003 145 dx_bldstcad( ) — define a user-defined single-frequency cadenced tone Parameter Description offtdev specifies the allowable deviation for off time (in 10 msec units) repcnt specifies the number of repetitions for the cadence (i.e., the number of times that an on/off signal is repeated) ! Cautions • Only one tone per application may be defined at any time. dx_bldstcad( ) will replace the previous user-defined tone definition. • Do not use tone IDs 261, 262 and 263; they are reserved for library use. • If you are using R2/MF tone detection, reserve the use of tone IDs 101 to 115 for the R2/MF tones. See the r2_creatfsig( ) function for further information. • When using this function in a multi-threaded application, use critical sections or a semaphore around the function call to ensure a thread-safe application. Failure to do so will result in “Bad Tone Template ID” errors. ! Errors None. ! Example #include #include #include #include #define TID_4 main() { int 104 dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", 0 ) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Describe a Single Tone Frequency Tone of 950-1050 Hz. * On between 190-210 msecs and off 990-1010 msecs and * a cadence of 3. */ if ( dx_bldstcad( TID_4, 1000, 50, 20, 1, 100, 1, 3 ) == -1 ) { printf( "Unable to build a Single Tone Cadence" ); printf( " Template\n"); } /* * Continue Processing * . * . * . */ 146 Voice API for Windows Operating Systems Library Reference — November 2003 define a user-defined single-frequency cadenced tone — dx_bldstcad( ) /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also • global tone detection topic in Voice API Programming Guide • dx_blddtcad( ) • dx_blddt( ) • dx_bldst( ) • dx_addtone( ) • dx_distone( ) • dx_enbtone( ) • r2_creatfsig( ) • r2_playbsig( ) Voice API for Windows Operating Systems Library Reference — November 2003 147 dx_bldtngen( ) — define a tone for generation dx_bldtngen( ) define a tone for generation Name: void dx_bldtngen(tngenp, freq1, freq2, ampl1, ampl2, duration) Inputs: TN_GEN *tngenp • pointer to tone generation structure unsigned short freq1 • frequency of tone 1 in Hz unsigned short freq2 • frequency of tone 2 in Hz short ampl1 • amplitude of tone 1 in dB short ampl2 • amplitude of tone 2 in dB short duration • duration of tone in 10 msec units Returns: none Includes: srllib.h dxxxlib.h Category: Global Tone Generation Mode: synchronous Platform: DM3, Springware ! Description The dx_bldtngen( ) function is a convenience function that defines a tone for generation by setting up the tone generation template (TN_GEN) and assigning specified values to the appropriate fields. The tone generation template is placed in the user’s return buffer and can then be used by the dx_playtone( ) function to generate the tone. For more information about Global Tone Generation, see the Voice API Programming Guide. 148 Parameter Description tngenp points to the TN_GEN data structure where the tone generation template is output freq1 specifies the frequency of tone 1 in Hz. Valid range is 200 to 3000 Hz. freq2 specifies the frequency of tone 2 in Hz. Valid range is 200 to 3000 Hz. To define a single tone, set freq1 to the desired frequency and set freq2 to 0. ampl1 specifies the amplitude of tone 1 in dB. Valid range is 0 to -40 dB. Calling this function with ampl1 set to R2_DEFAMPL will set the amplitude to -10 dB. ampl2 specifies the amplitude of tone 2 in dB. Valid range is 0 to -40 dB. Calling this function with ampl2 set to R2_DEFAMPL will set the amplitude to -10 dB. duration specifies the duration of the tone in 10 msec units. A value of -1 specifies infinite duration (the tone will only terminate upon an external terminating condition). Voice API for Windows Operating Systems Library Reference — November 2003 define a tone for generation — dx_bldtngen( ) Generating a tone with a high frequency component (approximately 700 Hz or higher) will cause the amplitude of the tone to increase. The increase will be approximately 1 dB at 1000 Hz. Also, the amplitude of the tone will increase by 2 dB if an analog (loop start) device is used. ! Cautions None. ! Errors None. ! Example #include #include #include #include main() { TN_GEN int tngen; dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", 0 ) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Build a Tone Generation Template. * This template has Frequency1 = 1140, * Frequency2 = 1020, amplitute at -10dB for * both frequencies and duration of 100 * 10 msecs. */ dx_bldtngen( &tngen, 1140, 1020, -10, -10, 100 ); /* * Continue Processing * . * . * . */ /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also • TN_GEN structure Voice API for Windows Operating Systems Library Reference — November 2003 149 dx_bldtngen( ) — define a tone for generation 150 • dx_playtone( ) • global tone generation topic in Voice API Programming Guide • r2_creatfsig( ) • r2_playbsig( ) Voice API for Windows Operating Systems Library Reference — November 2003 download a cached prompt from multiple sources — dx_cacheprompt( ) dx_cacheprompt( ) download a cached prompt from multiple sources Name: int dx_cacheprompt(brdhdl, iottp, prompthdl, mode) Inputs: int brdhdl • valid physical board device handle DX_IOTT *iottp • pointer to I/O Transfer Table int prompthdl • pointer to return the cached prompt handle unsigned short mode • cached prompt mode Returns: > 0 if successful -1 if failure Includes: srllib.h dxxxlib.h Category: Cached Prompt Management Mode: asynchronous or synchronous Platform: DM3 ! Description The dx_cacheprompt( ) function downloads voice data from multiple sources to the on-board memory. On successful completion the function returns a handle to the single cached prompt. This cached prompt handle can then be used in subsequent calls to a play function such as dx_playiottdata( ). For more information about cached prompt management and extended example code, see the Voice API Programming Guide. Parameter Description brdhdl specifies a valid physical board device handle (of the format brdBn) obtained by a call to dx_open( ) iottp points to the I/O Transfer Table structure, DX_IOTT, which specifies the location of voice data and the order in which data is downloaded. See DX_IOTT, on page 509, for information about this data structure. prompthdl points to an integer that represents the cached prompt handle mode specifies the mode in which the function will run. Valid values are: • EV_ASYNC – asynchronous mode • EV_SYNC – synchronous mode ! Cautions • Before using dx_cacheprompt( ), call dx_getcachesize( ) to determine the amount of onboard memory available for storing cached prompts. • Closing the physical board device handle using dx_close( ) flushes the prompts from the onboard cache. Voice API for Windows Operating Systems Library Reference — November 2003 151 dx_cacheprompt( ) — download a cached prompt from multiple sources • If the function is called in asynchronous mode (mode = EV_ASYNC), then the cached prompt handle returned should be used only after the TDX_CACHEPROMPT event is received. • When iottp parameter points to an array of DX_IOTT data structures (voice data being specified from multiple sources), the cached prompt handle that is returned refers to the beginning of the combined set of voice data that is downloaded. It is not possible to select an individual data item for playing from the cached prompt. • WAVE files cannot be played from on-board cache memory. • When dx_cacheprompt( ) is issued on a physical board device in asynchronous mode, and the function is immediately followed by another similar call prior to completion of the previous call on the same device, the subsequent call will fail with device busy. ! Errors In asynchronous mode, the function returns immediately and a TDX_CACHEPROMPT event is queued upon completion. Check the extended attribute function ATDX_TERMMSK( ) for the termination reason. If a failure occurs, then a TDX_ERROR event will be queued. Use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to determine the reason for error. In synchronous mode, if this function returns -1 to indicate failure, call ATDV_LASTERR( ) to obtain the error code, or use ATDV_ERRMSGP( ) to obtain a descriptive error message. For a list of error codes returned by ATDV_LASTERR( ), see the Error Codes chapter. ! Example #include #include #include #include "srllib.h" "dxxxlib.h" main() { int brdhdl; /* physical board device handle */ int promptHandle; /* Handle of the prompt to be downloaded */ int fd1; /* First file descriptor for file to be downloaded */ int fd2; /* Second file descriptor for file to be downloaded */ DX_IOTT iott[2]; /* I/O transfer table to download cached prompt */ . . . /* Open board */ if ((brdhdl = dx_open("brdB1",0)) == -1) { printf("Cannot open board\n"); /* Perform system error processing */ exit(1); } /* Open first VOX file to cache */ if ((fd1 = dx_fileopen("HELLO.VOX",O_RDONLY|O_BINARY)) == -1) { printf("File open error\n"); exit(2); } /* Open second VOX file to cache */ if ((fd2 = dx_fileopen("GREETING.VOX",O_RDONLY|O_BINARY)) == -1) { printf("File open error\n"); exit(2); } 152 Voice API for Windows Operating Systems Library Reference — November 2003 download a cached prompt from multiple sources — dx_cacheprompt( ) /* Set up DX_IOTT */ /*This block specifies the first data file */ iott[0].io_fhandle = fd1; iott[0].io_offset = 0; iott[0].io_length = -1; iott[0].io_type = IO_DEV | IO_CONT; /*This block specifies the second data file */ iott[1].io_fhandle = fd2; iott[1].io_offset = 0; iott[1].io_length = -1; iott[1].io_type = IO_DEV | IO_EOT /* Download the prompts to the on-board memory */ int promptHandle; int result = dx_cacheprompt(brdhdl, iott, &promptHandle, EV_SYNC); } ! See Also • dx_getcachesize( ) • dx_open( ) • dx_playiottdata( ) • dx_setuio( ) Voice API for Windows Operating Systems Library Reference — November 2003 153 dx_chgdur( ) — change the duration definition for a tone dx_chgdur( ) change the duration definition for a tone Name: int dx_chgdur(tonetype, ontime, ondev, offtime, offdev) Inputs: int tonetype • tone to modify int ontime • on duration int ondev • ontime deviation int offtime • off duration int offdev • offtime deviation Returns: 0 on success -1 if tone does not have cadence values -2 if unknown tone type Includes: srllib.h dxxxlib.h Category: Call Progress Analysis Mode: synchronous Platform: Springware ! Description The dx_chgdur( ) function changes the standard duration definition for a call progress analysis tone, identified by tonetype. The voice driver comes with default definitions for each of the call progress analysis tones. The dx_chgdur( ) function alters the standard definition of the duration component. Changing a tone definition has no immediate effect on the behavior of an application. The dx_initcallp( ) function takes the tone definitions and uses them to initialize a channel. Once a channel is initialized, subsequent changes to the tone definitions have no effect on that channel. For these changes to take effect, you must first call dx_deltones( ) followed by dx_initcallp( ). For more information on default tone templates as well as the call progress analysis feature, see the Voice API Programming Guide. 154 Voice API for Windows Operating Systems Library Reference — November 2003 change the duration definition for a tone — dx_chgdur( ) Parameter Description tonetype specifies the identifier of the tone whose definition is to be modified. It may be one of the following: • TID_BUSY1 – Busy signal • TID_BUSY2 – Alternate busy signal • TID_DIAL_INTL – International dial tone • TID_DIAL_LCL – Local dial tone • TID_DIAL_XTRA – Special (extra) dial tone • TID_DISCONNECT – Disconnect tone (post-connect) • TID_FAX1 – Fax or modem tone • TID_FAX2 – Alternate fax or modem tone • TID_RNGBK1 – Ringback (detected as single tone) • TID_RINGBK2 – Ringback (detected as dual tone) ontime specifies the length of time that the tone is on (10 msec units) ondev specifies the maximum permissible deviation from ontime (10 msec units) offtime specifies the length of time that the tone is off (10 msec units) offdev specifies the maximum permissible deviation from offtime (10 msec units) ! Cautions This function changes only the definition of a tone. The new definition does not apply to a channel until dx_deltones( ) is called on that channel followed by dx_initcallp( ). ! Errors For a list of error codes, see the Error Codes chapter. ! Example #include #include #include #include main() { DX_CAP cap_s; int ddd, car; char *chnam, *dialstrg; chnam = "dxxxB1C1"; dialstrg = "L1234"; /* * Open channel */ if ((ddd = dx_open( chnam, NULL )) == -1 ) { /* handle error */ } Voice API for Windows Operating Systems Library Reference — November 2003 155 dx_chgdur( ) — change the duration definition for a tone /* * Delete any previous tones */ if ( dx_deltones(ddd) < 0 ) { /* handle error */ } /* * Change Enhanced call progress default local dial tone */ if (dx_chgfreq( TID_DIAL_LCL, 425, 150, 0, 0 ) < 0) { /* handle error */ } /* * Change Enhanced call progress default busy cadence */ if (dx_chgdur( TID_BUSY1, 550, 400, 550, 400 ) < 0) { /* handle error */ } if (dx_chgrepcnt( TID_BUSY1, 4 ) < 0) { /* handle error */ } /* * Now enable Enhanced call progress with above changed settings. */ if (dx_initcallp( ddd )) { /* handle error */ } /* * Set off Hook */ if ((dx_sethook( ddd, DX_OFFHOOK, EV_SYNC )) == -1) { /* handle error */ } /* * Dial */ if ((car = dx_dial( ddd, dialstrg,(DX_CAP *)&cap_s, DX_CALLP|EV_SYNC))==-1) { /* handle error */ } switch( car ) { case CR_NODIALTONE: printf(" Unable to get dial tone\n"); break; case CR_BUSY: printf(" %s engaged\n", dialstrg ); break; case CR_CNCT: printf(" Successful connection to %s\n", dialstrg ); break; default: break; } 156 Voice API for Windows Operating Systems Library Reference — November 2003 change the duration definition for a tone — dx_chgdur( ) /* * Set on Hook */ if ((dx_sethook( ddd, DX_ONHOOK, EV_SYNC )) == -1) { /* handle error */ } dx_close( ddd ); } ! See Also • dx_chgfreq( ) • dx_chgrepcnt( ) • dx_deltones( ) • dx_initcallp( ) Voice API for Windows Operating Systems Library Reference — November 2003 157 dx_chgfreq( ) — change the frequency definition for a tone dx_chgfreq( ) change the frequency definition for a tone Name: int dx_chgfreq(tonetype, freq1, freq1dev, freq2, freq2dev) Inputs: int tonetype • tone to modify int freq1 • frequency of first tone int freq1dev • frequency deviation for first tone int freq2 • frequency of second tone int freq2dev • frequency deviation of second tone Returns: 0 on success -1 on failure due to bad parameter(s) for tone type -2 on failure due to unknown tone type Includes: srllib.h dxxxlib.h Category: Call Progress Analysis Mode: synchronous Platform: Springware ! Description The dx_chgfreq( ) function changes the standard frequency definition for a call progress analysis tone, identified by tonetype. The voice driver comes with default definitions for each of the call progress analysis tones. The dx_chgfreq( ) function alters the standard definition of the frequency component. Call progress analysis supports both single-frequency and dual-frequency tones. For dualfrequency tones, the frequency and tolerance of each component may be specified independently. For single-frequency tones, specifications for the second frequency are set to zero. Changing a tone definition has no immediate effect on the behavior of an application. The dx_initcallp( ) function takes the tone definitions and uses them to initialize a channel. Once a channel is initialized, subsequent changes to the tone definitions have no effect on that channel. For these changes to take effect, you must first call dx_deltones( ) followed by dx_initcallp( ). For more information on default tone templates as well as the call progress analysis feature, see the Voice API Programming Guide. 158 Voice API for Windows Operating Systems Library Reference — November 2003 change the frequency definition for a tone — dx_chgfreq( ) Parameter Description tonetype specifies the identifier of the tone whose definition is to be modified. It may be one of the following: • TID_BUSY1 – Busy signal • TID_BUSY2 – Alternate busy signal • TID_DIAL_INTL – International dial tone • TID_DIAL_LCL – Local dial tone • TID_DIAL_XTRA – Special (extra) dial tone • TID_DISCONNECT – Disconnect tone (post-connect) • TID_FAX1 – Fax or modem tone • TID_FAX2 – Alternate fax or modem tone • TID_RNGBK1 – Ringback (detected as single tone) • TID_RINGBK2 – Ringback (detected as dual tone) freq1 specifies the frequency of the first tone (in Hz) freq1dev specifies the maximum permissible deviation (in Hz) from freq1 freq2 specifies the frequency of the second tone, if any (in Hz). If there is only one frequency, freq2 is set to 0. freq2dev specifies the maximum permissible deviation (in Hz) from freq2 ! Cautions This function changes only the definition of a tone. The new definition does not apply to a channel until dx_deltones( ) is called on that channel followed by dx_initcallp( ). ! Errors For a list of error codes, see the Error Codes chapter. ! Example #include #include #include #include main() { DX_CAP cap_s; int ddd, car; char *chnam, *dialstrg; chnam = "dxxxB1C1"; dialstrg = "L1234"; /* * Open channel */ if ((ddd = dx_open( chnam, NULL )) == -1 ) { /* handle error */ } Voice API for Windows Operating Systems Library Reference — November 2003 159 dx_chgfreq( ) — change the frequency definition for a tone /* * Delete any previous tones */ if ( dx_deltones(ddd) < 0 ) { /* handle error */ } /* * Change Enhanced call progress default local dial tone */ if (dx_chgfreq( TID_DIAL_LCL, 425, 150, 0, 0 ) < 0) { /* handle error */ } /* * Change Enhanced call progress default busy cadence */ if (dx_chgdur( TID_BUSY1, 550, 400, 550, 400 ) < 0) { /* handle error */ } if (dx_chgrepcnt( TID_BUSY1, 4 ) < 0) { /* handle error */ } /* * Now enable Enhanced call progress with above changed settings. */ if (dx_initcallp( ddd )) { /* handle error */ } /* * Set off Hook */ if ((dx_sethook( ddd, DX_OFFHOOK, EV_SYNC )) == -1) { /* handle error */ } /* * Dial */ if ((car = dx_dial( ddd, dialstrg,(DX_CAP *)&cap_s, DX_CALLP|EV_SYNC))==-1) { /* handle error */ } switch( car ) { case CR_NODIALTONE: printf(" Unable to get dial tone\n"); break; case CR_BUSY: printf(" %s engaged\n", dialstrg ); break; case CR_CNCT: printf(" Successful connection to %s\n", dialstrg ); break; default: break; } 160 Voice API for Windows Operating Systems Library Reference — November 2003 change the frequency definition for a tone — dx_chgfreq( ) /* * Set on Hook */ if ((dx_sethook( ddd, DX_ONHOOK, EV_SYNC )) == -1) { /* handle error */ } dx_close( ddd ); } ! See Also • dx_chgdur( ) • dx_chgrepcnt( ) • dx_deltones( ) • dx_initcallp( ) Voice API for Windows Operating Systems Library Reference — November 2003 161 dx_chgrepcnt( ) — change the repetition definition for a tone dx_chgrepcnt( ) change the repetition definition for a tone Name: int dx_chgrepcnt(tonetype, repcnt) Inputs: int tonetype • tone to modify int repcnt • repetition count Returns: 0 if success -1 if tone does not have a repetition value 2 if unknown tone type Includes: srllib.h dxxxlib.h Category: Call Progress Analysis Mode: synchronous Platform: Springware ! Description The dx_chgrepcnt( ) function changes the standard repetition definition for a call progress analysis tone, identified by tonetype. The repetition count component refers to the number of times that the signal must repeat before being recognized as valid. The voice driver comes with default definitions for each of the call progress analysis tones. The dx_chgrepcnt( ) function alters the standard definition of the repetition count component. Unlike other voice API library functions, the streaming to board functions do not use SRL device handles. Therefore, ATDV_LASTERR( ) and ATDV_ERRMSGP( ) cannot be used to retrieve error codes and error descriptions. Changing a tone definition has no immediate effect on the behavior of an application. The dx_initcallp( ) function takes the tone definitions and uses them to initialize a channel. Once a channel is initialized, subsequent changes to the tone definitions have no effect on that channel. For these changes to take effect, you must first call dx_deltones( ) followed by dx_initcallp( ). 162 Voice API for Windows Operating Systems Library Reference — November 2003 change the repetition definition for a tone — dx_chgrepcnt( ) Parameter Description tonetype specifies the identifier of the tone whose definition is to be modified. It may be one of the following: • TID_BUSY1 – Busy signal • TID_BUSY2 – Alternate busy signal • TID_DIAL_INTL – International dial tone • TID_DIAL_LCL – Local dial tone • TID_DIAL_XTRA – Special (extra) dial tone • TID_DISCONNECT – Disconnect tone (post-connect) • TID_FAX1 – Fax or modem tone • TID_FAX2 – Alternate fax or modem tone • TID_RNGBK1 – Ringback (detected as single tone) • TID_RINGBK2 – Ringback (detected as dual tone) repcnt the number of times that the signal must repeat ! Cautions This function changes only the definition of a tone. The new definition does not apply to a channel until dx_deltones( ) is called on that channel followed by dx_initcallp( ). ! Errors For a list of error codes, see the Error Codes chapter. ! Example #include #include #include #include main() { DX_CAP cap_s; int ddd, car; char *chnam, *dialstrg; chnam = "dxxxB1C1"; dialstrg = "L1234"; /* * Open channel */ if ((ddd = dx_open( chnam, NULL )) == -1 ) { /* handle error */ } /* * Delete any previous tones */ if ( dx_deltones(ddd) < 0 ) { /* handle error */ } Voice API for Windows Operating Systems Library Reference — November 2003 163 dx_chgrepcnt( ) — change the repetition definition for a tone /* * Change Enhanced call progress default local dial tone */ if (dx_chgfreq( TID_DIAL_LCL, 425, 150, 0, 0 ) < 0) { /* handle error */ } /* * Change Enhanced call progress default busy cadence */ if (dx_chgdur( TID_BUSY1, 550, 400, 550, 400 ) < 0) { /* handle error */ } if (dx_chgrepcnt( TID_BUSY1, 4 ) < 0) { /* handle error */ } /* * Now enable Enhanced call progress with above changed settings. */ if (dx_initcallp( ddd )) { /* handle error */ } /* * Set off Hook */ if ((dx_sethook( ddd, DX_OFFHOOK, EV_SYNC )) == -1) { /* handle error */ } /* * Dial */ if ((car = dx_dial( ddd, dialstrg,(DX_CAP *)&cap_s, DX_CALLP|EV_SYNC))==-1) { /* handle error */ } switch( car ) { case CR_NODIALTONE: printf(" Unable to get dial tone\n"); break; case CR_BUSY: printf(" %s engaged\n", dialstrg ); break; case CR_CNCT: printf(" Successful connection to %s\n", dialstrg ); break; default: break; } /* * Set on Hook */ if ((dx_sethook( ddd, DX_ONHOOK, EV_SYNC )) == -1) { /* handle error */ } dx_close( ddd ); } ! See Also • 164 dx_chgdur( ) Voice API for Windows Operating Systems Library Reference — November 2003 change the repetition definition for a tone — dx_chgrepcnt( ) • dx_chgfreq( ) • dx_deltones( ) • dx_initcallp( ) Voice API for Windows Operating Systems Library Reference — November 2003 165 dx_close( ) — close a channel or board device handle dx_close( ) close a channel or board device handle Name: int dx_close(dev) Inputs: int dev • valid channel or board device handle Returns: 0 if successful -1 if error Includes: srllib.h dxxxlib.h Category: Device Management Mode: synchronous Platform: DM3, Springware ! Description The dx_close( ) function closes a channel device handle or board device handle that was previously opened using dx_open( ). On DM3 boards, the dx_close( ) function also closes a physical board device that was previously opened using dx_open( ). This function does not affect any action occurring on a device. It does not affect the hook state or any of the parameters that have been set for the device. It releases the handle and breaks the link between the calling process and the device, regardless of whether the device is busy or idle. Note: The dx_close( ) function disables the generation of all events. Parameter Description dev specifies the valid device handle obtained when a board or channel was opened using dx_open( ) ! Cautions 166 • Once a device is closed, a process can no longer act on that device using that device handle. • Other handles for that device that exist in the same process or other processes will still be valid. • The only process affected by dx_close( ) is the process that called the function. • Do not use the Windows close( ) function to close a voice device; unpredictable results will occur. • The dx_close( ) function discards any outstanding events on that handle. • On DM3 boards, if you close a device via dx_close( ) after modifying speed and volume table values using dx_setsvmt( ), the dx_getcursv( ) function may return incorrect speed and volume settings for the device. This is because the next dx_open( ) resets the speed and volume tables to their default values. Voice API for Windows Operating Systems Library Reference — November 2003 close a channel or board device handle — dx_close( ) ! Errors If this function returns -1 to indicate failure, a system error has occurred; use dx_fileerrno( ) to obtain the system error value. Refer to the dx_fileerrno( ) function for a list of the possible system error values. ! Example 1 This example illustrates how to close a channel device handle. #include #include #include main() { int chdev; . . . /* channel descriptor */ /* Open Channel */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } . . . /* Close channel */ if (dx_close(chdev) == -1) { /* process error */ } } ! Example 2 This example illustrates how to close a physical board device handle when using cached prompts. #include "srllib.h" #include "dxxxlib.h" main() { int brdhdl; /* board handle */ . . . /* Open board */ if ((brdhdl = dx_open("brdB1",0)) == -1) { printf("Cannot open board\n"); /* Perform system error processing */ exit(1); } . . . dx_close(brdhdl); } Voice API for Windows Operating Systems Library Reference — November 2003 167 dx_close( ) — close a channel or board device handle ! See Also • 168 dx_open( ) Voice API for Windows Operating Systems Library Reference — November 2003 delete a circular stream buffer — dx_CloseStreamBuffer( ) dx_CloseStreamBuffer( ) delete a circular stream buffer Name: int dx_CloseStreamBuffer(hBuffer) Inputs: int hBuffer • stream buffer handle Returns: 0 if successful -1 if failure Includes: srllib.h dxxxlib.h Category: streaming to board Mode: synchronous Platform: DM3 ! Description The dx_CloseStreamBuffer( ) function deletes the circular stream buffer identified by the stream buffer handle. If the stream buffer is currently in use (playing), this function returns -1 as an error. Parameter Description hBuffer specifies the stream buffer handle obtained from dx_OpenStreamBuffer( ) ! Cautions You cannot delete a circular stream buffer while it is in use by a play operation. If you try to delete the buffer in this situation, the dx_CloseStreamBuffer( ) function will return -1 as an error. ! Errors This function returns -1 on error. The error can occur if you passed the wrong buffer handle to the function call or if the buffer is in use by an active play. To see if the buffer is in use by an active play, call dx_GetStreamInfo( ) and check the item “currentState” in the DX_STREAMSTAT structure. A value of ASSIGNED_STREAM_BUFFER for this item means that the buffer is currently in use in a play. A value of UNASSIGNED_STREAM_BUFFER means that the buffer is not being used currently in any play. Unlike other voice API library functions, the streaming to board functions do not use SRL device handles. Therefore, ATDV_LASTERR( ) and ATDV_ERRMSGP( ) cannot be used to retrieve error codes and error descriptions. Voice API for Windows Operating Systems Library Reference — November 2003 169 dx_CloseStreamBuffer( ) — delete a circular stream buffer ! Example #include #include main() { int nBuffSize = 32768, vDev = 0; int hBuffer = -1; char pData[1024]; DX_IOTT iott; if ((hBuffer = dx_OpenStreamBuffer(nBuffSize)) < 0) { printf("Error opening stream buffer \n"); exit(1); } if (dx_PutStreamData(hBuffer, pData, 1024, STREAM_CONT) < 0) { printf("Error in dx_PutStreamData \n"); exit(2); } if ((vDev = dx_open("dxxxB1C1", 0)) < 0) { printf("Error opening voice device\n"); exit(3); } iott.io_type = IO_STREAM|IO_EOT; iott.io_bufp = 0; iott.io_offset = 0; iott.io_length = -1; /* play until STREAM_EOD */ iott.io_fhandle = hBuffer; if (dx_playiottdata(vDev, &iott, NULL, EV_SYNC) < 0) { printf("Error in dx_play() %d\n", ATDV_LASTERR(vDev)); } if (dx_close(vDev) < 0) { printf("Error closing voice device\n"); } if (dx_CloseStreamBuffer(hBuffer) < 0) { printf("Error closing stream buffer \n"); } } ! See Also 170 • dx_OpenStreamBuffer( ) • dx_GetStreamInfo( ) Voice API for Windows Operating Systems Library Reference — November 2003 clear all fields in a DX_CAP structure — dx_clrcap( ) dx_clrcap( ) clear all fields in a DX_CAP structure Name: void dx_clrcap(capp) Inputs: DX_CAP *capp • pointer to call progress analysis parameter data structure Returns: none Includes: srllib.h dxxxlib.h Category: Structure Clearance Mode: synchronous Platform: DM3, Springware ! Description The dx_clrcap( ) function clears all fields in a DX_CAP structure by setting them to zero. dx_clrcap( ) is a VOID function that returns no value. It is provided as a convenient way of clearing a DX_CAP structure. Parameter Description capp pointer to call progress analysis parameter data structure, DX_CAP. For more information on this structure, see DX_CAP, on page 496. ! Cautions Clear the DX_CAP structure using dx_clrcap( ) before the structure is used as an argument in a dx_dial( ) function call. This will prevent parameters from being set unintentionally. ! Errors None. ! Example #include #include #include main() { DX_CAP cap; int chdev; /* open the channel using dx_open */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } . . /* set call progress analysis parameters before doing call progress analysis */ dx_clrcap(&cap); Voice API for Windows Operating Systems Library Reference — November 2003 171 dx_clrcap( ) — clear all fields in a DX_CAP structure cap.ca_nbrdna = 5; /* 5 rings before no answer */ . . /* continue with call progress analysis */ . . } ! See Also 172 • dx_dial( ) • DX_CAP data structure • call progress analysis topic in the Voice API Programming Guide Voice API for Windows Operating Systems Library Reference — November 2003 clear all digits in the firmware digit buffer — dx_clrdigbuf( ) dx_clrdigbuf( ) clear all digits in the firmware digit buffer Name: int dx_clrdigbuf(chdev) Inputs: int chdev • valid channel device handle Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Configuration Mode: synchronous Platform: DM3, Springware ! Description The dx_clrdigbuf( ) function clears all digits in the firmware digit buffer of the channel specified by chdev. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions The function will fail and return -1 if the channel device handle is invalid or the channel is busy. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example See the Example code in the function descriptions for dx_getdig( ), dx_play( ), and dx_rec( ) for more examples of how to use dx_clrdigbuf( ). #include #include #include Voice API for Windows Operating Systems Library Reference — November 2003 173 dx_clrdigbuf( ) — clear all digits in the firmware digit buffer main() { int chdev; /* channel descriptor */ . . . /* Open Channel */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* Clear digit buffer */ if (dx_clrdigbuf(chdev) == -1) { /* process error*/ } . . } ! See Also None. 174 Voice API for Windows Operating Systems Library Reference — November 2003 clear all speed or volume adjustment conditions — dx_clrsvcond( ) dx_clrsvcond( ) clear all speed or volume adjustment conditions Name: int dx_clrsvcond(chdev) Inputs: int chdev • valid channel device handle Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Speed and Volume Mode: synchronous Platform: DM3, Springware ! Description The dx_clrsvcond( ) function clears all speed or volume adjustment conditions that have been previously set using dx_setsvcond( ) or the convenience functions dx_addspddig( ) and dx_addvoldig( ). Before resetting an adjustment condition, you must first clear all current conditions by using this function, and then reset conditions using dx_setsvcond( ), dx_addspddig( ), or dx_addvoldig( ). Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions None. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BADPROD Function not supported on this board EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value Voice API for Windows Operating Systems Library Reference — November 2003 175 dx_clrsvcond( ) — clear all speed or volume adjustment conditions ! Example #include #include #include #include main() { int dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", 0) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Clear all Speed and Volume Conditions */ if ( dx_clrsvcond( dxxxdev ) == -1 ) { printf( "Unable to Clear the Speed/Volume" ); printf( " Conditions\n" ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Continue Processing * . * . * . */ /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also 176 • dx_setsvcond( ) • dx_addspddig( ) • dx_addvoldig( ) • speed and volume modification tables in Voice API Programming Guide • DX_SVCB data structure Voice API for Windows Operating Systems Library Reference — November 2003 clear all fields in a DV_TPT structure — dx_clrtpt( ) dx_clrtpt( ) clear all fields in a DV_TPT structure Name: int dx_clrtpt(tptp, size) Inputs: DV_TPT *tptp • pointer to Termination Parameter Table structure int size • number of entries to clear Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Structure Clearance Mode: synchronous Platform: DM3, Springware ! Description The dx_clrtpt( ) function clears all fields except tp_type and tp_nextp in the specified number of DV_TPT structures. This function is provided as a convenient way of clearing a DV_TPT structure, before reinitializing it for a new set of termination conditions. Parameter Description tptp points to the first DV_TPT structure to be cleared size indicates the number of DV_TPT structures to clear. If size is set to 0, the function will return a 0 to indicate success. For more information on this structure, see DV_TPT, on page 485. Notes: 1. The DV_TPT is defined in srllib.h rather than dxxxlib.h since it can be used by other non-voice devices. 2. Before calling dx_clrtpt( ), you must set the tp_type field of DV_TPT as follows: IO_CONT if the next DV_TPT is contiguous IO_LINK if the next DV_TPT is linked IO_EOT for the last DV_TPT ! Cautions If tp_type in the DV_TPT structure is set to IO_LINK, you must set tp_nextp to point to the next DV_TPT in the chain. The last DV_TPT in the chain must have its tp_type field set to IO_EOT. By setting the tp_type and tp_nextp fields appropriately, dx_clrtpt( ) can be used to clear a combination of contiguous and linked DV_TPT structures. To reinitialize DV_TPT structures with a new set of conditions, call dx_clrtpt( ) only after the links have been set up properly, as illustrated in the Example. Voice API for Windows Operating Systems Library Reference — November 2003 177 dx_clrtpt( ) — clear all fields in a DV_TPT structure ! Errors The function will fail and return -1 if IO_EOT is encountered in the tp_type field before the number of DV_TPT structures specified in size have been cleared. ! Example #include #include #include main() { DV_TPT tpt1[2]; DV_TPT tpt2[2]; /* Set up the links in the DV_TPTs */ tpt1[0].tp_type = IO_CONT; tpt1[1].tp_type = IO_LINK; tpt1[1].tp_nextp = &tpt2[0]; tpt2[0].tp_type = IO_CONT; tpt2[1].tp_type = IO_EOT; /* set up the other DV_TPT fields as required for termination */ . . /* play a voice file, get digits, etc. */ . . /* clear out the DV_TPT structures if required */ dx_clrtpt(&tpt1[0],4); /* now set up the DV_TPT structures for the next play */ . . } ! See Also • 178 DV_TPT data structure Voice API for Windows Operating Systems Library Reference — November 2003 create a new tone definition for a specific call progress tone — dx_createtone( ) dx_createtone( ) create a new tone definition for a specific call progress tone Name: int dx_createtone(brdhdl, toneid, *tonedata, mode) Inputs: int brdhdl • a valid physical board device handle int toneid • tone ID of the call progress tone TONE_DATA *tonedata • pointer to the TONE_DATA structure unsigned short mode • mode Returns: 0 if successful -1 if failure Includes: srllib.h dxxxlib.h Category: Call Progress Analysis Mode: Asynchronous or synchronous Platform: DM3 ! Description The dx_createtone( ) function creates a new tone definition for a specific call progress tone. On successful completion of the function, the TONE_DATA structure is used to create a tone definition for the specified call progress tone. Prior to creating a new tone definition with dx_createtone( ), use dx_querytone( ) to get tone information for that tone, then use dx_deletetone( ) to delete that tone. Voice API for Windows Operating Systems Library Reference — November 2003 179 dx_createtone( ) — create a new tone definition for a specific call progress tone Parameter Description brdhdl specifies a valid physical board device handle (of the format brdBn) obtained by a call to dx_open( ) toneid specifies the tone ID of the call progress tone whose definition needs to be created. Valid values are: • TID_DIAL_LCL • TID_DIAL_INTL • TID_BUSY1 • TID_RNGBK1 • TID_BUSY2 • TID_RNGBK2 • TID_DISCONNECT • TID_FAX1 • TID_FAX2 • TID_SIT_NC (no circuit found) • TID_SIT_IC (operator intercept) • TID_SIT_VC (vacant circuit) • TID_SIT_RO (reorder) tonedata specifies a pointer to the TONE_DATA data structure which contains the tone information to be created for the call progress tone identified by toneid mode specifies how the function should be executed, either EV_ASYNC (asynchronous) or EV_SYNC (synchronous) When running asynchronously, the function returns 0 to indicate that it initiated successfully and generates the TDX_CREATETONE event to indicate completion or the TDX_CREATETONE_FAIL event to indicate failure. By default, this function runs synchronously and returns 0 to indicate completion. ! Cautions 180 • Only the default call progress tones as listed in the toneid parameter description are supported for this function. • If you call dx_createtone( ) prior to calling dx_deletetone( ), then dx_createtone( ) will fail with an error EDX_TNQUERYDELETE. • To modify a default tone definition, use the three functions dx_querytone( ), dx_deletetone( ), and dx_createtone( ) in this order, for one tone at a time. • When dx_createtone( ) is issued on a physical board device in asynchronous mode, and the function is immediately followed by another similar call prior to completion of the previous call on the same device, the subsequent call will fail with device busy. Voice API for Windows Operating Systems Library Reference — November 2003 create a new tone definition for a specific call progress tone — dx_createtone( ) ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM invalid parameter EDX_SYSTEM error from operating system EDX_TNPARM invalid tone template parameter EDX_TNQUERYDELETE tone not queried or deleted prior to create ! Example #include "srllib.h" #include "dxxxlib.h" main() { int brdhdl; /* board handle */ . . . /* Open board */ if ((brdhdl = dx_open("brdB1",0)) == -1) { printf("Cannot open board\n"); /* Perform system error processing */ exit(1); } /* Get the Tone Information for the TID_BUSY1 tone*/ int result; TONE_DATA tonedata; if ((result = dx_querytone(brdhdl, TID_BUSY1, &tonedata, EV_ASYNC)) == -1) { printf("Cannot obtain tone information for TID_BUSY1 \n"); /* Perform system error processing */ exit(1); } /* Delete the current TID_BUSY1 call progress tone before creating a new definition*/ if ((result = dx_deletetone(brdhdl, TID_BUSY1, EV_ASYNC)) == -1) { printf("Cannot delete the TID_BUSY1 tone\n"); /* Perform system error processing */ exit(1); } /* Change call progress default Busy tone */ tonedata.numofseg = 1; /* Single segment tone */ toneinfo.toneseg[0].tn1_min = 0; /* Min. Frequency toneinfo.toneseg[0].tn1_max = 450; /* Max. Frequency toneinfo.toneseg[0].tn2_min = 0; /* Min. Frequency toneinfo.toneseg[0].tn2_max = 150; /* Max. Frequency toneinfo.toneseg[0].tnon_min = 400; toneinfo.toneseg[0].tnon_max = 550; for for for for Tone Tone Tone Tone 1 1 2 2 (in (in (in (in Hz) Hz) Hz) Hz) */ */ */ */ /* Debounce Min. ON Time */ /* Debounce Max. ON Time */ Voice API for Windows Operating Systems Library Reference — November 2003 181 dx_createtone( ) — create a new tone definition for a specific call progress tone toneinfo.toneseg[0].tnoff_min = 400; toneinfo.toneseg[0].tnoff_max = 550; /* Debounce Min. OFF Time */ /* Debounce Max. OFF Time */ tonedata.toneseg[0].tn_rep_cnt = 4; if ((result = dx_createtone(brdhdl, TID_BUSY1, &tonedata, EV_SYNC)) == -1) { printf("create tone for TID_BUSY1 failed\n"); /* Perform system error processing */ exit(1); } ! See Also 182 • dx_deletetone( ) • dx_querytone( ) Voice API for Windows Operating Systems Library Reference — November 2003 delete a specific call progress tone — dx_deletetone( ) dx_deletetone( ) delete a specific call progress tone Name: int dx_deletetone(brdhdl, toneid, mode) Inputs: int brdhdl • a valid physical board device handle int toneid • tone ID of the call progress tone unsigned short mode • mode Returns: 0 if successful -1 if failure Includes: srllib.h dxxxlib.h Category: Call Progress Analysis Mode: Asynchronous or synchronous Platform: DM3 ! Description The dx_deletetone( ) function deletes the specified call progress tone. Prior to creating a new tone definition with dx_createtone( ), use dx_querytone( ) to get tone information for that tone, then use dx_deletetone( ) to delete that tone. Parameter Description brdhdl specifies a valid physical board device handle (not a virtual board device) of the format brdBn obtained by a call to dx_open( ) Voice API for Windows Operating Systems Library Reference — November 2003 183 dx_deletetone( ) — delete a specific call progress tone Parameter Description toneid specifies the tone ID of the call progress tone. Valid values are: • TID_DIAL_LCL • TID_DIAL_INTL • TID_BUSY1 • TID_RNGBK1 • TID_BUSY2 • TID_RNGBK2 • TID_DISCONNECT • TID_FAX1 • TID_FAX2 • TID_SIT_NC (no circuit found) • TID_SIT_IC (operator intercept) • TID_SIT_VC (vacant circuit) • TID_SIT_RO (reorder) mode specifies how the function should be executed, either EV_ASYNC (asynchronous) or EV_SYNC (synchronous) When running asynchronously, the function returns 0 to indicate that it initiated successfully and generates the TDX_DELETETONE event to indicate completion or the TDX_DELETETONE_FAIL event to indicate failure. The TONE_DATA structure should remain in scope until the application receives these events. By default, this function runs synchronously and returns 0 to indicate completion. ! Cautions • Only the default call progress tones as listed in the toneid parameter description are supported for this function. • When dx_deletetone( ) is issued on a physical board device in asynchronous mode, and the function is immediately followed by another similar call prior to completion of the previous call on the same device, the subsequent call will fail with device busy. ! Errors If this function returns -1 to indicate failure, use ATDV_LASTERR( ) and ATDV_ERRMSGP( ) to retrieve one of the following error reasons: EDX_BADPARM invalid parameter EDX_SYSTEM error from operating system EDX_TONEID bad tone template ID 184 Voice API for Windows Operating Systems Library Reference — November 2003 delete a specific call progress tone — dx_deletetone( ) ! Example #include "srllib.h" #include "dxxxlib.h" main() { int brdhdl; /* board handle */ . . . /* Open board */ if ((brdhdl = dx_open("brdB1",0)) == -1) { printf("Cannot open board\n"); /* Perform system error processing */ exit(1); } /* Delete the current TID_BUSY1 call progress tone*/ int result; if ((result = dx_deletetone(brdhdl, TID_BUSY1, &tonedata, EV_SYNC)) == -1) { printf("Cannot delete the TID_BUSY1 tone \n"); /* Perform system error processing */ exit(1); } } ! See Also • dx_createtone( ) • dx_querytone( ) Voice API for Windows Operating Systems Library Reference — November 2003 185 dx_deltones( ) — delete all user-defined tones dx_deltones( ) delete all user-defined tones Name: int dx_deltones(chdev) Inputs: int chdev • valid channel device handle Returns: 0 if successful -1 if error Includes: srllib.h dxxxlib.h Category: Global Tone Detection Mode: synchronous Platform: DM3, Springware ! Description The dx_deltones( ) function deletes all user-defined tones previously added to a channel with dx_addtone( ). If no user-defined tones were previously enabled for this channel, this function has no effect. Note: Calling this function deletes ALL user-defined tones set by dx_blddt( ), dx_bldst( ), dx_bldstcad( ), or dx_blddtcad( ). Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) ! Cautions When using this function in a multi-threaded application, use critical sections or a semaphore around the function call to ensure a thread-safe application. Failure to do so will result in “Bad Tone Template ID” errors. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BADPROD Function not supported on this board EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value 186 Voice API for Windows Operating Systems Library Reference — November 2003 delete all user-defined tones — dx_deltones( ) ! Example #include #include #include #include main() { int dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", 0 ) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Delete all Tone Templates */ if ( dx_deltones( dxxxdev ) == -1 ) { printf( "Unable to Delete all the Tone Templates\n" ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Continue Processing * . * . * . */ /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also Adding and Enabling User-defined Tones: • dx_addtone( ) • dx_enbtone( ) Building Tones: • dx_blddt( ) • dx_bldst( ) • dx_bldstcad( ) • dx_blddtcad( ) Voice API for Windows Operating Systems Library Reference — November 2003 187 dx_dial( ) — dial an ASCIIZ string dx_dial( ) dial an ASCIIZ string Name: int dx_dial(chdev, dialstrp, capp, mode) Inputs: int chdev • valid channel device handle char *dialstrp • pointer to the ASCIIZ dial string DX_CAP *capp • pointer to call progress analysis parameter structure unsigned short mode • asynchronous/synchronous setting and call progress analysis flag Returns: 0 to indicate successful initiation (asynchronous) ≥0 to indicate call progress analysis result if successful (synchronous) -1 if failure Includes: srllib.h dxxxlib.h Category: I/O Mode: asynchronous or synchronous Platform: DM3, Springware ! Description The dx_dial( ) function dials an ASCIIZ string on an open, idle channel and optionally enables call progress analysis to provide information about the call. For detailed information on call progress analysis, see the Voice API Programming Guide. For DM3 boards, see also the Global Call API Programming Guide for information on call progress analysis. To determine the state of the channel during a dial and/or call progress analysis, use ATDX_STATE( ). Notes: 1. dx_dial( ) doesn’t affect the hook state. 2. dx_dial( ) doesn’t wait for dial tone before dialing. 188 Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) dialstrp points to the ASCII dial string. dialstrp must contain a null-terminated string of ASCII characters. For a list of valid dialing and control characters, see Table 2 and Table 3. Voice API for Windows Operating Systems Library Reference — November 2003 dial an ASCIIZ string — dx_dial( ) Parameter Description capp points to the call progress analysis parameter structure, DX_CAP. To use the default call progress analysis parameters, specify NULL in capp and DX_CALLP in mode. mode specifies whether the ASCIIZ string will be dialed with or without call progress analysis enabled, and whether the function will run asynchronously or synchronously. This parameter is a bit mask that can be set to a combination of the following values: • DX_CALLP – enables call progress analysis • EV_ASYNC – runs dx_dial( ) asynchronously • EV_SYNC – runs dx_dial( ) synchronously (default) On Springware boards, to enable call progress analysis (PerfectCall), you must call dx_initcallp( ) prior to calling dx_dial( ). Otherwise, dx_dial( ) uses basic call progress analysis. If dx_dial( ) with call progress analysis is performed on a channel that is onhook, the function will only dial digits. Call progress analysis will not occur. On DM3 boards, call progress analysis (PerfectCall) is enabled directly through dx_dial( ). The dx_initcallp( ) function is not supported. Valid Dial String Characters On DM3 boards, the following is a list of valid dialing and control characters. Table 2. Valid Dial String Characters (DM3) Characters Description Valid in Dial Mode DTMF MF On Keypad 0123456789 digits Yes Yes * asterisk or star Yes Yes (KP) # pound, hash, number, or octothorpe Yes Yes (ST) a Yes Yes (ST1) b Yes Yes (ST2) c Yes Yes (ST3) d Yes Not on Keypad Special Control , pause for 2.5 seconds (comma) Yes Yes T Dial Mode: Tone (DTMF) (default) Yes Yes M Dial Mode: MF Yes Yes When using dx_dial( ) on DM3 boards, be aware of the following considerations: Voice API for Windows Operating Systems Library Reference — November 2003 189 dx_dial( ) — dial an ASCIIZ string • Dial string characters are case-sensitive. • The default dialing mode is “T” (DTMF tone dialing). • When you change the dialing mode by specifying the M or T control characters, it becomes the new default and that dialing mode remains in effect for all dialing until a new dialing mode is specified or the system is restarted. For this reason, we recommend that you always put “T”in the dialing string for DTMF tone dialing after using the M (MF) dial mode. The dx_close( ) and dx_open( ) do not reset the default dialing mode to DTMF tone dialing. • The dx_dial( ) function does not support dial tone detection. • Dialing parameter default values can be set or retrieved using dx_getparm( ) and dx_setparm( ); see board and channel parameter defines in these function descriptions. • Invalid characters that are part of a dial string are ignored and an error will not be generated. For instance, a dial string of “(123) 456-7890” is equivalent to “1234567890”. On Springware boards, the following is a list of valid dialing and control characters. Table 3. Valid Dial String Characters (Springware) Characters Description Valid in Dial Mode DTMF MF Pulse On Keypad 0123456789 digits Yes Yes * asterisk or star Yes Yes (KP) # pound, hash, number, or octothorpe Yes Yes (ST) a Yes Yes (ST1) b Yes Yes (ST2) c Yes Yes (ST3) d Yes Yes Not on Keypad Special Control , pause (comma) Yes Yes & flash (ampersand) Yes Yes T Dial Mode: Tone (DTMF) (default) Yes Yes Yes P Dial Mode: Pulse Yes Yes Yes M Dial Mode: MF Yes Yes Yes L call progress analysis: local dial tone Yes Yes Yes I call progress analysis: international dial tone Yes Yes Yes X call progress analysis: special dial tone Yes Yes Yes When using dx_dial( ) on Springware boards, be aware of the following considerations: 190 • Dial string characters are case-sensitive. • The default dialing mode is “T” (DTMF tone dialing). Voice API for Windows Operating Systems Library Reference — November 2003 dial an ASCIIZ string — dx_dial( ) • When you change the dialing mode by specifying the P, M, or T control characters, it becomes the new default and that dialing mode remains in effect for all dialing until a new dialing mode is specified or the system is restarted. For this reason, we recommend that you always put “T”in the dialing string for DTMF tone dialing after using the P (pulse) or M (MF) dial modes. The dx_close( ) and dx_open( ) do not reset the default dialing mode to DTMF tone dialing. • Intel® TDM bus boards do not support pulse digit dialing using dx_dial( ). • The L, I, and X control characters function only when dialing with PerfectCall call progress analysis. • MF dialing is only available on systems with MF capability. • The pause character “,” and the flash character “&” are not available in MF dialing mode. To send these characters with a string of MF digits, switch to DTMF or pulse mode before sending “,” or “&”, and then switch back to MF mode by sending an “M”. For example: M*1234T,M5678a • Dialing parameter default values can be set or retrieved using dx_getparm( ) and dx_setparm( ); see the board and channel parameter defines in these function descriptions. • Invalid characters that are part of a dial string are ignored and an error will not be generated. For instance, a dial string of “(123) 456-7890” is equivalent to “1234567890”. Asynchronous Operation Set the mode field to EV_ASYNC, using a bitwise OR. When running asynchronously, the function will return 0 to indicate it has initiated successfully, and will generate one of the following termination events to indicate completion: TDX_CALLP termination of dialing (with call progress analysis) TDX_DIAL termination of dialing (without call progress analysis) Use SRL Event Management functions to handle the termination event. If asynchronous dx_dial( ) terminates with a TDX_DIAL event, use ATDX_TERMMSK( ) to determine the reason for termination. If dx_dial( ) terminates with a TDX_CALLP event, use ATDX_CPTERM( ) to determine the reason for termination. Synchronous Operation By default, this function runs synchronously, and will return a 0 to indicate that it has completed successfully. When synchronous dialing terminates, the function will return the call progress result (if call progress analysis is enabled) or 0 to indicate success (if call progress analysis isn’t enabled). Call Progress Analysis Call progress analysis provides information about the call. If it is enabled using the mode parameter, it runs on the call after dialing completes. The function can be set to run using default Voice API for Windows Operating Systems Library Reference — November 2003 191 dx_dial( ) — dial an ASCIIZ string call progress analysis parameters, or by using the call progress analysis parameter structure (DX_CAP). Call progress analysis results can be retrieved using ATDX_CPTERM( ). If dx_dial( ) is running synchronously, the call progress analysis results will also be returned by the dx_dial( ) function. Possible call progress analysis termination reasons are: CR_BUSY line was busy CR_CEPT operator intercept CR_CNCT call connected CR_ERROR call progress analysis error CR_FAXTONE fax machine or modem CR_NOANS no answer CR_NODIALTONE no dial tone CR_NORB no ringback CR_STOPD call progress analysis stopped due to dx_stopch( ) On DM3 boards, if call progress analysis is enabled, additional information about the call can be obtained using the following extended attribute functions: ATDX_CONNTYPE( ) Returns the connection type for a completed call ATDX_CPERROR( ) Returns call progress analysis error ATDX_CPTERM( ) Returns last call progress analysis termination Note: On DM3 boards, the extended attribute functions that provide call progress analysis information do not return information related to functionality that is not supported; for example, ATDX_CONNTYPE( ) connection type CON_LPC and ATDX_CPTERM( ) termination reason CR_NODIALTONE. On Springware boards, if call progress analysis is enabled, additional information about the call can be obtained using the following extended attribute functions: ATDX_ANSRSIZ( ) Returns duration of answer 192 Voice API for Windows Operating Systems Library Reference — November 2003 dial an ASCIIZ string — dx_dial( ) ATDX_CONNTYPE( ) Returns the connection type for a completed call ATDX_CPERROR( ) Returns call progress analysis error ATDX_CPTERM( ) Returns last call progress analysis termination ATDX_CRTNID( ) Returns tone identifier ATDX_DTNFAIL( ) Returns dial tone fail character ATDX_FRQDUR( ) Returns duration of first frequency detected ATDX_FRQDUR2( ) Returns duration of second frequency detected ATDX_FRQDUR3( ) Returns duration of third frequency detected ATDX_FRQHZ( ) Returns frequency of first detected tone in Hz ATDX_FRQHZ2( ) Returns frequency of second detected tone in Hz ATDX_FRQHZ3( ) Returns frequency of third detected tone in Hz ATDX_FRQOUT( ) Returns percent of frequency out of bounds ATDX_LONGLOW( ) Returns duration of longer silence ATDX_SHORTLOW( ) Returns duration of shorter silence ATDX_SIZEHI( ) Returns duration of non-silence ! Cautions • If you attempt to dial a channel in MF mode and do not have MF capabilities on that channel, DTMF tone dialing is used. • Issuing a dx_stopch( ) on a channel that is dialing with call progress analysis disabled has no effect on the dial, and will return 0. The digits specified in the dialstrp parameter will still be dialed. • Issuing a dx_stopch( ) on a channel that is dialing with call progress analysis enabled will cause the dialing to complete, but call progress analysis will not be executed. The digits specified in the dialstrp parameter will be dialed. Any call progress analysis information collected prior to the stop will be returned by extended attribute functions. • Issue this function when the channel is idle. Voice API for Windows Operating Systems Library Reference — November 2003 193 dx_dial( ) — dial an ASCIIZ string • Clear the DX_CAP structure using dx_clrcap( ) before the structure is used as an argument in a dx_dial( ) function call. This will prevent parameters from being set unintentionally. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BUSY Channel is busy EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example This example demonstrates how to use dx_dial( ) and call progress analysis (synchronous mode) on Springware boards. On DM3 boards, dx_dial( ) supports call progress analysis directly; you do not use dx_initcallp( ) to initialize call progress analysis. #include #include #include #include main() { DX_CAP int char chnam dialstrg cap_s; ddd, car; *chnam, *dialstrg; = "dxxxB1C1"; = "L1234"; /* * Open channel */ if ((ddd = dx_open( chnam, NULL )) == -1 ) { /* handle error */ } /* * Delete any previous tones */ if ( dx_deltones(ddd) < 0 ) { /* handle error */ } /* * Change call progress analysis default local dial tone */ if (dx_chgfreq( TID_DIAL_LCL, 425, 150, 0, 0 ) < 0) { /* handle error */ } 194 Voice API for Windows Operating Systems Library Reference — November 2003 dial an ASCIIZ string — dx_dial( ) /* * Change call progress analysis default busy cadence */ if (dx_chgdur( TID_BUSY1, 550, 400, 550, 400 ) < 0) { /* handle error */ } if (dx_chgrepcnt( TID_BUSY1, 4 ) < 0) { /* handle error */ } /* * Now enable call progress analysis with above changed settings. */ if (dx_initcallp( ddd )) { /* handle error */ } /* * Set off Hook */ if ((dx_sethook( ddd, DX_OFFHOOK, EV_SYNC )) == -1) { /* handle error */ } /* * Dial */ if ((car = dx_dial( ddd, dialstrg,(DX_CAP *)&cap_s, DX_CALLP|EV_SYNC))==-1) { /* handle error */ } switch( car ) { case CR_NODIALTONE: printf(" Unable to get dial tone\n"); break; case CR_BUSY: printf(" %s engaged\n", dialstrg ); break; case CR_CNCT: printf(" Successful connection to %s\n", dialstrg ); break; default: break; } /* * Set on Hook */ if ((dx_sethook( ddd, DX_ONHOOK, EV_SYNC )) == -1) { /* handle error */ } dx_close( ddd ); } ! See Also • dx_stopch( ) • event management functions in the Standard Runtime Library API Library Reference • ATDX_CPTERM( ) (to retrieve termination reason and events for dx_dial( ) with call progress analysis) • ATDX_TERMMSK( ) (to retrieve termination reason for dx_dial( ) without call progress analysis) Voice API for Windows Operating Systems Library Reference — November 2003 195 dx_dial( ) — dial an ASCIIZ string 196 • DX_CAP data structure • call progress analysis topic in the Voice API Programming Guide • ATDX_ANSRSIZ( ) • ATDX_CPERROR( ) • ATDX_FRQDUR( ) • ATDX_FRQDUR2( ) • ATDX_FRQDUR3( ) • ATDX_FRQHZ( ) • ATDX_FRQHZ2( ) • ATDX_FRQHZ3( ) • ATDX_FRQOUT( ) • ATDX_LONGLOW( ) • ATDX_SHORTLOW( ) • ATDX_SIZEHI( ) Voice API for Windows Operating Systems Library Reference — November 2003 disable detection of a user-defined tone — dx_distone( ) dx_distone( ) disable detection of a user-defined tone Name: int dx_distone(chdev, toneid, evt_mask) Inputs: int chdev • valid channel device handle int toneid • tone template identification int evt_mask • event mask Returns: 0 if success -1 if error Includes: srllib.h dxxxlib.h Category: Global Tone Detection Mode: synchronous Platform: DM3, Springware ! Description The dx_distone( ) function disables detection of a user-defined tone on a channel, as well as the tone-on and tone-off events for that tone. Detection capability for user-defined tones is enabled on a channel by default when dx_addtone( ) is called. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) toneid specifies the user-defined tone identifier for which detection is being disabled To disable detection of all user-defined tones on the channel, set toneid to TONEALL. evt_mask specifies whether to disable detection of the user-defined tone going on or going off. Set to one or both of the following using a bitwise-OR ( | ) operator. • DM_TONEON – disable TONE ON detection • DM_TONEOFF – disable TONE OFF detection evt_mask affects the enabled/disabled status of the tone template and remains in effect until dx_distone( ) or dx_enbtone( ) is called again to reset it. ! Cautions When using this function in a multi-threaded application, use critical sections or a semaphore around the function call to ensure a thread-safe application. Failure to do so will result in “Bad Tone Template ID” errors. Voice API for Windows Operating Systems Library Reference — November 2003 197 dx_distone( ) — disable detection of a user-defined tone ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BADPROD Function not supported on this board EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value EDX_TNMSGSTATUS Invalid message status setting EDX_TONEID Bad tone ID ! Example #include #include #include #include #define TID_1 main() { int 101 dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", NULL) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Describe a Simple Dual Tone Frequency Tone of 950* 1050 Hz and 475-525 Hz using leading edge detection. */ if ( dx_blddt( TID_1, 1000, 50, 500, 25, TN_LEADING ) == -1 ) { printf( "Unable to build a Dual Tone Template\n" ); } /* * Bind the Tone to the Channel */ if ( dx_addtone( dxxxdev, NULL, 0 ) == -1 ) { printf( "Unable to Bind the Tone %d\n", TID_1 ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } 198 Voice API for Windows Operating Systems Library Reference — November 2003 disable detection of a user-defined tone — dx_distone( ) /* * Disable Detection of ToneId TID_1 */ if ( dx_distone( dxxxdev, TID_1, DM_TONEON | DM_TONEOFF ) == -1 ) { printf( "Unable to Disable Detection of Tone %d\n", TID_1 ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Continue Processing * . * . * . */ /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also • dx_addtone( ) • dx_blddt( ), dx_bldst( ), dx_blddtcad( ), dx_bldstcad( ) • dx_enbtone( ) • global tone detection topic in the Voice API Programming Guide • dx_getevt( ) • DX_CST data structure • sr_getevtdatap( ) in the Standard Runtime Library API Library Reference Voice API for Windows Operating Systems Library Reference — November 2003 199 dx_enbtone( ) — enable detection of a user-defined tone dx_enbtone( ) enable detection of a user-defined tone Name: int dx_enbtone(chdev, toneid, evt_mask) Inputs: int chdev • valid channel device handle int toneid • tone template identification int evt_mask • event mask Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Global Tone Detection Mode: synchronous Platform: DM3, Springware ! Description The dx_enbtone( ) function enables detection of a user-defined tone on a channel, including the tone-on and tone-off events for that tone. Detection capability for tones is enabled on a channel by default when dx_addtone( ) is called. See the dx_addtone( ) function description for information about retrieving call status transition (CST) tone-on and tone-off events. Use dx_enbtone( ) to enable a tone that was previously disabled using dx_distone( ). Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) toneid specifies the user-defined tone identifier for which detection is being enabled To enable detection of all user-defined tones on the channel, set toneid to TONEALL. evt_mask specifies whether to enable detection of the user-defined tone going on or going off. Set to one or both of the following using a bitwise-OR ( | ) operator. • DM_TONEON – disable TONE ON detection • DM_TONEOFF – disable TONE OFF detection evt_mask affects the enabled/disabled status of the tone template and will remain in effect until dx_enbtone( ) or dx_distone( ) is called again to reset it. 200 Voice API for Windows Operating Systems Library Reference — November 2003 enable detection of a user-defined tone — dx_enbtone( ) ! Cautions When using this function in a multi-threaded application, use critical sections or a semaphore around the function call to ensure a thread-safe application. Failure to do so will result in “Bad Tone Template ID” errors. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BADPROD Function not supported on this board EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value EDX_TONEID Bad tone ID EDX_TNMSGSTATUS Invalid message status setting ! Example #include #include #include #include #define TID_1 main() { int 101 dxxxdev; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", NULL) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Describe a Simple Dual Tone Frequency Tone of 950* 1050 Hz and 475-525 Hz using leading edge detection. */ if ( dx_blddt( TID_1, 1000, 50, 500, 25, TN_LEADING ) == -1 ) { printf( "Unable to build a Dual Tone Template\n" ); } /* * Bind the Tone to the Channel */ if ( dx_addtone( dxxxdev, NULL, 0 ) == -1 ) { printf( "Unable to Bind the Tone %d\n", TID_1 ); Voice API for Windows Operating Systems Library Reference — November 2003 201 dx_enbtone( ) — enable detection of a user-defined tone printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Enable Detection of ToneId TID_1 */ if ( dx_enbtone( dxxxdev, TID_1, DM_TONEON | DM_TONEOFF ) == -1 ) { printf( "Unable to Enable Detection of Tone %d\n", TID_1 ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } /* * Continue Processing * . * . * . */ /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also 202 • dx_addtone( ) • dx_blddt( ), dx_bldst( ), dx_blddtcad( ), dx_bldstcad( ) • dx_distone( ) • global tone detection in Voice API Programming Guide • dx_getevt( ) • DX_CST data structure • sr_getevtdatap( ) in Standard Runtime Library API Library Reference Voice API for Windows Operating Systems Library Reference — November 2003 close a file — dx_fileclose( ) dx_fileclose( ) close a file Name: int dx_fileclose(handle) Inputs: int handle • handle returned from dx_fileopen( ) Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: File Manipulation Mode: synchronous Platform: DM3, Springware ! Description The dx_fileclose( ) function closes a file associated with the device handle returned by the dx_fileopen( ) function. See the _close function in the Microsoft Visual C++ Run-Time Library Reference for more information. Use dx_fileclose( ) instead of _close to ensure the compatibility of applications with the libraries across various versions of Visual C++. ! Cautions None. ! Errors If this function returns -1 to indicate failure, a system error has occurred; use dx_fileerrno( ) to obtain the system error value. Refer to the dx_fileerrno( ) function for a list of the possible system error values. ! Example /* * Play a voice file. Terminate on receiving 4 digits or at end of file */ #include #include #include #include Voice API for Windows Operating Systems Library Reference — November 2003 203 dx_fileclose( ) — close a file main() { int chdev; DX_IOTT iott; DV_TPT tpt; DV_DIGIT dig; . . /* Open the device using dx_open( ). Get channel device descriptor in * chdev. */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* set up DX_IOTT */ iott.io_type = IO_DEV|IO_EOT; iott.io_bufp = 0; iott.io_offset = 0; iott.io_length = -1; /* play till end of file */ if((iott.io_handle = dx_fileopen("prompt.vox", O_RDONLY|O_BINARY)) == -1) { /* process error */ } /* set up DV_TPT */ dx_clrtpt(&tpt,1); tpt.tp_type = IO_EOT; tpt.tp_termno = DX_MAXDTMF; tpt.tp_length = 4; tpt.tp_flags = TF_MAXDTMF; /* /* /* /* only entry in the table */ Maximum digits */ terminate on four digits */ Use the default flags */ /* clear previously entered digits */ if (dx_clrdigbuf(chdev) == -1) { /* process error */ } /* Now play the file */ if (dx_play(chdev,&iott,&tpt,EV_SYNC) == -1) { /* process error */ } /* get digit using dx_getdig( ) and continue processing. */ . . if (dx_fileclose(iott.io_handle) == -1) { /* process error */ } } ! See Also 204 • dx_fileopen( ) • dx_fileseek( ) • dx_fileread( ) • dx_filewrite( ) Voice API for Windows Operating Systems Library Reference — November 2003 return the system error value — dx_fileerrno( ) dx_fileerrno( ) return the system error value Name: int dx_fileerrno(void) Inputs: none Returns: system error value Includes: srllib.h dxxxlib.h Category: File Manipulation Mode: synchronous Platform: DM3, Springware ! Description The dx_fileerrno( ) function returns the global system error value from the operating system. Call dx_fileerrno( ) to obtain the correct system error value, which provides the reason for the error. For example, if dx_fileopen( ) fails, the error supplied by the operating system can only be obtained by calling dx_fileerrno( ). Note: Unpredictable results can occur if you use the global variable errno directly to obtain the system error value. Earlier versions of Visual C++ use different Visual C++ runtime library names. The application and Intel® Dialogic® libraries may then be using separate C++ runtime libraries with separate errno values for each. See the Microsoft Visual C++ Run-Time Library Reference or MSDN documentation for more information on system error values and their meanings. All error values, which are defined as manifest constants in errno.h, are UNIX-compatible. The values valid for 32-bit Windows applications are a subset of these UNIX values. Table 4 lists the system error values that may be returned by dx_fileerrno( ). Table 4. System Error Values Value Description E2BIG Argument list too long. EACCES Permission denied; indicates a locking or sharing violation. The file’s permission setting or sharing mode does not allow the specified access. This error signifies that an attempt was made to access a file (or, in some cases, a directory) in a way that is incompatible with the file’s attributes. For example, the error can occur when an attempt is made to read from a file that is not open, to open an existing read-only file for writing, or to open a directory instead of a file. The error can also occur in an attempt to rename a file or directory or to remove an existing directory. EAGAIN No more processes. An attempt to create a new process failed because there are no more process slots, or there is not enough memory, or the maximum nesting level has been reached. Voice API for Windows Operating Systems Library Reference — November 2003 205 dx_fileerrno( ) — return the system error value Table 4. System Error Values Value Description EBADF Bad file number; invalid file descriptor (file is not opened for writing). Possible causes: 1) The specified file handle is not a valid file-handle value or does not refer to an open file. 2) An attempt was made to write to a file or device opened for read-only access or a locked file. EDOM Math argument. EEXIST Files exist. An attempt has been made to create a file that already exists. For example, the _O_CREAT and _O_EXCL flags are specified in an _open call, but the named file already exists. EINTR A signal was caught. EINVAL Invalid argument. An invalid value was given for one of the arguments to a function. For example, the value given for the origin or the position specified by offset when positioning a file pointer (by means of a call to fseek) is before the beginning of the file. Other possibilities are as follows: The dev/evt/handler triplet was not registered or has already been registered. Invalid timeout value. Invalid flags or pmode argument. EIO Error during a Windows open. EMFILE Too many open files. No more file handles are available, so no more files can be opened. ENOENT No such file or directory; invalid device name; file or path not found. The specified file or directory does not exist or cannot be found. This message can occur whenever a specified file does not exist or a component of a path does not specify an existing directory. ENOMEM Not enough memory. Not enough memory is available for the attempted operation. The library has run out of space when allocating memory for internal data structures. ENOSPC Not enough space left on the device for the operation. No more space for writing is available on the device (for example, when the disk is full). ERANGE Result too large. An argument to a math function is too large, resulting in partial or total loss of significance in the result. This error can also occur in other functions when an argument is larger than expected. ESR_TMOUT Timed out waiting for event. EXDEV Cross-device link. An attempt was made to move a file to a different device (using the rename function). ! Cautions None. ! Errors None. ! Example rc=dx_fileopen(FileName, O_RDONLY); if (rc == -1) { printf('Error opening %s, system error: %d\n", FileName, dx_fileerrno( ) ); } 206 Voice API for Windows Operating Systems Library Reference — November 2003 return the system error value — dx_fileerrno( ) ! See Also None. Voice API for Windows Operating Systems Library Reference — November 2003 207 dx_fileopen( ) — open a file dx_fileopen( ) open a file Name: int dx_fileopen(filep, flags, pmode) Inputs: const char *filep • filename int flags • type of operations allowed int pmode • permission mode Returns: file handle if success -1 if failure Includes: srllib.h dxxxlib.h Category: File Manipulation Mode: synchronous Platform: DM3, Springware ! Description The dx_fileopen( ) function opens a file specified by filep, and prepares the file for reading and writing, as specified by flags. See the _open function in the Microsoft Visual C++ Run-Time Library Reference for more information. Use dx_fileopen( ) instead of _open to ensure the compatibility of applications with the libraries across various versions of Visual C++. ! Cautions When using dx_reciottdata( ) to record WAVE files, you cannot use the O_APPEND mode with dx_fileopen( ), because for each record, a WAVE file header will be created. ! Errors If this function returns -1 to indicate failure, a system error has occurred; use dx_fileerrno( ) to obtain the system error value. Refer to the dx_fileerrno( ) function for a list of the possible system error values. ! Example /* Play a voice file. Terminate on receiving 4 digits or at end of file*/ #include #include #include #include 208 Voice API for Windows Operating Systems Library Reference — November 2003 open a file — dx_fileopen( ) main() { int chdev; DX_IOTT iott; DV_TPT tpt; DV_DIGIT dig; . . /* Open the device using dx_open( ). Get channel device descriptor in * chdev. */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* set up DX_IOTT */ iott.io_type = IO_DEV|IO_EOT; iott.io_bufp = 0; iott.io_offset = 0; iott.io_length = -1; /* play till end of file */ if((iott.io_handle = dx_fileopen("prompt.vox", O_RDONLY|O_BINARY)) == -1) /* process error */ } /* set up DV_TPT */ dx_clrtpt(&tpt,1); tpt.tp_type = IO_EOT; tpt.tp_termno = DX_MAXDTMF; tpt.tp_length = 4; tpt.tp_flags = TF_MAXDTMF; /* /* /* /* { only entry in the table */ Maximum digits */ terminate on four digits */ Use the default flags */ /* clear previously entered digits */ if (dx_clrdigbuf(chdev) == -1) { /* process error */ } /* Now play the file */ if (dx_play(chdev,&iott,&tpt,EV_SYNC) == -1) { /* process error */ } /* get digit using dx_getdig( ) and continue processing. */ . . if (dx_fileclose(iott.io_handle) == -1) { /* process error */ } } ! See Also • dx_fileclose( ) • dx_fileseek( ) • dx_fileread( ) • dx_filewrite( ) Voice API for Windows Operating Systems Library Reference — November 2003 209 dx_fileread( ) — read data from a file dx_fileread( ) read data from a file Name: int dx_fileread(handle, buffer, count) Inputs: int handle • handle returned from dx_fileopen( ) void *buffer • storage location for data unsigned int count • maximum number of bytes Returns: number of bytes if success -1 if failure Includes: srllib.h dxxxlib.h Category: File Manipulation Mode: synchronous Platform: DM3, Springware ! Description The dx_fileread( ) function reads data from a file associated with the file handle. The function will read the number of bytes from the file associated with the handle into the buffer. The number of bytes read may be less than the value of count if there are fewer than count bytes left in the file or if the file was opened in text mode. See the _read function in the Microsoft Visual C++ Run-Time Library Reference for more information. Use dx_fileread( ) instead of _read to ensure the compatibility of applications with the libraries across various versions of Visual C++. ! Cautions None. ! Errors If this function returns -1 to indicate failure, a system error has occurred; use dx_fileerrno( ) to obtain the system error value. Refer to the dx_fileerrno( ) function for a list of the possible system error values. ! Example #include #include #include #include main() { 210 Voice API for Windows Operating Systems Library Reference — November 2003 read data from a file — dx_fileread( ) int cd; DX_UIO myio; /* channel device descriptor */ /* user definable I/O structure */ /* * User defined I/O functions */ int my_read(fd,ptr,cnt) int fd; char * ptr; unsigned cnt; { printf("My read\n"); return(dx_fileread(fd,ptr,cnt)); } /* * my write function */ int my_write(fd,ptr,cnt) int fd; char * ptr; unsigned cnt; { printf("My write \n"); return(dx_filewrite(fd,ptr,cnt)); } /* * my seek function */ long my_seek(fd,offset,whence) int fd; long offset; int whence; { printf("My seek\n"); return(dx_fileseek(fd,offset,whence)); } void main(argc,argv) int argc; char *argv[]; { . . /* Other initialization */ . DX_UIO uioblk; /* Initialize the UIO structure */ uioblk.u_read=my_read; uioblk.u_write=my_write; uioblk.u_seek=my_seek; /* Install my I/O routines */ dx_setuio(uioblk); vodat_fd = dx_fileopen("JUNK.VOX",O_RDWR|O_BINARY); /*This block uses standard I/O functions */ iott->io_type = IO_DEV|IO_CONT iott->io_fhandle = vodat_fd; iott->io_offset = 0; iott->io_length = 20000; Voice API for Windows Operating Systems Library Reference — November 2003 211 dx_fileread( ) — read data from a file /*This block uses my I/O functions */ iottp++; iottp->io_type = IO_DEV|IO_UIO|IO_CONT iottp->io_fhandle = vodat_fd; iott->io_offset = 20001; iott->io_length = 20000; /*This block uses standard I/O functions */ iottp++ iott->io_type = IO_DEV|IO_CONT iott->io_fhandle = vodat_fd; iott->io_offset = 20002; iott->io_length = 20000; /*This block uses my I/O functions */ iott->io_type = IO_DEV|IO_UIO|IO_EOT iott->io_fhandle = vodat_fd; iott->io_offset = 10003; iott->io_length = 20000; devhandle = dx_open("dxxxB1C1", 0); dx_sethook(devhandle, DX-ONHOOK,EV_SYNC) dx_wtring(devhandle,1,DX_OFFHOOK,EV_SYNC); dx_clrdigbuf; if(dx_rec(devhandle,iott,(DX_TPT*)NULL,RM_TONE|EV_SYNC) == -1) { perror(""); exit(1); } dx_clrdigbuf(devhandle); if(dx_play(devhandle,iott,(DX_TPT*)EV_SYNC) == -1 { perror(""); exit(1); } dx_close(devhandle); } ! See Also 212 • dx_fileopen( ) • dx_fileclose( ) • dx_fileseek( ) • dx_filewrite( ) Voice API for Windows Operating Systems Library Reference — November 2003 move a file pointer — dx_fileseek( ) dx_fileseek( ) move a file pointer Name: long dx_fileseek(handle, offset, origin) Inputs: int handle • handle returned from dx_fileopen( ) long offset • number of bytes from the origin int origin • initial position Returns: number of bytes read if success -1 if failure Includes: srllib.h dxxxlib.h Category: File Manipulation Mode: synchronous Platform: DM3, Springware ! Description The dx_fileseek( ) function moves a file pointer associated with the file handle to a new location that is offset bytes from origin. The function returns the offset, in bytes, of the new position from the beginning of the file. See the _lseek function in the Microsoft Visual C++ Run-Time Library Reference for more information. Use dx_fileseek( ) instead of _lseek to ensure the compatibility of applications with the libraries across various versions of Visual C++. ! Cautions Do not use dx_fileseek( ) against files that utilize encoding formats with headers (such as GSM). The dx_fileseek( ) function is not designed to make adjustments for the various header sizes that some encoding formats use. ! Errors If this function returns -1 to indicate failure, a system error has occurred; use dx_fileerrno( ) to obtain the system error value. Refer to the dx_fileerrno( ) function for a list of the possible system error values. ! Example #include #include #include #include Voice API for Windows Operating Systems Library Reference — November 2003 213 dx_fileseek( ) — move a file pointer main() { int cd; DX_UIO myio; /* channel device descriptor */ /* user definable I/O structure */ /* * User defined I/O functions */ int my_read(fd,ptr,cnt) int fd; char * ptr; unsigned cnt; { printf("My read\n"); return(dx_fileread(fd,ptr,cnt)); } /* * my write function */ int my_write(fd,ptr,cnt) int fd; char * ptr; unsigned cnt; { printf("My write \n"); return(dx_filewrite(fd,ptr,cnt)); } /* * my seek function */ long my_seek(fd,offset,whence) int fd; long offset; int whence; { printf("My seek\n"); return(dx_fileseek(fd,offset,whence)); } void main(argc,argv) int argc; char *argv[]; { . . /* Other initialization */ . DX_UIO uioblk; /* Initialize the UIO structure */ uioblk.u_read=my_read; uioblk.u_write=my_write; uioblk.u_seek=my_seek; /* Install my I/O routines */ dx_setuio(uioblk); vodat_fd = dx_fileopen("JUNK.VOX",O_RDWR|O_BINARY); /*This block uses standard I/O functions */ iott->io_type = IO_DEV|IO_CONT iott->io_fhandle = vodat_fd; iott->io_offset = 0; iott->io_length = 20000; 214 Voice API for Windows Operating Systems Library Reference — November 2003 move a file pointer — dx_fileseek( ) /*This block uses my I/O functions */ iottp++; iottp->io_type = IO_DEV|IO_UIO|IO_CONT iottp->io_fhandle = vodat_fd; iott->io_offset = 20001; iott->io_length = 20000; /*This block uses standard I/O functions */ iottp++ iott->io_type = IO_DEV|IO_CONT iott->io_fhandle = vodat_fd; iott->io_offset = 20002; iott->io_length = 20000; /*This block uses my I/O functions */ iott->io_type = IO_DEV|IO_UIO|IO_EOT iott->io_fhandle = vodat_fd; iott->io_offset = 10003; iott->io_length = 20000; devhandle = dx_open("dxxxB1C1", NULL); dx_sethook(devhandle, DX-ONHOOK,EV_SYNC) dx_wtring(devhandle,1,DX_OFFHOOK,EV_SYNC); dx_clrdigbuf; if(dx_rec(devhandle,iott,(DX_TPT*)NULL,RM_TONE|EV_SYNC) == -1) { perror(""); exit(1); } dx_clrdigbuf(devhandle); if(dx_play(devhandle,iott,(DX_TPT*)EV_SYNC) == -1 { perror(""); exit(1); } dx_close(devhandle); } ! See Also • dx_fileopen( ) • dx_fileclose( ) • dx_fileread( ) • dx_filewrite( ) Voice API for Windows Operating Systems Library Reference — November 2003 215 dx_filewrite( ) — write data from a buffer into a file dx_filewrite( ) write data from a buffer into a file Name: int dx_filewrite(handle, buffer, count) Inputs: int handle • handle returned from dx_fileopen( ) void *buffer • data to be written unsigned int count • number of bytes Returns: number of bytes if success -1 if failure Includes: srllib.h dxxxlib.h Category: File Manipulation Mode: synchronous Platform: DM3, Springware ! Description The dx_filewrite( ) function writes data from a buffer into a file associated with file handle. The write operation begins at the current position of the file pointer (if any) associated with the given file. If the file was opened for appending, the operation begins at the current end of the file. After the write operation, the file pointer is increased by the number of bytes actually written. See the _write function in the Microsoft Visual C++ Run-Time Library Reference for more information. Use dx_filewrite( ) instead of _write to ensure the compatibility of applications with the libraries across various versions of Visual C++. ! Cautions None. ! Errors If this function returns -1 to indicate failure, a system error has occurred; use dx_fileerrno( ) to obtain the system error value. Refer to the dx_fileerrno( ) function for a list of the possible system error values. ! Example #include #include #include #include main() { int cd; DX_UIO myio; 216 /* channel device descriptor */ /* user definable I/O structure */ Voice API for Windows Operating Systems Library Reference — November 2003 write data from a buffer into a file — dx_filewrite( ) /* * User defined I/O functions */ int my_read(fd,ptr,cnt) int fd; char * ptr; unsigned cnt; { printf("My read\n"); return(dx_fileread(fd,ptr,cnt)); } /* * my write function */ int my_write(fd,ptr,cnt) int fd; char * ptr; unsigned cnt; { printf("My write \n"); return(dx_filewrite(fd,ptr,cnt)); } /* * my seek function */ long my_seek(fd,offset,whence) int fd; long offset; int whence; { printf("My seek\n"); return(dx_fileseek(fd,offset,whence)); } void main(argc,argv) int argc; char *argv[]; { . . /* Other initialization */ . DX_UIO uioblk; /* Initialize the UIO structure */ uioblk.u_read=my_read; uioblk.u_write=my_write; uioblk.u_seek=my_seek; /* Install my I/O routines */ dx_setuio(uioblk); vodat_fd = dx_fileopen("JUNK.VOX",O_RDWR|O_BINARY); /*This block uses standard I/O functions */ iott->io_type = IO_DEV|IO_CONT iott->io_fhandle = vodat_fd; iott->io_offset = 0; iott->io_length = 20000; /*This block uses my I/O functions */ iottp++; iottp->io_type = IO_DEV|IO_UIO|IO_CONT iottp->io_fhandle = vodat_fd; iott->io_offset = 20001; iott->io_length = 20000; Voice API for Windows Operating Systems Library Reference — November 2003 217 dx_filewrite( ) — write data from a buffer into a file /*This block uses standard I/O functions */ iottp++ iott->io_type = IO_DEV|IO_CONT iott->io_fhandle = vodat_fd; iott->io_offset = 20002; iott->io_length = 20000; /*This block uses my I/O functions */ iott->io_type = IO_DEV|IO_UIO|IO_EOT iott->io_fhandle = vodat_fd; iott->io_offset = 10003; iott->io_length = 20000; devhandle = dx_open("dxxxB1C1", NULL); dx_sethook(devhandle, DX-ONHOOK,EV_SYNC) dx_wtring(devhandle,1,DX_OFFHOOK,EV_SYNC); dx_clrdigbuf; if(dx_rec(devhandle,iott,(DX_TPT*)NULL,RM_TONE|EV_SYNC) == -1) { perror(""); exit(1); } dx_clrdigbuf(devhandle); if(dx_play(devhandle,iott,(DX_TPT*)EV_SYNC) == -1 { perror(""); exit(1); } dx_close(devhandle); } ! See Also 218 • dx_fileopen( ) • dx_fileclose( ) • dx_fileseek( ) • dx_fileread( ) Voice API for Windows Operating Systems Library Reference — November 2003 get size of on-board memory for cached prompts — dx_getcachesize( ) dx_getcachesize( ) get size of on-board memory for cached prompts Name: int dx_getcachesize(brdhdl, cachesize, flag) Inputs: int brdhdl • valid physical board device handle int *cachesize • pointer to current cache size unsigned short flag • flag for type of cache size Returns: 0 if successful -1 if failure Includes: srllib.h dxxxlib.h Category: Cached Prompt Management Mode: synchronous Platform: DM3 ! Description The dx_getcachesize( ) function returns the size of the on-board memory used to store cached prompts for a board specified by the board handle. If the flag specified is DX_CACHETOTAL, the function returns the total size of the memory available for the board. If the flag specified is DX_CACHEREMAINING, the function returns the remaining size of the cache that can be used to store additional prompts. For more information about Cached Prompt Management and extended example code, see the Voice API Programming Guide. Parameter Description brdhdl specifies a valid physical board device handle (of the format brdBn) obtained by a call to dx_open( ) cachesize points to an integer that represents the current cache size in bytes flag flag that indicates the type of cache size. Valid values are: • DX_CACHETOTAL – total size of memory available on the board • DX_CACHEREMAINING – remaining size of cache that can be used to store additional prompts ! Cautions None. ! Errors If this function returns -1 to indicate failure, call the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code, or use ATDV_ERRMSGP( ) to Voice API for Windows Operating Systems Library Reference — November 2003 219 dx_getcachesize( ) — get size of on-board memory for cached prompts obtain a descriptive error message. For a list of error codes returned by ATDV_LASTERR( ), see the Error Codes chapter. ! Example #include #include #include #include "srllib.h" "dxxxlib.h" main() { int brdhdl; /* board handle */ int cachetotal; /* Total size of the on-board memory for storing cache prompts */ int cacheremaining; /* Remaining size of on-board memory */ . . . /* Open board */ if ((brdhdl = dx_open("brdB1",0)) == -1) { printf("Cannot open board\n"); /* Perform system error processing */ exit(1); } /* Find the total available size of the on-board memory */ if (dx_getcachesize(brdhdl, &cachetotal, DX_CACHETOTAL) == -1) { printf("Error while getting cache size \n"); /* Perform system error processing */ exit(1); } . . . /* Download prompts to the on-board memory */ . . . /* Check available size remaining for additional downloads */ if (dx_getcachesize(brdhdl, &cacheremaining, DX_CACHEREMAINING) == -1) { printf("Error while getting cache size \n"); /* Perform system error processing */ exit(1); } } ! See Also 220 • dx_cacheprompt( ) • dx_open( ) • dx_playiottdata( ) Voice API for Windows Operating Systems Library Reference — November 2003 get information about a voice device — dx_getctinfo( ) dx_getctinfo( ) get information about a voice device Name: int dx_getctinfo(chdev, ct_devinfop) Inputs: int chdev • valid channel device handle CT_DEVINFO *ct_devinfop • pointer to device information structure Returns: 0 on success -1 on error Includes: srllib.h dxxxlib.h Category: TDM Routing Mode: synchronous Platform: DM3, Springware, Intel® NetStructure™ IPT Series ! Description The dx_getctinfo( ) function returns information about a voice channel of a voice device. This information is contained in a CT_DEVINFO structure. Parameter Description chdev specifies the valid voice channel handle obtained when the channel was opened using dx_open( ) ct_devinfop specifies a pointer to the CT_DEVINFO structure that will contain the voice channel device information ! Cautions This function will fail if an invalid voice channel handle is specified. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Parameter error EDX_SH_BADEXTTS TDM bus time slot is not supported at current clock rate EDX_SH_BADINDX Invalid Switch Handler index number EDX_SH_BADTYPE Invalid local time slot channel type (voice, analog, etc.) Voice API for Windows Operating Systems Library Reference — November 2003 221 dx_getctinfo( ) — get information about a voice device EDX_SH_CMDBLOCK Blocking command is in progress EDX_SH_LIBBSY Switch Handler library is busy EDX_SH_LIBNOTINIT Switch Handler library is uninitialized EDX_SH_MISSING Switch Handler is not present EDX_SH_NOCLK Switch Handler clock fallback failed EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example #include #include main() { int chdev; CT_DEVINFO ct_devinfo; /* Channel device handle */ /* Device information structure */ /* Open board 1 channel 1 devices */ if ((chdev = dx_open("dxxxB1C1", 0)) == -1) { /* process error */ } /* Get Device Information */ if (dx_getctinfo(chdev, &ct_devinfo) == -1) { printf("Error message = %s", ATDV_ERRMSGP(chdev)); exit(1); } printf("%s Product Id = 0x%x, Family = %d, Mode = %d, Network = %d, Bus ...mode = %d, Encoding = %d", ATDV_NAMEP(chdev), ct_devinfo.ct_prodid, ...ct_devinfo.ct_devfamily, ct_devinfo.ct_devmode, ct_devinfo.ct_nettype, ...ct_devinfo.ct_busmode, ct_devinfo.ct_busencoding); } ! See Also 222 • ag_getctinfo( ) • dt_getctinfo( ) in the Digital Network Interface Software Reference Voice API for Windows Operating Systems Library Reference — November 2003 return the specified current speed and volume settings — dx_getcursv( ) dx_getcursv( ) return the specified current speed and volume settings Name: int dx_getcursv(chdev, curvolp, curspeedp) Inputs: int chdev • valid channel device handle int * curvolp • pointer to current absolute volume setting int * curspeedp • pointer to current absolute speed setting Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Speed and Volume Mode: synchronous Platform: DM3, Springware ! Description The dx_getcursv( ) function returns the specified current speed and volume settings on a channel. For example, use dx_getcursv( ) to determine the speed and volume level set interactively by a listener using DTMF digits during a play. DTMF digits are set as play adjustment conditions using the dx_setsvcond( ) function, or by one of the convenience functions, dx_addspddig( ) or dx_addvoldig( ). Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) curvolp points to an integer that represents the current absolute volume setting for the channel. This value will be between -30 dB and +10 dB. curspeedp points to an integer that represents the current absolute speed setting for the channel. This value will be between -50% and +50%. ! Cautions On DM3 boards, if you close a device via dx_close( ) after modifying speed and volume table values using dx_setsvmt( ), the dx_getcursv( ) function may return incorrect speed and volume settings for the device. This is because the next dx_open( ) resets the speed and volume tables to their default values. Voice API for Windows Operating Systems Library Reference — November 2003 223 dx_getcursv( ) — return the specified current speed and volume settings ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BADPROD Function not supported on this board EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example #include #include #include #include /* * Global Variables */ main() { int int dxxxdev; curspeed, curvolume; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", NULL) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Get the Current Volume and Speed Settings */ if ( dx_getcursv( dxxxdev, &curvolume, &curspeed ) == -1 ) { printf( "Unable to Get the Current Speed and" ); printf( " Volume Settings\n"); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } else { printf( "Volume = %d Speed = %d\n", curvolume, curspeed ); } /* * Continue Processing * . * . * . */ 224 Voice API for Windows Operating Systems Library Reference — November 2003 return the specified current speed and volume settings — dx_getcursv( ) /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also • dx_adjsv( ) • dx_addspddig( ) • dx_addvoldig( ) • dx_setsvmt( ) • dx_getsvmt( ) • dx_setsvcond( ) • dx_clrsvcond( ) • speed and volume modification tables in the Voice API Programming Guide • DX_SVMT data structure Voice API for Windows Operating Systems Library Reference — November 2003 225 dx_getdig( ) — collect digits from a channel digit buffer dx_getdig( ) collect digits from a channel digit buffer Name: int dx_getdig(chdev, tptp, digitp, mode) Inputs: int chdev • valid channel device handle DV_TPT *tptp • pointer to Termination Parameter Table structure DV_DIGIT *digitp • pointer to User Digit Buffer structure unsigned short mode • asynchronous/synchronous setting Returns: 0 to indicate successful initiation (asynchronous) number of digits (+1 for NULL) if successful (synchronous) -1 if failure Includes: srllib.h dxxxlib.h Category: I/O Mode: asynchronous or synchronous Platform: DM3, Springware ! Description The dx_getdig( ) function initiates the collection of digits from an open channel’s digit buffer. Upon termination of the function, the collected digits are written in ASCIIZ format into the local buffer, which is arranged as a DV_DIGIT structure. The type of digits collected depends on the digit detection mode set by the dx_setdigtyp( ) function (for standard voice board digits) or by the dx_addtone( ) function (for user-defined digits). Note: The channel must be idle, or the function will return an EDX_BUSY error. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) tptp points to the Termination Parameter Table structure, DV_TPT, which specifies termination conditions for this function. For a list of possible termination conditions, see DV_TPT, on page 485. digitp points to the User Digit Buffer structure, DV_DIGIT, where collected digits and their types are stored in arrays. For a list of digit types, see DV_DIGIT, on page 483. For more information about creating user-defined digits, see dx_addtone( ). mode 226 specifies whether to run dx_getdig( ) asynchronously or synchronously. Specify one of the following: • EV_ASYNC – run asynchronously • EV_SYNC – run synchronously (default) Voice API for Windows Operating Systems Library Reference — November 2003 collect digits from a channel digit buffer — dx_getdig( ) ! Asynchronous Operation To run this function asynchronously, set the mode parameter to EV_ASYNC. In asynchronous mode, this function returns 0 to indicate success, and generates a TDX_GETDIG termination event to indicate completion. Use the Standard Runtime Library (SRL) Event Management functions to handle the termination event. For more information, see the Standard Runtime Library API Library Reference. When operating asynchronously, ensure that the digit buffer stays in scope for the duration of the function. After dx_getdig( ) terminates, use the ATDX_TERMMSK( ) function to determine the reason for termination. ! Synchronous Operation By default, this function runs synchronously. Termination of synchronous digit collection is indicated by a return value greater than 0 that represents the number of digits received (+1 for NULL). Use ATDX_TERMMSK( ) to determine the reason for termination. The channel’s digit buffer contains up to 31 digits, collected on a First-In First-Out (FIFO) basis. Since the digits remain in the channel’s digit buffer until they are overwritten or cleared using dx_clrdigbuf( ), the digits in the channel’s buffer may have been received prior to this function call. The DG_MAXDIGS define in dxxxlib.h specifies the maximum number of digits (that is, 31) that can be returned by a single call to dx_getdig( ). Note: By default, after the thirty-first digit, all subsequent digits will be discarded. You can use the dx_setdigbuf( ) function with the mode parameter set to DX_DIGCYCLIC, which will cause all incoming digits to overwrite the oldest digit in the buffer. If the function is operating synchronously and there are no digits in the buffer, the return value from this function will be 1, which indicates the NULL terminator. ! Cautions • On DM3 boards, Global DPD is not supported (DG_DPD_ASCII is not available). • Some MF digits use approximately the same frequencies as DTMF digits (see Section 6.1, “DTMF and MF Tone Specifications”, on page 539). Because there is a frequency overlap, if you have the incorrect kind of detection enabled, MF digits may be mistaken for DTMF digits, and vice versa. To ensure that digits are correctly detected, only one kind of detection should be enabled at any time. To set MF digit detection, use the dx_setdigtyp( ) function. • A digit that is set to adjust play speed or play volume (using dx_setsvcond( )) will not be passed to dx_getdig( ), and will not be used as a terminating condition. If a digit is defined both to adjust play and to terminate play, then the play adjustment will take priority. • The dx_getdig( ) does not support terminating on a user-defined tone (GTD). Specifying DX_TONE in the DV_TPT tp_termno field has no effect on dx_getdig( ) termination and will be ignored. • In a TDM bus configuration, when a caller on one voice board is routed in a conversation on an analog line with a caller on another voice board (analog inbound/outbound configuration) and either caller sends a DTMF digit, both voice channels will detect the DTMF digit if the Voice API for Windows Operating Systems Library Reference — November 2003 227 dx_getdig( ) — collect digits from a channel digit buffer corresponding voice channels are listening. This occurs because the network functionality of the voice board cannot be separated from the voice functionality in an analog connection between two callers. In this situation, you are not able to determine which caller sent the DTMF digit. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BADTPT Invalid DV_TPT entry EDX_BUSY Channel busy EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example 1 This example illustrates how to use dx_getdig( ) in synchronous mode. #include #include #include #include main() { DV_TPT tpt[3]; DV_DIGIT digp; int chdev, numdigs, cnt; /* open the channel with dx_open( ). Obtain channel device descriptor * in chdev */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* initiate the call */ . . /* Set up the DV_TPT and get the digits */ dx_clrtpt(tpt,3); tpt[0].tp_type = IO_CONT; tpt[0].tp_termno = DX_MAXDTMF; /* Maximum number of digits */ tpt[0].tp_length = 4; /* terminate on 4 digits */ tpt[0].tp_flags = TF_MAXDTMF; /* terminate if already in buf. */ tpt[1].tp_type tpt[1].tp_termno tpt[1].tp_length tpt[1].tp_flags 228 = = = = IO_CONT; DX_LCOFF; /* LC off termination */ 3; /* Use 30 msec (10 msec resolution timer) */ TF_LCOFF|TF_10MS; /* level triggered, clear history, Voice API for Windows Operating Systems Library Reference — November 2003 collect digits from a channel digit buffer — dx_getdig( ) * 10 msec resolution */ tpt[2].tp_type tpt[2].tp_termno tpt[2].tp_length tpt[2].tp_flags = = = = IO_EOT; DX_MAXTIME; 100; TF_MAXTIME; /* Function Time */ /* 10 seconds (100 msec resolution timer) */ /* Edge-triggered */ /* clear previously entered digits */ if (dx_clrdigbuf(chdev) == -1) { /* process error */ } if ((numdigs = dx_getdig(chdev,tpt, &digp, EV_SYNC)) == -1) { /* process error */ } for (cnt=0; cnt < numdigs; cnt++) { printf("\nDigit received = %c, digit type = %d", digp.dg_value[cnt], digp.dg_type[cnt]); } /* go to next state */ . . } ! Example 2 This example illustrates how to use dx_getdig( ) in asynchronous mode. #include #include #include #include #define MAXCHAN 24 int digit_handler(); DV_TPT stpt[3]; DV_DIGIT digp[256]; main() { int i, chdev[MAXCHAN]; char *chnamep; int srlmode; /* Set SRL to run in polled mode. */ srlmode = SR_POLLMODE; if (sr_setparm(SRL_DEVICE, SR_MODEID, (void *)&srlmode) == -1) { /* process error */ } for (i=0; i #include #include int InitDevices( ) { DWORD dwfilever, dwprodver; /************************************************************************ 232 Voice API for Windows Operating Systems Library Reference — November 2003 retrieve the voice DLL version number — dx_GetDllVersion( ) * Initialize all the DLLs required. This will cause the DLLs to be * loaded and entry points to be resolved. Entry points not resolved * are set up to point to a default not implemented function in the * 'C' library. If the DLL is not found all functions are resolved * to not implemented. ************************************************************************/ if (sr_libinit(DLGC_MT) == -1) { /* Must be already loaded, only reason if sr_libinit( ) was already called */ } /* Call technology specific dx_libinit( ) functions to load voice DLL */ if (dx_libinit(DLGC_MT) == -1) { /* Must be already loaded, only reason if dx_libinit( ) was already called */ } /********************************************************************************* * Voice library initialized so all other voice functions may be called * as normal. Display the version number of the DLL **********************************************************************************/ dx_GetDllVersion(&dwfilever, &dwprodver); printf("File Version for voice DLL is %d.%02d\n", HIWORD(dwfilever), LOWORD(dwfilever)); printf("Product Version for voice DLL is %d.%02d\n", HIWORD(dwprodver), LOWORD(dwprodver)); /* Now open all the voice devices */ } ! See Also • fx_GetDllVersion( ) in the Fax Software Reference • sr_GetDllVersion( ) in the Standard Runtime Library API Library Reference • dt_GetDllVersion( ) in the Digital Network Interface Software Reference Voice API for Windows Operating Systems Library Reference — November 2003 233 dx_getevt( ) — monitor channel events synchronously dx_getevt( ) monitor channel events synchronously Name: int dx_getevt(chdev, eblkp, timeout) Inputs: int chdev • valid channel device handle DX_EBLK *eblkp • pointer to Event Block structure int timeout • timeout value in seconds Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Call Status Transition Event Mode: synchronous Platform: DM3, Springware ! Description The dx_getevt( ) function monitors channel events synchronously for possible call status transition events in conjunction with dx_setevtmsk( ). The dx_getevt( ) function blocks and returns control to the program after one of the events set by dx_setevtmsk( ) occurs on the channel specified in the chdev parameter. The DX_EBLK structure contains the event that ended the blocking. Note: Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) eblkp points to the Event Block structure DX_EBLK, which contains the event that ended the blocking timeout specifies the maximum amount of time in seconds to wait for an event to occur. timeout can have one of the following values: • number of seconds – maximum length of time dx_getevt( ) will wait for an event. When the time specified has elapsed, the function will terminate and return an error. • -1 – dx_getevt( ) will block until an event occurs; it will not time out. • 0 – The function will return -1 immediately if no event is present. When the time specified in timeout expires, dx_getevt( ) will terminate and return an error. Use the Standard Attribute function ATDV_LASTERR( ) to determine the cause of the error, which in this case is EDX_TIMEOUT. ! Cautions It is recommended that you enable only one process per channel. The event that dx_getevt( ) is waiting for may change if another process sets a different event for that channel. See dx_setevtmsk( ) for more information. 234 Voice API for Windows Operating Systems Library Reference — November 2003 monitor channel events synchronously — dx_getevt( ) ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value EDX_TIMEOUT Timeout time limit is reached ! Example #include #include #include #include main() { int chdev; int timeout; DX_EBLK eblk; . . . /* channel descriptor */ /* timeout for function */ /* Event Block Structure */ /* Open Channel */ if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) { /* process error */ } /* Set RINGS or WINK as events to wait on */ if (dx_setevtmsk(chdev,DM_RINGS|DM_WINK) == -1) { /* process error */ } /* Set timeout to 5 seconds */ timeout = 5; if (dx_getevt(chdev,&eblk,timeout) == -1){ /* process error */ if (ATDV_LASTERR(chdev) == EDX_TIMEOUT) { /* check if timed out */ printf("Timed out waiting for event.\n"); } else { /* further error processing */ . . } } switch (eblk.ev_event) { case DE_RINGS: printf("Ring event occurred.\n"); break; case DE_WINK: printf("Wink event occurred.\n"); Voice API for Windows Operating Systems Library Reference — November 2003 235 dx_getevt( ) — monitor channel events synchronously break; } . . } ! See Also 236 • dx_setevtmsk( ) • DX_EBLK data structure Voice API for Windows Operating Systems Library Reference — November 2003 retrieve feature support information for the device — dx_getfeaturelist( ) dx_getfeaturelist( ) retrieve feature support information for the device Name: int dx_getfeaturelist(dev, feature_tablep) Inputs: int dev • valid board or channel device handle FEATURE_TABLE *feature_tablep • pointer to features information structure Returns: 0 on success -1 on error Includes: srllib.h dxxxlib.h Category: Configuration Mode: synchronous Platform: DM3, Springware ! Description The dx_getfeaturelist( ) function returns information about the features supported on the device. This information is contained in the FEATURE_TABLE data structure. Parameter Description dev specifies the valid device handle obtained when a board (in the format dxxxBn) or channel (dxxxBnCm) was opened using dx_open( ). Note: Specifying a board device handle is not supported on Springware boards. Note: On high-density DM3 boards, retrieving information for a channel device can be time-consuming as each channel is opened one by one. You can retrieve information for the board device instead. All channel devices belonging to the specific board device have the same features as the parent board. feature_tablep specifies a pointer to the FEATURE_TABLE data structure which contains the bitmasks of various features supported such as data format for play/record, fax features, and more. For more information on this structure, see FEATURE_TABLE, on page 525. ! Cautions • This function fails if an invalid device handle is specified. • On DM3 analog boards, use dx_getctinfo( ) to return information about the type of front end or network interface on the board. The network interface information is contained in the ct_nettype field of CT_DEVINFO. Voice API for Windows Operating Systems Library Reference — November 2003 237 dx_getfeaturelist( ) — retrieve feature support information for the device ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Parameter error EDX_SH_BADEXTTS TDM bus time slot is not supported at current clock rate EDX_SH_BADINDX Invalid Switch Handler index number EDX_SH_BADTYPE Invalid local time slot channel type (voice, analog, etc.) EDX_SH_CMDBLOCK Blocking command is in progress EDX_SH_LIBBSY Switch Handler library is busy EDX_SH_LIBNOTINIT Switch Handler library is uninitialized EDX_SH_MISSING Switch Handler is not present EDX_SH_NOCLK Switch Handler clock fallback failed EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example #include #include #include #include "srllib.h" "dxxxlib.h" void main(int argc, char ** argv) { char chname[32] = "dxxxB1C1"; int dev; FEATURE_TABLE feature_table; if ((dev = dx_open(chname, 0)) == -1) { printf("Error opening \"%s\"\n", chname); exit(1); } if (dx_getfeaturelist(dev, &feature_table) == -1) { printf("%s: Error %d getting featurelist\n", chname, ATDV_LASTERR(dev)); exit(2); } 238 Voice API for Windows Operating Systems Library Reference — November 2003 retrieve feature support information for the device — dx_getfeaturelist( ) printf("\n%s: Play Features:-\n", chname); if (feature_table.ft_play & FT_ADPCM) { printf("ADPCM "); } if (feature_table.ft_play & FT_PCM) { printf("PCM "); } if (feature_table.ft_play & FT_ALAW) { printf("ALAW "); } if (feature_table.ft_play & FT_ULAW) { printf("ULAW "); } if (feature_table.ft_play & FT_LINEAR) { printf("LINEAR "); } if (feature_table.ft_play & FT_ADSI) { printf("ADSI "); } if (feature_table.ft_play & FT_DRT6KHZ) { printf("DRT6KHZ "); } if (feature_table.ft_play & FT_DRT8KHZ) { printf("DRT8KHZ "); } if (feature_table.ft_play & FT_DRT11KHZ) { printf("DRT11KHZ"); } printf("\n\n%s: Record Features:-\n", chname); if (feature_table.ft_record & FT_ADPCM) { printf("ADPCM "); } if (feature_table.ft_record & FT_PCM) { printf("PCM "); } if (feature_table.ft_record & FT_ALAW) { printf("ALAW "); } if (feature_table.ft_record & FT_ULAW) { printf("ULAW "); } if (feature_table.ft_record & FT_LINEAR) { printf("LINEAR "); } if (feature_table.ft_record & FT_ADSI) { printf("ADSI "); } if (feature_table.ft_record & FT_DRT6KHZ) { printf("DRT6KHZ "); } Voice API for Windows Operating Systems Library Reference — November 2003 239 dx_getfeaturelist( ) — retrieve feature support information for the device if (feature_table.ft_record & FT_DRT8KHZ) { printf("DRT8KHZ "); } if (feature_table.ft_record & FT_DRT11KHZ) { printf("DRT11KHZ"); } printf("\n\n%s: Tone Features:-\n", chname); if (feature_table.ft_tone & FT_GTDENABLED) { printf("GTDENABLED "); } if (feature_table.ft_tone & FT_GTGENABLED) { printf("GTGENABLED "); } if (feature_table.ft_tone & FT_CADENCE_TONE) { printf("CADENCE_TONE"); } printf("\n\n%s: E2P Board Configuration Features:-\n", chname); if (feature_table.ft_e2p_brd_cfg & FT_DPD) { printf("DPD "); } if (feature_table.ft_e2p_brd_cfg & FT_SYNTELLECT) { printf("SYNTELLECT"); } printf("\n\n%s: FAX Features:-\n", chname); if (feature_table.ft_fax & FT_FAX) { printf("FAX "); } if (feature_table.ft_fax & FT_VFX40) { printf("VFX40 "); } if (feature_table.ft_fax & FT_VFX40E) { printf("VFX40E "); } if (feature_table.ft_fax & FT_VFX40E_PLUS) { printf("VFX40E_PLUS"); } if( (feature_table.ft_fax & FT_FAX_EXT_TBL) && !(feature_table.ft_send & FT_SENDFAX_TXFILE_ASCII) ) printf("SOFTFAX !\n"); } printf("\n\n%s: FrontEnd Features:-\n", chname); if (feature_table.ft_front_end & FT_ANALOG) { printf("ANALOG "); } if (feature_table.ft_front_end & FT_EARTH_RECALL) { printf("EARTH_RECALL"); } printf("\n\n%s: Miscellaneous Features:-\n", chname); 240 Voice API for Windows Operating Systems Library Reference — November 2003 retrieve feature support information for the device — dx_getfeaturelist( ) if (feature_table.ft_misc & FT_CALLERID) { printf("CALLERID"); } printf("\n"); dx_close(dev); } ! See Also • dx_getctinfo( ) Voice API for Windows Operating Systems Library Reference — November 2003 241 dx_getparm( ) — get the current parameter settings dx_getparm( ) get the current parameter settings Name: int dx_getparm(dev, parm, valuep) Inputs: int dev • valid channel or board device handle unsigned long parm • parameter type to get value of void *valuep • pointer to variable for returning parameter value Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Configuration Mode: synchronous Platform: DM3, Springware ! Description The dx_getparm( ) function returns the current parameter settings for an open device. This function returns the value of one parameter at a time. A different set of parameters is available for board and channel devices. Board parameters affect all channels on the board. Channel parameters affects the specified channel only. The channel must be idle (that is, no I/O function running) when calling dx_getparm( ). 242 Parameter Description dev specifies the valid device handle obtained when a board or channel was opened using dx_open( ) Voice API for Windows Operating Systems Library Reference — November 2003 get the current parameter settings — dx_getparm( ) Parameter Description parm Specifies the define for the parameter type whose value is to be returned in the variable pointed to by valuep. The voice device parameters allow you to query and control device-level information and settings related to the voice functionality. These parameters are described in the dx_setparm( ) function description. For DM3 boards, board parameter defines are described in Table 12, “Voice Board Parameters (DM3)”, on page 390. For Springware boards, board parameter defines are described in Table 13, “Voice Board Parameters (Springware)”, on page 390. For DM3 boards, channel parameter defines are described in Table 14, “Voice Channel Parameters (DM3)”, on page 391. For Springware boards, channel parameter defines are described in Table 15, “Voice Channel Parameters (Springware)”, on page 394. valuep Points to the variable where the value of the parameter specified in parm should be returned. Note: You must use a void* cast on the returned parameter value, as demonstrated in the Example section code for this function. Note: valuep should point to a variable large enough to hold the value of the parameter. The size of a parameter is encoded in the define for the parameter. The defines for parameter sizes are PM_SHORT, PM_BYTE, PM_INT, PM_LONG, PM_FLSTR (fixed length string), and PM_VLSTR (variable length string). Most parameters are of type short. ! Cautions Clear the variable in which the parameter value is returned prior to calling dx_getparm( ), as illustrated in the Example section. The variable whose address is passed to should be of a size sufficient to hold the value of the parameter. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BUSY Channel is busy (when channel device handle is specified) or first channel is busy (when board device handle is specified) EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value Voice API for Windows Operating Systems Library Reference — November 2003 243 dx_getparm( ) — get the current parameter settings ! Example #include #include #include #include main() { int bddev; unsigned short parmval; /* open the board using dx_open( ). Obtain board device descriptor in * bddev */ if ((bddev = dx_open("dxxxB1",NULL)) == -1) { /* process error */ } parmval = 0; /* CLEAR parmval */ /* get the number of channels on the board. DXBD_CHNUM is of type * unsigned short as specified by the PM_SHORT define in the definition * for DXBD_CHNUM in dxxxlib.h. The size of the variable parmval is * sufficient to hold the value of DXBD_CHNUM. */ if (dx_getparm(bddev, DXBD_CHNUM, (void *)&parmval) == -1) { /* process error */ } printf("\nNumber of channels on board = %d",parmval); . . } ! See Also • 244 dx_setparm( ) Voice API for Windows Operating Systems Library Reference — November 2003 return assignment status of a shared resource — dx_GetRscStatus( ) dx_GetRscStatus( ) return assignment status of a shared resource Name: int dx_GetRscStatus(chdev, rsctype, status) Inputs: int chdev • valid channel device handle int rsctype • type of resource int *status • pointer to assignment status Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Configuration Mode: synchronous Platform: Springware ! Description The dx_GetRscStatus( ) function returns the assignment status of the shared resource for the specified channel. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) rsctype specifies the type of shared resource: • RSC_FAX – shared fax resource (DSP-based Group 3 Fax, also known as Softfax) status points to the data that represents the assignment status of the resource: • RSC_ASSIGNED – a shared resource of the specified rsctype is assigned to the channel • RSC_NOTASSIGNED – a shared resource of the specified rsctype is not assigned to the channel ! Cautions None. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter Voice API for Windows Operating Systems Library Reference — November 2003 245 dx_GetRscStatus( ) — return assignment status of a shared resource EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example /* Check #include #include #include #include #include whether a shared Fax resource is assigned to the voice channel */ main() { int chdev ; /* Fax channel device handle */ int status; /*Open the Voice channel resource (device) using dx_open(). */ : : /*Open the FAX channel resource(device) */ if((chdev = fx_open("dxxxB1C1", NULL)) == -1) { /*Error opening device */ /* Perform system error processing */ exit(1); } /*Get current Resource Status*/ if(dx_GetRscStatus(chdev, RSC_FAX, &status) == -1) { printf("Error - %s (error code %d)\n", ATDV_ERRMSGP(chdev), ATDV_LASTERR(chdev)); if(ATDV_LASTERR(chdev) == EDX_SYSTEM) { /* Perform system error processing */ } } else { printf("The resource status ::%d\n", status); } } ! See Also • 246 DSP Fax topic in the Fax Software Reference Voice API for Windows Operating Systems Library Reference — November 2003 retrieve information about the circular stream buffer — dx_GetStreamInfo( ) dx_GetStreamInfo( ) retrieve information about the circular stream buffer Name: int dx_GetStreamInfo(hBuffer, &StreamStatStruct) Inputs: int hBuffer • stream buffer handle DX_STREAMSTAT StreamStatStruct • pointer to stream status structure Returns: 0 if successful -1 if failure Includes: srllib.h dxxxlib.h Category: streaming to board Mode: synchronous Platform: DM3 ! Description The dx_GetStreamInfo( ) function populates the stream status structure with the current status information about the circular stream buffer handle passed into it. The data returned is a snapshot of the status at the time dx_GetStreamInfo( ) is called. Parameter Description hBuffer specifies the circular stream buffer handle StreamStatStruct specifies a pointer to the DX_STREAMSTAT data structure. For more information on this structure, see DX_STREAMSTAT, on page 512. ! Cautions None. ! Errors Unlike other voice API library functions, the streaming to board functions do not use SRL device handles. Therefore, ATDV_LASTERR( ) and ATDV_ERRMSGP( ) cannot be used to retrieve error codes and error descriptions. ! Example #include #include main() { int nBuffSize = 32768; int hBuffer = -1; DX_STREAMSTAT streamStat; Voice API for Windows Operating Systems Library Reference — November 2003 247 dx_GetStreamInfo( ) — retrieve information about the circular stream buffer if ((hBuffer = dx_OpenStreamBuffer(nBuffSize)) < 0) { printf("Error opening stream buffer \n" ); } if (dx_GetStreamInfo(hBuffer, &streamStat) < 0) { printf("Error getting stream buffer info \n"); } else { printf("version=%d, bytesIn=%d, bytesOut=%d, headPointer=%d, tailPointer=%d, currentState=%d, numberOfBufferUnderruns=%d, numberOfBufferOverruns=%d, BufferSize=%d, spaceAvailable=%d, highWaterMark=%d, lowWaterMark=%d \n"; streamStat.version,streamStat.bytesIn,streamStat.bytesOut,streamStat.headPointer, streamStat.tailPointer,streamStat.currentState,streamStat.numberOfBufferUnderruns, streamStat.numberOfBufferOverruns,streamStat.BufferSize,streamStat.spaceAvailable, streamStat.highWaterMark,streamStat.lowWaterMark); } if (dx_CloseStreamBuffer(hBuffer) < 0) { printf("Error closing stream buffer \n"); } } ! See Also • 248 dx_OpenStreamBuffer( ) Voice API for Windows Operating Systems Library Reference — November 2003 return the current speed or volume modification table — dx_getsvmt( ) dx_getsvmt( ) return the current speed or volume modification table Name: int dx_getsvmt(chdev, tabletype, svmtp ) Inputs: int chdev • valid channel device handle unsigned short tabletype • type of table to retrieve (speed or volume) DX_SVMT * svmtp • pointer to speed or volume modification table structure to retrieve Returns: 0 if success -1 if failure Includes: srllib.h dxxxlib.h Category: Speed and Volume Mode: synchronous Platform: DM3, Springware ! Description The dx_getsvmt( ) function returns the current speed or volume modification table to the DX_SVMT structure. Parameter Description chdev specifies the valid channel device handle obtained when the channel was opened using dx_open( ) tabletype specifies whether to retrieve the speed or the volume modification table: • SV_SPEEDTBL – retrieve the speed modification table values • SV_VOLUMETBL – retrieve the volume modification table values svmtp points to the DX_SVMT structure that contains the speed and volume modification table entries ! Cautions None. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Invalid parameter EDX_BADPROD Function not supported on this board Voice API for Windows Operating Systems Library Reference — November 2003 249 dx_getsvmt( ) — return the current speed or volume modification table EDX_SPDVOL Must specify either SV_SPEEDTBL or SV_VOLUMETBL EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example #include #include #include #include /* * Global Variables */ main() { DX_SVMT int svmt; dxxxdev, index; /* * Open the Voice Channel Device and Enable a Handler */ if ( ( dxxxdev = dx_open( "dxxxB1C1", NULL) ) == -1 ) { perror( "dxxxB1C1" ); exit( 1 ); } /* * Get the Current Volume Modification Table */ memset( &svmt, 0, sizeof( DX_SVMT ) ); if (dx_getsvmt( dxxxdev, SV_VOLUMETBL, &svmt ) == -1 ){ printf( "Unable to Get the Current Volume" ); printf( " Modification Table\n" ); printf( "Lasterror = %d Err Msg = %s\n", ATDV_LASTERR( dxxxdev ), ATDV_ERRMSGP( dxxxdev ) ); dx_close( dxxxdev ); exit( 1 ); } else { printf( "Volume Modification Table is:\n" ); for ( index = 0; index < 10; index++ ) { printf( "decrease[ %d ] = %d\n", index, svmt.decrease[ index ] ); } printf( "origin = %d\n", svmt.origin ); for ( index = 0; index < 10; index++ ) { printf( "increase[ %d ] = %d\n", index, svmt.increase[ index ] ); } } /* * Continue Processing * . * . * . */ 250 Voice API for Windows Operating Systems Library Reference — November 2003 return the current speed or volume modification table — dx_getsvmt( ) /* * Close the opened Voice Channel Device */ if ( dx_close( dxxxdev ) != 0 ) { perror( "close" ); } /* Terminate the Program */ exit( 0 ); } ! See Also • dx_addspddig( ) • dx_addvoldig( ) • dx_adjsv( ) • dx_clrsvcond( ) • dx_getcursv( ) • dx_setsvcond( ) • dx_setsvmt( ) • speed and volume modification tables in Voice API Programming Guide • DX_SVMT data structure Voice API for Windows Operating Systems Library Reference — November 2003 251 dx_getxmitslot( ) — get TDM bus time slot number of voice transmit channel dx_getxmitslot( ) get TDM bus time slot number of voice transmit channel Name: int dx_getxmitslot(chdev, sc_tsinfop) Inputs: int chdev • valid channel device handle SC_TSINFO *sc_tsinfop • pointer to TDM bus time slot information structure Returns: 0 on success -1 on error Includes: srllib.h dxxxlib.h Category: TDM routing Mode: synchronous Platform: DM3, Springware ! Description The dx_getxmitslot( ) function returns the time division multiplexing (TDM) bus time slot number of the voice transmit channel. The TDM bus time slot information is contained in an SC_TSINFO structure that includes the number of the TDM bus time slot connected to the voice transmit channel. For more information on this structure, see SC_TSINFO, on page 529. Note: TDM bus convenience function nr_scroute( ) includes dx_getxmitslot( ) functionality. Parameter Description chdev specifies the voice channel device handle obtained when the channel was opened using dx_open( ) sc_tsinfop specifies a pointer to the data structure SC_TSINFO A voice channel on a TDM bus-based board can transmit on only one TDM bus time slot. ! Cautions 252 • This function fails when an invalid channel device handle is specified. • On DM3 boards, this function is supported in a flexible routing configuration but not a fixed routing configuration. This document assumes that a flexible routing configuration is the configuration of choice. For more information on API restrictions in a fixed routing configuration, see the Voice API Programming Guide. Voice API for Windows Operating Systems Library Reference — November 2003 get TDM bus time slot number of voice transmit channel — dx_getxmitslot( ) ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Parameter error EDX_SH_BADCMD Command is not supported in current bus configuration EDX_SH_BADINDX Invalid Switch Handler index number EDX_SH_BADLCLTS Invalid channel number EDX_SH_BADMODE Function is not supported in current bus configuration EDX_SH_BADTYPE Invalid channel type (voice, analog, etc.) EDX_SH_CMDBLOCK Blocking command is in progress EDX_SH_LCLDSCNCT Channel is already disconnected from TDM bus EDX_SH_LIBBSY Switch Handler library is busy EDX_SH_LIBNOTINIT Switch Handler library is uninitialized EDX_SH_MISSING Switch Handler is not present EDX_SH_NOCLK Switch Handler clock fallback failed EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example #include #include #include main() { int chdev; SC_TSINFO sc_tsinfo; long scts; /* Channel device handle */ /* Time slot information structure */ /* TDM bus time slot */ Voice API for Windows Operating Systems Library Reference — November 2003 253 dx_getxmitslot( ) — get TDM bus time slot number of voice transmit channel /* Open board 1 channel 1 devices */ if ((chdev = dx_open("dxxxB1C1", 0)) == -1) { /* process error */ } /* Fill in the TDM bus time slot information */ sc_tsinfo.sc_numts = 1; sc_tsinfo.sc_tsarrayp = &scts; /* Get TDM bus time slot connected to transmit of voice channel 1 on board ...1 */ if (dx_getxmitslot(chdev, &sc_tsinfo) == -1) { printf("Error message = %s", ATDV_ERRMSGP(chdev)); exit(1); } printf("%s transmitting on TDM bus time slot %d", ATDV_NAMEP(chdev),scts); return(0); } ! See Also 254 • dx_listen( ) • dt_listen( ) in the Digital Network Interface Software Reference • fx_listen( ) in the Fax Software Reference Voice API for Windows Operating Systems Library Reference — November 2003 get echo cancellation resource transmit time slot number — dx_getxmitslotecr( ) dx_getxmitslotecr( ) get echo cancellation resource transmit time slot number Name: int dx_getxmitslotecr(chdev, sc_tsinfop) Inputs: int chdev • valid channel device handle SC_TSINFO *sc_tsinfop • pointer to TDM bus time slot information structure Returns: 0 on success -1 on error Includes: srllib.h dxxxlib.h Category: Echo Cancellation Resource Mode: synchronous Platform: Springware ! Description The dx_getxmitslotecr( ) function returns the transmit time slot number assigned to the echo cancellation resource (ECR) of the specified voice channel device. The time slot information is contained in an SC_TSINFO structure. For more information on this structure, see SC_TSINFO, on page 529. Note: The ECR functions have been replaced by the continuous speech processing (CSP) API functions. CSP provides enhanced echo cancellation. For more information, see the Continuous Speech Processing API Programming Guide and Continuous Speech Processing API Library Reference. Parameter Description chdev specifies the voice channel device handle obtained when the channel was opened using dx_open( ) sc_tsinfop specifies a pointer to the data structure SC_TSINFO ! Cautions This function fails when: • An invalid channel device handle is specified. • The ECR feature is not enabled on the board specified. • The ECR feature is not supported on the board specified. ! Errors If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. One of the following error codes may be returned: EDX_BADPARM Parameter error Voice API for Windows Operating Systems Library Reference — November 2003 255 dx_getxmitslotecr( ) — get echo cancellation resource transmit time slot number EDX_SH_BADCMD Function is not supported in current bus configuration EDX_SH_BADINDX Invalid Switch Handler index number EDX_SH_BADLCLTS Invalid channel number EDX_SH_BADMODE Function is not supported in current bus configuration EDX_SH_BADTYPE Invalid channel type (voice, analog, etc.) EDX_SH_CMDBLOCK Blocking function is in progress EDX_SH_LCLDSCNCT Channel is already disconnected from TDM bus EDX_SH_LIBBSY Switch Handler library is busy EDX_SH_LIBNOTINIT Switch Handler library is not initialized EDX_SH_MISSING Switch Handler is not present EDX_SH_NOCLK Switch Handler clock fallback failed EDX_SYSTEM Error from operating system; use dx_fileerrno( ) to obtain error value ! Example #include #include #include #include