ASTCallMap Class Reference

This class administer all call maps of ActivaTSP. More...

#include <call_map.h>

List of all members.

Public Member Functions

 ASTCallMap (ASTLogListener *pLog)
 ~ASTCallMap ()
void __WaitForMapLock ()
void __ReleaseMapLock ()
void AddXref (std::string deviceId, MonitorXref newxref)
bool RemoveXref (MonitorXref xref)
std::string GetDeviceFromMonitor (MonitorXref xref)
void AddConnectionToCallModel (DWORD callId, std::string deviceId, csta_states deviceState)
csta_states GetStateOfDevice (DWORD callId, std::string device)
void RemoveConnectionFromCallModel (DWORD callId, std::string deviceId)
void RemoveCallFromCallModel (DWORD callId)
bool GetMonitorSetFromCallModel (DWORD callId, Set_xref &setXref)
AsteriskCallGetOrCreateCall (std::string _uniqueId)
AsteriskCallFindCallByUniqueId (std::string uniqueId)
AsteriskCallFindCallByChannel (std::string channel)
AsteriskCallFindCallByAddress (std::string address)
AsteriskCallFindCallByCallId (DWORD callId)
AsteriskCallFindCallByCallIdAndDevice (DWORD callId, std::string device)
AsteriskCall_deprecated__FindCallByCID (std::string cid, DWORD callId)
AsteriskCallGetSourceCall (AsteriskCall *pAC)
DWORD GetLogicCallId (AsteriskCall *pAC)
void GetSetCallIdByDevice (std::string device, Set_callId &setCallId)
bool GetCIDInfoFromSourceCall (AsteriskCall *pAC, std::string &cid, std::string &cidname, std::string &userData)
void GetDestinationCallSet (std::string sourceUniqueId, Set_uniqueId &setUniqueid)
bool IsLocalCall (DWORD callId)
bool HasDestinationCall (AsteriskCall *pAC)
bool _deprecated__ExistCSTACall (DWORD callId, std::string device)
void RemoveCallByUniqueId (std::string uniqueId)
void GetSetDevicesFromCallId (DWORD callId, Set_deviceId &setDevices)
void CleanupMaps ()
void DumpMaps ()
virtual DWORD GetNewCallId () sealed

Static Public Member Functions

static std::string CSTAState2Str (csta_states state)

Protected Attributes

Set_callId m_callIdSet
 set of active callId. Used by GetNewCallId() and DropCallId(callid)
Map_deviceId2setXref m_mapDeviceId2Xref
 map of deviceId (extensions) to list of references (xref).
Map_callId2setDeviceId m_mapCallId2DeviceId
 map of callId to list of devices (extensions)
Map_UniqueId2AsteriskCall m_uniqueId2Asteriskcall
 map of {uniqueId, AsteriskCall}


Detailed Description

This class administer all call maps of ActivaTSP.

It encapsulates three different callmaps:


Constructor & Destructor Documentation

ASTCallMap::ASTCallMap ( ASTLogListener logger  ) 

Construct a map with Asterisk calls and CSTA calls

ASTCallMap::~ASTCallMap (  ) 

destruct the map


Member Function Documentation

void ASTCallMap::__ReleaseMapLock (  ) 

Leaves a critical section

void ASTCallMap::__WaitForMapLock (  ) 

Enter into a critical section

bool ASTCallMap::_deprecated__ExistCSTACall ( DWORD  callId,
std::string  device 
)

Search if exist an entry in CSTAMap with the specific callId and device

Parameters:
callId 
device 
Returns:
Retuns true or false if exist an entry in CSTAMap with the specific callId and device

AsteriskCall * ASTCallMap::_deprecated__FindCallByCID ( std::string  cid,
DWORD  callid 
)

Find another call (different of callid) with the same CID

Parameters:
cid 
callid 
Returns:
the fist AsteriskCall or null if it doesn't exist

void ASTCallMap::AddConnectionToCallModel ( DWORD  callId,
std::string  deviceId,
csta_states  deviceState 
)

Update CSTA call map [callId] -> device -> state

Parameters:
callId identifier of the call
deviceId device
deviceState The state of device: can be Initialited, Alerting, Connected, Failed, Held.

void ASTCallMap::AddXref ( std::string  address,
MonitorXref  newxref 
)

Add a new reference on m_mapDeviceId2Xref map

Parameters:
address device or extension
newxref number of monitor

void ASTCallMap::CleanupMaps (  ) 

Cleanup all call maps

std::string ASTCallMap::CSTAState2Str ( csta_states  state  )  [static]

Convert from csta_state to std::string

void ASTCallMap::DumpMaps (  ) 

Dump all call maps

AsteriskCall * ASTCallMap::FindCallByAddress ( std::string  address  ) 

Find an AsteriskCall with a specify Address.

Parameters:
address 
Returns:
an AsteriskCall or null if it doesn't exist.

AsteriskCall * ASTCallMap::FindCallByCallId ( DWORD  callId  ) 

