#include <asttapiprovider.h>
Public Member Functions | |
~ASTTapiProvider () | |
LONG | TSPI_providerShutdown (DWORD dwTSPIVersion, DWORD dwPermanentProviderID) |
shutsdown and disconnects from asterisk | |
LONG | TSPI_lineGetDevCaps (DWORD dwDeviceID, DWORD dwTSPIVersion, DWORD dwExtVersion, LPLINEDEVCAPS pldc) |
returns device caps | |
LONG | TSPI_lineGetAddressCaps (DWORD dwDeviceID, DWORD dwAddressID, DWORD dwTSPIVersion, DWORD dwExtVersion, LPLINEADDRESSCAPS pac) |
returns address caps | |
LONG | TSPI_lineOpen (DWORD dwDeviceID, HTAPILINE htLine, LPHDRVLINE phdLine, DWORD dwTSPIVersion, LINEEVENT pfnEventProc) |
opens a tapi line | |
LONG | TSPI_lineClose (HDRVLINE hdLine) |
closes a tapi line | |
LONG | TSPI_lineMakeCall (DRV_REQUESTID dwRequestID, HDRVLINE hdLine, HTAPICALL htCall, LPHDRVCALL phdCall, LPCWSTR pszDestAddress, DWORD dwCountryCode, LPLINECALLPARAMS const pCallParams) |
makes a call | |
LONG | TSPI_lineDrop (DRV_REQUESTID dwRequestID, HDRVCALL hdCall, LPCSTR lpsUserInfo, DWORD dwSize) |
hangups a call | |
LONG | TSPI_lineCloseCall (HDRVCALL hdCall) |
deallocates a call | |
LONG | TSPI_lineForward (DRV_REQUESTID dwRequestID, HDRVLINE hdLine, DWORD bAllAddresses, DWORD dwAddressID, LPLINEFORWARDLIST const lpForwardList, DWORD dwNumRingsNoAnswer, HTAPICALL htConsultCall, LPHDRVCALL lphdConsultCall, LPLINECALLPARAMS const lpCallParams) |
sets line worward options | |
LONG | TSPI_lineGetCallInfo (HDRVCALL hdCall, LPLINECALLINFO lpCallInfo) |
returns call info to tapi | |
LONG | TSPI_lineSetupTransfer (DRV_REQUESTID dwRequestID, HDRVCALL hdCall, HTAPICALL htConsultCall, LPHDRVCALL lphdConsultCall, LPLINECALLPARAMS const lpCallParams) |
setup transfer | |
LONG | TSPI_lineDial (DRV_REQUESTID dwRequestID, HDRVCALL hdCall, LPCWSTR lpszDestAddress, DWORD dwCountryCode) |
Dial. | |
LONG | TSPI_lineHold (DRV_REQUESTID dwRequestID, HDRVCALL hdCall) |
hold call | |
LONG | TSPI_lineUnHold (DRV_REQUESTID dwRequestID, HDRVCALL hdCall) |
retrieve call | |
Static Public Member Functions | |
static ASTTapiProvider * | Create (ASTLogListener *logCallBack, ASYNC_COMPLETION fnAsincCompletionProc, DWORD dwPermanentProviderID, DWORD dwLineDeviceIDBase, std::vector< std::string > v_vOutDnVector) |
factory method | |
static DWORD | ProcessDnExp (std::vector< std::string > &out_dn_vector, BasicLogger &logger) |
get dns from registry expresions. STATIC!!! | |
Protected Member Functions | |
ASTTapiProvider () |
ASTTapiProvider uses ASTCstaProvider to integrate TAPI to Asterisk pbx
ASTTapiProvider::ASTTapiProvider | ( | ) | [protected] |
Constructor
ASTTapiProvider::~ASTTapiProvider | ( | ) |
Destructor
ASTTapiProvider * ASTTapiProvider::Create | ( | ASTLogListener * | logCallBack, | |
ASYNC_COMPLETION | fnCompletionProc, | |||
DWORD | dwPermanentProviderID, | |||
DWORD | dwLineDeviceIDBase, | |||
std::vector< std::string > | v_vOutDnVector | |||
) | [static] |
factory method
factory method creates a ASTTapiProvider and attach itself as a cstalistener
logCallBack | ||
fnCompletionProc | ||
dwPermanentProviderID | ||
dwLineDeviceIDBase | ||
v_vOutDnVector |
DWORD ASTTapiProvider::ProcessDnExp | ( | std::vector< std::string > & | out_dn_vector, | |
BasicLogger & | logger | |||
) | [static] |
get dns from registry expresions. STATIC!!!
Get expresion dn from registy, process it and store dns in vector
pout_dn_vector | Vector with the extension numbers. | |
logger | BasicLogger to trace |
LONG ASTTapiProvider::TSPI_lineClose | ( | HDRVLINE | hdLine | ) |
closes a tapi line
Function TSPI_lineClose Called by TAPI when a line is no longer required. We close the monitor opened on the device.
hdLine |
LONG ASTTapiProvider::TSPI_lineCloseCall | ( | HDRVCALL | hdCall | ) |
deallocates a call
Removes TapiCall and deletes from map. Does not hangup nor change Asterisk call status.
Implementation note: TAPI specs say that 'The status information for the call is retained until the function TSPI_lineCloseCall is called' so in future revisions we won't delete TapiCall here.
Anyway we have found that some buggy tapi apps do not call release handlers appropiately so tapi never calls TSPI_lineCloseCall(), and a driver resource-leak arises.
For now we delete our TapiCall objects in OnConnectionCleared() handler, and in a future revision we will implement some kind of 'dirty' cache to retain information while not suffering from buggy tapi apps.
hdCall |
LONG ASTTapiProvider::TSPI_lineDial | ( | DRV_REQUESTID | dwRequestID, | |
HDRVCALL | hdCall, | |||
LPCWSTR | lpszDestAddress, | |||
DWORD | dwCountryCode | |||
) |
Dial.
Function TSPI_lineDial Dials the specified dialable number on the specified call.
dwRequestID | ||
hdCall | ||
lpszDestAddress | ||
dwCountryCode |
LONG ASTTapiProvider::TSPI_lineDrop | ( | DRV_REQUESTID | dwRequestID, | |
HDRVCALL | hdCall, | |||
LPCSTR | lpsUserInfo, | |||
DWORD | dwSize | |||
) |
hangups a call
Function TSPI_lineDrop drops a call It returns success if related AsteriskCall can be droped or if it had already been dropped. Must IDLE the TapiCall. FIX: outlook 2000 call this function when the call is finished. Asterisk report an error (no such channel).
dwRequestID | ||
hdCall | ||
lpsUserInfo | ||
dwSize |
LONG ASTTapiProvider::TSPI_lineForward | ( | DRV_REQUESTID | dwRequestID, | |
HDRVLINE | hdLine, | |||
DWORD | bAllAddresses, | |||
DWORD | dwAddressID, | |||
LPLINEFORWARDLIST const | lpForwardList, | |||
DWORD | dwNumRingsNoAnswer, | |||
HTAPICALL | htConsultCall, | |||
LPHDRVCALL | lphdConsultCall, | |||
LPLINECALLPARAMS const | lpCallParams | |||
) |
sets line worward options
lineForward mainly used to simulate do-not-disturb=yes/no if lpForwardList==NULL we treat as DND=OFF, DND=ON otherwise
dwRequestID | ||
hdLine | ||
bAllAddresses | ||
dwAddressID | ||
lpForwardList | ||
dwNumRingsNoAnswer | ||
htConsultCall | ||
lphdConsultCall | ||
lpCallParams |
LONG ASTTapiProvider::TSPI_lineGetAddressCaps | ( | DWORD | dwDeviceID, | |
DWORD | dwAddressID, | |||
DWORD | dwTSPIVersion, | |||
DWORD | dwExtVersion, | |||
LPLINEADDRESSCAPS | pac | |||
) |
returns address caps
Function TSPI_lineGetAddressCaps Allows TAPI to check our line capabilities before placing a call
dwDeviceID | ||
dwAddressID | ||
dwTSPIVersion | ||
dwExtVersion | ||
pac |
LONG ASTTapiProvider::TSPI_lineGetCallInfo | ( | HDRVCALL | hdCall, | |
LPLINECALLINFO | lpCallInfo | |||
) |
returns call info to tapi
Function TSPI_lineGetCallInfo
CallerID, CalledID, ConnectedID, RedirectingID, RedirectionIDhdCall | ||
lpCallInfo |
LONG ASTTapiProvider::TSPI_lineGetDevCaps | ( | DWORD | dwDeviceID, | |
DWORD | dwTSPIVersion, | |||
DWORD | dwExtVersion, | |||
LPLINEDEVCAPS | pldc | |||
) |
returns device caps
Function TSPI_lineGetDevCaps Allows TAPI to check our line capabilities before placing a call
dwDeviceID | ||
dwTSPIVersion | ||
dwExtVersion | ||
pldc |
fix: wcscpy_s second parameter makes an access violation. Now that is only the content lenght of szLineName
LONG ASTTapiProvider::TSPI_lineHold | ( | DRV_REQUESTID | dwRequestID, | |
HDRVCALL | hdCall | |||
) |
hold call
Function TSPI_lineHold places the specified call on hold
dwRequestID | ||
hdCall |
LONG ASTTapiProvider::TSPI_lineMakeCall | ( | DRV_REQUESTID | dwRequestID, | |
HDRVLINE | hdLine, | |||
HTAPICALL | htCall, | |||
LPHDRVCALL | phdCall, | |||
LPCWSTR | pszDestAddress, | |||
DWORD | dwCountryCode, | |||
LPLINECALLPARAMS const | pCallParams | |||
) |
makes a call
Function TSPI_lineMakeCall.
This function is called by TAPI to initialize a new outgoing call.
Originates a call via AMI originate action.
TAPI standard compatible applications should send calledNumber in 'standard dialable form'
... but begining in 1.2 and for flexibility reasons Activa tsp will filter out characters as following:sample:
Some dialed sequences are interpreted as the following feature-codes:
Adds new call to callmap.
If LINECALLPARAMFLAGS_PREDICTIVEDIAL flag on pCallParams is activated, a makePredictiveCall will be executed.
If ASTProvider returns ok_feature_dialed meaning that make call succeded but no real call was initiated, call is inmediately erased from map, and LINECALLSTATE_DIALTONE + LINECALLSTATE_IDLE events are sent to tapi.dwRequestID | ||
hdLine | ||
htCall | ||
phdCall | ||
pszDestAddress | ||
dwCountryCode | ||
pCallParams |
FIX: Dead Lock when events and make predictive call runs concurrently
FIX: Race condition: one TapiLine haven't do more than one calls at the same time. To solve it, we create a new TapiCall and get the new callId previously to make call or makepredictive call.
LONG ASTTapiProvider::TSPI_lineOpen | ( | DWORD | dwDeviceID, | |
HTAPILINE | htLine, | |||
LPHDRVLINE | phdLine, | |||
DWORD | dwTSPIVersion, | |||
LINEEVENT | pfnEventProc | |||
) |
opens a tapi line
Function TSPI_lineOpen Connects to asterisk (it may alredy be connected so a fails_already_connected is treated as ok) and a new monitor is opened on the deviceID. Use pointer to TapiLine as opaque HDRVLINE.
dwDeviceID | ||
htLine | ||
phdLine | ||
dwTSPIVersion | ||
pfnEventProc |
LONG ASTTapiProvider::TSPI_lineSetupTransfer | ( | DRV_REQUESTID | dwRequestID, | |
HDRVCALL | hdCall, | |||
HTAPICALL | htConsultCall, | |||
LPHDRVCALL | lphdConsultCall, | |||
LPLINECALLPARAMS const | lpCallParams | |||
) |
setup transfer
Function TSPI_lineSetupTransfer Initiates a transfer of the call specified by hdCall. It establishes a consultation call, lphdConsultCall, on which the party can be dialed that can become the destination of the transfer.
dwRequestID | ||
hdCall | ||
htConsultCall | ||
lphdConsultCall | ||
lpCallParams |
LONG ASTTapiProvider::TSPI_lineUnHold | ( | DRV_REQUESTID | dwRequestID, | |
HDRVCALL | hdCall | |||
) |
retrieve call
TSPI_lineUnHold retrieves the specified held call.
dwRequestID | request identifier | |
hdCall | hdCall identifier |
LONG ASTTapiProvider::TSPI_providerShutdown | ( | DWORD | dwTSPIVersion, | |
DWORD | dwPermanentProviderID | |||
) |
shutsdown and disconnects from asterisk
Function TSPI_providerShutdown Disconnects from asterisk. Shutdown and clean up.
dwTSPIVersion | ||
dwPermanentProviderID |