#include <lidep.h>
Inheritance diagram for OpalLIDEndPoint:
Public Member Functions | |
Overrides from OpalEndPoint | |
virtual BOOL | MakeConnection (OpalCall &call, const PString &party, void *userData=NULL, unsigned int options=0, OpalConnection::StringOptions *stringOptions=NULL) |
virtual BOOL | OnSetUpConnection (OpalLineConnection &connection) |
virtual OpalMediaFormatList | GetMediaFormats () const |
Connection management | |
virtual OpalLineConnection * | CreateConnection (OpalCall &call, OpalLine &line, void *userData, const PString &number) |
LID management | |
PSafePtr< OpalLineConnection > | GetLIDConnectionWithLock (const PString &token, PSafetyMode mode=PSafeReadWrite) |
BOOL | AddLine (OpalLine *line) |
void | RemoveLine (OpalLine *line) |
const PList< OpalLine > & | GetLines () const |
void | RemoveLine (const PString &token) |
void | RemoveAllLines () |
virtual BOOL | AddLinesFromDevice (OpalLineInterfaceDevice &device) |
void | RemoveLinesFromDevice (OpalLineInterfaceDevice &device) |
BOOL | AddDeviceNames (const PStringArray &descriptors) |
BOOL | AddDeviceName (const PString &descriptor) |
virtual BOOL | AddDevice (OpalLineInterfaceDevice *device) |
void | RemoveDevice (OpalLineInterfaceDevice *device) |
OpalLine * | GetLine (const PString &lineName, BOOL enableAudio=FALSE) const |
void | SetDefaultLine (const PString &lineName) |
Protected Member Functions | |
PDECLARE_NOTIFIER (PThread, OpalLIDEndPoint, MonitorLines) | |
virtual void | MonitorLine (OpalLine &line) |
Protected Attributes | |
OpalLIDList | devices |
OpalLineList | lines |
PString | defaultLine |
PMutex | linesMutex |
PThread * | monitorThread |
PSyncPoint | exitFlag |
OpalLIDEndPoint::OpalLIDEndPoint | ( | OpalManager & | manager, | |
const PString & | prefix, | |||
unsigned | attributes | |||
) |
Create a new endpoint.
manager | Manager of all endpoints. |
prefix | Prefix for URL style address strings |
attributes | Bit mask of attributes endpoint has |
OpalLIDEndPoint::~OpalLIDEndPoint | ( | ) |
Make sure thread has stopped before exiting.
OpalLIDEndPoint::OpalLIDEndPoint | ( | OpalManager & | manager, | |
const PString & | prefix, | |||
unsigned | attributes | |||
) |
Create a new endpoint.
manager | Manager of all endpoints. |
prefix | Prefix for URL style address strings |
attributes | Bit mask of attributes endpoint has |
OpalLIDEndPoint::~OpalLIDEndPoint | ( | ) |
Make sure thread has stopped before exiting.
virtual BOOL OpalLIDEndPoint::MakeConnection | ( | OpalCall & | call, | |
const PString & | party, | |||
void * | userData = NULL , |
|||
unsigned int | options = 0 , |
|||
OpalConnection::StringOptions * | stringOptions = NULL | |||
) | [virtual] |
Set up a connection to a remote party. This is called from the OpalManager::MakeConnection() function once it has determined that this is the endpoint for the protocol.
The general form for this party parameter is:
[proto:][alias@][transport$]address[:port]
where the various fields will have meanings specific to the endpoint type. For example, with H.323 it could be "h323:Fred@site.com" which indicates a user Fred at gatekeeper size.com. Whereas for the PSTN endpoint it could be "pstn:5551234" which is to call 5551234 on the first available PSTN line.
The proto field is optional when passed to a specific endpoint. If it is present, however, it must agree with the endpoints protocol name or FALSE is returned.
This function usually returns almost immediately with the connection continuing to occur in a new background thread.
If FALSE is returned then the connection could not be established. For example if a PSTN endpoint is used and the assiciated line is engaged then it may return immediately. Returning a non-NULL value does not mean that the connection will succeed, only that an attempt is being made.
The default behaviour is pure.
call | Owner of connection |
party | Remote party to call |
userData | Arbitrary data to pass to connection |
options | options to pass to conneciton |
Implements OpalEndPoint.
virtual BOOL OpalLIDEndPoint::OnSetUpConnection | ( | OpalLineConnection & | connection | ) | [virtual] |
Callback for outgoing connection, it is invoked after OpalLineConnection::SetUpConnection This function allows the application to set up some parameters or to log some messages
virtual OpalMediaFormatList OpalLIDEndPoint::GetMediaFormats | ( | ) | const [virtual] |
Get the data formats this endpoint is capable of operating. This provides a list of media data format names that may be used by an OpalMediaStream may be created by a connection from this endpoint.
Note that a specific connection may not actually support all of the media formats returned here, but should return no more.
The default behaviour is pure.
Implements OpalEndPoint.
virtual OpalLineConnection* OpalLIDEndPoint::CreateConnection | ( | OpalCall & | call, | |
OpalLine & | line, | |||
void * | userData, | |||
const PString & | number | |||
) | [virtual] |
call | Call that owns the connection |
line | Line connection is to use |
userData | Arbitrary user data from MakeConnection |
number | Number to dial in outgoing call |
PSafePtr<OpalLineConnection> OpalLIDEndPoint::GetLIDConnectionWithLock | ( | const PString & | token, | |
PSafetyMode | mode = PSafeReadWrite | |||
) | [inline] |
Find a connection that uses the specified token. This searches the endpoint for the connection that contains the token as provided by functions such as MakeConnection().
token | Token to identify connection |
BOOL OpalLIDEndPoint::AddLine | ( | OpalLine * | line | ) |
Add a line to the endpoint. Note that once the line is added it is "owned" by the endpoint and should not be deleted directly. Use the RemoveLine() function to delete the line.
Returns TRUE if the lines device was open and the line was added.
void OpalLIDEndPoint::RemoveLine | ( | OpalLine * | line | ) |
Remove a line from the endpoint. The line is removed from the endpoints processing and deleted.
const PList<OpalLine>& OpalLIDEndPoint::GetLines | ( | ) | const [inline] |
get all lines of the endpopint
void OpalLIDEndPoint::RemoveLine | ( | const PString & | token | ) |
Remove a line from the endpoint. The line is removed from the endpoints processing and deleted.
void OpalLIDEndPoint::RemoveAllLines | ( | ) |
Remove all lines from the endpoint. The line is removed from the endpoints processing and deleted. All devices are also deleted from the endpoint
virtual BOOL OpalLIDEndPoint::AddLinesFromDevice | ( | OpalLineInterfaceDevice & | device | ) | [virtual] |
Add all lines on a device to the endpoint. Note that once the line is added it is "owned" by the endpoint and should not be deleted directly. Use the RemoveLine() function to delete the line.
Note the device should already be open or no lines are added.
Returns TRUE if at least one line was added.
device | Device to add lines |
void OpalLIDEndPoint::RemoveLinesFromDevice | ( | OpalLineInterfaceDevice & | device | ) |
Remove all lines on a device from the endpoint. The lines are removed from the endpoints processing and deleted.
device | Device to remove lines |
BOOL OpalLIDEndPoint::AddDeviceNames | ( | const PStringArray & | descriptors | ) |
Add a line interface devices to the endpoint by name. This calls AddDeviceName() for each entry in the array.
Returns TRUE if at least one line from one device was added.
descriptors | Device descritptions to add |
BOOL OpalLIDEndPoint::AddDeviceName | ( | const PString & | descriptor | ) |
Add a line interface device to the endpoint by name. This will add the registered OpalLineInterfaceDevice descendent and all of the lines that it has to the endpoint. The parameter is a string as would be returned from the OpalLineInterfaceDevice::GetAllDevices() function.
Returns TRUE if at least one line was added or the descriptor was already present.
descriptor | Device descritption to add |
virtual BOOL OpalLIDEndPoint::AddDevice | ( | OpalLineInterfaceDevice * | device | ) | [virtual] |
Add a line interface device to the endpoint. This will add the OpalLineInterfaceDevice descendent and all of the lines that it has to the endpoint.
The lid is then "owned" by the endpoint and will be deleted automatically when the endpoint is destroyed.
Note the device should already be open or no lines are added.
Returns TRUE if at least one line was added.
device | Device to add |
void OpalLIDEndPoint::RemoveDevice | ( | OpalLineInterfaceDevice * | device | ) |
Remove the device and all its lines from the endpoint. The device will be automatically deleted.
device | Device to remove |
OpalLine* OpalLIDEndPoint::GetLine | ( | const PString & | lineName, | |
BOOL | enableAudio = FALSE | |||
) | const |
Get the line by name. The lineName parameter may be "*" to matche the first line.
If the enableAudio flag is TRUE then the EnableAudio() function is called on the line and it is returns only if successful. This effectively locks the line for exclusive use of the caller.
lineName | Name of line to get. |
enableAudio | Flag to enable audio on the line. |
void OpalLIDEndPoint::SetDefaultLine | ( | const PString & | lineName | ) |
Set the default line to be used on call. If the lineName is "*" then the first available line is used.
lineName | Name of line to set to default. |
OpalLIDEndPoint::PDECLARE_NOTIFIER | ( | PThread | , | |
OpalLIDEndPoint | , | |||
MonitorLines | ||||
) | [protected] |
virtual void OpalLIDEndPoint::MonitorLine | ( | OpalLine & | line | ) | [protected, virtual] |
OpalLIDList OpalLIDEndPoint::devices [protected] |
OpalLineList OpalLIDEndPoint::lines [protected] |
PString OpalLIDEndPoint::defaultLine [protected] |
PMutex OpalLIDEndPoint::linesMutex [protected] |
PThread* OpalLIDEndPoint::monitorThread [protected] |
PSyncPoint OpalLIDEndPoint::exitFlag [protected] |