Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Trunk Class Reference

We derive a Bayonne server version of ScriptInterp, "Trunk", which holds most common elements of the script engine for Bayonne use. Bayonne channel port script engine. More...

#include <bayonne.h>

Inheritance diagram for Trunk::

ScriptInterp List of all members.

Public Methods

virtual unsigned long getCapabilities (void)
 Get driver capabilities. More...

virtual void getName (char *buffer)=0
 Get the device logical name number. More...

virtual bool postEvent (TrunkEvent *event)=0
 Invoke a runtime state handler for a trunk driver. More...

int getDigit (char digit)
 Compute the DTMF digit id of a character. More...

bool isReady (void)
 See if trunk is idle and available. More...

void libexec (char **argv, unsigned timeout)
 Perform a libexec operation on behalf of the current trunk. More...

void libtts (const char *msg, ttsmode_t mode)
 Perform a gateway TTS operation on behalf of the current trunk. More...

bool getOnce (void)
 Make getOnce() into a public. More...

unsigned getMemberId (void)
 Get group membership. More...


Protected Methods

unsigned long getTrapDefault (void)
 Our default mask includes timeout. More...

void setConstant (const char *id, const char *data)
 This is used to initialize constant variables in the symbol space. More...

void repSymbol (const char *id, const char *data)
 Replace a symbol if a valid value is passed for a replacement. More...

scriptsymbol_t * getEntry (const char *symname, int size)
 This provides an interface to internal symbol definitions. More...

void Commit (scriptsymbol_t *sym)
 A derived Commit handler, allows "clear digits", etc. More...

timeout_t getTimeout (void)
 Get a "timeout" option. More...

timeout_t getInterdigit (void)
 Get a "interdigit" timeout option. More...

unsigned short getDigitMask (void)
 Get a dtmf bit "mask". More...

bool TrunkSignal (trunksignal_t)
 Notify the script subsystem of a completion event. More...

virtual void setDTMFDetect (void)
 This function sets dtmf detection based on the script interpreter's current trap mask. More...

virtual void setDTMFDetect (bool enable)
 Set actual dtmf detection in the derived trunk class driver. More...

virtual void stopServices (void)
 This is used to reset service threads and generally cleanup the session handler. More...

virtual void TrunkStep (trunkstep_t step)=0
 Used to perform state transitions when trunk is in "step" state, from the Bayonne script engine. More...

bool idleHangup ()
 This is used to see if the total timer has expired. More...

virtual unsigned long getIdleTime (void)=0
 This is used to determine if the trunk is currently "idle" and for how long. More...

bool ScriptStep (void)
 This is used to post a step update back to the script engine. More...

bool Attach (const char *scrname)
 We override ScriptInterp::Attach with our own that adds additional support. More...

void Detach (void)
 We override ScriptInterp::Detach with our own that adds additional support to purge the variable pool. More...

unsigned long getMask (void)
 Get the interpter mask or manager mask. More...

char ** getInitial (char **args)
 We get the scheduled or dnis or callerid map table values. More...

void setList (char **list)
 Set a list of keyword values into the variable space of the script interpreter. More...

virtual void Accept (void)
 Accept method for accept scripts. More...

virtual void Reject (void)
 Reject method for reject scripts. More...

 Trunk (int port)

Protected Attributes

ScriptInterface * script
TrunkGroupgroup
PortManagermanager
int id
time_t start
time_t idle
int idle_timer
int rings
int digits
Servicethread
trunkdata_t data
execdata_t tgi
digitsymbol_t dtmf
char buffer [65]
Trunk:: { ... }  flags
bool offhook: 1
bool dtmf: 1
bool script: 1
bool reset: 1
bool timer: 1
bool audio: 1
bool once: 1
bool ready: 1
bool echo: 1
unsigned temp: 1
trunkmode_t trunk: 2
dspmode_t dsp: 4

Static Protected Attributes

ScriptSymbol globals
char digit [16]

Friends

