man Trunk () - 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.

NAME

Trunk - 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.

SYNOPSIS



#include <bayonne.h>

Public Member Functions

bool isAdmin (void)

Flag if admin user. const char * getStation (void)

Get a fax station identifier for a script. timeout_t getTimeout (const char *keyword=NULL)

Get a 'timeout' option. timeout_t getInterdigit (const char *keyword=NULL)

Get a 'interdigit' timeout option. unsigned short getDigitMask (const char *keyword=NULL)

Get a dtmf bit 'mask'. unsigned getId (void)

Get the timeslot port number. unsigned getSequence (void)

Get the trunk sequence number. void setSave (const char *save)

Set the sleep save marker for sleeping tasks. virtual unsigned long getCapabilities (void)

Get driver capabilities. virtual void getName (char *buffer)=0

Get the device logical name number. virtual bool postEvent (TrunkEvent *event)=0

Invoke a runtime state handler for a trunk driver. bool recvEvent (TrunkEvent *event)

Receive an event message from a foreign trunk and process it locally. int getDigit (char digit)

Compute the DTMF digit id of a character. bool isReady (void)

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

Make getOnce() into a public. unsigned getMemberId (void)

Get group membership. phTone * getTone (void)

Process a soft tone buffer. ScriptCommand * getCommand (void)

Fetch the command interpreter in public context. trunkmode_t getTrunkMode (void)

Fetch the current trunk mode flag.

Static Public Member Functions

const char * getExtReference (const char *ref)

Extract an extension reference, either directly, or from an encoded global/local session identifier. ScriptSymbol * getGlobals (void)

Get global symbol stace. void load (const char *id)

Load user preferences. void loadPref (const char *id, const char *prefix, const char *dir)

Load line preferences. void save (const char *id)

Save user preferences. void savePref (const char *id, const char *prefix, const char *dir)

Save line preferences. void sync (bool force=false)

Sync session settings. void initPassword (void)

Init password database. void initLines (void)

Init trunk line database.

Protected Member Functions

bool scrCommit (void)

bool scrChange (void)

bool scrPassword (void)

bool scrLogin (void)

bool scrLogout (void)

bool scrSync (void)

bool scrAnswer (void)

bool scrDial (void)

bool scrTransfer (void)

bool scrHold (void)

bool scrOptions (void)

bool scrRedirect (void)

void setExclusive (bool enable)

void setIdle (bool mode)

Set idle count of the driver. virtual void initSyms (void)=0

Set symbol constants on attach. unsigned long getTrapDefault (void)

Our default mask includes timeout. void repSymbol (const char *id, const char *data)

Replace a symbol if a valid value is passed for a replacement. Symbol * getEntry (const char *symname, int size)

This provides an interface to internal symbol definitions. bool setVariable (const char *id, int size, const char *value=NULL)

Provides interface for setting local or global variable passed by reference to drivers and such. const char * getVariable (const char *id)

Accesses local or global variable by direct name reference. void commit (Symbol *sym)

A derived Commit handler, allows 'clear %digits', etc. bool trunkSignal (trunksignal_t)

Notify the script subsystem of a completion event. virtual void setDTMFDetect (void)

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

Set actual dtmf detection in the derived trunk class driver. virtual void stopServices (void)

This is used to reset service threads and generally cleanup the session handler. virtual void trunkStep (trunkstep_t step)=0

Used to perform state transitions when trunk is in 'step' state, from the Bayonne script engine. bool idleHangup ()

This is used to see if the total timer has expired. virtual unsigned long getIdleTime (void)=0

This is used to determine if the trunk is currently 'idle' and for how long. const char * getPrefixPath (void)

Compute a prefix path based on prefix passed. bool scriptStep (void)

This is used to post a step update back to the script engine. bool attach (const char *scrname)

We override ScriptInterp::Attach with our own that adds additional support. void detach (void)

We override ScriptInterp::Detach with our own that adds additional support to purge the variable pool. char ** getInitial (char **args)

We get the scheduled or dnis or callerid map table values. void setList (char **list)

Set a list of keyword values into the variable space of the script interpreter. virtual void accept (void)

Accept method for accept scripts. virtual const char * getLibexec (void)

Get the voice library extension set to use. virtual const char * getDefaultEncoding (void)

Get the default audio encoding format to use. virtual void reject (void)

Reject method for reject scripts. void enterState (const char *state)

Enter a state and post it's identifier in local sym. Trunk (int port, int card=0, int span=0)

Protected Attributes

phTone * tonetmp

Number numbers [6]

