ASTCstaProvider Class Reference

This is the main class of Activa framework. Provides a csta-like programming interface. More...

#include <astcstaprovider.h>

Inheritance diagram for ASTCstaProvider:

ASTCstaProviderInterface ASTListener

List of all members.

Public Member Functions

AC_RESULT Connect (std::string sHost, int nPort, std::string user, std::string pwd, AUTH_TYPE eAuthType=at_md5)
 Connect to Asterisk.
bool Disconnect ()
 Disconnect from Asterisk.
MonitorXref OpenMonitor (std::string deviceId)
bool CloseMonitor (MonitorXref xref)
 Close a previously opened monitor.
AC_RESULT MakeCall (std::string callingDevice, std::string contextCalling, std::string calledDevice, DWORD &callid, std::string contextCalled, std::string callerIdName, std::string userData, std::string variable, bool bLockReaderAfterResponse=false)
 Originates a call from callingDevice to calleddevice using 'context'.
AC_RESULT MakePredictiveCall (std::string callingDevice, std::string contextCalling, std::string calledDevice, std::string contextCalled, DWORD &callid, std::string callerId, std::string userData, DWORD timeout, std::string variable, bool bLockReaderAfterResponse=false)
 Originate a predictive call from callingDevice to calledDevice using 'context'.
AC_RESULT ClearCall (DWORD callId)
 Disconnects a call identified by uniqueid/callid.
AC_RESULT ClearConnection (DWORD callid, std::string address)
 Disconnects a Connection identified by callId and device).
AC_RESULT FastTransfer (DWORD callId, std::string transferringDevice, std::string destination, std::string destinationContext)
 Redirects a call to an extsnsion.
AC_RESULT SetDoNotDisturb (std::string deviceId, bool bDND_on, std::string dndContext)
 Sets Do-not-disturb flag on/off.
AC_RESULT SetAgentStatus (std::string deviceId, std::string queue, AGENT_STATUS newStatus, std::string agentContext)
 Set agentState.
AC_RESULT HoldCall (DWORD callId, std::string holdingDevice, std::string holdContext)
AC_RESULT RetrieveCall (DWORD callId, std::string retreivingDevice, std::string retrieveContext)
AC_RESULT StartRecording (DWORD callid, std::string address, std::string RecordingFileName, std::string format, std::string mix)
 Start Recording.
AC_RESULT StopRecording (DWORD callid, std::string address)
 Stop Recording.
AC_RESULT PauseRecording (DWORD callid, std::string address)
 Pause Recording.
AC_RESULT UnpauseRecording (DWORD callid, std::string address)
 Unpause Recording.
AC_RESULT ChangeRecordingFileName (DWORD callid, std::string address, std::string NewRecordingFileName)
 Change Recording File Name.
DWORD GetNewCallId ()
bool DropCallId (DWORD idCall)
bool GetMonitorSet (DWORD callId, Set_xref &setXref)
 returns the monitor set linked to the given callid
void UnLockReader ()
void OnNewStateEvent (ManagerEvent ev)
 OnNewStateEvent handler.
void OnNewCallerIdEvent (ManagerEvent ev)
 OnNewCallerIdEvent handler.
void OnNewExten (ManagerEvent ev)
 OnNewExten handler.
void OnChannelEvent (ManagerEvent ev)
 OnChannelEvent handler.
void OnHangup (ManagerEvent ev)
 OnHangup handler.
void OnNewChannelEvent (ManagerEvent ev)
 OnNewChannelEvent handler.
void OnDialEvent (ManagerEvent ev)
 OnDialEvent handler.
void OnRenameEvent (ManagerEvent ev)
 OnRenameEvent handler.
void OnLinkEvent (ManagerEvent ev)
 OnLinkEvent handler.
void OnUnlinkEvent (ManagerEvent ev)
 OnUnLinkEvent handler.
void OnJoinEvent (ManagerEvent ev)
 OnJoinEvent handler.
void OnLeaveEvent (ManagerEvent ev)
 OnLeaveEvent handler.
void OnLinkDown ()
 OnLinkDown handler.
void OnUnparkedCallEvent (ManagerEvent ev)
 OnUnparked handler.
void OnOriginateFailureEvent (ManagerEvent ev)
 OnOriginateFailure handler.
void OnQueueCallerAbandonEvent (ManagerEvent ev)
 OnQueueCallerAbandon handler Asterisk 1.4.
void OnHoldEvent (ManagerEvent ev)
 OnHold event.