Find an AsteriskCall with a specify callId.

Parameters:
callId 
Returns:
the fist AsteriskCall or null if it doesn't exist

AsteriskCall * ASTCallMap::FindCallByCallIdAndDevice ( DWORD  callId,
std::string  device 
)

Find an AsteriskCall with a specify callID and device.

Parameters:
callId 
device 
Returns:
the fist AsteriskCall or null if it doesn't exist

AsteriskCall * ASTCallMap::FindCallByChannel ( std::string  _channel  ) 

Find an AsteriskCall with a specify channel

Parameters:
_channel 
Returns:
an AsteriskCall or null if it doesn't exist

AsteriskCall * ASTCallMap::FindCallByUniqueId ( std::string  _uniqueId  ) 

Find an AsteriskCall with a specify uniqueId

Parameters:
_uniqueId 
Returns:
an AsteriskCall or null if does not exist any call in m_uniqueId2Asteriskcall.

bool ASTCallMap::GetCIDInfoFromSourceCall ( AsteriskCall pAC,
std::string &  cid,
std::string &  cidname,
std::string &  userData 
)

Extract callerID, callerIDname and userData from a call

Parameters:
pAC 
cid by reference
cidname by reference
userData by reference
Returns:
false if the AsteriskCall specify is null or if the map of Asterisk calls is too deep.

void ASTCallMap::GetDestinationCallSet ( std::string  sourceUniqueId,
Set_uniqueId &  setUniqueid 
)

Looks for the set of calls (identified by its uniqueid) that have a given sourceUniqueId. Search is based on list-scan so its complexity is O(n)

Parameters:
sourceUniqueId 
setUniqueid by reference

std::string ASTCallMap::GetDeviceFromMonitor ( MonitorXref  xref  ) 

Return the device of the monitor

Parameters:
xref monitor reference
Returns:
string with device

DWORD ASTCallMap::GetLogicCallId ( AsteriskCall pAC  ) 

Find the callId of the call. The first AsteriskCall contains the logic CallId.

Parameters:
pAC 
Returns:
Returns the callId of the source call.

bool ASTCallMap::GetMonitorSetFromCallModel ( DWORD  callId,
Set_xref &  setXref 
)

Get a set of reference with the same callId.

Parameters:
callId identifier of call.
setXref set of reference.
Returns:
true if exist any call with this callId, otherwise false

DWORD ASTCallMap::GetNewCallId (  )  [sealed, virtual]

Generate unique callID

Returns:
new CallID

AsteriskCall * ASTCallMap::GetOrCreateCall ( std::string  _uniqueId  ) 

Get a call with uniqueId specify. Otherwise, create one with a new callID.

Parameters:
_uniqueId 
Returns:
an AsteriskCall with call

void ASTCallMap::GetSetCallIdByDevice ( std::string  device,
Set_callId &  setCallId 
)

Search all callId that one device can have got

Parameters:
device 
setCallId set of callId with device specify

void ASTCallMap::GetSetDevicesFromCallId ( DWORD  callId,
Set_deviceId &  setDevices 
)

Search set devices with one callId

Parameters:
callId 
setDevices by reference.

AsteriskCall * ASTCallMap::GetSourceCall ( AsteriskCall pAC  ) 

Walks through Asterisk call map and returns the source/originator call. That call hasn't got sourceUniqueId. we cannot assert there are no oops in the walk so implementation is not recursive. walk limited to MAX_LINKED_CALLS deep by implementation.

Parameters:
pAC 
Returns:
Source AsteriskCall or null if there is one or itself is none

csta_states ASTCallMap::GetStateOfDevice ( DWORD  callId,
std::string  deviceId 
)

Returns the state of device specify on CSTA call map.

Parameters:
callId identifier of the call
deviceId identifier of device
Returns:
string with state of device

bool ASTCallMap::HasDestinationCall ( AsteriskCall pAC  ) 

Scan if an AsteriskCall has a destination

Parameters:
pAC 
Returns:
true if has destination, otherwise return false

bool ASTCallMap::IsLocalCall ( DWORD  callId  ) 

Find if a call specify with callId has only local channels

Parameters:
callId 
Returns:
True if only has local channels. Otherwise return false.

void ASTCallMap::RemoveCallByUniqueId ( std::string  uniqueId  ) 

Remove m_uniqueId2Asteriskcall map

Parameters:
uniqueId 

void ASTCallMap::RemoveCallFromCallModel ( DWORD  callId  ) 

Removes a call from CSTA call map.

Parameters:
callId 

void ASTCallMap::RemoveConnectionFromCallModel ( DWORD  callId,
std::string  deviceId 
)

Removes a connection from CSTA call map.

Parameters:
callId identifier of the call
deviceId identifier of device

bool ASTCallMap::RemoveXref ( MonitorXref  xref  ) 

Removes a reference from the monitor map

Parameters:
xref reference to search
Returns:
true if the reference was removed correctly


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