# class ClientChannel

Channel used by client programs. More...

Full name | `TelEngine::ClientChannel`
Definition | `#include <yatecbase.h>`
Inherits | TelEngine::Channel [public ]
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum Notification { Startup, Destroyed, Active, OnHold, Mute, Noticed, AddrChanged, Routed, Accepted, Rejected, Progressing, Ringing, Answered, Transfer, Conference, AudioSet, Unknown }
- enum SlaveType { SlaveNone = 0, SlaveTransfer, SlaveConference, }

#### Public Methods

- ClientChannel (const Message& msg, const String& peerid)
- ClientChannel (const String& target, const NamedList& params, int st = SlaveNone, const String& masterChan = String::empty())
- explicit ClientChannel (const String& soundId)
- virtual ~ClientChannel ()
- bool start (const String& target, const NamedList& params)
- virtual bool msgProgress (Message& msg)
- virtual bool msgRinging (Message& msg)
- virtual bool msgAnswered (Message& msg)
- virtual bool msgDrop (Message& msg, const char* reason)
- virtual bool callRouted (Message& msg)
- virtual void callAccept (Message& msg)
- virtual void callRejected (const char* error, const char* reason, const Message* msg)
- void callAnswer (bool setActive = true)
- inline int slave () const
- inline ObjList& slaves ()
- inline unsigned int slavesCount () const
- inline void addSlave (const String& sid)
- inline void removeSlave (const String& sid)
- inline const String& master () const
- inline const NamedList& clientParams () const
- inline const String& party () const
- inline const String& partyName () const
- inline bool conference () const
- inline const String& transferId () const
- inline RefObject* clientData () const
- inline void setClientData (RefObject* obj = 0)
- bool setMedia (bool open = false, bool replace = false)
- bool setActive (bool active, bool update = true)
- bool setMuted (bool on, bool update = true)
- void setTransfer (const String& target = String::empty())
- void setConference (const String& target = String::empty())
- inline const String& peerOutFormat () const
- inline const String& peerInFormat () const
- inline bool active () const
- inline bool muted () const
- inline bool isNoticed () const
- void noticed ()
- inline int line () const
- void line (int newLine)
- void update (int notif, bool chan = true, bool updatePeer = true, const char* engineMsg = 0, bool minimal = false, bool data = false)
- inline void getReconnPeer (String& buf)
- inline bool hasReconnPeer ()
- CallEndpoint* getReconnPeer (bool ref = true)
- void dropReconnPeer (const char* reason = 0)

#### Public Static Methods

- static int lookup (const char* notif, int def = Unknown)
- static const char* lookup (int notif, const char* def = 0)
- static int lookupSlaveType (const char* notif, int def = SlaveNone)

#### Public Members

- static const TokenDict s_notification[]
- static const TokenDict s_slaveTypes[]

#### Protected Methods

- virtual void destroyed ()
- virtual void connected (const char* reason)
- virtual void disconnected (bool final, const char* reason)
- inline bool peerHasSource (Message& msg)
- void checkSilence ()

#### Protected Members

- int m_slave
- String m_master
- String m_party
- String m_partyName
- String m_peerOutFormat
- String m_peerInFormat
- String m_reason
- String m_peerId
- bool m_noticed
- int m_line
- bool m_active
- bool m_silence
- bool m_conference
- bool m_muted
- String m_transferId
- RefObject* m_clientData
- bool m_utility
- String m_soundId
- ObjList m_slaves
- NamedList m_clientParams

## Detailed Description

This class implements a Channel used by client programs

enum Notification { Startup, Destroyed, Active, OnHold, Mute, Noticed, AddrChanged, Routed, Accepted, Rejected, Progressing, Ringing, Answered, Transfer, Conference, AudioSet, Unknown }

### Notification

Channel notifications

enum SlaveType { SlaveNone = 0, SlaveTransfer, SlaveConference, }

### SlaveType

Channel slave type

ClientChannel (const Message& msg, const String& peerid)

### ClientChannel

Incoming (from engine) constructor

Parameters:

msg | The call.execute message
peerid | The peer's id

ClientChannel (const String& target, const NamedList& params, int st = SlaveNone, const String& masterChan = String::empty())