void OnUnholdEvent (ManagerEvent ev)
 OnUnhold event.

Static Public Member Functions

static ASTCstaProviderCreate (ASTCstaListener *listener, ASTLogListener *logger)
 factory method

Friends

class ASTTapiProvider


Detailed Description

This is the main class of Activa framework. Provides a csta-like programming interface.

This is the main class of Activa framework. Provides a csta-like programming interface. To create an instance you can call the Create() factory method Events are reported through a listener class implementing ASTCstaListener interface. A custom logger can be attached via ASTLogListener


Member Function Documentation

AC_RESULT ASTCstaProvider::ChangeRecordingFileName ( DWORD  callid,
std::string  address,
std::string  NewRecordingFileName 
) [virtual]

Change Recording File Name.

Change recording file name

Parameters:
callid identifier of call
address device
NewRecordingFileName Recording file name
Returns:
AC_RESULT: ok, no such channel, generic failure, timeout

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::ClearCall ( DWORD  callid  )  [virtual]

Disconnects a call identified by uniqueid/callid.

Hang up an established call

Parameters:
callid identifier of call
Returns:
AC_RESULT: ok, no such channel, generic failure, timeout

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::ClearConnection ( DWORD  callid,
std::string  address 
) [virtual]

Disconnects a Connection identified by callId and device).

Hang up an established Connection

Parameters:
callid identifier of call
address device
Returns:
AC_RESULT: ok, no such channel, generic failure, timeout

Implements ASTCstaProviderInterface.

bool ASTCstaProvider::CloseMonitor ( MonitorXref  xref  )  [virtual]

Close a previously opened monitor.

Close a monitor with reference xref

Parameters:
xref the monitor you want to close
Returns:
bool if monitor is closed correctly or not

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::Connect ( std::string  sHost,
int  nPort,
std::string  user,
std::string  pwd,
AUTH_TYPE  eAuthType = at_md5 
) [virtual]

Connect to Asterisk.

Connects to asterisk

Parameters:
sHost ip host address of asterisk box
nPort ip port asterisk manaegr api is listening to. Usually default asterisk configuration port is 5038
user user, ie: admin
pwd password, ie: amp111
eAuthType authentification type 0-plaintext 1-md5
Returns:
Returns AC_RESULT

Implements ASTCstaProviderInterface.

ASTCstaProvider * ASTCstaProvider::Create ( ASTCstaListener cstaListener,
ASTLogListener logger 
) [static]

factory method

ASTCstaProvider factory method. Creates a ASTCstaProvider and attach a listener.

Parameters:
cstaListener csta event listener
logger logger, can be null
Returns:
Returns NULL if cannot create or listener is null.

bool ASTCstaProvider::Disconnect (  )  [virtual]

Disconnect from Asterisk.

Disconnect from Asterisk

Returns:
bool

Implements ASTCstaProviderInterface.

bool ASTCstaProvider::DropCallId ( DWORD  idCall  )  [inline, virtual]

Returns:
result This method is implemented ONLY to allow ASTTapiProvider::TSPI_lineMakeCall() to drop a idCall previously acquired through GetCallId()

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::FastTransfer ( DWORD  callId,
std::string  transferringDevice,
std::string  destination,
std::string  destinationContext 
) [virtual]

Redirects a call to an extsnsion.

Do a FastTransfer from one device to another.

Parameters:
callId identifier of call
transferringDevice 
destination 
destinationContext 
Returns:
AC_RESULT: ok, generic failure, timeout

Implements ASTCstaProviderInterface.

DWORD ASTCstaProvider::GetNewCallId (  )  [inline, virtual]

Returns:
New Callid This method is implemented ONLY to allow ASTTapiProvider::TSPI_lineMakeCall() to get a real unique callid before Originate().

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::HoldCall ( DWORD  callId,
std::string  holdingDevice,
std::string  holdContext 
) [virtual]

Put a call in HOLD state

Parameters:
callId identifier of call
holdingDevice 
holdContext 
Returns:
AC_RESULT: ok, generic failure, timeout

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::MakeCall ( std::string  callingDevice,
std::string  contextCalling,
std::string  calledDevice,
DWORD &  callid,
std::string  contextCalled,
std::string  callerIdName,
std::string  userData,
std::string  variable,
bool  bLockReaderAfterResponse = false 
) [virtual]

Originates a call from callingDevice to calleddevice using 'context'.

CallerIdName may set caller_id_name info

