Yate: Driver Class Reference

Yate

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Friends | List of all members
Driver Class Referenceabstract

A Channel driver module. More...

`#include <yatephone.h>`

Inheritance diagram for Driver:

## Public Member Functions
virtual void * | getObject (const String &name) const
const String & | prefix () const
bool | varchan () const
ObjList & | channels ()
virtual Channel * | find (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
int | chanCount () const
int | maxChans () const
Public Member Functions inherited from Module
const String & | type () const
void | changed ()
bool | filterInstalled () const
bool | filterDebug (const String &item) const
Public Member Functions inherited from Plugin
| Plugin (const char *name, bool earlyInit=false)
virtual | ~Plugin ()
virtual const String & | toString () const
const String & | name () const
NamedCounter * | objectsCounter () const
bool | earlyInit () const
Public Member Functions inherited from GenObject
| GenObject ()
virtual | ~GenObject ()
virtual bool | alive () const
virtual void | destruct ()
virtual const String & | traceId () const
NamedCounter * | getObjCounter () const
NamedCounter * | setObjCounter (NamedCounter *counter)
Public Member Functions inherited from DebugEnabler
| DebugEnabler (int level=TelEngine::debugLevel(), bool enabled=true)
int | debugLevel () const
int | debugLevel (int level)
bool | debugEnabled () const
void | debugEnabled (bool enable)
const char * | debugName () const
bool | debugAt (int level) const
bool | debugChained () const
void | debugChain (const DebugEnabler *chain=0)
void | debugCopy (const DebugEnabler *original=0)
Public Member Functions inherited from Mutex
| Mutex (bool recursive=false, const char *name=0)
| Mutex (const Mutex &original)
| ~Mutex ()
Mutex & | operator= (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 ()

## 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 ()
virtual bool | canStopCall () const
void | varchan (bool variable)
void | timeout (int tout)
void | maxRoute (int ncalls)
void | maxChans (int ncalls)
void | dtmfDups (bool duplicates)
Protected Member Functions inherited from Module
| Module (const char *name, const char *type=0, bool earlyInit=false)
virtual | ~Module ()
void | setup ()
bool | relayInstalled (int id) const
bool | installRelay (int id, unsigned priority=100)
bool | installRelay (const char *name, unsigned priority=100)
bool | installRelay (int id, const char *name, unsigned priority=100)
bool | installRelay (MessageRelay *relay)
bool | uninstallRelay (MessageRelay *relay, bool delRelay=true)
bool | uninstallRelay (int id, bool delRelay=true)
bool | uninstallRelays ()
virtual void | msgTimer (Message &msg)
virtual void | msgStatus (Message &msg)
virtual bool | msgCommand (Message &msg)
virtual bool | commandExecute (String &retVal, const String &line)
Protected Member Functions inherited from DebugEnabler
void | debugName (const char *name)

## Friends
class | Router
class | Channel

## Additional Inherited Members
Static Public Member Functions inherited from Module
static unsigned int | updateDelay ()
static void | updateDelay (unsigned int delay)
static bool | itemComplete (String &itemList, const String &item, const String &partWord)
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 NamedCounter * | getObjCounter (const String &name, bool create=true)
static ObjList & | getObjCounters ()
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 Types inherited from Module
enum | { Status = 0x00000001, Timer = 0x00000002, Level = 0x00000004, Command = 0x00000008, Help = 0x00000010, Halt = 0x00000020, Route = 0x00000040, Stop = 0x00000080, Execute = 0x00000100, Drop = 0x00000200, Locate = 0x00000400, Masquerade = 0x00000800, Ringing = 0x00001000, Answered = 0x00002000, Tone = 0x00004000, Text = 0x00008000, Progress = 0x00010000, Update = 0x00020000, Transfer = 0x00040000, Control = 0x00080000, MsgExecute = 0x00100000, PubLast = 0x00ffffff, Private = 0x01000000 }
Static Protected Member Functions inherited from Module
static const char * | messageName (int id)
static int | relayId (const char *name)
Protected Attributes inherited from Module
enum TelEngine::Module:: { ... } | RelayID

## 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

  name | Plugin name of this driver
  type | Type of the driver: "fixchans", "varchans", etc.

## Member Function Documentation

virtual bool canAccept | ( | bool | routers = `true` | ) |
| virtual

Check if new connections can be accepted

Parameters

  routers | Set 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

virtual bool canStopCall | ( |  | ) | const
| inlineprotectedvirtual

Module is able to simulate a call without generating anything at protocol layer

Returns
  True if module is able

int chanCount | ( |  | ) | const
| inline

Get the number of running channels

Returns
  Number of channels running at this time

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
| ) |  |
| protectedvirtual

Complete a command line

Parameters

  msg | Message to return completion into
  partLine | Partial line to complete, excluding the last word
  partWord | Partial 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

  msg | Notification message

void dtmfDups | ( | bool | duplicates | ) |
| inlineprotected

Set the DTMF duplicates allowed flag

Parameters

  duplicates | True to allow DTMF duplicate messages

virtual Channel* find | ( | const String & | id | ) | const
| virtual

Find a channel by id

Parameters

  id | Unique identifier of the channel to find

Returns
  Pointer to the channel or NULL if not found

virtual void genUpdate | ( | Message & | msg | ) |
| protectedvirtual

Opportunity to modify the update message

Parameters

  msg | Status 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

  name | Name 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
| protectedvirtual

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

Parameters

  line | Name of the line to check

Returns
  True if this driver owns line with the specified name

virtual void initialize | ( |  | ) |
| protectedvirtual

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 | ( |  | ) |
| protectedvirtual

Load the global limits from the main config file

int maxChans | ( |  | ) | const
| inline

Get the maximum number of running channels for this driver

Returns
  Maximum number of calls to run simultaneously, zero to accept all

void maxChans | ( | int | ncalls | ) |
| inlineprotected

Set the maximum number of running channels for this driver

Parameters

  ncalls | Number of calls to run simultaneously, zero to accept all

void maxRoute | ( | int | ncalls | ) |
| inlineprotected

Set the maximum number of routing messages for this driver

Parameters

  ncalls | Number of calls to route simultaneously, zero to accept all

virtual bool msgExecute | ( | Message & | msg,
|  | String & | dest
| ) |  |
| protectedpure virtual

Create an outgoing calling channel

Parameters

  msg | Call execute message
  dest | Destination of the new call

Returns
  True if outgoing call was created

Implemented in ClientDriver.

virtual bool msgRoute | ( | Message & | msg | ) |
| protectedvirtual

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

Parameters

  msg | Call 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
| ) |  |
| protectedvirtual

Message receiver handler

Parameters

  msg | The received message
  id | The 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
| ) |  |
| protectedvirtual

Set the local debugging level

Parameters

  msg | Debug setting message
  target | String 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

  prefix | Prefix to use with channels of this driver
  minimal | Install just a minimal set of message relays

virtual void statusDetail | ( | String & | str | ) |
| protectedvirtual

Build the channel list part of the status answer

Parameters

  str | String variable to fill up

Reimplemented from Module.

virtual void statusModule | ( | String & | str | ) |
| protectedvirtual

Build the module identification part of the status answer

Parameters

  str | String variable to fill up

Reimplemented from Module.

virtual void statusParams | ( | String & | str | ) |
| protectedvirtual

Build the parameter reporting part of the status answer

Parameters

  str | String 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 | ) |
| inlineprotected

Set the default driver timeout

Parameters

  tout | New 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 | ) |
| inlineprotected

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

Parameters

  variable | True if the channels are dynamic, false for fixed

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

- yatephone.h