Yate
AnalogLine Class Reference

An analog line. More...

#include <yatesig.h>

Inheritance diagram for AnalogLine:
RefObject Mutex GenObject Lockable

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)
 
- Public Member Functions inherited from RefObject
 RefObject ()
 
virtual ~RefObject ()
 
virtual void * getObject (const String &name) const
 
virtual bool alive () const
 
bool ref ()
 
bool deref ()
 
int refcount () const
 
virtual void destruct ()
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual const StringtraceId () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 
- Public Member Functions inherited from Mutex
 Mutex (bool recursive=false, const char *name=0)
 
 Mutex (const Mutex &original)
 
 ~Mutex ()
 
Mutexoperator= (const Mutex &original)
 
virtual bool lock (long maxwait=-1)
 
virtual bool unlock ()
 
virtual bool locked () const
 
const char * owner () const
 
bool recursive () const
 
- Public Member Functions inherited from Lockable
virtual ~Lockable ()
 
virtual bool check (long maxwait=-1)
 
virtual bool unlockAll ()
 

Static Public Member Functions

static const TokenDicttypeNames ()
 
static const TokenDictstateNames ()
 
static const TokenDictcsNames ()
 
- Static Public Member Functions inherited from RefObject
static bool alive (const RefObject *obj)
 
static bool efficientIncDec ()
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 
- Static Public Member Functions inherited from Mutex
static int count ()
 
static int locks ()
 
static bool efficientTimedLock ()
 
- Static Public Member Functions inherited from Lockable
static void wait (unsigned long maxwait)
 
static unsigned long wait ()
 
static void startUsingNow ()
 
static void enableSafety (bool safe=true)
 
static bool safety ()
 

Protected Member Functions

virtual void destroyed ()
 
- Protected Member Functions inherited from RefObject
virtual void zeroRefs ()
 
bool resurrect ()
 

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

◆ CallSetupInfo

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

◆ State

enum State

Line state enumeration

◆ Type

enum Type

Line type enumerator

Constructor & Destructor Documentation

◆ AnalogLine()

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

Referenced by destroyed(), getPeer(), and setPeer().

◆ ~AnalogLine()

virtual ~AnalogLine ( )
virtual

Destructor

Member Function Documentation

◆ acceptPulseDigit()

void acceptPulseDigit ( bool ok)
inline

Set/reset accept pulse digits flag

Parameters
okTrue to accept incoming pulse digits, false to ignore them

◆ address()

const char * address ( ) const
inline

Get the line address: group_name/circuit_number

Returns
The line address

◆ alarmTimeout()

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

◆ answerOnPolarity()

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

◆ callSetup()

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

◆ callSetupTimeout()

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

◆ changeState()

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

Referenced by sendEvent().

◆ checkTimeouts()

virtual void checkTimeouts ( const Time & when)
inlinevirtual

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

◆ circuit()

SignallingCircuit * circuit ( )
inline

Get the line's circuit

Returns
SignallingCircuit pointer or 0 if no circuit was attached to this line

◆ connect()

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

◆ csNames()

static const TokenDict * csNames ( )
static

Call setup info names

◆ delayDial()

u_int64_t delayDial ( ) const
inline

Get the time delay of dialing the called number

Returns
The time delay of dialing the called number

◆ destroyed()

virtual void destroyed ( )
protectedvirtual

Deref the circuit. Remove itself from group

Reimplemented from RefObject.

References AnalogLine().

◆ disconnect()

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)

◆ enable()

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

◆ getEvent()

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

◆ getMonitorEvent()

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

◆ getPeer()

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

References AnalogLine().

◆ group()

AnalogLineGroup * group ( )
inline

Get the group owning this line

Returns
The group owning this line

◆ hangupOnPolarity()

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

◆ noRingTimeout()

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

◆ outbandDtmf()

bool outbandDtmf ( ) const
inline

Check if allowed to send outband DTMFs (DTMF events)

Returns
True if allowed to send outband DTMFs

◆ polarityControl()

bool polarityControl ( ) const
inline

Check if the line polarity change should be used

Returns
True if the line polarity change should be used

◆ resetCircuit()

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

References state().

◆ resetEcho()

void resetEcho ( bool train)

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

Parameters
trainStart echo canceller training if enabled

◆ sendEvent() [1/2]

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

References type().

Referenced by sendEvent().

◆ sendEvent() [2/2]

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

References changeState(), sendEvent(), and type().

◆ setCircuitParam()

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

◆ setPeer()

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

References AnalogLine().

◆ state()

State state ( ) const
inline

Get the line state

Returns
The line state as enumeration

Referenced by resetCircuit().

◆ stateNames()

static const TokenDict * stateNames ( )
static

Line state names dictionary

◆ toString()

virtual const String & toString ( ) const
inlinevirtual

Get this line's address

Returns
This line's address

Reimplemented from GenObject.

◆ type()

Type type ( ) const
inline

Get this line's type

Returns
The line type as enumeration

Referenced by sendEvent(), and sendEvent().

◆ typeNames()

static const TokenDict * typeNames ( )
static

Line type names dictionary

◆ userdata() [1/2]

void * userdata ( ) const
inline

Get the private user data of this line

Returns
The private user data of this line

◆ userdata() [2/2]

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

References Mutex::lock().


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