Yate
|
An analog line. More...
#include <yatesig.h>
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 ¶ms) | |
virtual | ~AnalogLine () |
Type | type () const |
State | state () const |
AnalogLineGroup * | group () |
AnalogLine * | getPeer () |
void | setPeer (AnalogLine *line=0, bool sync=true) |
SignallingCircuit * | circuit () |
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 String & | toString () 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 AnalogLineEvent * | getEvent (const Time &when) |
virtual AnalogLineEvent * | getMonitorEvent (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 TokenDict * | typeNames () |
static const TokenDict * | stateNames () |
static const TokenDict * | csNames () |
Protected Member Functions | |
virtual void | destroyed () |
Friends | |
class | AnalogLineGroup |
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
enum CallSetupInfo |
Call setup (such as Caller ID) management (send and detect)
enum State |
Line state enumeration
enum Type |
Line type enumerator
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
grp | The group owning this analog line |
cic | The code of the signalling circuit used this line |
params | The line's parameters |
virtual ~AnalogLine | ( | ) | [virtual] |
Destructor
void acceptPulseDigit | ( | bool | ok | ) | [inline] |
Set/reset accept pulse digits flag
ok | True to accept incoming pulse digits, false to ignore them |
const char* address | ( | ) | const [inline] |
Get the line address: group_name/circuit_number
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
bool answerOnPolarity | ( | ) | const [inline] |
Check 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
u_int64_t callSetupTimeout | ( | ) | const [inline] |
Get 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
newState | The new state of the line |
sync | True to synchronize (change state) the peer |
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
when | Time to use as computing base for timeouts |
SignallingCircuit* circuit | ( | ) | [inline] |
Get the line's circuit
bool connect | ( | bool | sync | ) |
Connect the line's circuit. Reset line echo canceller
sync | True to synchronize (connect) the peer |
u_int64_t delayDial | ( | ) | const [inline] |
Get 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
sync | True to synchronize (disconnect) the peer |
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
ok | Enable (change state to Idle) or disable (change state to OutOfService) the line |
sync | True to synchronize (enable/disable) the peer |
connectNow | Connect the line if enabled. Ignored if the line will be disabled |
virtual AnalogLineEvent* getEvent | ( | const Time & | when | ) | [virtual] |
Get events from the line's circuit if not out of service. Check timeouts
when | The current time |
virtual AnalogLineEvent* getMonitorEvent | ( | const Time & | when | ) | [virtual] |
Alternate get events from this line or peer
when | The current time |
AnalogLine* getPeer | ( | ) | [inline] |
Get this line's peer if belongs to a pair of monitored lines
AnalogLineGroup* group | ( | ) | [inline] |
Get the group owning this line
bool hangupOnPolarity | ( | ) | const [inline] |
Check 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
bool outbandDtmf | ( | ) | const [inline] |
Check if allowed to send outband DTMFs (DTMF events)
bool polarityControl | ( | ) | const [inline] |
Check if the line polarity change should be used
bool resetCircuit | ( | ) | [inline] |
Reset the line's circuit (change its state to Reserved)
void resetEcho | ( | bool | train | ) |
Reset the line circuit's echo canceller to line default echo canceller state
train | Start echo canceller training if enabled |
bool sendEvent | ( | SignallingCircuitEvent::Type | type, |
NamedList * | params = 0 |
||
) |
Send an event through this line if not out of service
type | The type of the event to send |
params | Optional event parameters |
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
type | The type of the event to send |
newState | The new state of the line if the event was sent |
params | Optional event parameters |
bool setCircuitParam | ( | const char * | param, |
const char * | value = 0 |
||
) | [inline] |
Set a parameter of this line's circuit
param | Parameter name |
value | Optional parameter value |
void setPeer | ( | AnalogLine * | line = 0 , |
bool | sync = true |
||
) |
Remove old peer's peer. Set this line's peer
line | This line's peer |
sync | True to synchronize (set/reset) with the old peer |
static const TokenDict* stateNames | ( | ) | [static] |
Line state names dictionary
void* userdata | ( | ) | const [inline] |
Get 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
data | The new private user data value of this line |
sync | True to synchronize (set data) with the peer |