# class CallEndpoint

An abstract call endpoint. More...

Full name | `TelEngine::CallEndpoint`
Definition | `#include <yatephone.h>`
Inherits | TelEngine::RefObject [public ]
Inherited by | Channel, ClientChannel
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- virtual void destroyed ()
- virtual void* getObject (const String& name) const
- virtual const String& toString () const
- inline const String& id () const
- inline CallEndpoint* getPeer () const
- bool getPeerId (String& id) const
- String getPeerId () const
- inline Mutex* mutex () const
- bool connect (CallEndpoint* peer, const char* reason = 0, bool notify = true)
- inline bool disconnect (const char* reason = 0, bool notify = true, const NamedList* params = 0)
- inline bool disconnect (const char* reason, const NamedList& params)
- DataEndpoint* getEndpoint (const String& type = CallEndpoint::audioType()) const
- DataEndpoint* setEndpoint (const String& type = CallEndpoint::audioType())
- void clearEndpoint (const String& type = String::empty())
- void setSource (DataSource* source = 0, const String& type = CallEndpoint::audioType())
- DataSource* getSource (const String& type = CallEndpoint::audioType()) const
- void setConsumer (DataConsumer* consumer = 0, const String& type = CallEndpoint::audioType())
- DataConsumer* getConsumer (const String& type = CallEndpoint::audioType()) const
- bool clearData (DataNode* node, const String& type = CallEndpoint::audioType())

#### Public Static Methods

- static Mutex& commonMutex ()
- static const String& audioType ()

#### Protected Methods

- CallEndpoint (const char* id = 0)
- virtual void connected (const char* reason)
- virtual void disconnected (bool final, const char* reason)
- virtual void setDisconnect (const NamedList* params)
- void setPeer (CallEndpoint* peer, const char* reason = 0, bool notify = true, const NamedList* params = 0)
- void setEndpoint (DataEndpoint* endPoint)
- virtual void setId (const char* newId)

#### Protected Members

- ObjList m_data
- Mutex* m_mutex

## Detailed Description

A class that holds common call control and data related features

ObjList m_data

### m_data

[protected]

Mutex* m_mutex

### m_mutex

[protected]

void destroyed ()

### destroyed

[virtual]

Destruct notification, performs cleanups

Reimplemented from RefObject.

void* getObject (const String& name)

### getObject

[const virtual]

Get a pointer to a derived class given that class name

Parameters:

name | Name of the class we are asking for

Returns: Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented from RefObject.

const String& toString ()

### toString

[const virtual]

Get a string representation of this channel

Returns: A reference to the name of this object

Reimplemented from GenObject.

inline const String& id ()

### id

[const]

Get the unique channel identifier

Returns: A String holding the unique channel id

inline CallEndpoint* getPeer ()

### getPeer

[const]

Get the connected peer call

Returns: Pointer to connected peer call or NULL

bool getPeerId (String& id)

### getPeerId

[const]

Get the connected peer call id in a caller supplied String

Parameters:

id | String to fill in

Returns: True if the call endpoint had a peer

String getPeerId ()

### getPeerId

[const]

Get the connected peer call id

Returns: Connected peer call id or empty string

inline Mutex* mutex ()

### mutex

[const]

Get the mutex that serializes access to this call endpoint, if any

Returns: Pointer to the call's mutex object or NULL

Mutex& commonMutex ()

### commonMutex

[static]

Get the big mutex that serializes access to all call endpoints

Returns: A reference to the mutex

bool connect (CallEndpoint* peer, const char* reason = 0, bool notify = true)

### connect

Connect the call endpoint to a peer.

Parameters:

peer | Pointer to the peer call endpoint.
reason | Text that describes connect reason.
notify | Call disconnected() notification method on old peer

Returns: True if connected, false if an error occured.

inline bool disconnect (const char* reason = 0, bool notify = true, const NamedList* params = 0)

### disconnect

Disconnect from the connected peer call endpoint.

Parameters:

