Yate
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
AnalogLine Class Reference

An analog line. More...

#include <yatesig.h>

Inheritance diagram for AnalogLine:
RefObject Mutex GenObject Lockable

List of all members.

Public Types

enum  Type {
  FXO, FXS, Recorder, Monitor,
  Unknown
}
enum  State {
  OutOfService = -1, Idle = 0, Dialing = 1, DialComplete = 2,
  Ringing = 3, Answered = 4, CallEnded = 5, OutOfOrder = 6
}
enum  CallSetupInfo { After, Before, NoCallSetup }

Public Member Functions

 AnalogLine (AnalogLineGroup *grp, unsigned int cic, const NamedList &params)
virtual ~AnalogLine ()
Type type () const
State state () const
AnalogLineGroupgroup ()
AnalogLinegetPeer ()
void setPeer (AnalogLine *line=0, bool sync=true)
SignallingCircuitcircuit ()
const char * address () const
bool outbandDtmf () const
bool answerOnPolarity () const
bool hangupOnPolarity () const
bool polarityControl () const
CallSetupInfo callSetup () const
u_int64_t callSetupTimeout () const
u_int64_t noRingTimeout () const
u_int64_t alarmTimeout () const
u_int64_t delayDial () const
void acceptPulseDigit (bool ok)
void * userdata () const
void userdata (void *data, bool sync=true)
virtual const StringtoString () const
void resetEcho (bool train)
bool resetCircuit ()
bool setCircuitParam (const char *param, const char *value=0)
bool connect (bool sync)
bool disconnect (bool sync)
bool sendEvent (SignallingCircuitEvent::Type type, NamedList *params=0)
bool sendEvent (SignallingCircuitEvent::Type type, State newState, NamedList *params=0)
virtual AnalogLineEventgetEvent (const Time &when)
virtual AnalogLineEventgetMonitorEvent (const Time &when)
virtual void checkTimeouts (const Time &when)
bool changeState (State newState, bool sync=false)
bool enable (bool ok, bool sync, bool connectNow=true)

Static Public Member Functions

static const TokenDicttypeNames ()
static const TokenDictstateNames ()
static const TokenDictcsNames ()

Protected Member Functions

virtual void destroyed ()

Friends

class AnalogLineGroup

Detailed Description

An analog line.

This class is used to manage an analog line and keep data associated with it. Also it can be used to monitor a pair of FXS/FXO analog lines


Member Enumeration Documentation

Call setup (such as Caller ID) management (send and detect)

enum State

Line state enumeration

enum Type

Line type enumerator


Constructor & Destructor Documentation

AnalogLine ( AnalogLineGroup grp,
unsigned int  cic,
const NamedList params 
)

Constructor. Reserve the line's circuit. Connect it if requested. Creation will fail if no group, circuit, caller or the circuit is already allocated for another line in the group

Parameters:
grpThe group owning this analog line
cicThe code of the signalling circuit used this line
paramsThe line's parameters
virtual ~AnalogLine ( ) [virtual]

Destructor


Member Function Documentation

void acceptPulseDigit ( bool  ok) [inline]

Set/reset accept pulse digits flag

Parameters:
okTrue to accept incoming pulse digits, false to ignore them
const char* address ( ) const [inline]

Get the line address: group_name/circuit_number

Returns:
The line address
u_int64_t alarmTimeout ( ) const [inline]

Get the time allowed to stay in alarm. This option can be used by the clients to terminate an active call

Returns:
The time allowed to stay in alarm
bool answerOnPolarity ( ) const [inline]

Check if the line should be answered on polarity change

Returns:
True if the line should be answered on polarity change
CallSetupInfo callSetup ( ) const [inline]

Check if the line is processing (send/receive) the setup info (such as caller id) and when it does it

Returns:
Call setup info processing as enumeration
u_int64_t callSetupTimeout ( ) const [inline]

Get the time allowed to ellapse between the call setup data and the first ring

Returns:
The time allowed to ellapse between the call setup data and the first ring
bool changeState ( State  newState,
bool  sync = false 
)

Change the line state if neither current or new state are OutOfService

Parameters:
newStateThe new state of the line
syncTrue to synchronize (change state) the peer
Returns:
True if line state changed
virtual void checkTimeouts ( const Time when) [inline, virtual]

Check timeouts if the line is not out of service and no event was generated by the circuit

Parameters:
whenTime to use as computing base for timeouts
SignallingCircuit* circuit ( ) [inline]

Get the line's circuit

Returns:
SignallingCircuit pointer or 0 if no circuit was attached to this line
bool connect ( bool  sync)