### ClientChannel

Outgoing (to engine) constructor

Parameters:

target | The target to call
params | Call parameters
st | Optional slave
masterChan | Master channel id if slave, ignored otherwise

explicit ClientChannel (const String& soundId)

### ClientChannel

Constructor for utility channels used to play notifications

Parameters:

soundId | The id of the sound to play

~ClientChannel ()

### ~ClientChannel

[virtual]

bool start (const String& target, const NamedList& params)

### start

Init and start router for an outgoing (to engine), not utility, channel

Parameters:

target | The target to call
params | Call parameters

Returns: True on success

bool msgProgress (Message& msg)

### msgProgress

[virtual]

Reimplemented from Channel.

bool msgRinging (Message& msg)

### msgRinging

[virtual]

Reimplemented from Channel.

bool msgAnswered (Message& msg)

### msgAnswered

[virtual]

Reimplemented from Channel.

bool msgDrop (Message& msg, const char* reason)

### msgDrop

[virtual]

Reimplemented from Channel.

bool callRouted (Message& msg)

### callRouted

[virtual]

Reimplemented from Channel.

void callAccept (Message& msg)

### callAccept

[virtual]

Reimplemented from Channel.

void callRejected (const char* error, const char* reason, const Message* msg)

### callRejected

[virtual]

Reimplemented from Channel.

void callAnswer (bool setActive = true)

### callAnswer

Answer an incoming call. Set media channels. Enqueue a clientchan.update message

Parameters:

setActive | True to activate the channel

inline int slave ()

### slave

[const]

Get the slave type of this channel

Returns: The slave type of this channel

inline ObjList& slaves ()

### slaves

Retrieve channel slaves. This method is not thread safe

Returns: Channel slaves list

inline unsigned int slavesCount ()

### slavesCount

[const]

Retrieve channel slaves number. This method is thread safe

Returns: Channel slaves list

inline void addSlave (const String& sid)

### addSlave

Add a slave id. This method is thread safe

Parameters:

sid | Slave id to add

inline void removeSlave (const String& sid)

### removeSlave

Remove a slave id. This method is thread safe

Parameters:

sid | Slave id to remove

inline const String& master ()

### master

[const]

Get the master channel id if any

Returns: The master channel id of this channel

inline const NamedList& clientParams ()

### clientParams

[const]

Retrieve channel client parameters

Returns: Channel client parameters list

inline const String& party ()

### party

[const]

Get the remote party of this channel

Returns: The remote party of this channel

inline const String& partyName ()

### partyName

[const]

Get the remote party name of this channel

Returns: The remote party name of this channel

inline bool conference ()

### conference

[const]

Check if this channel is in conference

Returns: True if this channel is in conference

inline const String& transferId ()

### transferId

[const]

Get the transferred peer's id

Returns: The transferred peer's id

inline RefObject* clientData ()

### clientData

[const]

Get the client data

Returns: RefObject pointer or 0

inline void setClientData (RefObject* obj = 0)

### setClientData

Set/reset the client data. If a new client data is set its reference counter is increased

Parameters:

obj | The new client data

bool setMedia (bool open = false, bool replace = false)

### setMedia

Attach/detach media channels

Parameters:

open | True to open, false to close
replace | True to replace media if already open. Ignored if open is false

Returns: True on success

bool setActive (bool active, bool update = true)

### setActive

Set/reset this channel's data source/consumer

Parameters:

active | True to set active, false to set inactive (mute)
update | True to enqueue an update message

Returns: True on success

bool setMuted (bool on, bool update = true)

### setMuted

Set/reset this channel's muted flag. Set media if 'on' is false and the channel is active

Parameters:

on | True to reset outgoing media, false to set outgoing media
update | True to enqueue an update message

Returns: True on success

void setTransfer (const String& target = String::empty())

### setTransfer

Set/reset the transferred peer's id. Enqueue clientchan.update if changed. Open media when reset if the channel is active and answered

Parameters:

target | The transferred peer's id. Leave it blank to reset

void setConference (const String& target = String::empty())

### setConference

Set/reset the conference data. Enqueue clientchan.update if changed. Open media when reset if the channel is active and answered