class TestDebug
class aaScript
class Translator
class ScriptInterface
class Service
class AudioService
class Fifo
class PortManager

Detailed Description

We derive a Bayonne server version of ScriptInterp, "Trunk", which holds most common elements of the script engine for Bayonne use. Bayonne channel port script engine.

This is also the base of the channel port structure for Bayonne. Drivers will further derive this as "DriverTrunk".

Author:
David Sugar <dyfet@ostel.com>


Constructor & Destructor Documentation

Trunk::Trunk int   port [protected]
 


Member Function Documentation

virtual void Trunk::Accept void   [inline, protected, virtual]
 

Accept method for accept scripts.

bool Trunk::Attach const char *   scrname [protected]
 

We override ScriptInterp::Attach with our own that adds additional support.

This attach initializes a series of required and default "variables" for the script interpreter.

Returns:
true on success
Parameters:
name   of script to start.

void Trunk::Commit scriptsymbol_t *   sym [protected]
 

A derived Commit handler, allows "clear digits", etc.

Parameters:
symbol   entry.

void Trunk::Detach void   [protected]
 

We override ScriptInterp::Detach with our own that adds additional support to purge the variable pool.

virtual void Trunk::Reject void   [inline, protected, virtual]
 

Reject method for reject scripts.

In case needed.

bool Trunk::ScriptStep void   [protected]
 

This is used to post a step update back to the script engine.

bool Trunk::TrunkSignal trunksignal_t   [protected]
 

Notify the script subsystem of a completion event.

Parameters:
completion   event signal id.

virtual void Trunk::TrunkStep trunkstep_t   step [protected, pure virtual]
 

Used to perform state transitions when trunk is in "step" state, from the Bayonne script engine.

This call is used rather than "postEvent" with TRUNK_MAKE_STEP since the Bayonne engine is already in the context of the callback thread and invoked from a postEvent initiated call. Hence, this saves the overhead rather of a recursive postEvent call.

Parameters:
new   state to use.

virtual unsigned long Trunk::getCapabilities void   [inline, virtual]
 

Get driver capabilities.

Returns:
capability mask.

int Trunk::getDigit char   digit
 

Compute the DTMF digit id of a character.

Returns:
dtmf digit or -1.

unsigned short Trunk::getDigitMask void   [protected]
 

Get a dtmf bit "mask".

Returns:
dtmf bit mask of digits.

scriptsymbol_t* Trunk::getEntry const char *   symname,
int   size
[protected]
 

This provides an interface to internal symbol definitions.

Returns:
symbol entry.
Parameters:
symbol   name.
allocation   size if not found.

virtual unsigned long Trunk::getIdleTime void   [protected, pure virtual]
 

This is used to determine if the trunk is currently "idle" and for how long.

Returns:
number of seconds idle.

char** Trunk::getInitial char **   args [protected]
 

We get the scheduled or dnis or callerid map table values.

Returns:
argument list for startup.
Parameters:
buffer   for defaults.

timeout_t Trunk::getInterdigit void   [protected]
 

Get a "interdigit" timeout option.

This is like getValue, however the interdigit value supplied is from the const table.

Returns:
interdigit timeout in milli-seconds.

unsigned long Trunk::getMask void   [protected]
 

Get the interpter mask or manager mask.

unsigned Trunk::getMemberId void   [inline]
 

Get group membership.

Returns:
member id.

virtual void Trunk::getName char *   buffer [pure virtual]
 

Get the device logical name number.

Parameters:
Buffer   to store name.

bool Trunk::getOnce void   [inline]
 

Make getOnce() into a public.

timeout_t Trunk::getTimeout void   [protected]
 

Get a "timeout" option.

This is like getValue, however the default timeout supplied is from the constant table, and special options for numeric times of various types can be used.

Returns:
default timeout in milli-seconds.
Parameters:
optional   string to parse rather than option.

unsigned long Trunk::getTrapDefault void   [inline, protected]
 

Our default mask includes timeout.

