Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

TAPI

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TAPI

    discussion at:
    http://www.powerbasic.com/support/pb...ad.php?t=13294

    update 4 nov 18, 2005

    made possible by the kind insight and help of jose rocca. many, many thanks sir.

    [CODE]
    #compile exe "tapitest.exe"
    #dim all


    %tapi_current_version = &h00020000 ' version 2.0


    #if %tapi_current_version >= &h000020000 ' for completeness
    ' these constants are mutually exclusive - there's no way to specify more
    ' than one at a time (and it doesn't make sense, either) so they're ordinal rather than bits.
    %lineinitializeexoption_usehiddenwindow = &h00000001 ' tapi v2.0
    %lineinitializeexoption_useevent = &h00000002 ' tapi v2.0
    %lineinitializeexoption_usecompletionport = &h00000003 ' tapi v2.0
    #endif

    #include "win32api.inc"
    #include "tapi32.inc"


    declare function createconnection( stitle as string, totdev as dword ) as string
    declare function negotiateapiversions( totdev as dword, appapiver as dword ) as string
    declare function getlinedevcaps( totdev as dword ) as string
    declare function gettapistructstring( byval ptrtapistruct as long, byval offset as long, byval length as long ) as string
    declare function deviceinfo( dev as long ) as string
    declare function deviceconfigdialog( byval dev as long, byval ownerhwnd as long ) as string
    declare function dialingpropertiesdialog( byval dev as long, byval ownerhwnd as long, appapiver as dword ) as string
    declare function openline( dev as long ) as string
    declare function processcanonical( hlineapp as long, dev as long ) as string
    declare function makecallasynch( znumtodial as asciiz*%max_path ) as string
    declare function dropcallasynch( ) as string
    declare function deallocatecall( ) as string
    declare function closeline( ) as string
    declare function shutdownline( ) as string
    declare function paintdevicon( byval dev as long, hicon as long ) as string
    declare function showtext( stxt as string ) as long
    declare function linecallbackfunc( byval hdevice as dword, byval dwmsg as dword, byval dwcallbackinstance as dword, _
    byval dwparam1 as dword,byval dwparam2 as dword,byval dwparam3 as dword ) as long


    type tapilinetype
    zlinename as asciiz*%max_path ' dwlinenameoffset, dwlinenamesize)
    zproviderinfo as asciiz*%max_path ' dwproviderinfooffset, dwproviderinfosize)
    zswitchinfo as asciiz*%max_path ' dwswitchinfooffset, dwswitchinfosize)

    currentlineid as dword ' device number
    permanentlineid as dword ' dwpermanentlineid
    stringformat as dword ' dwstringformat
    numaddresses as dword ' dwnumaddresses
    maxdatarate as dword ' dwmaxrate
    bearermodes as dword ' dwbearermodes
    addressmodes as dword ' dwaddressmodes
    mediamodes as dword ' dwmediamodes
    generatetonemaxnumfreq as dword ' dwgeneratetonemaxnumfreq
    generatetonemodes as dword ' dwgeneratetonemodes
    numterminals as dword ' dwnumterminals

    negapiver as dword ' negotiated api version
    extapiver as lineextensionid ' extension api versions
    linesupportsvoicecalls as long ' can make a voice call

    znumtodial as asciiz*%max_path ' number user wants to dial
    zdialablestring as asciiz*%max_path ' contains all info
    zdisplayablestring as asciiz*%max_path ' does not display credit card info
    currentcountry as dword ' country/region code configured in currentlocation
    destcountry as dword ' destination country/region code of the translated address
    translateresults as dword ' code to string contents
    translatedefn as string*48 ' explanation of translation result
    end type
    global tapiline() as tapilinetype


    global requestingcall, droppingcall as long ' global call state flags

    global hdbg, hdlg, hcall, hline, hlineapp, done as long

    global lpfncallback as dword ' pointer to the function callback


    %loapi = &h10003 ' default tapi 1.3 (&h00010003) ' %early_tapi_version
    %hiapi = &h30000 ' default tapi 3.0 (&h00030000) ' %tapi_current_version


    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    function createconnection( stitle as string, totdev as dword ) as string


    local retval, hinstance as long
    local lpnumdevs as dword
    local ztemp as asciiz * 255
    local lpfncallback as long ptr
    local lip as lineinitializeexparams


    function = " ' no problems

    showtext "initializing tapi & enumerating lines"

    ztemp = stitle '
    hinstance = 0
    lip.dwtotalsize = len(lip) 'init params
    lip.dwoptions = %lineinitializeexoption_usehiddenwindow


    ' what is important to notice regarding lineinitializeex is that
    ' you can select one of two mechanisms by which tapi will notify the
    ' application of telephony events: hidden window or event handle.
    ' in this example we are using hidden window.

    ' when the hidden window method of notification is used in a tapi application, tapi creates a hidden
    ' window for the application in the context of the thread that called lineinitializeex. if the thread that
    ' calls lineinitializeex does not retrieve and dispatch windows messages, the hidden window does not
    ' receive windows messages, and in turn, the callback function registered by the tapi application is not called.

    ' calling lineinitialize is equivalent to calling lineinitializeex with the lineinitializeexoption_usehiddenwindow
    ' option, so using lineinitialize instead of lineinitializeex results in the same behavior.

    ' make sure the thread that calls lineinitializeex contains a message loop that retrieves and
    ' dispatches messages for the hidden window.

    lpfncallback = codeptr(linecallbackfunc) ' pointer to callback function

    retval = lineinitializeex( hlineapp, _ ' lphlineapp lphlineapp - handle used in all tapi functions calls
    hinstance, _ ' hinstance hinstance - exeordll instance handle
    byval lpfncallback, _ ' linecallback lpfncallback - callback function to return asynchronous notifications
    ztemp, _ ' lpcwstr lpszfriendlyappname - name to indicate who is calling tapi
    lpnumdevs, _ ' lpdword lpdwnumdevs - number of available tapi devices, 0 to dwnumdevices-1
    %hiapi, _ ' lpdword lpdwapiversion - negotiate tapi version
    lip) ' lplineinitializeexparams lip - hidden window or event handle
    ' returns 0 if successful


    if retval <> 0 then
    select case cdwd(retval)
    case %lineerr_invalappname : function = "invalid application name"
    case %lineerr_operationfailed : function = "the operation failed"
    case %lineerr_inifilecorrupt : function = "the ini file is corrupted"
    case %lineerr_invalpointer : function = "invalid pointer"
    case %lineerr_reinit : function = "the application attempted to initialize tapi twice"
    case %lineerr_nomem : function = "no memory available"
    case %lineerr_invalparam : function = "invalid parameter"
    case else : function = "undefined error"+str$(retval) + " = &h" + hex$(retval)
    end select
    exit function
    end if
    '================================


    if lpnumdevs = 0 then
    function = "no tapi devices found" 'no lines!
    totdev = 0
    else
    totdev = lpnumdevs-1
    end if
    '================================

    end function



    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    function negotiateapiversions( totdev as dword, appapiver as dword ) as string

    local retval as long
    local dev as dword
    local lxid as lineextensionid


    function = " ' no problems

    showtext "negotiating api ver for lines"

    redim tapiline(totdev)

    for dev = 0 to totdev ' negotiate and cache api versions for each line
    retval = linenegotiateapiversion( hlineapp, dev, %loapi, %hiapi, tapiline(dev).negapiver, lxid) ' returns a long
    'print #hdbg, str$(dev) + ", negotiated api ver=" + str$(hi(word,tapiline(dev).negapiver)) + "." + str$(lo(word,tapiline(dev).negapiver))

    if retval <> 0 then
    select case cdwd(retval)
    case %lineerr_baddeviceid : function = "the device identifier provided is incorrect"
    case %lineerr_nodriver : function = "no driver was found"
    case %lineerr_incompatibleapiversion : function = "the api version is incompatible"
    case %lineerr_operationfailed : function = "the operation failed"
    case %lineerr_invalapphandle : function = "the application handle was invalid"
    case %lineerr_resourceunavail : function = "the resource is unavailable"
    case %lineerr_invalpointer : function = "the pointer is invalid"
    case %lineerr_uninitialized : function = "the parameter is uninitialized"
    case %lineerr_nomem : function = "no memory is available"
    case %lineerr_operationunavail : function = "the operation is unavailable"
    case %lineerr_nodevice : tapiline(dev).zlinename = "device not found" : iterate ' handle this differently
    case else : function = "undefined error"+str$(retval)
    end select ' "device not found" can occur on a laptop with pcmcia card coming out of hibernation.
    tapiline(dev).negapiver = 0 'no compatible api negotiated for this line
    exit function

    else ' print #hdbg, "extapiversions=" + str$(lxid.dwextensionid0) + str$(lxid.dwextensionid1) + str$(lxid.dwextensionid2) + str$(lxid.dwextensionid3)
    ' if the service provider for the specified dwdeviceid parameter supports provider-specific extensions,
    ' then, upon a successful negotiation, this structure is filled with the extension identifier of
    ' these extensions. this structure contains all zeros if the line provides no extensions. an application
    ' can ignore the returned parameter if it does not use extensions.
    tapiline(dev).extapiver.dwextensionid0 = lxid.dwextensionid0 ' save extension version (dev-specific features) if available
    tapiline(dev).extapiver.dwextensionid1 = lxid.dwextensionid1
    tapiline(dev).extapiver.dwextensionid2 = lxid.dwextensionid2
    tapiline(dev).extapiver.dwextensionid3 = lxid.dwextensionid3
    if tapiline(dev).negapiver > appapiver then appapiver = tapiline(dev).negapiver ' highest ver found
    end if
    next

    end function

    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    function getlinedevcaps( totdev as dword ) as string

    ' this function queries a specified line device to determine its telephony capabilities.
    ' the returned data is valid for all addresses on the line device

    ' linegetdevcaps(byval hlineapp as dword, byval dwdeviceid as dword, byval dwapiversion as dword, byval dwextversion as dword, lplinedevcaps as linedevcaps)

    local retval, lpdata, numelem as long
    local dev as dword

    local linecaps() as linedevcaps ' variable-length structures that tapi may throw at you


    function = " ' no problems

    showtext "getting line device info"

    ' note: dwneededsize will return zero if the memory size is too small to start with hence
    ' the test for %lineerr_structuretoosmall right after the function call. this test alone
    ' is not sufficient as the function may not return this error when the totalsize is still
    ' less than the neededsize! hence the test for both.
    ' retval is a long variable yet the constant is defined as a dword in tapi32.inc hence
    ' the need to convert retval to a dword. of course none of this is in msdn....
    numelem = 1 ' starting memory size
    dim linecaps(numelem-1) ' first attempt
    linecaps(0).dwtotalsize = sizeof(linedevcaps) * numelem ' size of the udt
    for dev = 0 to totdev
    if tapiline(dev).negapiver = 0 then iterate ' not found in api negotiation
    do
    retval = linegetdevcaps( hlineapp, dev, tapiline(dev).negapiver, 0, linecaps(0) ) 'request tapi to fill udt with info
    if cdwd(retval) = %lineerr_structuretoosmall or linecaps(0).dwtotalsize < linecaps(0).dwneededsize then ' increase buffer size
    'print #hdbg, str$(dev) + ", numelem=" + str$(numelem) + ", totalsize=" + str$(linecaps(0).dwtotalsize) + ", neededsize=" + str$(linecaps(0).dwneededsize)
    incr numelem ' once increased, just leave it that size for next device
    if numelem > 20 then ' something else is wrong
    function = "memory increased x"+str$(numelem)+" and still not big enough for linecaps!"
    exit function
    end if '
    redim linecaps(numelem-1) ' assign more memory
    linecaps(0).dwtotalsize = sizeof(linedevcaps) * numelem
    else ' print #hdbg, str$(dev) + ", numelem=" + str$(numelem) + ", totalsize=" + str$(linecaps(0).dwtotalsize) + ", neededsize=" + str$(linecaps(0).dwneededsize)
    exit loop
    end if
    loop
    '================================


    if retval <> 0 then
    select case cdwd(retval)
    case %lineerr_structuretoosmall : function = "the structure is too small" ' buffer size is too small
    case %lineerr_baddeviceid : function = "bad device id provided"
    case %lineerr_nomem : function = "no memory is available"
    case %lineerr_incompatibleapiversion : function = "api version is incompatible"
    case %lineerr_operationfailed : function = "the operation failed"
    case %lineerr_incompatibleextversion : function = "extension version is incompatible"
    case %lineerr_resourceunavail : function = "the resource is unavailable"
    case %lineerr_invalapphandle : function = "the application handle is invalid"
    case %lineerr_invalpointer : function = "invalid pointer"
    case %lineerr_uninitialized : function = "the parameter is uninitialized"
    case %lineerr_nodriver : function = "no driver was found"
    case %lineerr_operationunavail : function = "the operation is unavailable"
    case %lineerr_nodevice : function = "no device was found"
    case else : function = "undefined error"+str$(retval)
    end select
    exit function
    end if
    '================================


    'store udt info in class local variables
    tapiline(dev).currentlineid = dev
    tapiline(dev).zlinename = gettapistructstring(varptr(linecaps(0)), linecaps(0).dwlinenameoffset, linecaps(0).dwlinenamesize)
    tapiline(dev).zproviderinfo = gettapistructstring(varptr(linecaps(0)), linecaps(0).dwproviderinfooffset, linecaps(0).dwproviderinfosize)
    tapiline(dev).zswitchinfo = gettapistructstring(varptr(linecaps(0)), linecaps(0).dwswitchinfooffset, linecaps(0).dwswitchinfosize)
    tapiline(dev).permanentlineid = linecaps(0).dwpermanentlineid
    tapiline(dev).stringformat = linecaps(0).dwstringformat
    tapiline(dev).numaddresses = linecaps(0).dwnumaddresses
    tapiline(dev).maxdatarate = linecaps(0).dwmaxrate
    tapiline(dev).bearermodes = linecaps(0).dwbearermodes
    tapiline(dev).addressmodes = linecaps(0).dwaddressmodes
    tapiline(dev).mediamodes = linecaps(0).dwmediamodes
    tapiline(dev).generatetonemaxnumfreq = linecaps(0).dwgeneratetonemaxnumfreq
    tapiline(dev).generatetonemodes = linecaps(0).dwgeneratetonemodes
    tapiline(dev).numterminals = linecaps(0).dwnumterminals
    '================================


    if %linebearermode_voice and tapiline(dev).bearermodes then 'check if line supports making voice calls
    if %linemediamode_interactivevoice and tapiline(dev).mediamodes then
    tapiline(dev).linesupportsvoicecalls = 1
    end if
    end if
    '================================


    combobox add hdlg, 98, str$(dev) + " - " + trim$(tapiline(dev).zlinename) ' add the device to the combobox
    '================================

    next

    end function


    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    function gettapistructstring(byval ptrtapistruct as long, byval offset as long, byval length as long) as string

    local stemp as string

    function = "
    if length then ' handle erroneous input
    if offset then '
    stemp = space$(length)
    copymemory byval strptr(stemp), byval ptrtapistruct+offset, length
    function = stemp
    end if
    end if
    '================================

    end function


    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    function deviceinfo( dev as long ) as string

    local stemp, smsg as string

    smsg = "
    smsg = smsg + "tapi line name: " + tapiline(dev).zlinename + $crlf
    smsg = smsg + "tapi line: #" + str$(tapiline(dev).currentlineid) + $crlf '
    smsg = smsg + "tapi provider info: " + tapiline(dev).zproviderinfo + $crlf
    smsg = smsg + "tapi switch info: " + tapiline(dev).zswitchinfo + $crlf
    smsg = smsg + $crlf + "permanent line id: " + str$(tapiline(dev).permanentlineid) + $crlf
    select case tapiline(dev).stringformat
    case %stringformat_ascii
    smsg = smsg + "string format: stringformat_ascii" + $crlf
    case %stringformat_dbcs
    smsg = smsg + "string format: stringformat_dbcs" + $crlf
    case %stringformat_unicode
    smsg = smsg + "string format: stringformat_unicode" + $crlf
    case %stringformat_binary
    smsg = smsg + "string format: stringformat_binary" + $crlf
    case else
    end select
    smsg = smsg + "number of addresses associated with this line: " + str$(tapiline(dev).numaddresses) + $crlf
    smsg = smsg + "max data rate: " + str$(tapiline(dev).maxdatarate) + $crlf
    smsg = smsg + $crlf + "bearer modes supported:" + $crlf
    if %linebearermode_voice and tapiline(dev).bearermodes then smsg = smsg + $tab + "linebearermode_voice" + $crlf
    if %linebearermode_speech and tapiline(dev).bearermodes then smsg = smsg + $tab + "linebearermode_speech" + $crlf
    if %linebearermode_data and tapiline(dev).bearermodes then smsg = smsg + $tab + "linebearermode_data" + $crlf
    if %linebearermode_altspeechdata and tapiline(dev).bearermodes then smsg = smsg + $tab + "linebearermode_altspeechdata" + $crlf
    if %linebearermode_multiuse and tapiline(dev).bearermodes then smsg = smsg + $tab + "linebearermode_multiuse" + $crlf
    if %linebearermode_noncallsignaling and tapiline(dev).bearermodes then smsg = smsg + $tab + "linebearermode_noncallsignaling" + $crlf
    smsg = smsg + $crlf + "address modes supported:" + $crlf
    if tapiline(dev).addressmodes and %lineaddressmode_addressid then smsg = smsg + $tab + "lineaddressmode_addressid" + $crlf
    if tapiline(dev).addressmodes and %lineaddressmode_dialableaddr then smsg = smsg + $tab + "lineaddressmode_dialableaddr" + $crlf
    smsg = smsg + $crlf + "media modes supported:" + $crlf
    if %linemediamode_adsi and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_adsi" + $crlf
    if %linemediamode_automatedvoice and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_automatedvoice" + $crlf
    if %linemediamode_datamodem and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_datamodem" + $crlf
    if %linemediamode_digitaldata and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_digitaldata" + $crlf
    if %linemediamode_g3fax and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_g3fax" + $crlf
    if %linemediamode_g4fax and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_g4fax" + $crlf
    if %linemediamode_interactivevoice and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_interactivevoice" + $crlf
    if %linemediamode_mixed and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_mixed" + $crlf
    if %linemediamode_tdd and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_tdd" + $crlf
    if %linemediamode_teletex and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_teletex" + $crlf
    if %linemediamode_telex and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_telex" + $crlf
    if %linemediamode_unknown and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_unknown" + $crlf
    if %linemediamode_videotex and tapiline(dev).mediamodes then smsg = smsg + $tab + "linemediamode_videotex" + $crlf
    smsg = smsg + $crlf + "line tone generation supported: " + str$(tapiline(dev).generatetonemaxnumfreq) + $crlf
    if tapiline(dev).generatetonemaxnumfreq then 'show if tone generation is supported
    if %linetonemode_beep and tapiline(dev).generatetonemodes then smsg = smsg + $tab + "linetonemode_beep" + $crlf
    if %linetonemode_billing and tapiline(dev).generatetonemodes then smsg = smsg + $tab + "linetonemode_billing" + $crlf
    if %linetonemode_busy and tapiline(dev).generatetonemodes then smsg = smsg + $tab + "linetonemode_busy" + $crlf
    if %linetonemode_custom and tapiline(dev).generatetonemodes then smsg = smsg + $tab + "linetonemode_custom" + $crlf
    if %linetonemode_ringback and tapiline(dev).generatetonemodes then smsg = smsg + $tab + "linetonemode_ringback" + $crlf
    end if
    smsg = smsg + "number of terminals for this line: " + str$(tapiline(dev).numterminals) + $crlf

    function = smsg '

    end function


    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    function deviceconfigdialog( byval dev as long, byval ownerhwnd as long ) as string

    local ztemp as asciiz*255
    local retval as long

    function = " ' no problems

    ztemp = " ' highest level of config available
    retval = lineconfigdialog( tapiline(dev).currentlineid, ownerhwnd, ztemp)

    if retval <> 0 then
    select case cdwd(retval)
    case %lineerr_baddeviceid : function = "the device id is incorrect"
    case %lineerr_nomem : function = "not enough memory is available"
    case %lineerr_inuse : function = "the line is in use"
    case %lineerr_operationfailed : function = "the operation failed"
    case %lineerr_invaldeviceclass : function = "the device class is invalid"
    case %lineerr_resourceunavail : function = "the resource is unavailable"
    case %lineerr_invalparam : function = "the parameter is invalid"
    case %lineerr_uninitialized : function = "the parameter is uninitialized"
    case %lineerr_invalpointer : function = "the pointer is invalid"
    case %lineerr_operationunavail : function = "the operation is unavailable"
    case %lineerr_nodevice : function = "the device was not found"
    case else : function = "undefined error"+str$(retval) + " = &h" + hex$(retval)
    end select
    end if
    '================================

    end function


    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    function dialingpropertiesdialog(byval dev as long, byval ownerhwnd as long, appapiver as dword ) as string

    local retval as long

    function = " ' no problems

    retval = linetranslatedialog(hlineapp, tapiline(dev).currentlineid, appapiver, ownerhwnd, tapiline(dev).znumtodial)

    if retval <> 0 then
    select case cdwd(retval)
    case %lineerr_baddeviceid : function = "the device id is incorrect"
    case %lineerr_invalparam : function = "the parameter is invalid"
    case %lineerr_incompatibleapiversion : function = "the api version is incompatible"
    case %lineerr_invalpointer : function = "the pointer is invalid"
    case %lineerr_inifilecorrupt : function = "the ini file is corrupt"
    case %lineerr_nodriver : function = "the driver was not found"
    case %lineerr_inuse : function = "the line is in use"
    case %lineerr_nomem : function = "not enough memory is available"
    case %lineerr_invaladdress : function = "the address is invalid"
    case %lineerr_invalapphandle : function = "the application handle is invalid"
    case %lineerr_operationfailed : function = "the operation failed"
    case else : function = "unknown return value=" + str$(retval) + " = &h" + hex$(retval)
    end select
    end if
    '================================

    end function


    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    function openline( dev as long ) as string ' hline is global

    local privileges, mediamodes as long
    local retval as long
    local dwfncallback as dword ptr



    ' dwprivileges defines which privileges your application is
    ' interested in obtaining. possible values are linecallprivilege_none,
    ' linecallprivilege_monitor, and linecallprivilege_owner. if you do not need
    ' any stuff on incoming calls, simply put linecallprivilege_none there. in
    ' case you really want to deal with incoming/outgoing calls, specify the
    ' appropriate privilege level. the dwmediamodes parameter is used only if
    ' linecallprivilege_owner is set. it declares which media modes are of
    ' interest for your application.
    privileges = %linecallprivilege_none
    mediamodes = %linemediamode_interactivevoice
    '================================


    function = " ' no problems

    showtext "opening line #" + str$(dev)

    if hline <> 0 then ' check line is not allready open
    function = "line allready open on this device"
    exit function
    end if
    '================================


    dwfncallback = codeptr(linecallbackfunc) ' pointer to callback function
    '================================


    'n.b. you should pass the pointer to linecallbackfunc in lineinitializeex and 0 in lineopen.
    ' the dwcallbackinstance parameter is not a pointer to a callback function,
    ' but user-instance data. apparently, the vb code is using it to pass a
    ' pointer to a class and then doing some tweaking to be able to call the
    ' members of the class using a dotted syntax.


    retval = lineopen( hlineapp, _ '
    dev, _ ' dword dwdeviceid
    hline, _ ' lphline lphline - line handle for the corresponding opened line device
    tapiline(dev).negapiver, _ ' dword dwapiversion
    byval 0, _ ' dword dwextversion
    byval 0, _ ' dword_ptr dwcallbackinstance - user instance data
    privileges, _ ' dword dwprivileges
    mediamodes, _ ' dword dwmediamodes
    byval 0& ) ' lplinecallparams const lpcallparams, usually set to null
    '================================


    if retval < 0 then ' zero indicates success. a negative error number indicates that an error occurred
    select case cdwd(retval)
    case %lineerr_allocated : function = "the line cannot be opened, serial port may be in use"
    case %lineerr_linemapperfailed : function = "no lines found matching requirements specified in lpcallparams"
    case %lineerr_baddeviceid : function = "the device id is incorrect"
    case %lineerr_nodriver : function = "the driver was not found"
    case %lineerr_incompatibleapiversion : function = "the api version is incompatible"
    case %lineerr_nomem : function = "not enough memory is available"
    case %lineerr_operationfailed : function = "the operation failed"
    case %lineerr_invalapphandle : function = "the application handle is invalid"
    case %lineerr_resourceunavail : function = "he resource is unavailable"
    case %lineerr_invalmediamode : function = "the media mode is invalid"
    case %lineerr_structuretoosmall : function = "the structure is too small"
    case %lineerr_invalpointer : function = "the pointer is invalid"
    case %lineerr_uninitialized : function = "lthe parameter is uninitialized"
    case %lineerr_invalprivselect : function = "the priviledges are invalid"
    case %lineerr_reinit : function = "the application attempted to initialize tapi twice"
    case %lineerr_nodevice : function = "the device was not found"
    case %lineerr_operationunavail : function = "the operation is unavailable"
    case else : function = "unknown return value=" + str$(retval) + " = &h" + hex$(retval)
    end select
    end if ' print #hdbg, "lineopen() retval="+str$(retval)+"(zero indicates success), tapiver="+str$(tapiline(dev).negapiver)
    '================================


    end function


    '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    function processcanonical( hlineapp as long, dev as long ) as string ' hline is global

    'a common practice is that phone numbers are stored in canonical format,
    'which includes international the dialing code, area code, and so forth. an
    'actual call may use a modified form of this number depending on current
    'location, local or long distance call, and so forth. therefore, the
    'initial phone number should be translated into a dialable form. to proceed
    'with this task, you need to call linetranslateaddress. similar to
    'linegetdevcaps, you might be required to call this function several times
    'until a correctly sized memory block is passed to keep its output.


    'the canonical address format is:
    ' + country/regioncode ( areacode ) subscribernumber

    'for example, this is how you would enter a us number in canonical address format:
    '+1 (425) 555-0100


    local retval, numelem as long
    local trnsadd() as linetranslateoutput


    function = " ' no problems

    showtext "processing canonical number"

    if tapiline(dev).negapiver = 0 then ' not found in api negotiation
    function = "th

  • #2
    Code:
    '==============================================================================
    ' The  Telephony API is jointly copyrighted by Intel and Microsoft. You are
    ' granted a royalty free worldwide, unlimited license to make copies, and use
    ' the API/SPI for making applications/drivers that interface with the
    ' specification provided that this paragraph and the Intel/Microsoft copyright
    ' statement is maintained as is in the text and source code files.
    '
    ' Copyright 1995-96 Microsoft, all rights reserved.
    ' Portions copyright 1992, 1993 Intel/Microsoft, all rights reserved.
    ' Ported to PowerBasic 2001, Peter Lameijn. Based on TAPI.H
    ' Last updated : Oct 18, 2002.
    '------------------------------------------------------------------------------
    #If Not %Def(%TAPI32)
      %TAPI32 = 1
    
    #If Not %Def(%WINAPI)
      #Include "WIN32API.INC"
    #EndIf
    
    '------------------------------------------------------------------------------
    '  -- TAPI VERSION INFO -- TAPI VERSION INFO -- TAPI VERSION INFO --
    '  -- TAPI VERSION INFO -- TAPI VERSION INFO -- TAPI VERSION INFO --
    '  -- TAPI VERSION INFO -- TAPI VERSION INFO -- TAPI VERSION INFO --
    '
    ' To build  a TAPI 1.4 application put a define as below in your source
    ' file before you include TAPI.INC:
    '
    ' %TAPI_CURRENT_VERSION  = &h00010004
    '------------------------------------------------------------------------------
    #IF NOT %DEF(%TAPI_CURRENT_VERSION)
      %TAPI_CURRENT_VERSION                   = &h00020002
    #ENDIF
    
    
    '------------------------------------------------------------------------------
    ' Prototypes for used Callback routines
    '
    ' Sub LINECALLBACK(hDevice      As Dword, _
    '                  dwMessage    As Dword, _
    '                  dwInstance   As Dword, _
    '                  dwParam1     As Dword, _
    '                  dwParam2     As Dword, _
    '                  dwParam3     As Dword)
    '
    ' Sub PHONECALLBACK(hDevice     As Dword, _
    '                  dwMessage    As Dword, _
    '                  dwInstance   As Dword, _
    '                  dwParam1     As Dword, _
    '                  dwParam2     As Dword, _
    '                  dwParam3     As Dword)
    '------------------------------------------------------------------------------
    ' Messages for Phones and Lines
    '------------------------------------------------------------------------------
    %LINE_ADDRESSSTATE                      = 0&
    %LINE_CALLINFO                          = 1&
    %LINE_CALLSTATE                         = 2&
    %LINE_CLOSE                             = 3&
    %LINE_DEVSPECIFIC                       = 4&
    %LINE_DEVSPECIFICFEATURE                = 5&
    %LINE_GATHERDIGITS                      = 6&
    %LINE_GENERATE                          = 7&
    %LINE_LINEDEVSTATE                      = 8&
    %LINE_MONITORDIGITS                     = 9&
    %LINE_MONITORMEDIA                      = 10&
    %LINE_MONITORTONE                       = 11&
    %LINE_REPLY                             = 12&
    %LINE_REQUEST                           = 13&
    %PHONE_BUTTON                           = 14&
    %PHONE_CLOSE                            = 15&
    %PHONE_DEVSPECIFIC                      = 16&
    %PHONE_REPLY                            = 17&
    %PHONE_STATE                            = 18&
    %LINE_CREATE                            = 19&               'TAPI v1.4
    %PHONE_CREATE                           = 20&               'TAPI v1.4
               
    
    #IF %TAPI_CURRENT_VERSION >= &h000020000 
      %LINE_AGENTSPECIFIC                   = 21&               'TAPI v2.0
      %LINE_AGENTSTATUS                     = 22&               'TAPI v2.0
      %LINE_APPNEWCALL                      = 23&               'TAPI v2.0
      %LINE_PROXYREQUEST                    = 24&               'TAPI v2.0
      %LINE_REMOVE                          = 25&               'TAPI v2.0
      %PHONE_REMOVE                         = 26&               'TAPI v2.0 
    #ENDIF
    
    
    %INITIALIZE_NEGOTIATION                 = &hFFFFFFFF&
    
    %LINEADDRCAPFLAGS_FWDNUMRINGS           = &h000000001
    %LINEADDRCAPFLAGS_PICKUPGROUPID         = &h000000002
    %LINEADDRCAPFLAGS_SECURE                = &h000000004
    %LINEADDRCAPFLAGS_BLOCKIDDEFAULT        = &h000000008
    %LINEADDRCAPFLAGS_BLOCKIDOVERRIDE       = &h000000010
    %LINEADDRCAPFLAGS_DIALED                = &h000000020
    %LINEADDRCAPFLAGS_ORIGOFFHOOK           = &h000000040
    %LINEADDRCAPFLAGS_DESTOFFHOOK           = &h000000080
    %LINEADDRCAPFLAGS_FWDCONSULT            = &h000000100
    %LINEADDRCAPFLAGS_SETUPCONFNULL         = &h000000200
    %LINEADDRCAPFLAGS_AUTORECONNECT         = &h000000400
    %LINEADDRCAPFLAGS_COMPLETIONID          = &h000000800
    %LINEADDRCAPFLAGS_TRANSFERHELD          = &h000001000
    %LINEADDRCAPFLAGS_TRANSFERMAKE          = &h000002000
    %LINEADDRCAPFLAGS_CONFERENCEHELD        = &h000004000
    %LINEADDRCAPFLAGS_CONFERENCEMAKE        = &h000008000
    %LINEADDRCAPFLAGS_PARTIALDIAL           = &h000010000
    %LINEADDRCAPFLAGS_FWDSTATUSVALID        = &h000020000
    %LINEADDRCAPFLAGS_FWDINTEXTADDR         = &h000040000
    %LINEADDRCAPFLAGS_FWDBUSYNAADDR         = &h000080000
    %LINEADDRCAPFLAGS_ACCEPTTOALERT         = &h000100000
    %LINEADDRCAPFLAGS_CONFDROP              = &h000200000
    %LINEADDRCAPFLAGS_PICKUPCALLWAIT        = &h000400000
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINEADDRCAPFLAGS_PREDICTIVEDIALER    = &h000800000       'TAPI v2.0
      %LINEADDRCAPFLAGS_QUEUE               = &h001000000       'TAPI v2.0
      %LINEADDRCAPFLAGS_ROUTEPOINT          = &h002000000       'TAPI v2.0
      %LINEADDRCAPFLAGS_HOLDMAKESNEW        = &h004000000       'TAPI v2.0
      %LINEADDRCAPFLAGS_NOINTERNALCALLS     = &h008000000       'TAPI v2.0
      %LINEADDRCAPFLAGS_NOEXTERNALCALLS     = &h010000000       'TAPI v2.0
      %LINEADDRCAPFLAGS_SETCALLINGID        = &h020000000       'TAPI v2.0
    #EndIf
    
    %LINEADDRESSMODE_ADDRESSID              = &h000000001
    %LINEADDRESSMODE_DIALABLEADDR           = &h000000002
    
    %LINEADDRESSSHARING_PRIVATE             = &h000000001
    %LINEADDRESSSHARING_BRIDGEDEXCL         = &h000000002
    %LINEADDRESSSHARING_BRIDGEDNEW          = &h000000004
    %LINEADDRESSSHARING_BRIDGEDSHARED       = &h000000008
    %LINEADDRESSSHARING_MONITORED           = &h000000010
    
    %LINEADDRESSSTATE_OTHER                 = &h000000001
    %LINEADDRESSSTATE_DEVSPECIFIC           = &h000000002
    %LINEADDRESSSTATE_INUSEZERO             = &h000000004
    %LINEADDRESSSTATE_INUSEONE              = &h000000008
    %LINEADDRESSSTATE_INUSEMANY             = &h000000010
    %LINEADDRESSSTATE_NUMCALLS              = &h000000020
    %LINEADDRESSSTATE_FORWARD               = &h000000040
    %LINEADDRESSSTATE_TERMINALS             = &h000000080
    %LINEADDRESSSTATE_CAPSCHANGE            = &h000000100       'TAPI v1.4
    
    %LINEADDRFEATURE_FORWARD                = &h000000001
    %LINEADDRFEATURE_MAKECALL               = &h000000002
    %LINEADDRFEATURE_PICKUP                 = &h000000004
    %LINEADDRFEATURE_SETMEDIACONTROL        = &h000000008
    %LINEADDRFEATURE_SETTERMINAL            = &h000000010
    %LINEADDRFEATURE_SETUPCONF              = &h000000020
    %LINEADDRFEATURE_UNCOMPLETECALL         = &h000000040
    %LINEADDRFEATURE_UNPARK                 = &h000000080
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINEADDRFEATURE_PICKUPHELD           = &h000000100       'TAPI v2.0
      %LINEADDRFEATURE_PICKUPGROUP          = &h000000200       'TAPI v2.0
      %LINEADDRFEATURE_PICKUPDIRECT         = &h000000400       'TAPI v2.0
      %LINEADDRFEATURE_PICKUPWAITING        = &h000000800       'TAPI v2.0
      %LINEADDRFEATURE_FORWARDFWD           = &h000001000       'TAPI v2.0
      %LINEADDRFEATURE_FORWARDDND           = &h000002000       'TAPI v2.0
    #EndIf
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINEAGENTFEATURE_SETAGENTGROUP       = &h000000001       'TAPI v2.0
      %LINEAGENTFEATURE_SETAGENTSTATE       = &h000000002       'TAPI v2.0
      %LINEAGENTFEATURE_SETAGENTACTIVITY    = &h000000004       'TAPI v2.0
      %LINEAGENTFEATURE_AGENTSPECIFIC       = &h000000008       'TAPI v2.0
      %LINEAGENTFEATURE_GETAGENTACTIVITYLIST= &h000000010       'TAPI v2.0
      %LINEAGENTFEATURE_GETAGENTGROUP       = &h000000020       'TAPI v2.0
    #EndIf
    
    %LINEAGENTSTATE_LOGGEDOFF               = &h000000001       'TAPI v2.0
    %LINEAGENTSTATE_NOTREADY                = &h000000002       'TAPI v2.0
    %LINEAGENTSTATE_READY                   = &h000000004       'TAPI v2.0
    %LINEAGENTSTATE_BUSYACD                 = &h000000008       'TAPI v2.0
    %LINEAGENTSTATE_BUSYINCOMING            = &h000000010       'TAPI v2.0
    %LINEAGENTSTATE_BUSYOUTBOUND            = &h000000020       'TAPI v2.0
    %LINEAGENTSTATE_BUSYOTHER               = &h000000040       'TAPI v2.0
    %LINEAGENTSTATE_WORKINGAFTERCALL        = &h000000080       'TAPI v2.0
    %LINEAGENTSTATE_UNKNOWN                 = &h000000100       'TAPI v2.0
    %LINEAGENTSTATE_UNAVAIL                 = &h000000200       'TAPI v2.0
    
    %LINEAGENTSTATUS_GROUP                  = &h000000001       'TAPI v2.0
    %LINEAGENTSTATUS_STATE                  = &h000000002       'TAPI v2.0
    %LINEAGENTSTATUS_NEXTSTATE              = &h000000004       'TAPI v2.0
    %LINEAGENTSTATUS_ACTIVITY               = &h000000008       'TAPI v2.0
    %LINEAGENTSTATUS_ACTIVITYLIST           = &h000000010       'TAPI v2.0
    %LINEAGENTSTATUS_GROUPLIST              = &h000000020       'TAPI v2.0
    %LINEAGENTSTATUS_CAPSCHANGE             = &h000000040       'TAPI v2.0
    %LINEAGENTSTATUS_VALIDSTATES            = &h000000080       'TAPI v2.0
    %LINEAGENTSTATUS_VALIDNEXTSTATES        = &h000000100       'TAPI v2.0
    
    %LINEANSWERMODE_NONE                    = &h000000001
    %LINEANSWERMODE_DROP                    = &h000000002
    %LINEANSWERMODE_HOLD                    = &h000000004
    
    %LINEBEARERMODE_VOICE                   = &h000000001
    %LINEBEARERMODE_SPEECH                  = &h000000002
    %LINEBEARERMODE_MULTIUSE                = &h000000004
    %LINEBEARERMODE_DATA                    = &h000000008
    %LINEBEARERMODE_ALTSPEECHDATA           = &h000000010
    %LINEBEARERMODE_NONCALLSIGNALING        = &h000000020
    %LINEBEARERMODE_PASSTHROUGH             = &h000000040       'TAPI v1.4
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINEBEARERMODE_RESTRICTEDDATA        = &h000000080       'TAPI v2.0
    #EndIf
    
    %LINEBUSYMODE_STATION                   = &h000000001
    %LINEBUSYMODE_TRUNK                     = &h000000002
    %LINEBUSYMODE_UNKNOWN                   = &h000000004
    %LINEBUSYMODE_UNAVAIL                   = &h000000008
    
    %LINECALLCOMPLCOND_BUSY                 = &h000000001
    %LINECALLCOMPLCOND_NOANSWER             = &h000000002
    
    %LINECALLCOMPLMODE_CAMPON               = &h000000001
    %LINECALLCOMPLMODE_CALLBACK             = &h000000002
    %LINECALLCOMPLMODE_INTRUDE              = &h000000004
    %LINECALLCOMPLMODE_MESSAGE              = &h000000008
    
    %LINECALLFEATURE_ACCEPT                 = &h000000001
    %LINECALLFEATURE_ADDTOCONF              = &h000000002
    %LINECALLFEATURE_ANSWER                 = &h000000004
    %LINECALLFEATURE_BLINDTRANSFER          = &h000000008
    %LINECALLFEATURE_COMPLETECALL           = &h000000010
    %LINECALLFEATURE_COMPLETETRANSF         = &h000000020
    %LINECALLFEATURE_DIAL                   = &h000000040
    %LINECALLFEATURE_DROP                   = &h000000080
    %LINECALLFEATURE_GATHERDIGITS           = &h000000100
    %LINECALLFEATURE_GENERATEDIGITS         = &h000000200
    %LINECALLFEATURE_GENERATETONE           = &h000000400
    %LINECALLFEATURE_HOLD                   = &h000000800
    %LINECALLFEATURE_MONITORDIGITS          = &h000001000
    %LINECALLFEATURE_MONITORMEDIA           = &h000002000
    %LINECALLFEATURE_MONITORTONES           = &h000004000
    %LINECALLFEATURE_PARK                   = &h000008000
    %LINECALLFEATURE_PREPAREADDCONF         = &h000010000
    %LINECALLFEATURE_REDIRECT               = &h000020000
    %LINECALLFEATURE_REMOVEFROMCONF         = &h000040000
    %LINECALLFEATURE_SECURECALL             = &h000080000
    %LINECALLFEATURE_SENDUSERUSER           = &h000100000
    %LINECALLFEATURE_SETCALLPARAMS          = &h000200000
    %LINECALLFEATURE_SETMEDIACONTROL        = &h000400000
    %LINECALLFEATURE_SETTERMINAL            = &h000800000
    %LINECALLFEATURE_SETUPCONF              = &h001000000
    %LINECALLFEATURE_SETUPTRANSFER          = &h002000000
    %LINECALLFEATURE_SWAPHOLD               = &h004000000
    %LINECALLFEATURE_UNHOLD                 = &h008000000
    %LINECALLFEATURE_RELEASEUSERUSERINFO    = &h010000000       'TAPI v1.4
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINECALLFEATURE_SETTREATMENT         = &h020000000       'TAPI v2.0
      %LINECALLFEATURE_SETQOS               = &h040000000       'TAPI v2.0
      %LINECALLFEATURE_SETCALLDATA          = &h080000000       'TAPI v2.0
    #EndIf
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINECALLFEATURE2_NOHOLDCONFERENCE    = &h000000001       'TAPI v2.0
      %LINECALLFEATURE2_ONESTEPTRANSFER     = &h000000002       'TAPI v2.0
      %LINECALLFEATURE2_COMPLCAMPON         = &h000000004       'TAPI v2.0
      %LINECALLFEATURE2_COMPLCALLBACK       = &h000000008       'TAPI v2.0
      %LINECALLFEATURE2_COMPLINTRUDE        = &h000000010       'TAPI v2.0
      %LINECALLFEATURE2_COMPLMESSAGE        = &h000000020       'TAPI v2.0
      %LINECALLFEATURE2_TRANSFERNORM        = &h000000040       'TAPI v2.0
      %LINECALLFEATURE2_TRANSFERCONF        = &h000000080       'TAPI v2.0
      %LINECALLFEATURE2_PARKDIRECT          = &h000000100       'TAPI v2.0
      %LINECALLFEATURE2_PARKNONDIRECT       = &h000000200       'TAPI v2.0
    #EndIf
    
    %LINECALLINFOSTATE_OTHER                = &h000000001
    %LINECALLINFOSTATE_DEVSPECIFIC          = &h000000002
    %LINECALLINFOSTATE_BEARERMODE           = &h000000004
    %LINECALLINFOSTATE_RATE                 = &h000000008
    %LINECALLINFOSTATE_MEDIAMODE            = &h000000010
    %LINECALLINFOSTATE_APPSPECIFIC          = &h000000020
    %LINECALLINFOSTATE_CALLID               = &h000000040
    %LINECALLINFOSTATE_RELATEDCALLID        = &h000000080
    %LINECALLINFOSTATE_ORIGIN               = &h000000100
    %LINECALLINFOSTATE_REASON               = &h000000200
    %LINECALLINFOSTATE_COMPLETIONID         = &h000000400
    %LINECALLINFOSTATE_NUMOWNERINCR         = &h000000800
    %LINECALLINFOSTATE_NUMOWNERDECR         = &h000001000
    %LINECALLINFOSTATE_NUMMONITORS          = &h000002000
    %LINECALLINFOSTATE_TRUNK                = &h000004000
    %LINECALLINFOSTATE_CALLERID             = &h000008000
    %LINECALLINFOSTATE_CALLEDID             = &h000010000
    %LINECALLINFOSTATE_CONNECTEDID          = &h000020000
    %LINECALLINFOSTATE_REDIRECTIONID        = &h000040000
    %LINECALLINFOSTATE_REDIRECTINGID        = &h000080000
    %LINECALLINFOSTATE_DISPLAY              = &h000100000
    %LINECALLINFOSTATE_USERUSERINFO         = &h000200000
    %LINECALLINFOSTATE_HIGHLEVELCOMP        = &h000400000
    %LINECALLINFOSTATE_LOWLEVELCOMP         = &h000800000
    %LINECALLINFOSTATE_CHARGINGINFO         = &h001000000
    %LINECALLINFOSTATE_TERMINAL             = &h002000000
    %LINECALLINFOSTATE_DIALPARAMS           = &h004000000
    %LINECALLINFOSTATE_MONITORMODES         = &h008000000
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINECALLINFOSTATE_TREATMENT          = &h010000000       'TAPI v2.0
      %LINECALLINFOSTATE_QOS                = &h020000000       'TAPI v2.0
      %LINECALLINFOSTATE_CALLDATA           = &h040000000       'TAPI v2.0
    #EndIf
    
    %LINECALLORIGIN_OUTBOUND                = &h000000001
    %LINECALLORIGIN_INTERNAL                = &h000000002
    %LINECALLORIGIN_EXTERNAL                = &h000000004
    %LINECALLORIGIN_UNKNOWN                 = &h000000010
    %LINECALLORIGIN_UNAVAIL                 = &h000000020
    %LINECALLORIGIN_CONFERENCE              = &h000000040
    %LINECALLORIGIN_INBOUND                 = &h000000080       'TAPI v1.4
    
    %LINECALLPARAMFLAGS_SECURE              = &h000000001
    %LINECALLPARAMFLAGS_IDLE                = &h000000002
    %LINECALLPARAMFLAGS_BLOCKID             = &h000000004
    %LINECALLPARAMFLAGS_ORIGOFFHOOK         = &h000000008
    %LINECALLPARAMFLAGS_DESTOFFHOOK         = &h000000010
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINECALLPARAMFLAGS_NOHOLDCONFERENCE  = &h000000020       'TAPI v2.0
      %LINECALLPARAMFLAGS_PREDICTIVEDIAL    = &h000000040       'TAPI v2.0
      %LINECALLPARAMFLAGS_ONESTEPTRANSFER   = &h000000080       'TAPI v2.0
    #EndIf
    
    %LINECALLPARTYID_BLOCKED                = &h000000001
    %LINECALLPARTYID_OUTOFAREA              = &h000000002
    %LINECALLPARTYID_NAME                   = &h000000004
    %LINECALLPARTYID_ADDRESS                = &h000000008
    %LINECALLPARTYID_PARTIAL                = &h000000010
    %LINECALLPARTYID_UNKNOWN                = &h000000020
    %LINECALLPARTYID_UNAVAIL                = &h000000040
    
    %LINECALLPRIVILEGE_NONE                 = &h000000001
    %LINECALLPRIVILEGE_MONITOR              = &h000000002
    %LINECALLPRIVILEGE_OWNER                = &h000000004
    
    %LINECALLREASON_DIRECT                  = &h000000001
    %LINECALLREASON_FWDBUSY                 = &h000000002
    %LINECALLREASON_FWDNOANSWER             = &h000000004
    %LINECALLREASON_FWDUNCOND               = &h000000008
    %LINECALLREASON_PICKUP                  = &h000000010
    %LINECALLREASON_UNPARK                  = &h000000020
    %LINECALLREASON_REDIRECT                = &h000000040
    %LINECALLREASON_CALLCOMPLETION          = &h000000080
    %LINECALLREASON_TRANSFER                = &h000000100
    %LINECALLREASON_REMINDER                = &h000000200
    %LINECALLREASON_UNKNOWN                 = &h000000400
    %LINECALLREASON_UNAVAIL                 = &h000000800
    %LINECALLREASON_INTRUDE                 = &h000001000       'TAPI v1.4
    %LINECALLREASON_PARKED                  = &h000002000       'TAPI v1.4
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINECALLREASON_CAMPEDON              = &h000004000       'TAPI v2.0
      %LINECALLREASON_ROUTEREQUEST          = &h000008000       'TAPI v2.0
    #EndIf
    
    %LINECALLSELECT_LINE                    = &h000000001
    %LINECALLSELECT_ADDRESS                 = &h000000002
    %LINECALLSELECT_CALL                    = &h000000004
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINECALLSELECT_DEVICEID              = &h000000008       'TAPI v2.0
    #EndIf
    
    %LINECALLSTATE_IDLE                     = &h000000001
    %LINECALLSTATE_OFFERING                 = &h000000002
    %LINECALLSTATE_ACCEPTED                 = &h000000004
    %LINECALLSTATE_DIALTONE                 = &h000000008
    %LINECALLSTATE_DIALING                  = &h000000010
    %LINECALLSTATE_RINGBACK                 = &h000000020
    %LINECALLSTATE_BUSY                     = &h000000040
    %LINECALLSTATE_SPECIALINFO              = &h000000080
    %LINECALLSTATE_CONNECTED                = &h000000100
    %LINECALLSTATE_PROCEEDING               = &h000000200
    %LINECALLSTATE_ONHOLD                   = &h000000400
    %LINECALLSTATE_CONFERENCED              = &h000000800
    %LINECALLSTATE_ONHOLDPENDCONF           = &h000001000
    %LINECALLSTATE_ONHOLDPENDTRANSFER       = &h000002000
    %LINECALLSTATE_DISCONNECTED             = &h000004000
    %LINECALLSTATE_UNKNOWN                  = &h000008000
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINECALLTREATMENT_SILENCE            = &h000000001       'TAPI v2.0
      %LINECALLTREATMENT_RINGBACK           = &h000000002       'TAPI v2.0
      %LINECALLTREATMENT_BUSY               = &h000000003       'TAPI v2.0
      %LINECALLTREATMENT_MUSIC              = &h000000004       'TAPI v2.0
    #EndIf
    
    %LINECARDOPTION_PREDEFINED              = &h000000001       'TAPI v1.4
    %LINECARDOPTION_HIDDEN                  = &h000000002       'TAPI v1.4
    
    %LINECONNECTEDMODE_ACTIVE               = &h000000001       'TAPI v1.4
    %LINECONNECTEDMODE_INACTIVE             = &h000000002       'TAPI v1.4
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINECONNECTEDMODE_ACTIVEHELD         = &h000000004       'TAPI v2.0
      %LINECONNECTEDMODE_INACTIVEHELD       = &h000000008       'TAPI v2.0
      %LINECONNECTEDMODE_CONFIRMED          = &h000000010       'TAPI v2.0
    #EndIf
    
    %LINEDEVCAPFLAGS_CROSSADDRCONF          = &h000000001
    %LINEDEVCAPFLAGS_HIGHLEVCOMP            = &h000000002
    %LINEDEVCAPFLAGS_LOWLEVCOMP             = &h000000004
    %LINEDEVCAPFLAGS_MEDIACONTROL           = &h000000008
    %LINEDEVCAPFLAGS_MULTIPLEADDR           = &h000000010
    %LINEDEVCAPFLAGS_CLOSEDROP              = &h000000020
    %LINEDEVCAPFLAGS_DIALBILLING            = &h000000040
    %LINEDEVCAPFLAGS_DIALQUIET              = &h000000080
    %LINEDEVCAPFLAGS_DIALDIALTONE           = &h000000100
    
    %LINEDEVSTATE_OTHER                     = &h000000001
    %LINEDEVSTATE_RINGING                   = &h000000002
    %LINEDEVSTATE_CONNECTED                 = &h000000004
    %LINEDEVSTATE_DISCONNECTED              = &h000000008
    %LINEDEVSTATE_MSGWAITON                 = &h000000010
    %LINEDEVSTATE_MSGWAITOFF                = &h000000020
    %LINEDEVSTATE_INSERVICE                 = &h000000040
    %LINEDEVSTATE_OUTOFSERVICE              = &h000000080
    %LINEDEVSTATE_MAINTENANCE               = &h000000100
    %LINEDEVSTATE_OPEN                      = &h000000200
    %LINEDEVSTATE_CLOSE                     = &h000000400
    %LINEDEVSTATE_NUMCALLS                  = &h000000800
    %LINEDEVSTATE_NUMCOMPLETIONS            = &h000001000
    %LINEDEVSTATE_TERMINALS                 = &h000002000
    %LINEDEVSTATE_ROAMMODE                  = &h000004000
    %LINEDEVSTATE_BATTERY                   = &h000008000
    %LINEDEVSTATE_SIGNAL                    = &h000010000
    %LINEDEVSTATE_DEVSPECIFIC               = &h000020000
    %LINEDEVSTATE_REINIT                    = &h000040000
    %LINEDEVSTATE_LOCK                      = &h000080000
    %LINEDEVSTATE_CAPSCHANGE                = &h000100000       'TAPI v1.4
    %LINEDEVSTATE_CONFIGCHANGE              = &h000200000       'TAPI v1.4
    %LINEDEVSTATE_TRANSLATECHANGE           = &h000400000       'TAPI v1.4
    %LINEDEVSTATE_COMPLCANCEL               = &h000800000       'TAPI v1.4
    %LINEDEVSTATE_REMOVED                   = &h001000000       'TAPI v1.4
    
    %LINEDEVSTATUSFLAGS_CONNECTED           = &h000000001
    %LINEDEVSTATUSFLAGS_MSGWAIT             = &h000000002
    %LINEDEVSTATUSFLAGS_INSERVICE           = &h000000004
    %LINEDEVSTATUSFLAGS_LOCKED              = &h000000008
    
    %LINEDIALTONEMODE_NORMAL                = &h000000001
    %LINEDIALTONEMODE_SPECIAL               = &h000000002
    %LINEDIALTONEMODE_INTERNAL              = &h000000004
    %LINEDIALTONEMODE_EXTERNAL              = &h000000008
    %LINEDIALTONEMODE_UNKNOWN               = &h000000010
    %LINEDIALTONEMODE_UNAVAIL               = &h000000020
    
    %LINEDIGITMODE_PULSE                    = &h000000001
    %LINEDIGITMODE_DTMF                     = &h000000002
    %LINEDIGITMODE_DTMFEND                  = &h000000004
    
    %LINEDISCONNECTMODE_NORMAL              = &h000000001
    %LINEDISCONNECTMODE_UNKNOWN             = &h000000002
    %LINEDISCONNECTMODE_REJECT              = &h000000004
    %LINEDISCONNECTMODE_PICKUP              = &h000000008
    %LINEDISCONNECTMODE_FORWARDED           = &h000000010
    %LINEDISCONNECTMODE_BUSY                = &h000000020
    %LINEDISCONNECTMODE_NOANSWER            = &h000000040
    %LINEDISCONNECTMODE_BADADDRESS          = &h000000080
    %LINEDISCONNECTMODE_UNREACHABLE         = &h000000100
    %LINEDISCONNECTMODE_CONGESTION          = &h000000200
    %LINEDISCONNECTMODE_INCOMPATIBLE        = &h000000400
    %LINEDISCONNECTMODE_UNAVAIL             = &h000000800
    %LINEDISCONNECTMODE_NODIALTONE          = &h000001000       'TAPI v1.4
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINEDISCONNECTMODE_NUMBERCHANGED     = &h000002000       'TAPI v2.0
      %LINEDISCONNECTMODE_OUTOFORDER        = &h000004000       'TAPI v2.0
      %LINEDISCONNECTMODE_TEMPFAILURE       = &h000008000       'TAPI v2.0
      %LINEDISCONNECTMODE_QOSUNAVAIL        = &h000010000       'TAPI v2.0
      %LINEDISCONNECTMODE_BLOCKED           = &h000020000       'TAPI v2.0
      %LINEDISCONNECTMODE_DONOTDISTURB      = &h000040000       'TAPI v2.0
      %LINEDISCONNECTMODE_CANCELLED         = &h000080000       'TAPI v2.0
    #EndIf
    
    %LINEERR_ALLOCATED                      = &h080000001
    %LINEERR_BADDEVICEID                    = &h080000002
    %LINEERR_BEARERMODEUNAVAIL              = &h080000003
    %LINEERR_CALLUNAVAIL                    = &h080000005
    %LINEERR_COMPLETIONOVERRUN              = &h080000006
    %LINEERR_CONFERENCEFULL                 = &h080000007
    %LINEERR_DIALBILLING                    = &h080000008
    %LINEERR_DIALDIALTONE                   = &h080000009
    %LINEERR_DIALPROMPT                     = &h08000000A
    %LINEERR_DIALQUIET                      = &h08000000B
    %LINEERR_INCOMPATIBLEAPIVERSION         = &h08000000C
    %LINEERR_INCOMPATIBLEEXTVERSION         = &h08000000D
    %LINEERR_INIFILECORRUPT                 = &h08000000E
    %LINEERR_INUSE                          = &h08000000F
    %LINEERR_INVALADDRESS                   = &h080000010
    %LINEERR_INVALADDRESSID                 = &h080000011
    %LINEERR_INVALADDRESSMODE               = &h080000012
    %LINEERR_INVALADDRESSSTATE              = &h080000013
    %LINEERR_INVALAPPHANDLE                 = &h080000014
    %LINEERR_INVALAPPNAME                   = &h080000015
    %LINEERR_INVALBEARERMODE                = &h080000016
    %LINEERR_INVALCALLCOMPLMODE             = &h080000017
    %LINEERR_INVALCALLHANDLE                = &h080000018
    %LINEERR_INVALCALLPARAMS                = &h080000019
    %LINEERR_INVALCALLPRIVILEGE             = &h08000001A
    %LINEERR_INVALCALLSELECT                = &h08000001B
    %LINEERR_INVALCALLSTATE                 = &h08000001C
    %LINEERR_INVALCALLSTATELIST             = &h08000001D
    %LINEERR_INVALCARD                      = &h08000001E
    %LINEERR_INVALCOMPLETIONID              = &h08000001F
    %LINEERR_INVALCONFCALLHANDLE            = &h080000020
    %LINEERR_INVALCONSULTCALLHANDLE         = &h080000021
    %LINEERR_INVALCOUNTRYCODE               = &h080000022
    %LINEERR_INVALDEVICECLASS               = &h080000023
    %LINEERR_INVALDEVICEHANDLE              = &h080000024
    %LINEERR_INVALDIALPARAMS                = &h080000025
    %LINEERR_INVALDIGITLIST                 = &h080000026
    %LINEERR_INVALDIGITMODE                 = &h080000027
    %LINEERR_INVALDIGITS                    = &h080000028
    %LINEERR_INVALEXTVERSION                = &h080000029
    %LINEERR_INVALGROUPID                   = &h08000002A
    %LINEERR_INVALLINEHANDLE                = &h08000002B
    %LINEERR_INVALLINESTATE                 = &h08000002C
    %LINEERR_INVALLOCATION                  = &h08000002D
    %LINEERR_INVALMEDIALIST                 = &h08000002E
    %LINEERR_INVALMEDIAMODE                 = &h08000002F
    %LINEERR_INVALMESSAGEID                 = &h080000030
    %LINEERR_INVALPARAM                     = &h080000032
    %LINEERR_INVALPARKID                    = &h080000033
    %LINEERR_INVALPARKMODE                  = &h080000034
    %LINEERR_INVALPOINTER                   = &h080000035
    %LINEERR_INVALPRIVSELECT                = &h080000036
    %LINEERR_INVALRATE                      = &h080000037
    %LINEERR_INVALREQUESTMODE               = &h080000038
    %LINEERR_INVALTERMINALID                = &h080000039
    %LINEERR_INVALTERMINALMODE              = &h08000003A
    %LINEERR_INVALTIMEOUT                   = &h08000003B
    %LINEERR_INVALTONE                      = &h08000003C
    %LINEERR_INVALTONELIST                  = &h08000003D
    %LINEERR_INVALTONEMODE                  = &h08000003E
    %LINEERR_INVALTRANSFERMODE              = &h08000003F
    %LINEERR_LINEMAPPERFAILED               = &h080000040
    %LINEERR_NOCONFERENCE                   = &h080000041
    %LINEERR_NODEVICE                       = &h080000042
    %LINEERR_NODRIVER                       = &h080000043
    %LINEERR_NOMEM                          = &h080000044
    %LINEERR_NOREQUEST                      = &h080000045
    %LINEERR_NOTOWNER                       = &h080000046
    %LINEERR_NOTREGISTERED                  = &h080000047
    %LINEERR_OPERATIONFAILED                = &h080000048
    %LINEERR_OPERATIONUNAVAIL               = &h080000049
    %LINEERR_RATEUNAVAIL                    = &h08000004A
    %LINEERR_RESOURCEUNAVAIL                = &h08000004B
    %LINEERR_REQUESTOVERRUN                 = &h08000004C
    %LINEERR_STRUCTURETOOSMALL              = &h08000004D   ' **
    %LINEERR_TARGETNOTFOUND                 = &h08000004E
    %LINEERR_TARGETSELF                     = &h08000004F
    %LINEERR_UNINITIALIZED                  = &h080000050
    %LINEERR_USERUSERINFOTOOBIG             = &h080000051
    %LINEERR_REINIT                         = &h080000052
    %LINEERR_ADDRESSBLOCKED                 = &h080000053
    %LINEERR_BILLINGREJECTED                = &h080000054
    %LINEERR_INVALFEATURE                   = &h080000055
    %LINEERR_NOMULTIPLEINSTANCE             = &h080000056
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINEERR_INVALAGENTID                 = &h080000057       'TAPI v2.0
      %LINEERR_INVALAGENTGROUP              = &h080000058       'TAPI v2.0
      %LINEERR_INVALPASSWORD                = &h080000059       'TAPI v2.0
      %LINEERR_INVALAGENTSTATE              = &h08000005A       'TAPI v2.0
      %LINEERR_INVALAGENTACTIVITY           = &h08000005B       'TAPI v2.0
      %LINEERR_DIALVOICEDETECT              = &h08000005C       'TAPI v2.0
    #EndIf
    
    %LINEFEATURE_DEVSPECIFIC                = &h000000001
    %LINEFEATURE_DEVSPECIFICFEAT            = &h000000002
    %LINEFEATURE_FORWARD                    = &h000000004
    %LINEFEATURE_MAKECALL                   = &h000000008
    %LINEFEATURE_SETMEDIACONTROL            = &h000000010
    %LINEFEATURE_SETTERMINAL                = &h000000020
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINEFEATURE_SETDEVSTATUS             = &h000000040       'TAPI v2.0
      %LINEFEATURE_FORWARDFWD               = &h000000080       'TAPI v2.0
      %LINEFEATURE_FORWARDDND               = &h000000100       'TAPI v2.0
    #EndIf
    
    %LINEFORWARDMODE_UNCOND                 = &h000000001
    %LINEFORWARDMODE_UNCONDINTERNAL         = &h000000002
    %LINEFORWARDMODE_UNCONDEXTERNAL         = &h000000004
    %LINEFORWARDMODE_UNCONDSPECIFIC         = &h000000008
    %LINEFORWARDMODE_BUSY                   = &h000000010
    %LINEFORWARDMODE_BUSYINTERNAL           = &h000000020
    %LINEFORWARDMODE_BUSYEXTERNAL           = &h000000040
    %LINEFORWARDMODE_BUSYSPECIFIC           = &h000000080
    %LINEFORWARDMODE_NOANSW                 = &h000000100
    %LINEFORWARDMODE_NOANSWINTERNAL         = &h000000200
    %LINEFORWARDMODE_NOANSWEXTERNAL         = &h000000400
    %LINEFORWARDMODE_NOANSWSPECIFIC         = &h000000800
    %LINEFORWARDMODE_BUSYNA                 = &h000001000
    %LINEFORWARDMODE_BUSYNAINTERNAL         = &h000002000
    %LINEFORWARDMODE_BUSYNAEXTERNAL         = &h000004000
    %LINEFORWARDMODE_BUSYNASPECIFIC         = &h000008000
    %LINEFORWARDMODE_UNKNOWN                = &h000010000       'TAPI v1.4
    %LINEFORWARDMODE_UNAVAIL                = &h000020000       'TAPI v1.4
    
    %LINEGATHERTERM_BUFFERFULL              = &h000000001
    %LINEGATHERTERM_TERMDIGIT               = &h000000002
    %LINEGATHERTERM_FIRSTTIMEOUT            = &h000000004
    %LINEGATHERTERM_INTERTIMEOUT            = &h000000008
    %LINEGATHERTERM_CANCEL                  = &h000000010
    
    %LINEGENERATETERM_DONE                  = &h000000001
    %LINEGENERATETERM_CANCEL                = &h000000002
    
    '------------------------------------------------------------------------------
    ' These constants are mutually exclusive; there's no way to specify more than
    ' one at a time(doesn't make sense, either) so they're ordinal rather than bits
    '------------------------------------------------------------------------------
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINEINITIALIZEEXOPTION_USEHIDDENWINDOW   = &h00000001    'TAPI v2.0
      %LINEINITIALIZEEXOPTION_USEEVENT          = &h00000002    'TAPI v2.0
      %LINEINITIALIZEEXOPTION_USECOMPLETIONPORT = &h00000003    'TAPI v2.0
    #EndIf
    
    '------------------------------------------------------------------------------
    %LINELOCATIONOPTION_PULSEDIAL           = &h000000001       'TAPI v1.4
    
    %LINEMAPPER                             = &h0FFFFFFFF
    
    %LINEMEDIACONTROL_NONE                  = &h000000001
    %LINEMEDIACONTROL_START                 = &h000000002
    %LINEMEDIACONTROL_RESET                 = &h000000004
    %LINEMEDIACONTROL_PAUSE                 = &h000000008
    %LINEMEDIACONTROL_RESUME                = &h000000010
    %LINEMEDIACONTROL_RATEUP                = &h000000020
    %LINEMEDIACONTROL_RATEDOWN              = &h000000040
    %LINEMEDIACONTROL_RATENORMAL            = &h000000080
    %LINEMEDIACONTROL_VOLUMEUP              = &h000000100
    %LINEMEDIACONTROL_VOLUMEDOWN            = &h000000200
    %LINEMEDIACONTROL_VOLUMENORMAL          = &h000000400
    
    %LINEMEDIAMODE_UNKNOWN                  = &h000000002
    %LINEMEDIAMODE_INTERACTIVEVOICE         = &h000000004
    %LINEMEDIAMODE_AUTOMATEDVOICE           = &h000000008
    %LINEMEDIAMODE_DATAMODEM                = &h000000010
    %LINEMEDIAMODE_G3FAX                    = &h000000020
    %LINEMEDIAMODE_TDD                      = &h000000040
    %LINEMEDIAMODE_G4FAX                    = &h000000080
    %LINEMEDIAMODE_DIGITALDATA              = &h000000100
    %LINEMEDIAMODE_TELETEX                  = &h000000200
    %LINEMEDIAMODE_VIDEOTEX                 = &h000000400
    %LINEMEDIAMODE_TELEX                    = &h000000800
    %LINEMEDIAMODE_MIXED                    = &h000001000
    %LINEMEDIAMODE_ADSI                     = &h000002000
    %LINEMEDIAMODE_VOICEVIEW                = &h000004000       'TAPI v1.4
    
    #If %TAPI_CURRENT_VERSION >= &h000020001
      %LINEMEDIAMODE_VIDEO                  = &h000008000       'TAPI v2.1
    #EndIf
    
    %LAST_LINEMEDIAMODE                     = &h000008000
    
    %LINEOFFERINGMODE_ACTIVE                = &h000000001       'TAPI v1.4
    %LINEOFFERINGMODE_INACTIVE              = &h000000002       'TAPI v1.4
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINEOPENOPTION_SINGLEADDRESS         = &h080000000       'TAPI v2.0
      %LINEOPENOPTION_PROXY                 = &h040000000       'TAPI v2.0
    #EndIf
    
    %LINEPARKMODE_DIRECTED                  = &h000000001
    %LINEPARKMODE_NONDIRECTED               = &h000000002
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINEPROXYREQUEST_SETAGENTGROUP       = &h000000001       'TAPI v2.0
      %LINEPROXYREQUEST_SETAGENTSTATE       = &h000000002       'TAPI v2.0
      %LINEPROXYREQUEST_SETAGENTACTIVITY    = &h000000003       'TAPI v2.0
      %LINEPROXYREQUEST_GETAGENTCAPS        = &h000000004       'TAPI v2.0
      %LINEPROXYREQUEST_GETAGENTSTATUS      = &h000000005       'TAPI v2.0
      %LINEPROXYREQUEST_AGENTSPECIFIC       = &h000000006       'TAPI v2.0
      %LINEPROXYREQUEST_GETAGENTACTIVITYLIST= &h000000007       'TAPI v2.0
      %LINEPROXYREQUEST_GETAGENTGROUPLIST   = &h000000008       'TAPI v2.0
    #EndIf
    
    %LINEREMOVEFROMCONF_NONE                = &h000000001
    %LINEREMOVEFROMCONF_LAST                = &h000000002
    %LINEREMOVEFROMCONF_ANY                 = &h000000003
    
    %LINEREQUESTMODE_MAKECALL               = &h000000001
    %LINEREQUESTMODE_MEDIACALL              = &h000000002
    %LINEREQUESTMODE_DROP                   = &h000000004
    %LAST_LINEREQUESTMODE                   = %LINEREQUESTMODE_MEDIACALL
    
    %LINEROAMMODE_UNKNOWN                   = &h000000001
    %LINEROAMMODE_UNAVAIL                   = &h000000002
    %LINEROAMMODE_HOME                      = &h000000004
    %LINEROAMMODE_ROAMA                     = &h000000008
    %LINEROAMMODE_ROAMB                     = &h000000010
    
    %LINESPECIALINFO_NOCIRCUIT              = &h000000001
    %LINESPECIALINFO_CUSTIRREG              = &h000000002
    %LINESPECIALINFO_REORDER                = &h000000004
    %LINESPECIALINFO_UNKNOWN                = &h000000008
    %LINESPECIALINFO_UNAVAIL                = &h000000010
    
    %LINETERMDEV_PHONE                      = &h000000001
    %LINETERMDEV_HEADSET                    = &h000000002
    %LINETERMDEV_SPEAKER                    = &h000000004
    
    %LINETERMMODE_BUTTONS                   = &h000000001
    %LINETERMMODE_LAMPS                     = &h000000002
    %LINETERMMODE_DISPLAY                   = &h000000004
    %LINETERMMODE_RINGER                    = &h000000008
    %LINETERMMODE_HOOKSWITCH                = &h000000010
    %LINETERMMODE_MEDIATOLINE               = &h000000020
    %LINETERMMODE_MEDIAFROMLINE             = &h000000040
    %LINETERMMODE_MEDIABIDIRECT             = &h000000080
    
    %LINETERMSHARING_PRIVATE                = &h000000001
    %LINETERMSHARING_SHAREDEXCL             = &h000000002
    %LINETERMSHARING_SHAREDCONF             = &h000000004
    
    %LINETOLLLISTOPTION_ADD                 = &h000000001
    %LINETOLLLISTOPTION_REMOVE              = &h000000002
    
    %LINETONEMODE_CUSTOM                    = &h000000001
    %LINETONEMODE_RINGBACK                  = &h000000002
    %LINETONEMODE_BUSY                      = &h000000004
    %LINETONEMODE_BEEP                      = &h000000008
    %LINETONEMODE_BILLING                   = &h000000010
    
    %LINETRANSFERMODE_TRANSFER              = &h000000001
    %LINETRANSFERMODE_CONFERENCE            = &h000000002
    
    %LINETRANSLATEOPTION_CARDOVERRIDE       = &h000000001
    %LINETRANSLATEOPTION_CANCELCALLWAITING  = &h000000002       'TAPI v1.4
    %LINETRANSLATEOPTION_FORCELOCAL         = &h000000004       'TAPI v1.4
    %LINETRANSLATEOPTION_FORCELD            = &h000000008       'TAPI v1.4
                                        
    'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcetapi/html/cereflinetranslateresultconstants.asp
    %LINETRANSLATERESULT_CANONICAL          = &h000000001
    %LINETRANSLATERESULT_INTERNATIONAL      = &h000000002
    %LINETRANSLATERESULT_LONGDISTANCE       = &h000000004
    %LINETRANSLATERESULT_LOCAL              = &h000000008
    %LINETRANSLATERESULT_INTOLLLIST         = &h000000010
    %LINETRANSLATERESULT_NOTINTOLLLIST      = &h000000020
    %LINETRANSLATERESULT_DIALBILLING        = &h000000040
    %LINETRANSLATERESULT_DIALQUIET          = &h000000080
    %LINETRANSLATERESULT_DIALDIALTONE       = &h000000100
    %LINETRANSLATERESULT_DIALPROMPT         = &h000000200
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %LINETRANSLATERESULT_VOICEDETECT      = &h000000400       'TAPI v2.0
    #EndIf
    
    %PHONEBUTTONFUNCTION_UNKNOWN            = &h000000000
    %PHONEBUTTONFUNCTION_CONFERENCE         = &h000000001
    %PHONEBUTTONFUNCTION_TRANSFER           = &h000000002
    %PHONEBUTTONFUNCTION_DROP               = &h000000003
    %PHONEBUTTONFUNCTION_HOLD               = &h000000004
    %PHONEBUTTONFUNCTION_RECALL             = &h000000005
    %PHONEBUTTONFUNCTION_DISCONNECT         = &h000000006
    %PHONEBUTTONFUNCTION_CONNECT            = &h000000007
    %PHONEBUTTONFUNCTION_MSGWAITON          = &h000000008
    %PHONEBUTTONFUNCTION_MSGWAITOFF         = &h000000009
    %PHONEBUTTONFUNCTION_SELECTRING         = &h00000000A
    %PHONEBUTTONFUNCTION_ABBREVDIAL         = &h00000000B
    %PHONEBUTTONFUNCTION_FORWARD            = &h00000000C
    %PHONEBUTTONFUNCTION_PICKUP             = &h00000000D
    %PHONEBUTTONFUNCTION_RINGAGAIN          = &h00000000E
    %PHONEBUTTONFUNCTION_PARK               = &h00000000F
    %PHONEBUTTONFUNCTION_REJECT             = &h000000010
    %PHONEBUTTONFUNCTION_REDIRECT           = &h000000011
    %PHONEBUTTONFUNCTION_MUTE               = &h000000012
    %PHONEBUTTONFUNCTION_VOLUMEUP           = &h000000013
    %PHONEBUTTONFUNCTION_VOLUMEDOWN         = &h000000014
    %PHONEBUTTONFUNCTION_SPEAKERON          = &h000000015
    %PHONEBUTTONFUNCTION_SPEAKEROFF         = &h000000016
    %PHONEBUTTONFUNCTION_FLASH              = &h000000017
    %PHONEBUTTONFUNCTION_DATAON             = &h000000018
    %PHONEBUTTONFUNCTION_DATAOFF            = &h000000019
    %PHONEBUTTONFUNCTION_DONOTDISTURB       = &h00000001A
    %PHONEBUTTONFUNCTION_INTERCOM           = &h00000001B
    %PHONEBUTTONFUNCTION_BRIDGEDAPP         = &h00000001C
    %PHONEBUTTONFUNCTION_BUSY               = &h00000001D
    %PHONEBUTTONFUNCTION_CALLAPP            = &h00000001E
    %PHONEBUTTONFUNCTION_DATETIME           = &h00000001F
    %PHONEBUTTONFUNCTION_DIRECTORY          = &h000000020
    %PHONEBUTTONFUNCTION_COVER              = &h000000021
    %PHONEBUTTONFUNCTION_CALLID             = &h000000022
    %PHONEBUTTONFUNCTION_LASTNUM            = &h000000023
    %PHONEBUTTONFUNCTION_NIGHTSRV           = &h000000024
    %PHONEBUTTONFUNCTION_SENDCALLS          = &h000000025
    %PHONEBUTTONFUNCTION_MSGINDICATOR       = &h000000026
    %PHONEBUTTONFUNCTION_REPDIAL            = &h000000027
    %PHONEBUTTONFUNCTION_SETREPDIAL         = &h000000028
    %PHONEBUTTONFUNCTION_SYSTEMSPEED        = &h000000029
    %PHONEBUTTONFUNCTION_STATIONSPEED       = &h00000002A
    %PHONEBUTTONFUNCTION_CAMPON             = &h00000002B
    %PHONEBUTTONFUNCTION_SAVEREPEAT         = &h00000002C
    %PHONEBUTTONFUNCTION_QUEUECALL          = &h00000002D
    %PHONEBUTTONFUNCTION_NONE               = &h00000002E
    
    %PHONEBUTTONMODE_DUMMY                  = &h000000001
    %PHONEBUTTONMODE_CALL                   = &h000000002
    %PHONEBUTTONMODE_FEATURE                = &h000000004
    %PHONEBUTTONMODE_KEYPAD                 = &h000000008
    %PHONEBUTTONMODE_LOCAL                  = &h000000010
    %PHONEBUTTONMODE_DISPLAY                = &h000000020
    
    %PHONEBUTTONSTATE_UP                    = &h000000001
    %PHONEBUTTONSTATE_DOWN                  = &h000000002
    %PHONEBUTTONSTATE_UNKNOWN               = &h000000004       'TAPI v1.4
    %PHONEBUTTONSTATE_UNAVAIL               = &h000000008       'TAPI v1.4
    
    %PHONEERR_ALLOCATED                     = &h090000001
    %PHONEERR_BADDEVICEID                   = &h090000002
    %PHONEERR_INCOMPATIBLEAPIVERSION        = &h090000003
    %PHONEERR_INCOMPATIBLEEXTVERSION        = &h090000004
    %PHONEERR_INIFILECORRUPT                = &h090000005
    %PHONEERR_INUSE                         = &h090000006
    %PHONEERR_INVALAPPHANDLE                = &h090000007
    %PHONEERR_INVALAPPNAME                  = &h090000008
    %PHONEERR_INVALBUTTONLAMPID             = &h090000009
    %PHONEERR_INVALBUTTONMODE               = &h09000000A
    %PHONEERR_INVALBUTTONSTATE              = &h09000000B
    %PHONEERR_INVALDATAID                   = &h09000000C
    %PHONEERR_INVALDEVICECLASS              = &h09000000D
    %PHONEERR_INVALEXTVERSION               = &h09000000E
    %PHONEERR_INVALHOOKSWITCHDEV            = &h09000000F
    %PHONEERR_INVALHOOKSWITCHMODE           = &h090000010
    %PHONEERR_INVALLAMPMODE                 = &h090000011
    %PHONEERR_INVALPARAM                    = &h090000012
    %PHONEERR_INVALPHONEHANDLE              = &h090000013
    %PHONEERR_INVALPHONESTATE               = &h090000014
    %PHONEERR_INVALPOINTER                  = &h090000015
    %PHONEERR_INVALPRIVILEGE                = &h090000016
    %PHONEERR_INVALRINGMODE                 = &h090000017
    %PHONEERR_NODEVICE                      = &h090000018
    %PHONEERR_NODRIVER                      = &h090000019
    %PHONEERR_NOMEM                         = &h09000001A
    %PHONEERR_NOTOWNER                      = &h09000001B
    %PHONEERR_OPERATIONFAILED               = &h09000001C
    %PHONEERR_OPERATIONUNAVAIL              = &h09000001D
    %PHONEERR_RESOURCEUNAVAIL               = &h09000001F
    %PHONEERR_REQUESTOVERRUN                = &h090000020
    %PHONEERR_STRUCTURETOOSMALL             = &h090000021
    %PHONEERR_UNINITIALIZED                 = &h090000022
    %PHONEERR_REINIT                        = &h090000023
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %PHONEFEATURE_GETBUTTONINFO           = &h000000001       'TAPI v2.0
      %PHONEFEATURE_GETDATA                 = &h000000002       'TAPI v2.0
      %PHONEFEATURE_GETDISPLAY              = &h000000004       'TAPI v2.0
      %PHONEFEATURE_GETGAINHANDSET          = &h000000008       'TAPI v2.0
      %PHONEFEATURE_GETGAINSPEAKER          = &h000000010       'TAPI v2.0
      %PHONEFEATURE_GETGAINHEADSET          = &h000000020       'TAPI v2.0
      %PHONEFEATURE_GETHOOKSWITCHHANDSET    = &h000000040       'TAPI v2.0
      %PHONEFEATURE_GETHOOKSWITCHSPEAKER    = &h000000080       'TAPI v2.0
      %PHONEFEATURE_GETHOOKSWITCHHEADSET    = &h000000100       'TAPI v2.0
      %PHONEFEATURE_GETLAMP                 = &h000000200       'TAPI v2.0
      %PHONEFEATURE_GETRING                 = &h000000400       'TAPI v2.0
      %PHONEFEATURE_GETVOLUMEHANDSET        = &h000000800       'TAPI v2.0
      %PHONEFEATURE_GETVOLUMESPEAKER        = &h000001000       'TAPI v2.0
      %PHONEFEATURE_GETVOLUMEHEADSET        = &h000002000       'TAPI v2.0
      %PHONEFEATURE_SETBUTTONINFO           = &h000004000       'TAPI v2.0
      %PHONEFEATURE_SETDATA                 = &h000008000       'TAPI v2.0
      %PHONEFEATURE_SETDISPLAY              = &h000010000       'TAPI v2.0
      %PHONEFEATURE_SETGAINHANDSET          = &h000020000       'TAPI v2.0
      %PHONEFEATURE_SETGAINSPEAKER          = &h000040000       'TAPI v2.0
      %PHONEFEATURE_SETGAINHEADSET          = &h000080000       'TAPI v2.0
      %PHONEFEATURE_SETHOOKSWITCHHANDSET    = &h000100000       'TAPI v2.0
      %PHONEFEATURE_SETHOOKSWITCHSPEAKER    = &h000200000       'TAPI v2.0
      %PHONEFEATURE_SETHOOKSWITCHHEADSET    = &h000400000       'TAPI v2.0
      %PHONEFEATURE_SETLAMP                 = &h000800000       'TAPI v2.0
      %PHONEFEATURE_SETRING                 = &h001000000       'TAPI v2.0
      %PHONEFEATURE_SETVOLUMEHANDSET        = &h002000000       'TAPI v2.0
      %PHONEFEATURE_SETVOLUMESPEAKER        = &h004000000       'TAPI v2.0
      %PHONEFEATURE_SETVOLUMEHEADSET        = &h008000000       'TAPI v2.0
    #EndIf
    
    %PHONEHOOKSWITCHDEV_HANDSET             = &h000000001
    %PHONEHOOKSWITCHDEV_SPEAKER             = &h000000002
    %PHONEHOOKSWITCHDEV_HEADSET             = &h000000004
    
    %PHONEHOOKSWITCHMODE_ONHOOK             = &h000000001
    %PHONEHOOKSWITCHMODE_MIC                = &h000000002
    %PHONEHOOKSWITCHMODE_SPEAKER            = &h000000004
    %PHONEHOOKSWITCHMODE_MICSPEAKER         = &h000000008
    %PHONEHOOKSWITCHMODE_UNKNOWN            = &h000000010
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      %PHONEINITIALIZEEXOPTION_USEHIDDENWINDOW   = &h000000001  'TAPI v2.0
      %PHONEINITIALIZEEXOPTION_USEEVENT          = &h000000002  'TAPI v2.0
      %PHONEINITIALIZEEXOPTION_USECOMPLETIONPORT = &h000000003  'TAPI v2.0
    #EndIf
    
    %PHONELAMPMODE_DUMMY                    = &h000000001
    %PHONELAMPMODE_OFF                      = &h000000002
    %PHONELAMPMODE_STEADY                   = &h000000004
    %PHONELAMPMODE_WINK                     = &h000000008
    %PHONELAMPMODE_FLASH                    = &h000000010
    %PHONELAMPMODE_FLUTTER                  = &h000000020
    %PHONELAMPMODE_BROKENFLUTTER            = &h000000040
    %PHONELAMPMODE_UNKNOWN                  = &h000000080
    
    %PHONEPRIVILEGE_MONITOR                 = &h000000001
    %PHONEPRIVILEGE_OWNER                   = &h000000002
    
    %PHONESTATE_OTHER                       = &h000000001
    %PHONESTATE_CONNECTED                   = &h000000002
    %PHONESTATE_DISCONNECTED                = &h000000004
    %PHONESTATE_OWNER                       = &h000000008
    %PHONESTATE_MONITORS                    = &h000000010
    %PHONESTATE_DISPLAY                     = &h000000020
    %PHONESTATE_LAMP                        = &h000000040
    %PHONESTATE_RINGMODE                    = &h000000080
    %PHONESTATE_RINGVOLUME                  = &h000000100
    %PHONESTATE_HANDSETHOOKSWITCH           = &h000000200
    %PHONESTATE_HANDSETVOLUME               = &h000000400
    %PHONESTATE_HANDSETGAIN                 = &h000000800
    %PHONESTATE_SPEAKERHOOKSWITCH           = &h000001000
    %PHONESTATE_SPEAKERVOLUME               = &h000002000
    %PHONESTATE_SPEAKERGAIN                 = &h000004000
    %PHONESTATE_HEADSETHOOKSWITCH           = &h000008000
    %PHONESTATE_HEADSETVOLUME               = &h000010000
    %PHONESTATE_HEADSETGAIN                 = &h000020000
    %PHONESTATE_SUSPEND                     = &h000040000
    %PHONESTATE_RESUME                      = &h000080000
    %PHONESTATE_DEVSPECIFIC                 = &h000100000
    %PHONESTATE_REINIT                      = &h000200000
    %PHONESTATE_CAPSCHANGE                  = &h000400000       'TAPI v1.4
    %PHONESTATE_REMOVED                     = &h000800000       'TAPI v1.4
    
    %PHONESTATUSFLAGS_CONNECTED             = &h000000001
    %PHONESTATUSFLAGS_SUSPENDED             = &h000000002
    
    %STRINGFORMAT_ASCII                     = &h000000001
    %STRINGFORMAT_DBCS                      = &h000000002
    %STRINGFORMAT_UNICODE                   = &h000000003
    %STRINGFORMAT_BINARY                    = &h000000004
    
    %TAPI_REPLY                             = %WM_USER + 99
    
    %TAPIERR_CONNECTED                      =  0&
    %TAPIERR_DROPPED                        = -1&
    %TAPIERR_NOREQUESTRECIPIENT             = -2&
    %TAPIERR_REQUESTQUEUEFULL               = -3&
    %TAPIERR_INVALDESTADDRESS               = -4&
    %TAPIERR_INVALWINDOWHANDLE              = -5&
    %TAPIERR_INVALDEVICECLASS               = -6&
    %TAPIERR_INVALDEVICEID                  = -7&
    %TAPIERR_DEVICECLASSUNAVAIL             = -8&
    %TAPIERR_DEVICEIDUNAVAIL                = -9&
    %TAPIERR_DEVICEINUSE                    = -10&
    %TAPIERR_DESTBUSY                       = -11&
    %TAPIERR_DESTNOANSWER                   = -12&
    %TAPIERR_DESTUNAVAIL                    = -13&
    %TAPIERR_UNKNOWNWINHANDLE               = -14&
    %TAPIERR_UNKNOWNREQUESTID               = -15&
    %TAPIERR_REQUESTFAILED                  = -16&
    %TAPIERR_REQUESTCANCELLED               = -17&
    %TAPIERR_INVALPOINTER                   = -18&
    
    %TAPIMAXDESTADDRESSSIZE                 = 80&
    %TAPIMAXAPPNAMESIZE                     = 40&
    %TAPIMAXCALLEDPARTYSIZE                 = 40&
    %TAPIMAXCOMMENTSIZE                     = 80&
    %TAPIMAXDEVICECLASSSIZE                 = 40&
    %TAPIMAXDEVICEIDSIZE                    = 40&
    
    '------------------------------------------------------------------------------
    ' Type definitions
    '------------------------------------------------------------------------------
    Type LineAddressCaps
      dwTotalSize                       As Dword
      dwNeededSize                      As Dword
      dwUsedSize                        As Dword
      dwLineDeviceID                    As Dword
      dwAddressSize                     As Dword
      dwAddressOffset                   As Dword
      dwDevSpecificSize                 As Dword
      dwDevSpecificOffset               As Dword
      dwAddressSharing                  As Dword
      dwAddressStates                   As Dword
      dwCallInfoStates                  As Dword
      dwCallerIDFlags                   As Dword
      dwCalledIDFlags                   As Dword
      dwConnectedIDFlags                As Dword
      dwRedirectionIDFlags              As Dword
      dwRedirectingIDFlags              As Dword
      dwCallStates                      As Dword
      dwDialToneModes                   As Dword
      dwBusyModes                       As Dword
      dwSpecialInfo                     As Dword
      dwDisconnectModes                 As Dword
      dwMaxNumActiveCalls               As Dword
      dwMaxNumOnHoldCalls               As Dword
      dwMaxNumOnHoldPendingCalls        As Dword
      dwMaxNumConference                As Dword
      dwMaxNumTransConf                 As Dword
      dwAddrCapFlags                    As Dword
      dwCallFeatures                    As Dword
      dwRemoveFromConfCaps              As Dword
      dwRemoveFromConfState             As Dword
      dwTransferModes                   As Dword
      dwParkModes                       As Dword
      dwForwardModes                    As Dword
      dwMaxForwardEntries               As Dword
      dwMaxSpecificEntries              As Dword
      dwMinFwdNumRings                  As Dword
      dwMaxFwdNumRings                  As Dword
      dwMaxCallCompletions              As Dword
      dwCallCompletionConds             As Dword
      dwCallCompletionModes             As Dword
      dwNumCompletionMessages           As Dword
      dwCompletionMsgTextEntrySize      As Dword
      dwCompletionMsgTextSize           As Dword
      dwCompletionMsgTextOffset         As Dword
      dwAddressFeatures                 As Dword                'TAPI v1.4
    #If %TAPI_CURRENT_VERSION >= &h000020000
      dwPredictiveAutoTransferStates    As Dword                'TAPI v2.0
      dwNumCallTreatments               As Dword                'TAPI v2.0
      dwCallTreatmentListSize           As Dword                'TAPI v2.0
      dwCallTreatmentListOffset         As Dword                'TAPI v2.0
      dwDeviceClassesSize               As Dword                'TAPI v2.0
      dwDeviceClassesOffset             As Dword                'TAPI v2.0
      dwMaxCallDataSize                 As Dword                'TAPI v2.0
      dwCallFeatures2                   As Dword                'TAPI v2.0
      dwMaxNoAnswerTimeout              As Dword                'TAPI v2.0
      dwConnectedModes                  As Dword                'TAPI v2.0
      dwOfferingModes                   As Dword                'TAPI v2.0
      dwAvailableMediaModes             As Dword                'TAPI v2.0
    #EndIf
    End Type
    
    Type LineAddressStatus
      dwTotalSize                       As Dword
      dwNeededSize                      As Dword
      dwUsedSize                        As Dword
      dwNumInUse                        As Dword
      dwNumActiveCalls                  As Dword
      dwNumOnHoldCalls                  As Dword
      dwNumOnHoldPendCalls              As Dword
      dwAddressFeatures                 As Dword
      dwNumRingsNoAnswer                As Dword
      dwForwardNumEntries               As Dword
      dwForwardSize                     As Dword
      dwForwardOffset                   As Dword
      dwTerminalModesSize               As Dword
      dwTerminalModesOffset             As Dword
      dwDevSpecificSize                 As Dword
      dwDevSpecificOffset               As Dword
    End Type
    
    #If %TAPI_CURRENT_VERSION >= &h000020000
      Type LineAgentActivityEntry
        dwID                              As Dword              'TAPI v2.0
        dwNameSize                        As Dword              'TAPI v2.0
        dwNameOffset                      As Dword              'TAPI v2.0
      End Type
    
      Type LineAgentActivityList
        dwTotalSize                       As Dword              'TAPI v2.0
        dwNeededSize                      As Dword              'TAPI v2.0
        dwUsedSize                        As Dword              'TAPI v2.0
        dwNumEntries                      As Dword              'TAPI v2.0
        dwListSize                        As Dword              'TAPI v2.0
        dwListOffset                      As Dword              'TAPI v2.0
      End Type
    
      Type LineAgentCaps
        dwTotalSize                       As Dword              'TAPI v2.0
        dwNeededSize                      As Dword              'TAPI v2.0
        dwUsedSize                        As Dword              'TAPI v2.0
        dwAgentHandlerInfoSize            As Dword              'TAPI v2.0
        dwAgentHandlerInfoOffset          As Dword              'TAPI v2.0
        dwCapsVersion                     As Dword              'TAPI v2.0
        dwFeatures                        As Dword              'TAPI v2.0
        dwStates                          As Dword              'TAPI v2.0
        dwNextStates                      As Dword              'TAPI v2.0
        dwMaxNumGroupEntries              As Dword              'TAPI v2.0
        dwAgentStatusMessages             As Dword              'TAPI v2.0
        dwNumAgentExtensionIDs            As Dword              'TAPI v2.0
        dwAgentExtensionIDListSize        As Dword              'TAPI v2.0
        dwAgentExtensionIDListOffset      As Dword              'TAPI v2.0
      End Type
    
      Type GroupID
        dwGroupID1                        As Dword              'TAPI v2.0
        dwGroupID2                        As Dword              'TAPI v2.0
        dwGroupID3                        As Dword              'TAPI v2.0
        dwGroupID4                        As Dword              'TAPI v2.0
      End Type
    
      Type LineAgentGroupEntry
        dwGroupID1                        As Dword              'TAPI v2.0
        dwGroupID2                        As Dword              'TAPI v2.0
        dwGroupID3                        As Dword              'TAPI v2.0
        dwGroupID4                        As Dword              'TAPI v2.0
        dwNameSize                        As Dword              'TAPI v2.0
        dwNameOffset                      As Dword              'TAPI v2.0
      End Type
    
      Type LineAgentGroupList
        dwTotalSize                       As Dword              'TAPI v2.0
        dwNeededSize                      As Dword              'TAPI v2.0
        dwUsedSize                        As Dword              'TAPI v2.0
        dwNumEntries                      As Dword              'TAPI v2.0
        dwListSize                        As Dword              'TAPI v2.0
        dwListOffset                      As Dword              'TAPI v2.0
      End Type
    
      Type LineAgentStatus
        dwTotalSize                       As Dword              'TAPI v2.0
        dwNeededSize                      As Dword              'TAPI v2.0
        dwUsedSize                        As Dword              'TAPI v2.0
        dwNumEntries                      As Dword              'TAPI v2.0
        dwGroupListSize                   As Dword              'TAPI v2.0
        dwGroupListOffset                 As Dword              'TAPI v2.0
        dwState                           As Dword              'TAPI v2.0
        dwNextState                       As Dword              'TAPI v2.0
        dwActivityID                      As Dword              'TAPI v2.0
        dwActivitySize                    As Dword              'TAPI v2.0
        dwActivityOffset                  As Dword              'TAPI v2.0
        dwAgentFeatures                   As Dword              'TAPI v2.0
        dwValidStates                     As Dword              'TAPI v2.0
        dwValidNextStates                 As Dword              'TAPI v2.0
      End Type
    
      Type LineAppInfo
        dwMachineNameSize                 As Dword              'TAPI v2.0
        dwMachineNameOffset               As Dword              'TAPI v2.0
        dwUserNameSize                    As Dword              'TAPI v2.0
        dwUserNameOffset                  As Dword              'TAPI v2.0
        dwModuleFilenameSize              As Dword              'TAPI v2.0
        dwModuleFilenameOffset            As Dword              'TAPI v2.0
        dwFriendlyNameSize                As Dword              'TAPI v2.0
        dwFriendlyNameOffset              As Dword              'TAPI v2.0
        dwMediaModes                      As Dword              'TAPI v2.0
        dwAddressID                       As Dword              'TAPI v2.0
      End Type
    #EndIf
    
    Type LineDialParams
      dwDialPause                         As Dword
      dwDialSpeed                         As Dword
      dwDigitDuration                     As Dword
      dwWaitForDialtone                   As Dword
    End Type
    
    Type LineCallInfo
      dwTotalSize                         As Dword
      dwNeededSize                        As Dword
      dwUsedSize                          As Dword
      hLine                               As Dword  'HLINE(?)
      dwLineDeviceID                      As Dword
      dwAddressID                         As Dword
      dwBearerMode                        As Dword
      dwRate                              As Dword
      dwMediaMode                         As Dword
      dwAppSpecific                       As Dword
      dwCallID                            As Dword
      dwRelatedCallID                     As Dword
      dwCallParamFlags                    As Dword
      dwCallStates                        As Dword
      dwMonitorDigitModes                 As Dword
      dwMonitorMediaModes                 As Dword
      DialParams                          As LINEDIALPARAMS
      dwOrigin                            As Dword
      dwReason                            As Dword
      dwCompletionID                      As Dword
      dwNumOwners                         As Dword
      dwNumMonitors                       As Dword
      dwCountryCode                       As Dword
      dwTrunk                             As Dword
      dwCallerIDFlags                     As Dword
      dwCallerIDSize                      As Dword
      dwCallerIDOffset                    As Dword
      dwCallerIDNameSize                  As Dword
      dwCallerIDNameOffset                As Dword
      dwCalledIDFlags                     As Dword
      dwCalledIDSize                      As Dword
      dwCalledIDOffset                    As Dword
      dwCalledIDNameSize                  As Dword
      dwCalledIDNameOffset                As Dword
      dwConnectedIDFlags                  As Dword
      dwConnectedIDSize                   As Dword
      dwConnectedIDOffset                 As Dword
      dwConnectedIDNameSize               As Dword
      dwConnectedIDNameOffset             As Dword
      dwRedirectionIDFlags                As Dword
      dwRedirectionIDSize                 As Dword
      dwRedirectionIDOffset               As Dword
      dwRedirectionIDNameSize             As Dword
      dwRedirectionIDNameOffset           As Dword
      dwRedirectingIDFlags                As Dword
      dwRedirectingIDSize                 As Dword
      dwRedirectingIDOffset               As Dword
      dwRedirectingIDNameSize             As Dword
      dwRedirectingIDNameOffset           As Dword
      dwAppNameSize                       As Dword
      dwAppNameOffset                     As Dword
      dwDisplayableAddressSize            As Dword
      dwDisplayableAddressOffset          As Dword
      dwCalledPartySize                   As Dword
      dwCalledPartyOffset                 As Dword
      dwCommentSize                       As Dword
      dwCommentOffset                     As Dword
      dwDisplaySize                       As Dword
      dwDisplayOffset                     As Dword
      dwUserUserInfoSize                  As Dword
      dwUserUserInfoOffset                As Dword
      dwHighLevelCompSize                 As Dword
      dwHighLevelCompOffset               As Dword
      dwLowLevelCompSize                  As Dword
      dwLowLevelCompOffset                As Dword
      dwChargingInfoSize                  As Dword
      dwChargingInfoOffset                As Dword
      dwTerminalModesSize                 As Dword
      dwTerminalModesOffset               As Dword
      dwDevSpecificSize                   As Dword
      dwDevSpecificOffset                 As Dword
    #If %TAPI_CURRENT_VERSION >= &h000020000
      dwCallTreatment                     As Dword              'TAPI v2.0
      dwCallDataSize                      As Dword              'TAPI v2.0
      dwCallDataOffset                    As Dword              'TAPI v2.0
      dwSendingFlowspecSize               As Dword              'TAPI v2.0
      dwSendingFlowspecOffset             As Dword              'TAPI v2.0
      dwReceivingFlowspecSize             As Dword              'TAPI v2.0
      dwReceivingFlowspecOffset           As Dword              'TAPI v2.0
    #EndIf
    End Type
    
    Type LineCallList
      dwTotalSize                         As Dword
      dwNeededSize                        As Dword
      dwUsedSize                          As Dword
      dwCallsNumEntries                   As Dword
      dwCallsSize                         As Dword
      dwCallsOffset                       As Dword
    End Type
    
    Type LineCallParams                                         'Defaults:
      dwTotalSize                         As Dword              '---------
      dwBearerMode                        As Dword              'voice
      dwMinRate                           As Dword              '(3.1kHz)
      dwMaxRate                           As Dword              '(3.1kHz)
      dwMediaMode                         As Dword              'interactiveVoice
      dwCallParamFlags                    As Dword              '0
      dwAddressMode                       As Dword              'addressID
      dwAddressID                         As Dword              '(any available)
      DialParams                          As LINEDIALPARAMS     '(0, 0, 0, 0)
      dwOrigAddressSize                   As Dword              '0
      dwOrigAddressOffset                 As Dword              '
      dwDisplayableAddressSize            As Dword              '
      dwDisplayableAddressOffset          As Dword              '
      dwCalledPartySize                   As Dword              '0
      dwCalledPartyOffset                 As Dword              '
      dwCommentSize                       As Dword              '0
      dwCommentOffset                     As Dword              '
      dwUserUserInfoSize                  As Dword              '0
      dwUserUserInfoOffset                As Dword              '
      dwHighLevelCompSize                 As Dword              '0
      dwHighLevelCompOffset               As Dword              '
      dwLowLevelCompSize                  As Dword              '0
      dwLowLevelCompOffset                As Dword              '
      dwDevSpecificSize                   As Dword              '0
      dwDevSpecificOffset                 As Dword              '
    #If %TAPI_CURRENT_VERSION >= &h000020000
      dwPredictiveAutoTransferStates      As Dword              'TAPI v2.0
      dwTargetAddressSize                 As Dword              'TAPI v2.0
      dwTargetAddressOffset               As Dword              'TAPI v2.0
      dwSendingFlowspecSize               As Dword              'TAPI v2.0
      dwSendingFlowspecOffset             As Dword              'TAPI v2.0
      dwReceivingFlowspecSize             As Dword              'TAPI v2.0
      dwReceivingFlowspecOffset           As Dword              'TAPI v2.0
      dwDeviceClassSize                   As Dword              'TAPI v2.0
      dwDeviceClassOffset                 As Dword              'TAPI v2.0
      dwDeviceConfigSize                  As Dword              'TAPI v2.0
      dwDeviceConfigOffset                As Dword              'TAPI v2.0
      dwCallDataSize                      As Dword              'TAPI v2.0
      dwCallDataOffset                    As Dword              'TAPI v2.0
      dwNoAnswerTimeout                   As Dword              'TAPI v2.0
      dwCallingPartyIDSize                As Dword              'TAPI v2.0
      dwCallingPartyIDOffset              As Dword              'TAPI v2.0
    #EndIf
    End Type
    
    Type LineCallStatus
      dwTotalSize                         As Dword
      dwNeededSize                        As Dword
      dwUsedSize                          As Dword
      dwCallState                         As Dword
      dwCallStateMode                     As Dword
      dwCallPrivilege                     As Dword
      dwCallFeatures                      As Dword
      dwDevSpecificSize                   As Dword
      dwDevSpecificOffset                 As Dword
    #If %TAPI_CURRENT_VERSION >= &h00020000
      dwCallFeatures2                     As Dword              'TAPI v2.0
      tStateEntryTime                     As SYSTEMTIME         'TAPI v2.0
    #EndIf
    End Type
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Type LineCallTreatmentEntry
      dwCallTreatmentID                   As Dword              'TAPI v2.0
      dwCallTreatmentNameSize             As Dword              'TAPI v2.0
      dwCallTreatmentNameOffset           As Dword              'TAPI v2.0
    End Type
    #EndIf
    
    Type LineCardEntry
      dwPermanentCardID                   As Dword
      dwCardNameSize                      As Dword
      dwCardNameOffset                    As Dword
      dwCardNumberDigits                  As Dword              'TAPI v1.4
      dwSameAreaRuleSize                  As Dword              'TAPI v1.4
      dwSameAreaRuleOffset                As Dword              'TAPI v1.4
      dwLongDistanceRuleSize              As Dword              'TAPI v1.4
      dwLongDistanceRuleOffset            As Dword              'TAPI v1.4
      dwInternationalRuleSize             As Dword              'TAPI v1.4
      dwInternationalRuleOffset           As Dword              'TAPI v1.4
      dwOptions                           As Dword              'TAPI v1.4
    End Type
    
    Type LineCountryEntry
      dwCountryID                         As Dword              'TAPI v1.4
      dwCountryCode                       As Dword              'TAPI v1.4
      dwNextCountryID                     As Dword              'TAPI v1.4
      dwCountryNameSize                   As Dword              'TAPI v1.4
      dwCountryNameOffset                 As Dword              'TAPI v1.4
      dwSameAreaRuleSize                  As Dword              'TAPI v1.4
      dwSameAreaRuleOffset                As Dword              'TAPI v1.4
      dwLongDistanceRuleSize              As Dword              'TAPI v1.4
      dwLongDistanceRuleOffset            As Dword              'TAPI v1.4
      dwInternationalRuleSize             As Dword              'TAPI v1.4
      dwInternationalRuleOffset           As Dword              'TAPI v1.4
    End Type
    
    Type LineCountryList
      dwTotalSize                         As Dword              'TAPI v1.4
      dwNeededSize                        As Dword              'TAPI v1.4
      dwUsedSize                          As Dword              'TAPI v1.4
      dwNumCountries                      As Dword              'TAPI v1.4
      dwCountryListSize                   As Dword              'TAPI v1.4
      dwCountryListOffset                 As Dword              'TAPI v1.4
    End Type
    
    Type LineDevCaps
      dwTotalSize                         As Dword
      dwNeededSize                        As Dword
      dwUsedSize                          As Dword
      dwProviderInfoSize                  As Dword
      dwProviderInfoOffset                As Dword
      dwSwitchInfoSize                    As Dword
      dwSwitchInfoOffset                  As Dword
      dwPermanentLineID                   As Dword
      dwLineNameSize                      As Dword
      dwLineNameOffset                    As Dword
      dwStringFormat                      As Dword
      dwAddressModes                      As Dword
      dwNumAddresses                      As Dword
      dwBearerModes                       As Dword
      dwMaxRate                           As Dword
      dwMediaModes                        As Dword
      dwGenerateToneModes                 As Dword
      dwGenerateToneMaxNumFreq            As Dword
      dwGenerateDigitModes                As Dword
      dwMonitorToneMaxNumFreq             As Dword
      dwMonitorToneMaxNumEntries          As Dword
      dwMonitorDigitModes                 As Dword
      dwGatherDigitsMinTimeout            As Dword
      dwGatherDigitsMaxTimeout            As Dword
      dwMedCtlDigitMaxListSize            As Dword
      dwMedCtlMediaMaxListSize            As Dword
      dwMedCtlToneMaxListSize             As Dword
      dwMedCtlCallStateMaxListSize        As Dword
      dwDevCapFlags                       As Dword
      dwMaxNumActiveCalls                 As Dword
      dwAnswerMode                        As Dword
      dwRingModes                         As Dword
      dwLineStates                        As Dword
      dwUUIAcceptSize                     As Dword
      dwUUIAnswerSize                     As Dword
      dwUUIMakeCallSize                   As Dword
      dwUUIDropSize                       As Dword
      dwUUISendUserUserInfoSize           As Dword
      dwUUICallInfoSize                   As Dword
      MinDialParams                       As LINEDIALPARAMS
      MaxDialParams                       As LINEDIALPARAMS
      DefaultDialParams                   As LINEDIALPARAMS
      dwNumTerminals                      As Dword
      dwTerminalCapsSize                  As Dword
      dwTerminalCapsOffset                As Dword
      dwTerminalTextEntrySize             As Dword
      dwTerminalTextSize                  As Dword
      dwTerminalTextOffset                As Dword
      dwDevSpecificSize                   As Dword
      dwDevSpecificOffset                 As Dword
      dwLineFeatures                      As Dword              'TAPI v1.4
    #If %TAPI_CURRENT_VERSION >= &h00020000
      dwSettableDevStatus                 AS DWORD              'TAPI >= v2.0
      dwDeviceClassesSize                 AS DWORD              'TAPI >= v2.0
      dwDeviceClassesOffset               As Dword              'TAPI >= v2.0
    #EndIf
    End Type
    
    Type LineDevStatus
      dwTotalSize                         As Dword
      dwNeededSize                        As Dword
      dwUsedSize                          As Dword
      dwNumOpens                          As Dword
      dwOpenMediaModes                    As Dword
      dwNumActiveCalls                    As Dword
      dwNumOnHoldCalls                    As Dword
      dwNumOnHoldPendCalls                As Dword
      dwLineFeatures                      As Dword
      dwNumCallCompletions                As Dword
      dwRingMode                          As Dword
      dwSignalLevel                       As Dword
      dwBatteryLevel                      As Dword
      dwRoamMode                          As Dword
      dwDevStatusFlags                    As Dword
      dwTerminalModesSize                 As Dword
      dwTerminalModesOffset               As Dword
      dwDevSpecificSize                   As Dword
      dwDevSpecificOffset                 As Dword
    #If %TAPI_CURRENT_VERSION >= &h00020000
      dwAvailableMediaModes               As Dword              'TAPI v2.0
      dwAppInfoSize                       As Dword              'TAPI v2.0
      dwAppInfoOffset                     As Dword              'TAPI v2.0
    #EndIf
    End Type
    
    Type LineExtensionID
      dwExtensionID0                      As Dword
      dwExtensionID1                      As Dword
      dwExtensionID2                      As Dword
      dwExtensionID3                      As Dword
    End Type
    
    Type LineForward_type
      dwForwardMode                       As Dword
      dwCallerAddressSize                 As Dword
      dwCallerAddressOffset               As Dword
      dwDestCountryCode                   As Dword
      dwDestAddressSize                   As Dword
      dwDestAddressOffset                 As Dword
    End Type
    
    Type LineForwardList
      dwTotalSize                         As Dword
      dwNumEntries                        As Dword
      ForwardList(0)                      As LINEFORWARD_TYPE
    End Type
    
    Type LineGenTone
      dwFrequency                         As Dword
      dwCadenceOn                         As Dword
      dwCadenceOff                        As Dword
      dwVolume                            As Dword
    End Type
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    UNION Hndls
      hEvent                            As Dword
      hCompletionPort                   As Dword
    End Union
    
    Type LineInitializeExParams
      dwTotalSize                         As Dword              'TAPI v2.0
      dwNeededSize                        As Dword              'TAPI v2.0
      dwUsedSize                          As Dword              'TAPI v2.0
      dwOptions                           As Dword              'TAPI v2.0
      uHandles                            As Hndls
      dwCompletionKey                     As Dword              'TAPI v2.0
    End Type
    #EndIf
    
    Type LineLocationEntry
      dwPermanentLocationID               As Dword
      dwLocationNameSize                  As Dword
      dwLocationNameOffset                As Dword
      dwCountryCode                       As Dword
      dwCityCodeSize                      As Dword
      dwCityCodeOffset                    As Dword
      dwPreferredCardID                   As Dword
      dwLocalAccessCodeSize               As Dword              'TAPI v1.4
      dwLocalAccessCodeOffset             As Dword              'TAPI v1.4
      dwLongDistanceAccessCodeSize        As Dword              'TAPI v1.4
      dwLongDistanceAccessCodeOffset      As Dword              'TAPI v1.4
      dwTollPrefixListSize                As Dword              'TAPI v1.4
      dwTollPrefixListOffset              As Dword              'TAPI v1.4
      dwCountryID                         As Dword              'TAPI v1.4
      dwOptions                           As Dword              'TAPI v1.4
      dwCancelCallWaitingSize             As Dword              'TAPI v1.4
      dwCancelCallWaitingOffset           As Dword              'TAPI v1.4
    End Type
    
    Type LineMediaControlCallState
      dwCallStates                        As Dword
      dwMediaControl                      As Dword
    End Type
    
    Type LineMediaControlDigit
      dwDigit                             As Dword
      dwDigitModes                        As Dword
      dwMediaControl                      As Dword
    End Type
    
    Type LineMediaControlMedia
      dwMediaModes                        As Dword
      dwDuration                          As Dword
      dwMediaControl                      As Dword
    End Type
    
    Type LineMediaControlTone
      dwAppSpecific                       As Dword
      dwDuration                          As Dword
      dwFrequency1                        As Dword
      dwFrequency2                        As Dword
      dwFrequency3                        As Dword
      dwMediaControl                      As Dword
    End Type
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Type LineMessage
      hDevice                             As Dword              'TAPI v2.0
      dwMessageID                         As Dword              'TAPI v2.0
      dwCallbackInstance                  As Dword              'TAPI v2.0
      dwParam1                            As Dword              'TAPI v2.0
      dwParam2                            As Dword              'TAPI v2.0
      dwParam3                            As Dword              'TAPI v2.0
    End Type
    #EndIf
    
    Type LineMonitorTone
      dwAppSpecific                       As Dword
      dwDuration                          As Dword
      dwFrequency1                        As Dword
      dwFrequency2                        As Dword
      dwFrequency3                        As Dword
    End Type
    
    Type LineProviderEntry
      dwPermanentProviderID               As Dword              'TAPI v1.4
      dwProviderFilenameSize              As Dword              'TAPI v1.4
      dwProviderFilenameOffset            As Dword              'TAPI v1.4
    End Type
    
    Type LineProviderList
      dwTotalSize                         As Dword              'TAPI v1.4
      dwNeededSize                        As Dword              'TAPI v1.4
      dwUsedSize                          As Dword              'TAPI v1.4
      dwNumProviders                      As Dword              'TAPI v1.4
      dwProviderListSize                  As Dword              'TAPI v1.4
      dwProviderListOffset                As Dword              'TAPI v1.4
    End Type
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
      Type SetAgentGroup_Type
        dwAddressID                       As Dword
        GroupList                         As LINEAGENTGROUPLIST
      End Type
    
      Type SetAgentState_Type
        dwAddressID                       As Dword              'TAPI v2.0
        dwAgentState                      As Dword              'TAPI v2.0
        dwNextAgentState                  As Dword              'TAPI v2.0
      End Type
    
      Type SetAgentActivity_Type
        dwAddressID                       As Dword              'TAPI v2.0
        dwActivityID                      As Dword              'TAPI v2.0
       End Type
    
      Type GetAgentCaps_Type
        dwAddressID                       As Dword              'TAPI v2.0
        AgentCaps                         As LINEAGENTCAPS      'TAPI v2.0
      End Type
    
      Type GetAgentStatus_Type
        dwAddressID                       As Dword              'TAPI v2.0
        AgentStatus                       As LINEAGENTSTATUS    'TAPI v2.0
      End Type
    
      Type AgentSpecific_Type
        dwAddressID                       As Dword              'TAPI v2.0
        dwAgentExtensionIDIndex           As Dword              'TAPI v2.0
        dwSize                            As Dword              'TAPI v2.0
        Params                            As Byte               'TAPI v2.0
      End Type
    
      Type GetAgentActivityList_Type
        dwAddressID                       As Dword              'TAPI v2.0
        ActivityList                      As LINEAGENTACTIVITYLIST 'TAPI v2.0
      End Type
    
      Type GetAgentGroupList_Type
        dwAddressID                       As Dword              'TAPI v2.0
        GroupList                         As LINEAGENTGROUPLIST 'TAPI v2.0
      End Type
    
      Union ReqType
        SetAgentGroup                     As SETAGENTGROUP_TYPE
        SetAgentState                     As SETAGENTSTATE_TYPE
        SetAgentActivity                  As SETAGENTACTIVITY_TYPE
        GetAgentCaps                      As GETAGENTCAPS_TYPE
        GetAgentStatus                    As GETAGENTSTATUS_TYPE
        AgentSpecific                     As AGENTSPECIFIC_TYPE
        GetAgentActivityList              As GETAGENTACTIVITYLIST_TYPE
      End Union
      Type LineProxyRequest
        dwSize                            As Dword              'TAPI v2.0
        dwClientMachineNameSize           As Dword              'TAPI v2.0
        dwClientMachineNameOffset         As Dword              'TAPI v2.0
        dwClientUserNameSize              As Dword              'TAPI v2.0
        dwClientUserNameOffset            As Dword              'TAPI v2.0
        dwClientAppAPIVersion             As Dword              'TAPI v2.0
        dwRequestType                     As Dword              'TAPI v2.0
        uRequest                          As ReqType
    End Type
    #EndIf
    
    Type LineReqMakeCall
      szDestAddress                       As String * %TAPIMAXDESTADDRESSSIZE
      szAppName                           As String * %TAPIMAXAPPNAMESIZE
      szCalledParty                       As String * %TAPIMAXCALLEDPARTYSIZE
      szComment                           As String * %TAPIMAXCOMMENTSIZE
    End Type
    
    Type LineReqMediaCall
      hWnd                                As Dword
      wRequestID                          As Word   '(?)
      szDeviceClass                       As String * %TAPIMAXDEVICECLASSSIZE '(?)
      ucDeviceID(%TAPIMAXDEVICEIDSIZE-1)  As Byte   '(?)
      dwSize                              As Dword
      dwSecure                            As Dword
      szDestAddress                       As String * %TAPIMAXDESTADDRESSSIZE
      szAppName                           As String * %TAPIMAXAPPNAMESIZE
      szCalledParty                       As String * %TAPIMAXCALLEDPARTYSIZE
      szComment                           As String * %TAPIMAXCOMMENTSIZE
    End Type
    
    Type LineTermCaps
      dwTermDev                           As Dword
      dwTermModes                         As Dword
      dwTermSharing                       As Dword
    End Type
    
    Type LineTranslateCaps
      dwTotalSize                         As Dword
      dwNeededSize                        As Dword
      dwUsedSize                          As Dword
      dwNumLocations                      As Dword
      dwLocationListSize                  As Dword
      dwLocationListOffset                As Dword
      dwCurrentLocationID                 As Dword
      dwNumCards                          As Dword
      dwCardListSize                      As Dword
      dwCardListOffset                    As Dword
      dwCurrentPreferredCardID            As Dword
    End Type
    
    Type LineTranslateOutput
      dwTotalSize                         As Dword
      dwNeededSize                        As Dword
      dwUsedSize                          As Dword
      dwDialableStringSize                As Dword
      dwDialableStringOffset              As Dword
      dwDisplayableStringSize             As Dword
      dwDisplayableStringOffset           As Dword
      dwCurrentCountry                    As Dword
      dwDestCountry                       As Dword
      dwTranslateResults                  As Dword
    End Type
    
    Type PhoneButtonInfo
      dwTotalSize                         As Dword
      dwNeededSize                        As Dword
      dwUsedSize                          As Dword
      dwButtonMode                        As Dword
      dwButtonFunction                    As Dword
      dwButtonTextSize                    As Dword
      dwButtonTextOffset                  As Dword
      dwDevSpecificSize                   As Dword
      dwDevSpecificOffset                 As Dword
      dwButtonState                       As Dword              'TAPI v1.4
    End Type
    
    Type PhoneCaps
      dwTotalSize                         As Dword
      dwNeededSize                        As Dword
      dwUsedSize                          As Dword
      dwProviderInfoSize                  As Dword
      dwProviderInfoOffset                As Dword
      dwPhoneInfoSize                     As Dword
      dwPhoneInfoOffset                   As Dword
      dwPermanentPhoneID                  As Dword
      dwPhoneNameSize                     As Dword
      dwPhoneNameOffset                   As Dword
      dwStringFormat                      As Dword
      dwPhoneStates                       As Dword
      dwHookSwitchDevs                    As Dword
      dwHandsetHookSwitchModes            As Dword
      dwSpeakerHookSwitchModes            As Dword
      dwHeadsetHookSwitchModes            As Dword
      dwVolumeFlags                       As Dword
      dwGainFlags                         As Dword
      dwDisplayNumRows                    As Dword
      dwDisplayNumColumns                 As Dword
      dwNumRingModes                      As Dword
      dwNumButtonLamps                    As Dword
      dwButtonModesSize                   As Dword
      dwButtonModesOffset                 As Dword
      dwButtonFunctionsSize               As Dword
      dwButtonFunctionsOffset             As Dword
      dwLampModesSize                     As Dword
      dwLampModesOffset                   As Dword
      dwNumSetData                        As Dword
      dwSetDataSize                       As Dword
      dwSetDataOffset                     As Dword
      dwNumGetData                        As Dword
      dwGetDataSize                       As Dword
      dwGetDataOffset                     As Dword
      dwDevSpecificSize                   As Dword
      dwDevSpecificOffset                 As Dword
    #If %TAPI_CURRENT_VERSION >= &h00020000
      dwDeviceClassesSize                 As Dword              'TAPI v2.0
      dwDeviceClassesOffset               As Dword              'TAPI v2.0
      dwPhoneFeatures                     As Dword              'TAPI v2.0
      dwSettableHandsetHookSwitchModes    As Dword              'TAPI v2.0
      dwSettableSpeakerHookSwitchModes    As Dword              'TAPI v2.0
      dwSettableHeadsetHookSwitchModes    As Dword              'TAPI v2.0
      dwMonitoredHandsetHookSwitchModes   As Dword              'TAPI v2.0
      dwMonitoredSpeakerHookSwitchModes   As Dword              'TAPI v2.0
      dwMonitoredHeadsetHookSwitchModes   As Dword              'TAPI v2.0
    #EndIf
    End Type
    
    Type PhoneExtensionID
      dwExtensionID0                      As Dword
      dwExtensionID1                      As Dword
      dwExtensionID2                      As Dword
      dwExtensionID3                      As Dword
    End Type
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Type PhoneInitializeExParams
      dwTotalSize                         As Dword              'TAPI v2.0
      dwNeededSize                        As Dword              'TAPI v2.0
      dwUsedSize                          As Dword              'TAPI v2.0
      dwOptions                           As Dword              'TAPI v2.0
      uHandles                            AS Hndls            'TAPI v2.0
      dwCompletionKey                     As Dword              'TAPI v2.0
    End Type
    
    Type PhoneMessage
      hDevice                             As Dword              'TAPI v2.0
      dwMessageID                         As Dword              'TAPI v2.0
      dwCallbackInstance                  As Dword              'TAPI v2.0
      dwParam1                            As Dword              'TAPI v2.0
      dwParam2                            As Dword              'TAPI v2.0
      dwParam3                            As Dword              'TAPI v2.0
    End Type
    #EndIf
    
    Type PhoneStatus
      dwTotalSize                         As Dword
      dwNeededSize                        As Dword
      dwUsedSize                          As Dword
      dwStatusFlags                       As Dword
      dwNumOwners                         As Dword
      dwNumMonitors                       As Dword
      dwRingMode                          As Dword
      dwRingVolume                        As Dword
      dwHandsetHookSwitchMode             As Dword
      dwHandsetVolume                     As Dword
      dwHandsetGain                       As Dword
      dwSpeakerHookSwitchMode             As Dword
      dwSpeakerVolume                     As Dword
      dwSpeakerGain                       As Dword
      dwHeadsetHookSwitchMode             As Dword
      dwHeadsetVolume                     As Dword
      dwHeadsetGain                       As Dword
      dwDisplaySize                       As Dword
      dwDisplayOffset                     As Dword
      dwLampModesSize                     As Dword
      dwLampModesOffset                   As Dword
      dwOwnerNameSize                     As Dword
      dwOwnerNameOffset                   As Dword
      dwDevSpecificSize                   As Dword
      dwDevSpecificOffset                 As Dword
    #If %TAPI_CURRENT_VERSION >= &h00020000
      dwPhoneFeatures                     As Dword           'TAPI v2.0
    #EndIf
    End Type
    
    Type VarString
      dwTotalSize                         As Dword
      dwNeededSize                        As Dword
      dwUsedSize                          As Dword
      dwStringFormat                      As Dword
      dwStringSize                        As Dword
      dwStringOffset                      As Dword
    End Type
    
    
    '------------------------------------------------------------------------------
    
    Declare Function LineAccept Lib "TAPI32.DLL" Alias "lineAccept"(ByVal hCall As Dword, lpsUserUserInfo As Asciiz, dwSize As Dword) As Long
    Declare Function LineAddProvider Lib "TAPI32.DLL" Alias "lineAddProviderA"(lpszProviderFileName As Asciiz, ByVal hwndOwner As Dword, lpdwPermanentProviderID As Dword) As Long
    Declare Function LineAddToConference Lib "TAPI32.DLL" Alias "lineAddToConference"(ByVal hConfCall As Dword, ByVal hConsultCall As Dword) As Long
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Declare Function LineAgentSpecific Lib "TAPI32.DLL" Alias "lineAgentSpecific"(ByVal hLine As Dword, dwAddressID As Dword, dwAgentExtensionIDIndex As Dword, lpParams As Long, dwSize As Dword) As Long
    #EndIf
    
    Declare Function lineAnswer Lib "TAPI32.DLL" Alias "lineAnswer"(ByVal hCall As Dword, lpsUserUserInfo As Asciiz,ByVal dwSize As Dword) As Long
    Declare Function lineBlindTransfer Lib "TAPI32.DLL" Alias "lineBlindTransferA"(ByVal hCall As Dword, lpszDestAddress As Asciiz, ByVal dwCountryCode As Dword) As Long
    Declare Function lineClose Lib "TAPI32.DLL" Alias "lineClose"(ByVal hLine As Dword) As Long
    Declare Function lineCompleteCall Lib "TAPI32.DLL" Alias "lineCompleteCall"(ByVal hCall As Dword, lpdwCompletionID As Dword, ByVal dwCompletionMode As Dword, ByVal dwMessageID As Dword) As Long
    Declare Function lineCompleteTransfer Lib "TAPI32.DLL" Alias "lineCompleteTransfer"(ByVal hCall As Dword, ByVal hConsultCall As Dword, lphConfCall As Dword, ByVal dwTransferMode As Dword) As Long
    Declare Function lineConfigDialog Lib "TAPI32.DLL" Alias "lineConfigDialogA"(ByVal dwDeviceID As Dword, ByVal hwndOwner As Dword, lpszDeviceClass As Asciiz) As Long
    ' Declare Function lineConfigDialogEdit Lib "TAPI32.DLL" Alias "lineConfigDialogEditA"(ByVal dwDeviceID As Dword, ByVal hwndOwner As Dword, lpszDeviceClass As Asciiz, lpDeviceConfigIn As Any, ByVal dwSize As Dword, LPVARSTRING   lpDeviceConfigOut ) As Long
    Declare Function lineConfigProvider Lib "TAPI32.DLL" Alias "lineConfigProvider"(ByVal hwndOwner As Dword, ByVal dwPermanentProviderID As Dword) As Long
    Declare Function lineDeallocateCall Lib "TAPI32.DLL" Alias "lineDeallocateCall"(ByVal hCall As Dword) As Long
    Declare Function lineDevSpecific Lib "TAPI32.DLL" Alias "lineDevSpecific"(ByVal hLine As Dword, ByVal dwAddressID As Dword, ByVal hCall As Dword, lpParams As Any, ByVal dwSize As Dword) As Long
    Declare Function lineDevSpecificFeature Lib "TAPI32.DLL" Alias "lineDevSpecificFeature"(ByVal hLine As Dword, ByVal dwFeature As Dword, lpParams As Any, ByVal dwSize As Dword) As Long
    Declare Function lineDial Lib "TAPI32.DLL" Alias "lineDialA"(ByVal hCall As Dword, lpszDestAddress As Asciiz, ByVal dwCountryCode As Dword) As Long
    DECLARE FUNCTION lineDrop LIB "TAPI32.DLL" ALIAS "lineDrop"(BYVAL hCall AS DWORD, lpsUserUserInfo AS ASCIIZ, BYVAL dwSize AS DWORD) AS LONG   
    Declare Function lineForward Lib "TAPI32.DLL" Alias "lineForwardA"(ByVal hLine As Dword, ByVal bAllAddresses As Dword, ByVal dwAddressID As Dword, LpLineForwardList As LINEFORWARDLIST,  ByVal dwNumRingsNoAnswer As Dword, _
                     lphConsultCall As Dword, LpLineCallParams As LINECALLPARAMS) As Long
    Declare Function lineGatherDigits Lib "TAPI32.DLL" Alias "lineGatherDigitsA"(ByVal hCall As Dword, ByVal dwDigitMode As Dword, lpsDigits As Asciiz, ByVal dwNumDigits As Dword, lpszTerminationDigits As Asciiz, _
                     ByVal dwFirstDigitTimeout As Dword, ByVal dwInterDigitTimeout As Dword) As Long
    Declare Function lineGenerateDigits Lib "TAPI32.DLL" Alias "lineGenerateDigitsA"(ByVal hCall As Dword, ByVal dwDigitMode As Dword, lpszDigits As Asciiz, ByVal dwDuration As Dword) As Long
    Declare Function lineGenerateTone Lib "TAPI32.DLL" Alias "lineGenerateTone"(ByVal hCall As Dword, ByVal dwToneMode As Dword, ByVal dwDuration As Dword, ByVal dwNumTones As Dword, lpLineGenerateTone As LINEGENTONE) As Long
    Declare Function lineGetAddressCaps Lib "TAPI32.DLL" Alias "lineGetAddressCapsA"(ByVal hLineApp As Dword, ByVal dwDeviceID As Dword, ByVal dwAddressID As Dword, ByVal dwAPIVersion As Dword, ByVal dwExtVersion As Dword, _
                     lpAddressCaps As LINEADDRESSCAPS) As Long
    Declare Function lineGetAddressID Lib "TAPI32.DLL" Alias "lineGetAddressIDA"(ByVal hLine As Dword, lpdwAddressID As Dword, ByVal dwAddressMode As Dword, lpsAddress As Asciiz, ByVal dwSize As Dword) As Long
    Declare Function lineGetAddressStatus Lib "TAPI32.DLL" Alias "lineGetAddressStatusA"(ByVal hLine As Dword, ByVal dwAddressID As Dword, lpAddressStatus As LINEADDRESSSTATUS ) As Long
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Declare Function lineGetAgentActivityList Lib "TAPI32.DLL" Alias "lineGetAgentActivityListA"(ByVal hLine As Dword, ByVal dwAddressID As Dword, lpAgentActivityList As LINEAGENTACTIVITYLIST) As Long
    Declare Function lineGetAgentCaps Lib "TAPI32.DLL" Alias "lineGetAgentCapsA"(ByVal hLineApp As Dword, ByVal dwDeviceID As Dword, ByVal dwAddressID As Dword, ByVal dwAppAPIVersion As Dword, lpAgentCaps As LINEAGENTCAPS ) As Long
    Declare Function lineGetAgentGroupList Lib "TAPI32.DLL" Alias "lineGetAgentGroupListA"(ByVal hLine As Dword, ByVal dwAddressID As Dword, lpAgentGroupList As LINEAGENTGROUPLIST) As Long
    Declare Function lineGetAgentStatus Lib "TAPI32.DLL" Alias "lineGetAgentStatusA"(ByVal hLine As Dword, ByVal dwAddressID As Dword, lpAgentStatus As LINEAGENTSTATUS) As Long
    #EndIf
    Declare Function lineGetAppPriority Lib "TAPI32.DLL" Alias "lineGetAppPriorityA"(lpszAppFilename As Asciiz, ByVal dwMediaMode As Dword, lpExtensionID As LINEEXTENSIONID, ByVal dwRequestMode As Dword, _
                     lpExtensionName As VARSTRING, lpdwPriority As Dword) As Long
    Declare Function lineGetCallInfo Lib "TAPI32.DLL" Alias "lineGetCallInfoA"(ByVal hCall As Dword, lpCallInfo As LINECALLINFO) As Long
    Declare Function lineGetCallStatus Lib "TAPI32.DLL" Alias "lineGetCallStatus"(ByVal hCall As Dword, lpCallStatus As LINECALLSTATUS) As Long
    Declare Function lineGetConfRelatedCalls Lib "TAPI32.DLL" Alias "lineGetConfRelatedCalls"(ByVal hCall As Dword, lpCallList As LINECALLLIST) As Long
    Declare Function lineGetCountry Lib "TAPI32.DLL" Alias "lineGetCountryA"(ByVal dwCountryID As Dword, ByVal dwAPIVersion As Dword, lpLineCountryList As LINECOUNTRYLIST) As Long
    DECLARE FUNCTION lineGetDevCaps LIB "TAPI32.DLL" ALIAS "lineGetDevCapsA"(BYVAL hLineApp AS DWORD, BYVAL dwDeviceID AS DWORD, BYVAL dwAPIVersion AS DWORD, BYVAL dwExtVersion AS DWORD, lpLineDevCaps AS LINEDEVCAPS) AS LONG 
    Declare Function lineGetDevConfig Lib "TAPI32.DLL" Alias "lineGetDevConfigA"(ByVal dwDeviceID As Dword, lpDeviceConfig As VARSTRING, lpszDeviceClass As Asciiz) As Long
    Declare Function lineGetNewCalls Lib "TAPI32.DLL" Alias "lineGetNewCalls"(ByVal hLine As Dword, ByVal dwAddressID As Dword, ByVal dwSelect As Dword, lpCallList As LINECALLLIST) As Long
    DECLARE FUNCTION lineGetIcon LIB "TAPI32.DLL" ALIAS "lineGetIconA"(BYVAL dwDeviceID AS DWORD, lpszDeviceClass AS ASCIIZ, lphIcon AS DWORD) AS LONG 
    Declare Function lineGetID Lib "TAPI32.DLL" Alias "lineGetIDA"(ByVal hLine As Dword, ByVal dwAddressID As Dword, ByVal hCall As Dword, ByVal dwSelect As Dword, lpDeviceID As VARSTRING, lpszDeviceClass As Asciiz) As Long
    Declare Function lineGetLineDevStatus Lib "TAPI32.DLL" Alias "lineGetLineDevStatusA"(ByVal hLine As Dword, lpLineDevStatus As LINEDEVSTATUS) As Long
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Declare Function lineGetMessage Lib "TAPI32.DLL" Alias "lineGetMessage"(ByVal hLineApp As Dword, lpMessage As LINEMESSAGE, ByVal dwTimeout As Dword) As Long
    #EndIf
    
    Declare Function lineGetNumRings Lib "TAPI32.DLL" Alias "lineGetNumRings"(ByVal hLine As Dword, ByVal dwAddressID As Dword, lpdwNumRings As Dword) As Long
    Declare Function lineGetProviderList Lib "TAPI32.DLL" Alias "lineGetProviderListA"(ByVal dwAPIVersion As Dword, lpProviderList As LINEPROVIDERLIST) As Long
    Declare Function lineGetRequest Lib "TAPI32.DLL" Alias "lineGetRequestA"(ByVal hLineApp As Dword, ByVal dwRequestMode As Dword, lpRequestBuffer As Any) As Long
    Declare Function lineGetStatusMessages Lib "TAPI32.DLL" Alias "lineGetStatusMessages"(ByVal hLine As Dword, lpdwLineStates As Dword, lpdwAddressStates As Dword) As Long
    Declare Function lineGetTranslateCaps Lib "TAPI32.DLL" Alias "lineGetTranslateCapsA"(ByVal hLineApp As Dword, ByVal dwAPIVersion As Dword, lpTranslateCaps As LINETRANSLATECAPS) As Long
    Declare Function lineHandoff Lib "TAPI32.DLL" Alias "lineHandoffA"(ByVal hCall As Dword, lpszFileName As Asciiz, ByVal dwMediaMode As Dword) As Long
    Declare Function lineHold Lib "TAPI32.DLL" Alias "lineHold"(ByVal hCall As Dword ) As Long
    Declare Function lineInitialize Lib "TAPI32.DLL" Alias "lineInitialize"(lphLineApp As Dword, ByVal hInstance As Dword, lpfnCallback As Dword, lpszAppName As Asciiz, lpdwNumDevs As Dword) As Long
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Declare Function lineInitializeEx Lib "TAPI32.DLL" Alias "lineInitializeExA"(lphLineApp As Dword, ByVal hInstance As Dword, lpfnCallback As Dword, lpszFriendlyAppName As Asciiz, lpdwNumDevs As Dword, _
                                                                                 lpdwAPIVersion AS DWORD, lpLineInitializeExParams AS LINEINITIALIZEEXPARAMS) AS LONG   
    #EndIf
    
    DECLARE FUNCTION lineMakeCall LIB "TAPI32.DLL" ALIAS "lineMakeCallA"(BYVAL hLine AS DWORD, lphCall AS DWORD, lpszDestAddress AS ASCIIZ, BYVAL dwCountryCode AS DWORD, lpCallParams AS LINECALLPARAMS) AS LONG  
    Declare Function lineMonitorDigits Lib "TAPI32.DLL" Alias "lineMonitorDigits"(ByVal hCall As Dword, ByVal dwDigitModes As Dword) As Long
    Declare Function lineMonitorMedia Lib "TAPI32.DLL" Alias "lineMonitorMedia"(ByVal hCall As Dword, ByVal dwMediaModes As Dword) As Long
    Declare Function lineMonitorTones Lib "TAPI32.DLL" Alias "lineMonitorTones"(ByVal hCall As Dword, lpToneList As LINEMONITORTONE, ByVal dwNumEntries As Dword) As Long
    Declare Function lineNegotiateAPIVersion Lib "TAPI32.DLL" Alias "lineNegotiateAPIVersion"(ByVal hLineApp As Dword, ByVal dwDeviceID As Dword, ByVal dwAPILowVersion As Dword, ByVal dwAPIHighVersion As Dword, _
                     lpdwAPIVersion As Dword, lpExtensionID As LINEEXTENSIONID) As Long
    Declare Function lineNegotiateExtVersion Lib "TAPI32.DLL" Alias "lineNegotiateExtVersion"(ByVal hLineApp As Dword, ByVal dwDeviceID As Dword, ByVal dwAPIVersion As Dword, ByVal dwExtLowVersion As Dword, ByVal dwExtHighVersion As Dword, _
                     lpdwExtVersion As Dword) As Long
    Declare Function lineOpen Lib "TAPI32.DLL" Alias "lineOpenA"(ByVal hLineApp As Dword, ByVal dwDeviceID As Dword, lphLine As Dword, ByVal dwAPIVersion As Dword, ByVal dwExtVersion As Dword, ByVal dwCallbackInstance As Dword, ByVal dwPrivileges As Dword, _
                     ByVal dwMediaModes As Dword, lpCallParams As LINECALLPARAMS) As Long
    Declare Function linePark Lib "TAPI32.DLL" Alias "lineParkA"(ByVal hCall As Dword, ByVal dwParkMode As Dword, lpszDirAddress As Asciiz, lpNonDirAddress As VARSTRING) As Long
    Declare Function linePickup Lib "TAPI32.DLL" Alias "linePickupA"(ByVal hLine As Dword, ByVal dwAddressID As Dword, lphCall As Dword, lpszDestAddress As Asciiz, lpszGroupID As Asciiz) As Long
    Declare Function linePrepareAddToConference Lib "TAPI32.DLL" Alias "linePrepareAddToConferenceA"(ByVal hConfCall As Dword, lphConsultCall As Dword, lpCallParams As LINECALLPARAMS) As Long
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Declare Function lineProxyMessage Lib "TAPI32.DLL" Alias "lineProxyMessage"(ByVal hLine As Dword, ByVal hCall As Dword, ByVal dwMsg As Dword, ByVal dwParam1 As Dword, ByVal dwParam2 As Dword, ByVal dwParam3 As Dword) As Long
    Declare Function lineProxyResponse Lib "TAPI32.DLL" Alias "lineProxyResponse"(ByVal hLine As Dword, lpProxyRequest As LINEPROXYREQUEST, ByVal dwResult As Dword) As Long
    #EndIf
    
    Declare Function lineRedirect Lib "TAPI32.DLL" Alias "lineRedirectA"(ByVal hCall As Dword, lpszDestAddress As Asciiz, ByVal dwCountryCode As Dword) As Long
    Declare Function lineRegisterRequestRecipient Lib "TAPI32.DLL" Alias "lineRegisterRequestRecipient"(ByVal hLineApp As Dword, ByVal dwRegistrationInstance As Dword, ByVal dwRequestMode As Dword, ByVal bEnable As Dword) As Long
    Declare Function lineReleaseUserUserInfo Lib "TAPI32.DLL" Alias "lineReleaseUserUserInfo"(ByVal hCall As Dword) As Long
    Declare Function lineRemoveFromConference Lib "TAPI32.DLL" Alias "lineRemoveFromConference"(ByVal hCall As Dword) As Long
    Declare Function lineRemoveProvider Lib "TAPI32.DLL" Alias "lineRemoveProvider"(ByVal dwPermanentProviderID As Dword, ByVal hwndOwner As Dword) As Long
    Declare Function lineSecureCall Lib "TAPI32.DLL" Alias "lineSecureCall"(ByVal hCall As Dword) As Long
    Declare Function lineSendUserUserInfo Lib "TAPI32.DLL" Alias "lineSendUserUserInfo"(ByVal hCall As Dword, lpsUserUserInfo As Asciiz, ByVal dwSize As Dword) As Long
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Declare Function lineSetAgentActivity Lib "TAPI32.DLL" Alias "lineSetAgentActivity"(ByVal hLine As Dword, ByVal dwAddressID As Dword, ByVal dwActivityID As Dword) As Long
    Declare Function lineSetAgentGroup Lib "TAPI32.DLL" Alias "lineSetAgentGroup"(ByVal hLine As Dword, ByVal dwAddressID As Dword, lpAgentGroupList As LINEAGENTGROUPLIST) As Long
    Declare Function lineSetAgentState Lib "TAPI32.DLL" Alias "lineSetAgentState"(ByVal hLine As Dword, ByVal dwAddressID As Dword, ByVal dwAgentState As Dword, ByVal dwNextAgentState As Dword) As Long
    #EndIf
    
    Declare Function lineSetAppPriority Lib "TAPI32.DLL" Alias "lineSetAppPriorityA"(lpszAppFilename As Asciiz, ByVal dwMediaMode As Dword, lpExtensionID As LINEEXTENSIONID, ByVal dwRequestMode As Dword, _
                     lpszExtensionName As Asciiz, ByVal dwPriority As Dword) As Long
    Declare Function lineSetAppSpecific Lib "TAPI32.DLL" Alias "lineSetAppSpecific"(ByVal hCall As Dword, ByVal dwAppSpecific As Dword) As Long
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Declare Function lineSetCallData Lib "TAPI32.DLL" Alias "lineSetCallData"(ByVal hCall As Dword, lpCallData As Any, ByVal dwSize As Dword) As Long
    #EndIf
    
    Declare Function lineSetCallParams Lib "TAPI32.DLL" Alias "lineSetCallParams"(ByVal hCall As Dword, ByVal dwBearerMode As Dword, ByVal dwMinRate As Dword, ByVal dwMaxRate As Dword, lpDialParams As LINEDIALPARAMS) As Long
    Declare Function lineSetCallPrivilege Lib "TAPI32.DLL" Alias "lineSetCallPrivilege"(ByVal hCall As Dword, ByVal dwCallPrivilege As Dword) As Long
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Declare Function lineSetCallQualityOfService Lib "TAPI32.DLL" Alias "lineSetCallQualityOfService"(ByVal hCall As Dword, lpSendingFlowspec As Any, ByVal dwSendingFlowspecSize As Dword, lpReceivingFlowspec As Any, _
                     ByVal dwReceivingFlowspecSize As Dword) As Long
    Declare Function lineSetCallTreatment Lib "TAPI32.DLL" Alias "lineSetCallTreatment"(ByVal hCall As Dword, ByVal dwTreatment As Dword) As Long
    #EndIf
    
    Declare Function lineSetCurrentLocation Lib "TAPI32.DLL" Alias "lineSetCurrentLocation"(ByVal hLineApp As Dword, ByVal dwLocation As Dword) As Long
    Declare Function lineSetDevConfig Lib "TAPI32.DLL" Alias "lineSetDevConfigA"(ByVal dwDeviceID As Dword, lpDeviceConfig As Any, ByVal dwSize As Dword, lpszDeviceClass As Asciiz) As Long
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Declare Function lineSetLineDevStatus Lib "TAPI32.DLL" Alias "lineSetLineDevStatus"(ByVal hLine As Dword, ByVal dwStatusToChange As Dword, ByVal fStatus As Dword) As Long
    #EndIf
    
    Declare Function lineSetMediaControl Lib "TAPI32.DLL" Alias "lineSetMediaControl"(ByVal hLine As Dword, ByVal dwAddressID As Dword, ByVal hCall As Dword, ByVal dwSelect As Dword, lpDigitList As LINEMEDIACONTROLDIGIT, ByVal dwDigitNumEntries As Dword, _
                     lpMediaList As LINEMEDIACONTROLMEDIA, ByVal dwMediaNumEntries As Dword, lpToneList As LINEMEDIACONTROLTONE, ByVal dwToneNumEntries As Dword, lpCallStateList As LINEMEDIACONTROLCALLSTATE, ByVal dwCallStateNumEntries As Dword) As Long
    Declare Function lineSetMediaMode Lib "TAPI32.DLL" Alias "lineSetMediaMode"(ByVal hCall As Dword, ByVal dwMediaModes As Dword) As Long
    Declare Function lineSetNumRings Lib "TAPI32.DLL" Alias "lineSetNumRings"(ByVal hLine As Dword, ByVal dwAddressID As Dword, ByVal dwNumRings As Dword) As Long
    Declare Function lineSetStatusMessages Lib "TAPI32.DLL" Alias "lineSetStatusMessages"(ByVal hLine As Dword, ByVal dwLineStates As Dword, ByVal dwAddressStates As Dword) As Long
    Declare Function lineSetTerminal Lib "TAPI32.DLL" Alias "lineSetTerminal"(ByVal hLine As Dword, ByVal dwAddressID As Dword, ByVal hCall As Dword, ByVal dwSelect As Dword, ByVal dwTerminalModes As Dword, _
                     ByVal dwTerminalID As Dword, ByVal bEnable As Dword) As Long
    Declare Function lineSetTollList Lib "TAPI32.DLL" Alias "lineSetTollListA"(ByVal hLineApp As Dword, ByVal dwDeviceID As Dword, lpszAddressIn As Asciiz, ByVal dwTollListOption As Dword) As Long
    Declare Function lineSetupConference Lib "TAPI32.DLL" Alias "lineSetupConferenceA"(ByVal hCall As Dword, ByVal hLine As Dword, lphConfCall As Dword, lphConsultCall As Dword, ByVal dwNumParties As Dword, lpCallParams As LINECALLPARAMS) As Long
    Declare Function lineSetupTransfer Lib "TAPI32.DLL" Alias "lineSetupTransferA"(ByVal hCall As Dword, lphConsultCall As Dword, lpCallParams As LINECALLPARAMS) As Long
    Declare Function lineShutdown Lib "TAPI32.DLL" Alias "lineShutdown"(ByVal hLineApp As Dword) As Long
    Declare Function lineSwapHold Lib "TAPI32.DLL" Alias "lineSwapHold"(ByVal hActiveCall As Dword, ByVal hHeldCall As Dword) As Long
    Declare Function lineTranslateAddress Lib "TAPI32.DLL" Alias "lineTranslateAddressA"(ByVal hLineApp As Dword, ByVal dwDeviceID As Dword, _
                     ByVal dwAPIVersion As Dword, lpszAddressIn As Asciiz, ByVal dwCard As Dword, ByVal dwTranslateOptions As Dword, lpTranslateOutput As LINETRANSLATEOUTPUT) As Long
    DECLARE FUNCTION lineTranslateDialog LIB "TAPI32.DLL" ALIAS "lineTranslateDialogA"(BYVAL hLineApp AS DWORD, BYVAL dwDeviceID AS DWORD, BYVAL dwAPIVersion AS DWORD, BYVAL hwndOwner AS DWORD, lpszAddressIn AS ASCIIZ) AS LONG 
    Declare Function lineUncompleteCall Lib "TAPI32.DLL" Alias "lineUncompleteCall"(ByVal hLine As Dword, ByVal dwCompletionID As Dword) As Long
    Declare Function lineUnhold Lib "TAPI32.DLL" Alias "lineUnhold"(ByVal hCall As Dword) As Long
    Declare Function lineUnpark Lib "TAPI32.DLL" Alias "lineUnparkA"(ByVal hLine As Dword, ByVal dwAddressID As Dword, lphCall As Dword, lpszDestAddress As Asciiz) As Long
    Declare Function phoneClose Lib "TAPI32.DLL" Alias "phoneClose"(ByVal hPhone As Dword) As Long
    Declare Function phoneConfigDialog Lib "TAPI32.DLL" Alias "phoneConfigDialogA"(ByVal dwDeviceID As Dword, ByVal hwndOwner As Dword, lpszDeviceClass As Asciiz) As Long
    Declare Function phoneDevSpecific Lib "TAPI32.DLL" Alias "phoneDevSpecific"( ByVal hPhone As Dword, lpParams As Any, ByVal dwSize As Dword) As Long
    Declare Function phoneGetButtonInfo Lib "TAPI32.DLL" Alias "phoneGetButtonInfoA"(ByVal hPhone As Dword, ByVal dwButtonLampID As Dword, lpButtonInfo As PHONEBUTTONINFO) As Long
    Declare Function phoneGetData Lib "TAPI32.DLL" Alias "phoneGetData"(ByVal hPhone As Dword, ByVal dwDataID As Dword, lpData As Any, ByVal dwSize As Dword) As Long
    Declare Function phoneGetDevCaps Lib "TAPI32.DLL" Alias "phoneGetDevCapsA"(ByVal hPhoneApp As Dword, ByVal dwDeviceID As Dword, ByVal dwAPIVersion As Dword, ByVal dwExtVersion As Dword, lpPhoneCaps As PHONECAPS) As Long
    Declare Function phoneGetDisplay Lib "TAPI32.DLL" Alias "phoneGetDisplay"(ByVal hPhone As Dword, lpDisplay As VARSTRING) As Long
    Declare Function phoneGetGain Lib "TAPI32.DLL" Alias "phoneGetGain"(ByVal hPhone As Dword, ByVal dwHookSwitchDev As Dword, lpdwGain As Dword) As Long
    Declare Function phoneGetHookSwitch Lib "TAPI32.DLL" Alias "phoneGetHookSwitch"(ByVal hPhone As Dword, lpdwHookSwitchDevs As Dword) As Long
    Declare Function phoneGetIcon Lib "TAPI32.DLL" Alias "phoneGetIconA"(ByVal dwDeviceID As Dword, lpszDeviceClass As Asciiz, lphIcon As Dword) As Long
    Declare Function phoneGetID Lib "TAPI32.DLL" Alias "phoneGetIDA"(ByVal hPhone As Dword, lpDeviceID As VARSTRING, lpszDeviceClass As Asciiz) As Long
    Declare Function phoneGetLamp Lib "TAPI32.DLL" Alias "phoneGetLamp"(ByVal hPhone As Dword, ByVal dwButtonLampID As Dword, lpdwLampMode As Dword) As Long
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Declare Function phoneGetMessage Lib "TAPI32.DLL" Alias "phoneGetMessage"(ByVal hPhoneApp As Dword, lpMessage As PHONEMESSAGE, ByVal dwTimeout As Dword) As Long
    #EndIf
    
    Declare Function phoneGetRing Lib "TAPI32.DLL" Alias "phoneGetRing"(ByVal hPhone As Dword, lpdwRingMode As Dword, lpdwVolume As Dword) As Long
    Declare Function phoneGetStatus Lib "TAPI32.DLL" Alias "phoneGetStatusA"(ByVal hPhone As Dword, lpPhoneStatus As PHONESTATUS) As Long
    Declare Function phoneGetStatusMessages Lib "TAPI32.DLL" Alias "phoneGetStatusMessages"(ByVal hPhone As Dword, lpdwPhoneStates As Dword, lpdwButtonModes As Dword, lpdwButtonStates As Dword) As Long
    Declare Function phoneGetVolume Lib "TAPI32.DLL" Alias "phoneGetVolume"(ByVal hPhone As Dword, ByVal dwHookSwitchDev As Dword, lpdwVolume As Dword) As Long
    Declare Function phoneInitialize Lib "TAPI32.DLL" Alias "phoneInitialize"(lphPhoneApp As Dword, ByVal hInstance As Dword, lpfnCallback As Dword, lpszAppName As Asciiz, lpdwNumDevs As Dword) As Long
    
    #If %TAPI_CURRENT_VERSION >= &h00020000
    Declare Function phoneInitializeEx Lib "TAPI32.DLL" Alias "phoneInitializeExA"(lphPhoneApp As Dword, ByVal hInstance As Dword, lpfnCallback As Dword, lpszFriendlyAppName As Asciiz, lpdwNumDevs As Dword, _
                     lpdwAPIVersion As Dword, lpPhoneInitializeExParams As PHONEINITIALIZEEXPARAMS) As Long
    #EndIf
    Declare Function phoneNegotiateAPIVersion Lib "TAPI32.DLL" Alias "phoneNegotiateAPIVersion"(ByVal hPhoneApp As Dword, ByVal dwDeviceID As Dword, ByVal dwAPILowVersion As Dword, ByVal dwAPIHighVersion As Dword, lpdwAPIVersion As Dword, _
                     lpExtensionID As PHONEEXTENSIONID) As Long
    Declare Function phoneNegotiateExtVersion Lib "TAPI32.DLL" Alias "phoneNegotiateExtVersion"(ByVal hPhoneApp As Dword, ByVal dwDeviceID As Dword, ByVal dwAPIVersion As Dword, ByVal dwExtLowVersion As Dword, ByVal dwExtHighVersion As Dword, _
                     lpdwExtVersion As Dword) As Long
    Declare Function phoneOpen Lib "TAPI32.DLL" Alias "phoneOpen"(ByVal hPhoneApp As Dword, ByVal dwDeviceID As Dword, lphPhone As Dword, ByVal dwAPIVersion As Dword, ByVal dwExtVersion As Dword, ByVal dwCallbackInstance As Dword, _
                     ByVal dwPrivilege As Dword) As Long
    Declare Function phoneSetButtonInfo Lib "TAPI32.DLL" Alias "phoneSetButtonInfoA"(ByVal hPhone As Dword, ByVal dwButtonLampID As Dword, lpButtonInfo As PHONEBUTTONINFO) As Long
    Declare Function phoneSetData Lib "TAPI32.DLL" Alias "phoneSetData"(ByVal hPhone As Dword, ByVal dwDataID As Dword, lpData As Any, ByVal dwSize As Dword) As Long
    Declare Function phoneSetDisplay Lib "TAPI32.DLL" Alias "phoneSetDisplay"(ByVal hPhone As Dword, ByVal dwRow As Dword, ByVal dwColumn As Dword, lpsDisplay As Asciiz, ByVal dwSize As Dword) As Long
    Declare Function phoneSetGain Lib "TAPI32.DLL" Alias "phoneSetGain"(ByVal hPhone As Dword, ByVal dwHookSwitchDev As Dword, ByVal dwGain As Dword) As Long
    Declare Function phoneSetHookSwitch Lib "TAPI32.DLL" Alias "phoneSetHookSwitch"(ByVal hPhone As Dword, ByVal dwHookSwitchDevs As Dword, ByVal dwHookSwitchMode As Dword) As Long
    Declare Function phoneSetLamp Lib "TAPI32.DLL" Alias "phoneSetLamp"(ByVal hPhone As Dword, ByVal dwButtonLampID As Dword, ByVal dwLampMode As Dword) As Long
    Declare Function phoneSetRing Lib "TAPI32.DLL" Alias "phoneSetRing"(ByVal hPhone As Dword, ByVal dwRingMode As Dword, ByVal dwVolume As Dword) As Long
    Declare Function phoneSetStatusMessages Lib "TAPI32.DLL" Alias "phoneSetStatusMessages"(ByVal hPhone As Dword, ByVal dwPhoneStates As Dword, ByVal dwButtonModes As Dword, ByVal dwButtonStates As Dword) As Long
    Declare Function phoneSetVolume Lib "TAPI32.DLL" Alias "phoneSetVolume"(ByVal hPhone As Dword, ByVal dwHookSwitchDev As Dword, ByVal dwVolume As Dword) As Long
    Declare Function phoneShutdown Lib "TAPI32.DLL" Alias "phoneShutdown"(ByVal hPhoneApp As Dword) As Long
    Declare Function tapiGetLocationInfo Lib "TAPI32.DLL" Alias "tapiGetLocationInfoA"(lpszCountryCode As Asciiz, lpszCityCode As Asciiz) As Long
    Declare Function tapiRequestDrop Lib "TAPI32.DLL" Alias "tapiRequestDrop"(ByVal hwnd As Dword, ByVal wRequestID As Dword) As Long
    Declare Function tapiRequestMakeCall Lib "TAPI32.DLL" Alias "tapiRequestMakeCallA"(lpszDestAddress As Asciiz, lpszAppName As Asciiz, lpszCalledParty As Asciiz, lpszComment As Asciiz) As Long
    Declare Function tapiRequestMediaCall Lib "TAPI32.DLL" Alias "tapiRequestMediaCallA"(ByVal hwnd As Dword, ByVal wRequestID As Dword, lpszDeviceClass As Asciiz, lpDeviceID As Asciiz, _
                     ByVal dwSize As Dword, ByVal dwSecure As Dword, lpszDestAddress As Asciiz, lpszAppName As Asciiz, lpszCalledParty As Asciiz, lpszComment As Asciiz) As Long
    
    '==============================================================================
    #EndIf ' %TAPI
    ------------------
    Kind Regards
    Mike

    Comment

    Working...
    X