Yate
Public Member Functions | Protected Member Functions | Friends
Driver Class Reference

A Channel driver module. More...

#include <yatephone.h>

Inheritance diagram for Driver:
Module Plugin Mutex MessageReceiver GenObject DebugEnabler Lockable GenObject ClientDriver

List of all members.

Public Member Functions

virtual void * getObject (const String &name) const
const Stringprefix () const
bool varchan () const
ObjListchannels ()
virtual Channelfind (const String &id) const
virtual bool isBusy () const
virtual void dropAll (Message &msg)
virtual bool canAccept (bool routers=true)
virtual bool canRoute ()
unsigned int nextid ()
unsigned int lastid () const
int timeout () const
int routing () const
int routed () const
int total () const

Protected Member Functions

 Driver (const char *name, const char *type=0)
virtual void initialize ()
void setup (const char *prefix=0, bool minimal=false)
virtual bool received (Message &msg, int id)
virtual void genUpdate (Message &msg)
virtual bool hasLine (const String &line) const
virtual bool msgRoute (Message &msg)
virtual bool msgExecute (Message &msg, String &dest)=0
virtual bool commandComplete (Message &msg, const String &partLine, const String &partWord)
virtual void statusModule (String &str)
virtual void statusParams (String &str)
virtual void statusDetail (String &str)
virtual bool setDebug (Message &msg, const String &target)
virtual void loadLimits ()
void varchan (bool variable)
void timeout (int tout)
void maxRoute (int ncalls)
void maxChans (int ncalls)
void dtmfDups (bool duplicates)

Friends

class Router
class Channel

Detailed Description

A Channel driver module.

Driver is a module specialized for implementing channel drivers


Constructor & Destructor Documentation

Driver ( const char *  name,
const char *  type = 0 
) [protected]

Constructor

Parameters:
namePlugin name of this driver
typeType of the driver: "fixchans", "varchans", etc.

Member Function Documentation

virtual bool canAccept ( bool  routers = true) [virtual]

Check if new connections can be accepted

Parameters:
routersSet to true to check routing threads for incoming connections
Returns:
True if at least one new connection can be accepted, false if not
virtual bool canRoute ( ) [virtual]

Check if new incoming connections can be routed

Returns:
True if at least one new connection can be routed, false if not
ObjList& channels ( ) [inline]

Get the list of channels of this driver

Returns:
A reference to the channel list
virtual bool commandComplete ( Message msg,
const String partLine,
const String partWord 
) [protected, virtual]

Complete a command line

Parameters:
msgMessage to return completion into
partLinePartial line to complete, excluding the last word
partWordPartial word to complete
Returns:
True to stop processing the message, false to try other handlers

Reimplemented from Module.

virtual void dropAll ( Message msg) [virtual]

Drop all current channels

Parameters:
msgNotification message
void dtmfDups ( bool  duplicates) [inline, protected]

Set the DTMF duplicates allowed flag

Parameters:
duplicatesTrue to allow DTMF duplicate messages
virtual Channel* find ( const String id) const [virtual]

Find a channel by id

Parameters:
idUnique identifier of the channel to find
Returns:
Pointer to the channel or NULL if not found
virtual void genUpdate ( Message msg) [protected, virtual]

Opportunity to modify the update message

Parameters:
msgStatus update message

Reimplemented from Module.

virtual void* getObject ( const String name) const [virtual]

Get a pointer to a derived class given that class name

Parameters:
nameName of the class we are asking for
Returns:
Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented from Module.

virtual bool hasLine ( const String line) const [protected, virtual]

Check if driver owns a client line (registered to an external server)

Parameters:
lineName of the line to check
Returns:
True if this driver owns line with the specified name
virtual void initialize ( ) [protected, virtual]

This method is called to initialize the loaded module

Reimplemented from Module.

Reimplemented in ClientDriver.

virtual bool isBusy ( ) const [virtual]

Check if the driver is actively used.

Returns:
True if the driver is in use, false if should be ok to restart

Reimplemented from Plugin.

unsigned int lastid ( ) const [inline]

Get the current (last used) unique numeric id from a sequence

Returns:
The driver unique number
virtual void loadLimits ( ) [protected, virtual]

Load the global limits from the main config file

void maxChans ( int  ncalls) [inline, protected]

Set the maximum number of running channels for this driver

Parameters:
ncallsNumber of calls to run simultaneously, zero to accept all
void maxRoute ( int  ncalls) [inline, protected]

Set the maximum number of routing messages for this driver

Parameters:
ncallsNumber of calls to route simultaneously, zero to accept all
virtual bool msgExecute ( Message msg,
String dest 
) [protected, pure virtual]

Create an outgoing calling channel

Parameters:
msgCall execute message
destDestination of the new call
Returns:
True if outgoing call was created

Implemented in ClientDriver.

virtual bool msgRoute ( Message msg) [protected, virtual]

Routing message handler. The default implementation routes to this driver if it owns a line named in the "account" or "line" parameter.

Parameters:
msgCall routing message
Returns:
True to stop processing the message, false to try other handlers

Reimplemented from Module.

Reimplemented in ClientDriver.

unsigned int nextid ( )

Get the next unique numeric id from a sequence

Returns:
A driver unique number that increments by 1 at each call
const String& prefix ( ) const [inline]

Retrieve the prefix that is used as base for all channels

Returns:
The driver's prefix
virtual bool received ( Message msg,
int  id 
) [protected, virtual]

Message receiver handler

Parameters:
msgThe received message
idThe identifier with which the relay was created
Returns:
True to stop processing, false to try other handlers

Reimplemented from Module.

Reimplemented in ClientDriver.

int routed ( ) const [inline]

Get the number of calls successfully routed

Returns:
Number of calls that have gone past the routing stage
int routing ( ) const [inline]

Get the number of calls currently in the routing stage

Returns:
Number of router threads currently running
virtual bool setDebug ( Message msg,
const String target 
) [protected, virtual]

Set the local debugging level

Parameters:
msgDebug setting message
targetString to match for local settings

Reimplemented from Module.

void setup ( const char *  prefix = 0,
bool  minimal = false 
) [protected]

Install standard message relays and set up the prefix

Parameters:
prefixPrefix to use with channels of this driver
minimalInstall just a minimal set of message relays
virtual void statusDetail ( String str) [protected, virtual]

Build the channel list part of the status answer

Parameters:
strString variable to fill up

Reimplemented from Module.

virtual void statusModule ( String str) [protected, virtual]

Build the module identification part of the status answer

Parameters:
strString variable to fill up

Reimplemented from Module.

virtual void statusParams ( String str) [protected, virtual]

Build the parameter reporting part of the status answer

Parameters:
strString variable to fill up

Reimplemented from Module.

int timeout ( ) const [inline]

Get the default driver timeout

Returns:
Timeout value in milliseconds
void timeout ( int  tout) [inline, protected]

Set the default driver timeout

Parameters:
toutNew timeout in milliseconds or zero to disable
int total ( ) const [inline]

Get the total number of calls ever created

Returns:
Number of channels ever created for this driver
bool varchan ( ) const [inline]

Check if this driver is for dynamic (variable number) channels

Returns:
True if the channels are dynamic, false for fixed
void varchan ( bool  variable) [inline, protected]

Set if this driver is for dynamic (variable number) channels

Parameters:
variableTrue if the channels are dynamic, false for fixed

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