ASTTapiProvider Class Reference

tsp-level abstraction on top of ASTCstaProvider More...

#include <asttapiprovider.h>

Inheritance diagram for ASTTapiProvider:

ASTCstaListener

List of all members.

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 ASTTapiProviderCreate (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 ()


Detailed Description

tsp-level abstraction on top of ASTCstaProvider

ASTTapiProvider uses ASTCstaProvider to integrate TAPI to Asterisk pbx

See also:
http://msdn2.microsoft.com/en-us/library/ms736535.aspx

Constructor & Destructor Documentation

ASTTapiProvider::ASTTapiProvider (  )  [protected]

Constructor

ASTTapiProvider::~ASTTapiProvider (  ) 

Destructor


Member Function Documentation

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

Parameters:
logCallBack 
fnCompletionProc 
dwPermanentProviderID 
dwLineDeviceIDBase 
v_vOutDnVector 
Returns:
NULL if cannot create

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

Parameters:
pout_dn_vector Vector with the extension numbers.
logger BasicLogger to trace
Returns:
nlines Number of lines = pout_dn_vector.size()

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.

See also:
http://windowssdk.msdn.microsoft.com/en-us/library/ms725531.aspx
Parameters:
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.

See also:
http://msdn2.microsoft.com/en-us/library/ms725532.aspx
Parameters:
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.

See also:
http://msdn2.microsoft.com/en-us/library/ms725542.aspx
Parameters:
dwRequestID 
hdCall 
lpszDestAddress 
dwCountryCode 
Returns:
dwRequestId or LINEERR_OPERATIONFAILED

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).

See also:
http://msdn2.microsoft.com/en-us/library/ms725543.aspx
Parameters:
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

See also:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tapi/tspi/tspi_lineforward.asp?frame=true

http://msdn2.microsoft.com/en-us/library/ms725546.aspx

Parameters:
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

See also:
http://msdn2.microsoft.com/en-us/library/ms725560.aspx
Parameters:
dwDeviceID 
dwAddressID 
dwTSPIVersion 
dwExtVersion 
pac 

LONG ASTTapiProvider::TSPI_lineGetCallInfo ( HDRVCALL  hdCall,
LPLINECALLINFO  lpCallInfo 
)

returns call info to tapi

Function TSPI_lineGetCallInfo

See also:
http://windowssdk.msdn.microsoft.com/en-us/library/ms725566.aspx
CallerID, CalledID, ConnectedID, RedirectingID, RedirectionID
See also:
http://groups.google.es/group/microsoft.public.win32.programmer.tapi/browse_frm/thread/4f67342dbdf53d07/1d258a4ac426e38c?lnk=st&q=connectedID&rnum=11&hl=es#1d258a4ac426e38c
Parameters:
hdCall 
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

See also:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tapi/tspi/tspi_service_provider_functions.asp

http://msdn2.microsoft.com/en-us/library/ms725568.aspx

Parameters:
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

See also:
http://msdn2.microsoft.com/en-us/library/ms725575.aspx
Parameters:
dwRequestID 
hdCall 
Returns:
dwRequestId or LINEERR_OPERATIONFAILED

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'

See also:
http://windowssdk.msdn.microsoft.com/en-us/library/ms726017.aspx
... but begining in 1.2 and for flexibility reasons Activa tsp will filter out characters as following:
  • accepted characters: 0-9, A-D, *, #
  • escape character [ ' ] (apostrophe): stops filtering and accepts all remaining characters.

sample:

  • calledNumber = +1 (555) 43-21=> 15554321
  • calledNumber = 'extension0001 => extension0001

Some dialed sequences are interpreted as the following feature-codes:

  • FEATURE_LOGIN *7361<queue> QueueAdd queue=<queue>, paused=yes. Example: *7361555
  • FEATURE_LOGOUT *7360<queue> QueueRemove queue=<queue>. Example: *7360555
  • FEATURE_READY *7351<queue> QueuePause queue=<queue> paused=yes. Example: *7351555
  • FEATURE_NOTREADY *7350<queue> QueuePause queue=<queue> paused=no. Example: *7350555

Adds new call to callmap.

If LINECALLPARAMFLAGS_PREDICTIVEDIAL flag on pCallParams is activated, a makePredictiveCall will be executed.

See also:
http://msdn2.microsoft.com/en-us/library/ms735534.aspx
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.
See also:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tapi/tspi/tspi_linemakecall.asp
Parameters:
dwRequestID 
hdLine 
htCall 
phdCall 
pszDestAddress 
dwCountryCode 
pCallParams 

Todo:
: more detailed error handling on FEATURE_LOGOUT

Todo:
: more detailed error handling on FEATURE_READY

Todo:
: more detailed error handling on FEATURE_NOTREADY

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.

See also:
http://msdn2.microsoft.com/en-us/library/ms725583.aspx
Parameters:
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.

See also:
http://msdn2.microsoft.com/en-us/library/ms725609.aspx
Parameters:
dwRequestID 
hdCall 
htConsultCall 
lphdConsultCall 
lpCallParams 
Returns:
requestId

LONG ASTTapiProvider::TSPI_lineUnHold ( DRV_REQUESTID  dwRequestID,
HDRVCALL  hdCall 
)

retrieve call

TSPI_lineUnHold retrieves the specified held call.

See also:
http://msdn2.microsoft.com/en-us/library/ms725612.aspx
Parameters:
dwRequestID request identifier
hdCall hdCall identifier
Returns:
dwRequestId or LINEERR_OPERATIONFAILED

LONG ASTTapiProvider::TSPI_providerShutdown ( DWORD  dwTSPIVersion,
DWORD  dwPermanentProviderID 
)

shutsdown and disconnects from asterisk

Function TSPI_providerShutdown Disconnects from asterisk. Shutdown and clean up.

Parameters:
dwTSPIVersion 
dwPermanentProviderID 


The documentation for this class was generated from the following files:

Generated on Mon Jul 25 09:08:52 2011 for Activa Framework by  doxygen 1.5.9