reason | Text that describes disconnect reason.
notify | Call disconnected() notification method on old peer
params | Optional pointer to extra parameters for disconnect cause

Returns: True if the object was deleted, false if it still exists

inline bool disconnect (const char* reason, const NamedList& params)

### disconnect

Disconnect from the connected peer call endpoint and notify old peer.

Parameters:

reason | Text that describes disconnect reason.
params | Extra parameters for disconnect cause

Returns: True if the object was deleted, false if it still exists

DataEndpoint* getEndpoint (const String& type = CallEndpoint::audioType())

### getEndpoint

[const]

Get a data endpoint of this object

Parameters:

type | Type of data endpoint: "audio", "video", "text"

Returns: A pointer to the DataEndpoint object or NULL if not found

DataEndpoint* setEndpoint (const String& type = CallEndpoint::audioType())

### setEndpoint

Get a data endpoint of this object, create if required

Parameters:

type | Type of data endpoint: "audio", "video", "text"

Returns: A pointer to the DataEndpoint object or NULL if an error occured

void clearEndpoint (const String& type = String::empty())

### clearEndpoint

Clear one or all data endpoints of this object

Parameters:

type | Type of data endpoint: "audio", "video", "text", NULL to clear all

void setSource (DataSource* source = 0, const String& type = CallEndpoint::audioType())

### setSource

Set a data source of this object

Parameters:

source | A pointer to the new source or NULL
type | Type of data node: "audio", "video", "text"

DataSource* getSource (const String& type = CallEndpoint::audioType())

### getSource

[const]

Get a data source of this object

Parameters:

type | Type of data node: "audio", "video", "text"

Returns: A pointer to the DataSource object or NULL

void setConsumer (DataConsumer* consumer = 0, const String& type = CallEndpoint::audioType())

### setConsumer

Set the data consumer of this object

Parameters:

consumer | A pointer to the new consumer or NULL
type | Type of data node: "audio", "video", "text"

DataConsumer* getConsumer (const String& type = CallEndpoint::audioType())

### getConsumer

[const]

Get the data consumer of this object

Parameters:

type | Type of data node: "audio", "video", "text"

Returns: A pointer to the DataConsumer object or NULL

bool clearData (DataNode* node, const String& type = CallEndpoint::audioType())

### clearData

Clear a data node from any slot of a DataEndpoint of this object

Parameters:

node | Pointer to DataSource or DataConsumer to clear
type | Type of data node: "audio", "video", "text"

Returns: True if the node was removed from at least one slot

const String& audioType ()

### audioType

[static]

Return the defaul audio type "audio"

Returns: Return a string naming the "audio" type

CallEndpoint (const char* id = 0)

### CallEndpoint

[protected]

Constructor

void connected (const char* reason)

### connected

[protected virtual]

Connect notification method.

Parameters:

reason | Text that describes connect reason.

void disconnected (bool final, const char* reason)

### disconnected

[protected virtual]

Disconnect notification method.

Parameters:

final | True if this disconnect was called from the destructor.
reason | Text that describes disconnect reason.

void setDisconnect (const NamedList* params)

### setDisconnect

[protected virtual]

Set disconnect parameters

Parameters:

params | Pointer to disconnect cause parameters, NULL to reset them

void setPeer (CallEndpoint* peer, const char* reason = 0, bool notify = true, const NamedList* params = 0)

### setPeer

[protected]

Set the peer call endpoint pointer.

Parameters:

peer | A pointer to the new peer or NULL.
reason | Text describing the reason in case of disconnect.
notify | Call notification methods - connected() or disconnected()
params | Optional pointer to extra parameters for disconnect cause

void setEndpoint (DataEndpoint* endPoint)

### setEndpoint

[protected]

Set a foreign data endpoint in this object

Parameters:

endPoint | Data endpoint to set, will replace one with same type

void setId (const char* newId)

### setId

[protected virtual]

Set a new ID for this call endpoint

Parameters:

newId | New ID to set to this call

Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.