Parameters:
callingDevice Device who makes the call
calledDevice Device who is called
callid if callId is 0, it generates a new one
context 
callerIdName 
userData 
Returns:
AC_RESULT: ok, generic failure, timeout

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::MakePredictiveCall ( std::string  callingDevice,
std::string  contextCalling,
std::string  calledDevice,
std::string  contextCalled,
DWORD &  callid,
std::string  callerId,
std::string  userData,
DWORD  timeout,
std::string  variable,
bool  bLockReaderAfterResponse = false 
) [virtual]

Originate a predictive call from callingDevice to calledDevice using 'context'.

A predictive call is a call that originates in callingDevice an is transferred to callerDevice

Parameters:
callingDevice Device who makes the call
contextCalling 
calledDevice Device who is called
contextCalled 
callid if callId is 0, it generates a new one
callerId 
userData 
timeout 
Returns:
AC_RESULT: ok, generic failure, timeout

Implements ASTCstaProviderInterface.

void ASTCstaProvider::OnChannelEvent ( ManagerEvent  ev  )  [virtual]

OnChannelEvent handler.

Channel Event. Currently not used

Parameters:
ev 

Implements ASTListener.

void ASTCstaProvider::OnDialEvent ( ManagerEvent  ev  )  [virtual]

OnDialEvent handler.

Dial generates new call leg DialEvent info srcUniqueId = original call uniqueId destUniqueId = new call leg uniqueId

Parameters:
ev 

/Fix: Asterisk 1.4 compatibility update source callerid

Bug:
: if a new call is incoming into an ACD, fails because don't exist another call with the same callid and callerid

Implements ASTListener.

void ASTCstaProvider::OnHangup ( ManagerEvent  ev  )  [virtual]

OnHangup handler.

Hangup event

Parameters:
ev 

Implements ASTListener.

void ASTCstaProvider::OnHoldEvent ( ManagerEvent  ev  )  [virtual]

OnHold event.

OnHold event. It's produce when a user press Hold button in phone

Implements ASTListener.

void ASTCstaProvider::OnJoinEvent ( ManagerEvent  ev  )  [virtual]

OnJoinEvent handler.

Join Event: used when a call enter on a queue HEADER: event DATA: Join HEADER: privilege DATA: call,all HEADER: channel DATA: mISDN/1-1 HEADER: callerid DATA: 317 HEADER: calleridname DATA: unknown HEADER: queue DATA: 555 HEADER: position DATA: 1 HEADER: count DATA: 1

Parameters:
ev 

Implements ASTListener.

void ASTCstaProvider::OnLeaveEvent ( ManagerEvent  ev  )  [virtual]

OnLeaveEvent handler.

OnLeave event: Used when a call leave a queue

Parameters:
ev 

m_log.LogTrace("ASTCstaProvider::handleConnectionDequeued uniqueId=%s, address=%s, queue=%s", pCall->GetUniqueId().c_str(), address.c_str(), queue.c_str());

Implements ASTListener.

void ASTCstaProvider::OnLinkDown (  )  [virtual]

OnLinkDown handler.

handles provider link-down

Implements ASTListener.

void ASTCstaProvider::OnLinkEvent ( ManagerEvent  ev  )  [virtual]

OnLinkEvent handler.

Two channels got linked. This event is received when the audio channels are connected (too late). For this reason it can't be used to link calls

Parameters:
ev 

Implements ASTListener.

void ASTCstaProvider::OnNewCallerIdEvent ( ManagerEvent  ev  )  [virtual]

OnNewCallerIdEvent handler.

CallerId event is generated if the CallerId is set by the extensions configuration

Parameters:
ev 

Implements ASTListener.

void ASTCstaProvider::OnNewChannelEvent ( ManagerEvent  ev  )  [virtual]

OnNewChannelEvent handler.

NewChannel event

Parameters:
ev 

Implements ASTListener.

void ASTCstaProvider::OnNewExten ( ManagerEvent  ev  )  [virtual]

OnNewExten handler.

NewExten event used for dialplan. Currently not used

Parameters:
ev 

Implements ASTListener.

void ASTCstaProvider::OnNewStateEvent ( ManagerEvent  ev  )  [virtual]

OnNewStateEvent handler.

NewState Event

Parameters:
ev 

Implements ASTListener.

void ASTCstaProvider::OnOriginateFailureEvent ( ManagerEvent  ev  )  [virtual]

OnOriginateFailure handler.

OriginateFailure event. It's produced when a callback fails