Parameters:

target | The confeernce room's name. Leave it blank to reset

inline const String& peerOutFormat ()

### peerOutFormat

[const]

Get the peer consumer's data format

Returns: The peer consumer's data format

inline const String& peerInFormat ()

### peerInFormat

[const]

Get the peer source's data format

Returns: The peer source's data format

inline bool active ()

### active

[const]

Check if this channel is the active one

Returns: True if this channel is the active one

inline bool muted ()

### muted

[const]

Check if this channel is muted

Returns: True if this channel is muted

inline bool isNoticed ()

### isNoticed

[const]

Check if this channel was noticed

Returns: True if this channel was noticed

void noticed ()

### noticed

Notice this channel. Enqueue a clientchan.update message

inline int line ()

### line

[const]

Get this channel's line

Returns: This channel's line

void line (int newLine)

### line

Set this channel's line

Parameters:

newLine | This channel's line

void update (int notif, bool chan = true, bool updatePeer = true, const char* engineMsg = 0, bool minimal = false, bool data = false)

### update

Update channel. Enqueue a clientchan.update message with the given operation. Enqueue other channel status messages if required

Parameters:

notif | The value of the notify parameter
chan | Set the channel as message's user data
updatePeer | True to update peer's data formats
engineMsg | Optional message to enqueue in the engine
minimal | Set to true to fill in only a minimum of engine message's parameters
data | Set the channel as engine message's user data

inline void getReconnPeer (String& buf)

### getReconnPeer

Retrieve peer used to reconnect. This method is thread safe

Parameters:

buf | Destination buffer

inline bool hasReconnPeer ()

### hasReconnPeer

Check if the peer used to reconnect is alive

Returns: True if the peer used to reconnect is alive

CallEndpoint* getReconnPeer (bool ref = true)

### getReconnPeer

Get peer used to reconnect

Parameters:

ref | True to return a referenced pointer

Returns: CallEndpoint pointer or 0 if not found

void dropReconnPeer (const char* reason = 0)

### dropReconnPeer

Drop peer used to reconnect

int lookup (const char* notif, int def = Unknown)

### lookup

[static]

Lookup for a notification id

Parameters:

notif | The notification's name
def | Default value to return if not found

Returns: The result

const char* lookup (int notif, const char* def = 0)

### lookup

[static]

Lookup for a notification name

Parameters:

notif | The notification's id
def | Default value to return if not found

Returns: The result

int lookupSlaveType (const char* notif, int def = SlaveNone)

### lookupSlaveType

[static]

Lookup for a slave type

Parameters:

notif | The slave type name
def | Default value to return if not found

Returns: The result

static const TokenDict s_notification[]

### s_notification[]

static const TokenDict s_slaveTypes[]

### s_slaveTypes[]

void destroyed ()

### destroyed

[protected virtual]

Channel notifications dictionary

Reimplemented from CallEndpoint.

void connected (const char* reason)

### connected

[protected virtual]

Reimplemented from Channel.

void disconnected (bool final, const char* reason)

### disconnected

[protected virtual]

Reimplemented from Channel.

inline bool peerHasSource (Message& msg)

### peerHasSource

[protected]

void checkSilence ()

### checkSilence

[protected]

int m_slave

### m_slave

[protected]

String m_master

### m_master

[protected]

String m_party

### m_party

[protected]

String m_partyName

### m_partyName

[protected]

String m_peerOutFormat

### m_peerOutFormat

[protected]

String m_peerInFormat

### m_peerInFormat

[protected]

String m_reason

### m_reason

[protected]

String m_peerId

### m_peerId

[protected]

bool m_noticed

### m_noticed

[protected]

int m_line

### m_line

[protected]

bool m_active

### m_active

[protected]

bool m_silence

### m_silence

[protected]

bool m_conference

### m_conference

[protected]

bool m_muted

### m_muted

[protected]

String m_transferId

### m_transferId

[protected]

RefObject* m_clientData

### m_clientData

[protected]

bool m_utility

### m_utility

[protected]

String m_soundId

### m_soundId

[protected]

ObjList m_slaves

### m_slaves

[protected]

NamedList m_clientParams

### m_clientParams

[protected]

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