ScriptInterface * script

TrunkGroup * group

int id

unsigned span

time_t starttime

time_t idletime

time_t synctimer

time_t exittimer

volatile unsigned seq

int idle_timer

unsigned rings

unsigned digits

Service * thread

trunkdata_t data

execdata_t tgi

Digit dtmf

char buffer [65]

char extNumber [5]

bool dialgroup [10]

struct {

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 onexit: 1

trunkmode_t trunk: 2

dspmode_t dsp: 4

dtmfmode_t digits: 2

bool dnd: 1

bool cid: 1

bool sent: 1

} flags

Static Protected Attributes

ScriptSymbol globals

char digit [16]

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>

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 (Symbol * 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.

void Trunk::enterState (const char * state) [protected]

Enter a state and post it's identifier in local sym.

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

Get driver capabilities.

Returns: capability mask.

ScriptCommand* Trunk::getCommand (void) [inline]

Fetch the command interpreter in public context.

Returns: command interpreter.

virtual const char* Trunk::getDefaultEncoding (void) [inline, protected, virtual]

Get the default audio encoding format to use.

int Trunk::getDigit (char digit)

Compute the DTMF digit id of a character.

Returns: dtmf digit or -1.

unsigned short Trunk::getDigitMask (const char * keyword = NULL)

Get a dtmf bit 'mask'.

Returns: dtmf bit mask of digits.

Symbol* 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.

const char* Trunk::getExtReference (const char * ref) [static]

Extract an extension reference, either directly, or from an encoded global/local session identifier.

Returns: extension number or NULL if invalid.

Parameters: extension number or session id.

ScriptSymbol* Trunk::getGlobals (void) [inline, static]

Get global symbol stace.

Returns: pointer to global symbols.

unsigned Trunk::getId (void) [inline]

Get the timeslot port number.

Returns: driver port.

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 (const char * keyword = NULL)

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.

virtual const char* Trunk::getLibexec (void) [inline, protected, virtual]

Get the voice library extension set to use.

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.

const char* Trunk::getPrefixPath (void) [protected]

Compute a prefix path based on prefix passed.

Returns: prefix path.

unsigned Trunk::getSequence (void) [inline]

Get the trunk sequence number.

Returns: sequence.

const char* Trunk::getStation (void)

Get a fax station identifier for a script.

Returns: pointer to station id string.

timeout_t Trunk::getTimeout (const char * keyword = NULL)

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.

phTone* Trunk::getTone (void)

Process a soft tone buffer.

Returns: soft tone object.

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

Our default mask includes timeout.

Returns: default mask.

trunkmode_t Trunk::getTrunkMode (void) [inline]

Fetch the current trunk mode flag.

Returns: trunk call mode.

const char* Trunk::getVariable (const char * id) [protected]

Accesses local or global variable by direct name reference.

Returns: content

Parameters: symbol name.

bool Trunk::idleHangup () [protected]

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

Returns: true if should hangup.

void Trunk::initLines (void) [static]

Init trunk line database.

void Trunk::initPassword (void) [static]

Init password database.

virtual void Trunk::initSyms (void) [protected, pure virtual]

Set symbol constants on attach.

bool Trunk::isAdmin (void)

Flag if admin user.

bool Trunk::isReady (void)

See if trunk is idle and available.

Returns: true if ready.

void Trunk::load (const char * id) [static]

Load user preferences.

void Trunk::loadPref (const char * id, const char * prefix, const char * dir) [static]

Load line preferences.

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.

bool Trunk::recvEvent (TrunkEvent * event)

Receive an event message from a foreign trunk and process it locally.

Returns: true if event message valid.

virtual void Trunk::reject (void) [inline, protected, virtual]

Reject method for reject scripts.

In case needed.

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::save (const char * id) [static]

Save user preferences.

void Trunk::savePref (const char * id, const char * prefix, const char * dir) [static]

Save line preferences.

bool Trunk::scriptStep (void) [inline, protected]

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

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::setIdle (bool mode) [protected]

Set idle count of the driver.

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.

void Trunk::setSave (const char * save) [inline]

Set the sleep save marker for sleeping tasks.

Parameters: sym name.

bool Trunk::setVariable (const char * id, int size, const char * value = NULL) [protected]

Provides interface for setting local or global variable passed by reference to drivers and such.

Returns: true if successful

Parameters: symbol name.

symbol size to allocate if new.

symbol value.

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.

void Trunk::sync (bool force = false) [static]

Sync session settings.

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.

Author

Generated automatically by Doxygen for Bayonne from the source code.