Implements ASTListener.

void ASTCstaProvider::OnQueueCallerAbandonEvent ( ManagerEvent  ev  )  [virtual]

OnQueueCallerAbandon handler Asterisk 1.4.

QueueCallerAbandon event. It's produce in Asterisk 1.4 when a caller abandon a queue

Implements ASTListener.

void ASTCstaProvider::OnRenameEvent ( ManagerEvent  ev  )  [virtual]

OnRenameEvent handler.

Rename event

Parameters:
ev 

Todo:
: when the support of transferences will be included, should be send a transfer event.

Implements ASTListener.

void ASTCstaProvider::OnUnholdEvent ( ManagerEvent  ev  )  [virtual]

OnUnhold event.

OnUnhold event. It's produced when a user press unhold button in phone

Implements ASTListener.

void ASTCstaProvider::OnUnlinkEvent ( ManagerEvent  ev  )  [virtual]

OnUnLinkEvent handler.

Channels link was broken This event is received when the audio channels are broken (too early). For this reason this event cannot be used to unlink calls.

Parameters:
ev 

Implements ASTListener.

void ASTCstaProvider::OnUnparkedCallEvent ( ManagerEvent  ev  )  [virtual]

OnUnparked handler.

UnparkedCall event: used when a call leave a park extension FIX: if the call before to be parked had a CSTALink, the call after unparked will have it too

it is possible that they have been sent events to a new call. To correct it, we send a hangup of pACFrom and then link the two calls.

Implements ASTListener.

MonitorXref ASTCstaProvider::OpenMonitor ( std::string  channel  )  [virtual]

Opens a monitor to a device. Monitors are refererd by an opaque int handler known as monitor xref (monitor cross-reference)

Opens a new monitor interested in events on specific deviceID. DeviceId can be an address/extension (example: 311) or a full channel spec (example: sip/311) and it is parsed to extract the address part.

Parameters:
channel what channel, address or extension do you want to monitoring
Returns:
number of monitor

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::PauseRecording ( DWORD  callid,
std::string  address 
) [virtual]

Pause Recording.

Pause recording

Parameters:
callid identifier of call
address device
Returns:
AC_RESULT: ok, no such channel, generic failure, timeout

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::RetrieveCall ( DWORD  callId,
std::string  retreivingDevice,
std::string  retrieveContext 
) [virtual]

Retrieve a hold call

Parameters:
callId identifier of call
retreivingDevice 
retrieveContext 
Returns:
AC_RESULT: ok, generic failure, timeout

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::SetAgentStatus ( std::string  deviceId,
std::string  queue,
AGENT_STATUS  newStatus,
std::string  agentContext 
) [virtual]

Set agentState.

Set agentState. If deviceId is not a full channel identifier including technology will default to local/deviceId

Parameters:
deviceId 
queue 
newStatus 
agentContext 
Returns:
AC_RESULT: ok, already logged in, queue not specified, no such queue, generic failure

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::SetDoNotDisturb ( std::string  deviceId,
bool  bDND_on,
std::string  dndContext 
) [virtual]

Sets Do-not-disturb flag on/off.

SetDoNotDisturb actually implemented as SetAgentStatus (READY/NOTREADY)

Parameters:
deviceId 
bDND_on 
dndContext 
Returns:
AC_RESULT: ok, already logged in, queue not specified, no such queue, generic failure

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::StartRecording ( DWORD  callid,
std::string  address,
std::string  RecordingFileName,
std::string  format,
std::string  mix 
) [virtual]

Start Recording.

Start recording

Parameters:
callid identifier of call
address device
RecordingFileName Recording file name
Returns:
AC_RESULT: ok, no such channel, generic failure, timeout

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::StopRecording ( DWORD  callid,
std::string  address 
) [virtual]

Stop Recording.

Stop recording

Parameters:
callid identifier of call
address device
Returns:
AC_RESULT: ok, no such channel, generic failure, timeout

Implements ASTCstaProviderInterface.

void ASTCstaProvider::UnLockReader (  )  [inline, virtual]

UnLocks Reader Thread

Implements ASTCstaProviderInterface.

AC_RESULT ASTCstaProvider::UnpauseRecording ( DWORD  callid,
std::string  address 
) [virtual]

Unpause Recording.

Continue recording after pause

Parameters:
callid identifier of call
address device
Returns:
AC_RESULT: ok, no such channel, generic failure, timeout

Implements ASTCstaProviderInterface.


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