Returns:
default mask.

bool Trunk::idleHangup   [protected]
 

This is used to see if the total timer has expired.

Returns:
true if should hangup.

bool Trunk::isReady void  
 

See if trunk is idle and available.

Returns:
true if ready.

void Trunk::libexec char **   argv,
unsigned   timeout
 

Perform a libexec operation on behalf of the current trunk.

Parameters:
command   string to pass.
timeout   for command in seconds.

void Trunk::libtts const char *   msg,
ttsmode_t   mode
 

Perform a gateway TTS operation on behalf of the current trunk.

Parameters:
filename   or text string.
mode   argument.

virtual bool Trunk::postEvent TrunkEvent *   event [pure virtual]
 

Invoke a runtime state handler for a trunk driver.

This must be in an event in the derived TrunkDriver class.

Returns:
true if event claimed.
Parameters:
derived   method to call.

void Trunk::repSymbol const char *   id,
const char *   data
[protected]
 

Replace a symbol if a valid value is passed for a replacement.

Parameters:
symbol   name.
replacement   value.

void Trunk::setConstant const char *   id,
const char *   data
[protected]
 

This is used to initialize constant variables in the symbol space.

These are assumed to be constant for the current session as variables are purged between sessions.

Parameters:
symbol   name.
symbol   value.

virtual void Trunk::setDTMFDetect bool   enable [inline, protected, virtual]
 

Set actual dtmf detection in the derived trunk class driver.

This typically is called by the "initial" state handler when entering a trunk driver call processing state when an implicit setting is required (such as "collect", which forces enable).

Parameters:
true   to enable DTMF detection.

virtual void Trunk::setDTMFDetect void   [protected, virtual]
 

This function sets dtmf detection based on the script interpreter's current trap mask.

This is often used as the initial handler for setting dtmf detection when entering each trunk driver's state.

void Trunk::setList char **   list [protected]
 

Set a list of keyword values into the variable space of the script interpreter.

Parameters:
list   of keyword pairs.

virtual void Trunk::stopServices void   [protected, virtual]
 

This is used to reset service threads and generally cleanup the session handler.

It is a virtual since driver specific implimentations may vary.


Friends And Related Function Documentation

friend class AudioService [friend]
 

friend class Fifo [friend]
 

friend class PortManager [friend]
 

friend class ScriptInterface [friend]
 

friend class Service [friend]
 

friend class TestDebug [friend]
 

friend class Translator [friend]
 

friend class aaScript [friend]
 


Member Data Documentation

bool Trunk::audio [protected]
 

char Trunk::buffer[65] [protected]
 

trunkdata_t Trunk::data [protected]
 

char Trunk::digit[16] [static, protected]
 

int Trunk::digits [protected]
 

dspmode_t Trunk::dsp [protected]
 

bool Trunk::dtmf [protected]
 

digitsymbol_t Trunk::dtmf [protected]
 

bool Trunk::echo [protected]
 

struct { ... } Trunk::flags [protected]
 

ScriptSymbol Trunk::globals [static, protected]
 

TrunkGroup* Trunk::group [protected]
 

int Trunk::id [protected]
 

time_t Trunk::idle [protected]
 

int Trunk::idle_timer [protected]
 

PortManager* Trunk::manager [protected]
 

bool Trunk::offhook [protected]
 

bool Trunk::once [protected]
 

bool Trunk::ready [protected]
 

bool Trunk::reset [protected]
 

int Trunk::rings [protected]
 

bool Trunk::script [protected]
 

ScriptInterface* Trunk::script [protected]
 

time_t Trunk::start [protected]
 

unsigned Trunk::temp [protected]
 

execdata_t Trunk::tgi [protected]
 

Service* Trunk::thread [protected]
 

bool Trunk::timer [protected]
 

trunkmode_t Trunk::trunk [protected]
 


The documentation for this class was generated from the following file:
Generated at Wed Nov 21 12:17:05 2001 for Bayonne by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001