Connect the line's circuit. Reset line echo canceller

Parameters:
syncTrue to synchronize (connect) the peer
Returns:
True if the line's circuit state was changed to Connected
static const TokenDict* csNames ( ) [static]

Call setup info names

u_int64_t delayDial ( ) const [inline]

Get the time delay of dialing the called number

Returns:
The time delay of dialing the called number
virtual void destroyed ( ) [protected, virtual]

Deref the circuit. Remove itself from group

Reimplemented from RefObject.

bool disconnect ( bool  sync)

Disconnect the line's circuit. Reset line echo canceller

Parameters:
syncTrue to synchronize (disconnect) the peer
Returns:
True if the line's circuit was disconnected (changed state from Connected to Reserved)
bool enable ( bool  ok,
bool  sync,
bool  connectNow = true 
)

Enable/disable line. Change circuit's state to Disabled/Reserved when entering/exiting the OutOfService state

Parameters:
okEnable (change state to Idle) or disable (change state to OutOfService) the line
syncTrue to synchronize (enable/disable) the peer
connectNowConnect the line if enabled. Ignored if the line will be disabled
Returns:
True if line state changed
virtual AnalogLineEvent* getEvent ( const Time when) [virtual]

Get events from the line's circuit if not out of service. Check timeouts

Parameters:
whenThe current time
Returns:
AnalogLineEvent pointer or 0 if no events
virtual AnalogLineEvent* getMonitorEvent ( const Time when) [virtual]

Alternate get events from this line or peer

Parameters:
whenThe current time
Returns:
AnalogLineEvent pointer or 0 if no events
AnalogLine* getPeer ( ) [inline]

Get this line's peer if belongs to a pair of monitored lines

Returns:
This line's peer if belongs to a pair of monitored lines
AnalogLineGroup* group ( ) [inline]

Get the group owning this line

Returns:
The group owning this line
bool hangupOnPolarity ( ) const [inline]

Check if the line should be hanged up on polarity change

Returns:
True if the line should be hanged up on polarity change
u_int64_t noRingTimeout ( ) const [inline]

Get the time allowed to ellapse without receiving a ring on incoming calls

Returns:
The time allowed to ellapse without receiving a ring on incoming calls
bool outbandDtmf ( ) const [inline]

Check if allowed to send outband DTMFs (DTMF events)

Returns:
True if allowed to send outband DTMFs
bool polarityControl ( ) const [inline]

Check if the line polarity change should be used

Returns:
True if the line polarity change should be used
bool resetCircuit ( ) [inline]

Reset the line's circuit (change its state to Reserved)

Returns:
True if the line's circuit state was changed to Reserved
void resetEcho ( bool  train)

Reset the line circuit's echo canceller to line default echo canceller state

Parameters:
trainStart echo canceller training if enabled
bool sendEvent ( SignallingCircuitEvent::Type  type,
NamedList params = 0 
)

Send an event through this line if not out of service

Parameters:
typeThe type of the event to send
paramsOptional event parameters
Returns:
True on success
bool sendEvent ( SignallingCircuitEvent::Type  type,
State  newState,
NamedList params = 0 
) [inline]

Send an event through this line if not out of service and change its state on success

Parameters:
typeThe type of the event to send
newStateThe new state of the line if the event was sent
paramsOptional event parameters
Returns:
True on success
bool setCircuitParam ( const char *  param,
const char *  value = 0 
) [inline]

Set a parameter of this line's circuit

Parameters:
paramParameter name
valueOptional parameter value
Returns:
True if the line's circuit parameter was set
void setPeer ( AnalogLine line = 0,
bool  sync = true 
)

Remove old peer's peer. Set this line's peer

Parameters:
lineThis line's peer
syncTrue to synchronize (set/reset) with the old peer
State state ( ) const [inline]

Get the line state

Returns:
The line state as enumeration
static const TokenDict* stateNames ( ) [static]

Line state names dictionary

virtual const String& toString ( ) const [inline, virtual]

Get this line's address

Returns:
This line's address

Reimplemented from GenObject.

Type type ( ) const [inline]

Get this line's type

Returns:
The line type as enumeration
static const TokenDict* typeNames ( ) [static]

Line type names dictionary

void* userdata ( ) const [inline]

Get the private user data of this line

Returns:
The private user data of this line
void userdata ( void *  data,
bool  sync = true 
) [inline]

Set the private user data of this line and its peer if any

Parameters:
dataThe new private user data value of this line
syncTrue to synchronize (set data) with the peer

The documentation for this class was generated from the following file: