Asterisk - The Open Source Telephony Project  21.4.1
Data Structures | Macros | Enumerations | Functions | Variables
app_sla.c File Reference

Shared Line Appearances. More...

#include "asterisk.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/config.h"
#include "asterisk/app.h"
#include "asterisk/cli.h"
#include "asterisk/utils.h"
#include "asterisk/astobj2.h"
#include "asterisk/devicestate.h"
#include "asterisk/dial.h"
#include "asterisk/causes.h"
#include "asterisk/format_compatibility.h"

Go to the source code of this file.

Data Structures

struct  dial_trunk_args
 
struct  run_station_args
 
struct  sla_event
 
struct  sla_failed_station
 A station that failed to be dialed. More...
 
struct  sla_framehook_data
 Framehook to support HOLD within the conference. More...
 
struct  sla_ringing_station
 A station that is ringing. More...
 
struct  sla_ringing_trunk
 A trunk that is ringing. More...
 
struct  sla_station
 
struct  sla_station_ref
 A reference to a station. More...
 
struct  sla_trunk
 
struct  sla_trunk_ref
 A station's reference to a trunk. More...
 

Macros

#define MAX_CONFNUM   80
 
#define S(e)   case e: return # e;
 
#define SLA_CONFIG_FILE   "sla.conf"
 

Enumerations

enum  {
  CONFFLAG_QUIET = (1 << 0), CONFFLAG_MOH = (1 << 1), CONFFLAG_MARKEDEXIT = (1 << 2), CONFFLAG_MARKEDUSER = (1 << 3),
  CONFFLAG_PASS_DTMF = (1 << 4), CONFFLAG_SLA_STATION = (1 << 5), CONFFLAG_SLA_TRUNK = (1 << 6)
}
 
enum  { SLA_TRUNK_OPT_MOH = (1 << 0) }
 
enum  { SLA_TRUNK_OPT_ARG_MOH_CLASS = 0, SLA_TRUNK_OPT_ARG_ARRAY_SIZE = 1 }
 
enum  sla_event_type { SLA_EVENT_HOLD, SLA_EVENT_DIAL_STATE, SLA_EVENT_RINGING_TRUNK }
 Event types that can be queued up for the SLA thread. More...
 
enum  sla_hold_access { SLA_HOLD_OPEN, SLA_HOLD_PRIVATE }
 
enum  sla_station_hangup { SLA_STATION_HANGUP_NORMAL, SLA_STATION_HANGUP_TIMEOUT }
 
enum  sla_trunk_state {
  SLA_TRUNK_STATE_IDLE, SLA_TRUNK_STATE_RINGING, SLA_TRUNK_STATE_UP, SLA_TRUNK_STATE_ONHOLD,
  SLA_TRUNK_STATE_ONHOLD_BYME
}
 
enum  sla_which_trunk_refs { ALL_TRUNK_REFS, INACTIVE_TRUNK_REFS }
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
static void answer_trunk_chan (struct ast_channel *chan)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int attach_framehook (struct ast_channel *chan, const char *confname)
 
static int conf_kick_all (struct ast_channel *chan, const char *confname)
 
static int conf_run (struct ast_channel *chan, const char *confname, struct ast_flags *confflags, char *optargs[])
 
static struct sla_trunk_refcreate_trunk_ref (struct sla_trunk *trunk)
 
static void * dial_trunk (void *data)
 
static int load_config (int reload)
 
static int load_module (void)
 Load the module. More...
 
static struct sla_ringing_trunkqueue_ringing_trunk (struct sla_trunk *trunk)
 
static int reload (void)
 
static int remove_framehook (struct ast_channel *chan)
 
static void * run_station (void *data)
 
static void sla_add_trunk_to_station (struct sla_station *station, struct ast_variable *var)
 
static int sla_build_station (struct ast_config *cfg, const char *cat)
 
static int sla_build_trunk (struct ast_config *cfg, const char *cat)
 
static int sla_calc_station_delays (unsigned int *timeout)
 Calculate the ring delay for a station. More...
 
static int sla_calc_station_timeouts (unsigned int *timeout)
 Process station ring timeouts. More...
 
static int sla_calc_trunk_timeouts (unsigned int *timeout)
 Process trunk ring timeouts. More...
 
static void sla_change_trunk_state (const struct sla_trunk *trunk, enum sla_trunk_state state, enum sla_which_trunk_refs inactive_only, const struct sla_trunk_ref *exclude)
 
static int sla_check_device (const char *device)
 
static int sla_check_failed_station (const struct sla_station *station)
 Check to see if this station has failed to be dialed in the past minute. More...
 
static int sla_check_inuse_station (const struct sla_station *station)
 Check to see if a station is in use.
 
static int sla_check_ringing_station (const struct sla_station *station)
 Check to see if this station is already ringing. More...
 
static int sla_check_station_delay (struct sla_station *station, struct sla_ringing_trunk *ringing_trunk)
 Calculate the ring delay for a given ringing trunk on a station. More...
 
static int sla_check_station_hold_access (const struct sla_trunk *trunk, const struct sla_station *station)
 
static int sla_check_timed_out_station (const struct sla_ringing_trunk *ringing_trunk, const struct sla_station *station)
 Check to see if dialing this station already timed out for this ringing trunk. More...
 
static struct sla_trunk_refsla_choose_idle_trunk (const struct sla_station *station)
 For a given station, choose the highest priority idle trunk. More...
 
static struct sla_ringing_trunksla_choose_ringing_trunk (struct sla_station *station, struct sla_trunk_ref **trunk_ref, int rm)
 Choose the highest priority ringing trunk for a station. More...
 
static struct sla_failed_stationsla_create_failed_station (struct sla_station *station)
 
static struct sla_ringing_stationsla_create_ringing_station (struct sla_station *station)
 
static struct sla_station_refsla_create_station_ref (struct sla_station *station)
 
static void sla_destroy (void)
 
static void sla_dial_state_callback (struct ast_dial *dial)
 
static void sla_event_destroy (struct sla_event *event)
 
static void sla_failed_station_destroy (struct sla_failed_station *failed_station)
 
static struct sla_stationsla_find_station (const char *name)
 
static struct sla_trunksla_find_trunk (const char *name)
 
static struct sla_trunk_refsla_find_trunk_ref (const struct sla_station *station, const struct sla_trunk *trunk)
 
static struct sla_trunk_refsla_find_trunk_ref_byname (const struct sla_station *station, const char *name)
 Find a trunk reference on a station by name. More...
 
static struct ast_framesla_framehook (struct ast_channel *chan, struct ast_frame *f, enum ast_framehook_event event, void *data)
 
static int sla_framehook_consume (void *data, enum ast_frame_type type)
 Callback function which informs upstream if we are consuming a frame of a specific type.
 
static void sla_handle_dial_state_event (void)
 
static void sla_handle_hold_event (struct sla_event *event)
 
static void sla_handle_ringing_trunk_event (void)
 
static void sla_hangup_stations (void)
 
static const char * sla_hold_str (unsigned int hold_access)
 
static int sla_in_use (void)
 
static int sla_load_config (int reload)
 
static int sla_process_timers (struct timespec *ts)
 Calculate the time until the next known event. More...
 
static void sla_queue_event (enum sla_event_type type)
 
static void sla_queue_event_conf (enum sla_event_type type, struct ast_channel *chan, const char *confname)
 Queue a SLA event from the conference.
 
static void sla_queue_event_full (enum sla_event_type type, struct sla_trunk_ref *trunk_ref, struct sla_station *station, int lock)
 
static void sla_queue_event_nolock (enum sla_event_type type)
 
static int sla_ring_station (struct sla_ringing_trunk *ringing_trunk, struct sla_station *station)
 Ring a station. More...
 
static void sla_ring_stations (void)
 Ring stations based on current set of ringing trunks. More...
 
static void sla_ringing_station_destroy (struct sla_ringing_station *ringing_station)
 
static void sla_ringing_trunk_destroy (struct sla_ringing_trunk *ringing_trunk)
 
static char * sla_show_stations (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static char * sla_show_trunks (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static enum ast_device_state sla_state (const char *data)
 
static enum ast_device_state sla_state_to_devstate (enum sla_trunk_state state)
 
static int sla_station_cmp (void *obj, void *arg, int flags)
 
static void sla_station_destructor (void *obj)
 
static int sla_station_exec (struct ast_channel *chan, const char *data)
 
static int sla_station_is_marked (void *obj, void *arg, int flags)
 
static int sla_station_mark (void *obj, void *arg, int flags)
 
static void sla_station_ref_destructor (void *obj)
 
static int sla_station_release_refs (void *obj, void *arg, int flags)
 
static void sla_stop_ringing_station (struct sla_ringing_station *ringing_station, enum sla_station_hangup hangup)
 
static void sla_stop_ringing_trunk (struct sla_ringing_trunk *ringing_trunk)
 
static void * sla_thread (void *data)
 
static int sla_trunk_cmp (void *obj, void *arg, int flags)
 
static void sla_trunk_destructor (void *obj)
 
static int sla_trunk_exec (struct ast_channel *chan, const char *data)
 
static int sla_trunk_is_marked (void *obj, void *arg, int flags)
 
static int sla_trunk_mark (void *obj, void *arg, int flags)
 
static void sla_trunk_ref_destructor (void *obj)
 
static int sla_trunk_release_refs (void *obj, void *arg, int flags)
 
static const char * trunkstate2str (enum sla_trunk_state state)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Shared Line Appearances" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "da6642af068ee5e6490c5b1d2cc1d238" , .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_DEVSTATE_PROVIDER, }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct ast_cli_entry cli_sla []
 
struct {
   unsigned int   attempt_callerid:1
 
   ast_cond_t   cond
 
   struct {
      struct sla_event *   first
 
      struct sla_event *   last
 
   }   event_q
 
   struct {
      struct sla_failed_station *   first
 
      struct sla_failed_station *   last
 
   }   failed_stations
 
   ast_mutex_t   lock
 
   struct {
      struct sla_ringing_station *   first
 
      struct sla_ringing_station *   last
 
   }   ringing_stations
 
   struct {
      struct sla_ringing_trunk *   first
 
      struct sla_ringing_trunk *   last
 
   }   ringing_trunks
 
   unsigned int   stop:1
 
   pthread_t   thread
 
sla
 A structure for data used by the sla thread. More...
 
static const struct ast_datastore_info sla_framehook_datastore
 
static const char sla_registrar [] = "SLA"
 
static struct ao2_containersla_stations
 
static const struct ast_app_option sla_trunk_opts [128] = { [ 'M' ] = { .flag = SLA_TRUNK_OPT_MOH , .arg_index = SLA_TRUNK_OPT_ARG_MOH_CLASS + 1 }, }
 
static struct ao2_containersla_trunks
 
static const char *const slastation_app = "SLAStation"
 
static const char *const slatrunk_app = "SLATrunk"
 

Detailed Description

Shared Line Appearances.

Author
Naveen Albert aster.nosp@m.isk@.nosp@m.phrea.nosp@m.knet.nosp@m..org

Definition in file app_sla.c.

Enumeration Type Documentation

anonymous enum
Enumerator
CONFFLAG_QUIET 

If set there will be no enter or leave sounds

CONFFLAG_MOH 

Set to have music on hold when user is alone in conference

CONFFLAG_MARKEDEXIT 

If set, the channel will leave the conference if all marked users leave

CONFFLAG_MARKEDUSER 

If set, the user will be marked

CONFFLAG_PASS_DTMF 

Pass DTMF through the conference

Definition at line 130 of file app_sla.c.

130  {
131  /*! If set there will be no enter or leave sounds */
132  CONFFLAG_QUIET = (1 << 0),
133  /*! Set to have music on hold when user is alone in conference */
134  CONFFLAG_MOH = (1 << 1),
135  /*! If set, the channel will leave the conference if all marked users leave */
136  CONFFLAG_MARKEDEXIT = (1 << 2),
137  /*! If set, the user will be marked */
138  CONFFLAG_MARKEDUSER = (1 << 3),
139  /*! Pass DTMF through the conference */
140  CONFFLAG_PASS_DTMF = (1 << 4),
141  CONFFLAG_SLA_STATION = (1 << 5),
142  CONFFLAG_SLA_TRUNK = (1 << 6),
143 };

Event types that can be queued up for the SLA thread.

Enumerator
SLA_EVENT_HOLD 

A station has put the call on hold

SLA_EVENT_DIAL_STATE 

The state of a dial has changed

SLA_EVENT_RINGING_TRUNK 

The state of a ringing trunk has changed

Definition at line 278 of file app_sla.c.

278  {
279  /*! A station has put the call on hold */
281  /*! The state of a dial has changed */
283  /*! The state of a ringing trunk has changed */
285 };
Enumerator
SLA_HOLD_OPEN 

This means that any station can put it on hold, and any station can retrieve the call from hold.

SLA_HOLD_PRIVATE 

This means that only the station that put the call on hold may retrieve it from hold.

Definition at line 171 of file app_sla.c.

171  {
172  /*! This means that any station can put it on hold, and any station
173  * can retrieve the call from hold. */
175  /*! This means that only the station that put the call on hold may
176  * retrieve it from hold. */
178 };

Function Documentation

static int load_module ( void  )
static

Load the module.

Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.

Definition at line 2849 of file app_sla.c.

References ast_cli_register_multiple, ast_devstate_prov_add(), and ast_register_application_xml.

2850 {
2851  int res = 0;
2852 
2853  res |= load_config(0);
2854 
2855  ast_cli_register_multiple(cli_sla, ARRAY_LEN(cli_sla));
2856  res |= ast_register_application_xml(slastation_app, sla_station_exec);
2857  res |= ast_register_application_xml(slatrunk_app, sla_trunk_exec);
2858 
2859  res |= ast_devstate_prov_add("SLA", sla_state);
2860 
2861  return res;
2862 }
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
int ast_devstate_prov_add(const char *label, ast_devstate_prov_cb_type callback)
Add device state provider.
Definition: devicestate.c:391
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:640
static int sla_calc_station_delays ( unsigned int *  timeout)
static

Calculate the ring delay for a station.

Note
Assumes sla.lock is locked

Definition at line 1625 of file app_sla.c.

References ao2_iterator_destroy(), ao2_iterator_init(), ao2_ref, sla_check_inuse_station(), sla_check_ringing_station(), sla_check_station_delay(), and sla_choose_ringing_trunk().

Referenced by sla_process_timers().

1626 {
1627  struct sla_station *station;
1628  int res = 0;
1629  struct ao2_iterator i;
1630 
1631  i = ao2_iterator_init(sla_stations, 0);
1632  for (; (station = ao2_iterator_next(&i)); ao2_ref(station, -1)) {
1633  struct sla_ringing_trunk *ringing_trunk;
1634  int time_left;
1635 
1636  /* Ignore stations already ringing */
1637  if (sla_check_ringing_station(station)) {
1638  continue;
1639  }
1640 
1641  /* Ignore stations already on a call */
1642  if (sla_check_inuse_station(station)) {
1643  continue;
1644  }
1645 
1646  /* Ignore stations that don't have one of their trunks ringing */
1647  if (!(ringing_trunk = sla_choose_ringing_trunk(station, NULL, 0))) {
1648  continue;
1649  }
1650 
1651  if ((time_left = sla_check_station_delay(station, ringing_trunk)) == INT_MAX) {
1652  continue;
1653  }
1654 
1655  /* If there is no time left, then the station needs to start ringing.
1656  * Return non-zero so that an event will be queued up an event to
1657  * make that happen. */
1658  if (time_left <= 0) {
1659  res = 1;
1660  continue;
1661  }
1662 
1663  if (time_left < *timeout) {
1664  *timeout = time_left;
1665  }
1666  }
1668 
1669  return res;
1670 }
static int sla_check_ringing_station(const struct sla_station *station)
Check to see if this station is already ringing.
Definition: app_sla.c:1223
static struct sla_ringing_trunk * sla_choose_ringing_trunk(struct sla_station *station, struct sla_trunk_ref **trunk_ref, int rm)
Choose the highest priority ringing trunk for a station.
Definition: app_sla.c:1099
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
A trunk that is ringing.
Definition: app_sla.c:303
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
static int sla_check_station_delay(struct sla_station *station, struct sla_ringing_trunk *ringing_trunk)
Calculate the ring delay for a given ringing trunk on a station.
Definition: app_sla.c:1357
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1821
static int sla_check_inuse_station(const struct sla_station *station)
Check to see if a station is in use.
Definition: app_sla.c:1324
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
static int sla_calc_station_timeouts ( unsigned int *  timeout)
static

Process station ring timeouts.

Note
Called with sla.lock locked
Returns
non-zero if a change to the ringing stations was made

Definition at line 1533 of file app_sla.c.

References AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_tvdiff_ms(), ast_tvnow(), sla_ringing_trunk::ring_begin, sla_ringing_station::ring_begin, sla_station::ring_timeout, sla_trunk_ref::ring_timeout, and sla.

Referenced by sla_process_timers().

1534 {
1535  struct sla_ringing_trunk *ringing_trunk;
1536  struct sla_ringing_station *ringing_station;
1537  int res = 0;
1538 
1539  AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_stations, ringing_station, entry) {
1540  unsigned int ring_timeout = 0;
1541  int time_elapsed, time_left = INT_MAX, final_trunk_time_left = INT_MIN;
1542  struct sla_trunk_ref *trunk_ref;
1543 
1544  /* If there are any ring timeouts specified for a specific trunk
1545  * on the station, then use the highest per-trunk ring timeout.
1546  * Otherwise, use the ring timeout set for the entire station. */
1547  AST_LIST_TRAVERSE(&ringing_station->station->trunks, trunk_ref, entry) {
1548  struct sla_station_ref *station_ref;
1549  int trunk_time_elapsed, trunk_time_left;
1550 
1551  AST_LIST_TRAVERSE(&sla.ringing_trunks, ringing_trunk, entry) {
1552  if (ringing_trunk->trunk == trunk_ref->trunk) {
1553  break;
1554  }
1555  }
1556  if (!ringing_trunk) {
1557  continue;
1558  }
1559 
1560  /* If there is a trunk that is ringing without a timeout, then the
1561  * only timeout that could matter is a global station ring timeout. */
1562  if (!trunk_ref->ring_timeout) {
1563  break;
1564  }
1565 
1566  /* This trunk on this station is ringing and has a timeout.
1567  * However, make sure this trunk isn't still ringing from a
1568  * previous timeout. If so, don't consider it. */
1569  AST_LIST_TRAVERSE(&ringing_trunk->timed_out_stations, station_ref, entry) {
1570  if (station_ref->station == ringing_station->station) {
1571  break;
1572  }
1573  }
1574  if (station_ref) {
1575  continue;
1576  }
1577 
1578  trunk_time_elapsed = ast_tvdiff_ms(ast_tvnow(), ringing_trunk->ring_begin);
1579  trunk_time_left = (trunk_ref->ring_timeout * 1000) - trunk_time_elapsed;
1580  if (trunk_time_left > final_trunk_time_left) {
1581  final_trunk_time_left = trunk_time_left;
1582  }
1583  }
1584 
1585  /* No timeout was found for ringing trunks, and no timeout for the entire station */
1586  if (final_trunk_time_left == INT_MIN && !ringing_station->station->ring_timeout) {
1587  continue;
1588  }
1589 
1590  /* Compute how much time is left for a global station timeout */
1591  if (ringing_station->station->ring_timeout) {
1592  ring_timeout = ringing_station->station->ring_timeout;
1593  time_elapsed = ast_tvdiff_ms(ast_tvnow(), ringing_station->ring_begin);
1594  time_left = (ring_timeout * 1000) - time_elapsed;
1595  }
1596 
1597  /* If the time left based on the per-trunk timeouts is smaller than the
1598  * global station ring timeout, use that. */
1599  if (final_trunk_time_left > INT_MIN && final_trunk_time_left < time_left) {
1600  time_left = final_trunk_time_left;
1601  }
1602 
1603  /* If there is no time left, the station needs to stop ringing */
1604  if (time_left <= 0) {
1606  sla_stop_ringing_station(ringing_station, SLA_STATION_HANGUP_TIMEOUT);
1607  res = 1;
1608  continue;
1609  }
1610 
1611  /* There is still some time left for this station to ring, so save that
1612  * timeout if it is the first event scheduled to occur */
1613  if (time_left < *timeout) {
1614  *timeout = time_left;
1615  }
1616  }
1618 
1619  return res;
1620 }
unsigned int ring_timeout
Definition: app_sla.c:263
A station that is ringing.
Definition: app_sla.c:317
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:159
A reference to a station.
Definition: app_sla.c:214
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Definition: time.h:107
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:615
struct timeval ring_begin
Definition: app_sla.c:306
A trunk that is ringing.
Definition: app_sla.c:303
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:557
struct timeval ring_begin
Definition: app_sla.c:320
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
Definition: search.h:40
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:529
A station's reference to a trunk.
Definition: app_sla.c:255
unsigned int ring_timeout
Definition: app_sla.c:194
static struct @66 sla
A structure for data used by the sla thread.
static int sla_calc_trunk_timeouts ( unsigned int *  timeout)
static

Process trunk ring timeouts.

Note
Called with sla.lock locked
Returns
non-zero if a change to the ringing trunks was made

Definition at line 1501 of file app_sla.c.

References AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_tvdiff_ms(), ast_tvnow(), pbx_builtin_setvar_helper(), sla_ringing_trunk::ring_begin, and sla.

Referenced by sla_process_timers().

1502 {
1503  struct sla_ringing_trunk *ringing_trunk;
1504  int res = 0;
1505 
1506  AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) {
1507  int time_left, time_elapsed;
1508  if (!ringing_trunk->trunk->ring_timeout) {
1509  continue;
1510  }
1511  time_elapsed = ast_tvdiff_ms(ast_tvnow(), ringing_trunk->ring_begin);
1512  time_left = (ringing_trunk->trunk->ring_timeout * 1000) - time_elapsed;
1513  if (time_left <= 0) {
1514  pbx_builtin_setvar_helper(ringing_trunk->trunk->chan, "SLATRUNK_STATUS", "RINGTIMEOUT");
1516  sla_stop_ringing_trunk(ringing_trunk);
1517  res = 1;
1518  continue;
1519  }
1520  if (time_left < *timeout) {
1521  *timeout = time_left;
1522  }
1523  }
1525 
1526  return res;
1527 }
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:159
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Definition: time.h:107
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:615
struct timeval ring_begin
Definition: app_sla.c:306
A trunk that is ringing.
Definition: app_sla.c:303
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:557
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
Definition: search.h:40
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:529
static struct @66 sla
A structure for data used by the sla thread.
static int sla_check_failed_station ( const struct sla_station station)
static

Check to see if this station has failed to be dialed in the past minute.

Note
assumes sla.lock is locked

Definition at line 1239 of file app_sla.c.

References AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_tvdiff_ms(), ast_tvnow(), and sla.

Referenced by sla_ring_stations().

1240 {
1241  struct sla_failed_station *failed_station;
1242  int res = 0;
1243 
1244  AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.failed_stations, failed_station, entry) {
1245  if (station != failed_station->station) {
1246  continue;
1247  }
1248  if (ast_tvdiff_ms(ast_tvnow(), failed_station->last_try) > 1000) {
1250  sla_failed_station_destroy(failed_station);
1251  break;
1252  }
1253  res = 1;
1254  }
1256 
1257  return res;
1258 }
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:159
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Definition: time.h:107
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:615
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:557
A station that failed to be dialed.
Definition: app_sla.c:296
Definition: search.h:40
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:529
static struct @66 sla
A structure for data used by the sla thread.
static int sla_check_ringing_station ( const struct sla_station station)
static

Check to see if this station is already ringing.

Note
Assumes sla.lock is locked

Definition at line 1223 of file app_sla.c.

References AST_LIST_TRAVERSE, and sla.

Referenced by sla_calc_station_delays(), and sla_ring_stations().

1224 {
1225  struct sla_ringing_station *ringing_station;
1226 
1227  AST_LIST_TRAVERSE(&sla.ringing_stations, ringing_station, entry) {
1228  if (station == ringing_station->station) {
1229  return 1;
1230  }
1231  }
1232 
1233  return 0;
1234 }
A station that is ringing.
Definition: app_sla.c:317
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
Definition: search.h:40
static struct @66 sla
A structure for data used by the sla thread.
static int sla_check_station_delay ( struct sla_station station,
struct sla_ringing_trunk ringing_trunk 
)
static

Calculate the ring delay for a given ringing trunk on a station.

Parameters
stationthe station
ringing_trunkthe trunk. If NULL, the highest priority ringing trunk will be used
Returns
the number of ms left before the delay is complete, or INT_MAX if there is no delay

Definition at line 1357 of file app_sla.c.

References ast_tvdiff_ms(), ast_tvnow(), RAII_VAR, sla_ringing_trunk::ring_begin, sla_station::ring_delay, sla_trunk_ref::ring_delay, and sla_choose_ringing_trunk().

Referenced by sla_calc_station_delays(), and sla_ring_stations().

1358 {
1359  RAII_VAR(struct sla_trunk_ref *, trunk_ref, NULL, ao2_cleanup);
1360  unsigned int delay = UINT_MAX;
1361  int time_left, time_elapsed;
1362 
1363  if (!ringing_trunk) {
1364  ringing_trunk = sla_choose_ringing_trunk(station, &trunk_ref, 0);
1365  } else {
1366  trunk_ref = sla_find_trunk_ref(station, ringing_trunk->trunk);
1367  }
1368 
1369  if (!ringing_trunk || !trunk_ref) {
1370  return delay;
1371  }
1372 
1373  /* If this station has a ring delay specific to the highest priority
1374  * ringing trunk, use that. Otherwise, use the ring delay specified
1375  * globally for the station. */
1376  delay = trunk_ref->ring_delay;
1377  if (!delay) {
1378  delay = station->ring_delay;
1379  }
1380  if (!delay) {
1381  return INT_MAX;
1382  }
1383 
1384  time_elapsed = ast_tvdiff_ms(ast_tvnow(), ringing_trunk->ring_begin);
1385  time_left = (delay * 1000) - time_elapsed;
1386 
1387  return time_left;
1388 }
static struct sla_ringing_trunk * sla_choose_ringing_trunk(struct sla_station *station, struct sla_trunk_ref **trunk_ref, int rm)
Choose the highest priority ringing trunk for a station.
Definition: app_sla.c:1099
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:159
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
Definition: time.h:107
unsigned int ring_delay
Definition: app_sla.c:198
struct timeval ring_begin
Definition: app_sla.c:306
A station's reference to a trunk.
Definition: app_sla.c:255
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
Definition: utils.h:941
static int sla_check_timed_out_station ( const struct sla_ringing_trunk ringing_trunk,
const struct sla_station station 
)
static

Check to see if dialing this station already timed out for this ringing trunk.

Note
Assumes sla.lock is locked

Definition at line 1078 of file app_sla.c.

References AST_LIST_TRAVERSE.

Referenced by sla_choose_ringing_trunk(), and sla_ring_stations().

1079 {
1080  struct sla_station_ref *timed_out_station;
1081 
1082  AST_LIST_TRAVERSE(&ringing_trunk->timed_out_stations, timed_out_station, entry) {
1083  if (station == timed_out_station->station) {
1084  return 1;
1085  }
1086  }
1087 
1088  return 0;
1089 }
A reference to a station.
Definition: app_sla.c:214
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
Definition: search.h:40
static struct sla_trunk_ref* sla_choose_idle_trunk ( const struct sla_station station)
static

For a given station, choose the highest priority idle trunk.

Precondition
sla_station is locked

Definition at line 1935 of file app_sla.c.

References ao2_ref, and AST_LIST_TRAVERSE.

1936 {
1937  struct sla_trunk_ref *trunk_ref = NULL;
1938 
1939  AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) {
1940  if (trunk_ref->state == SLA_TRUNK_STATE_IDLE) {
1941  ao2_ref(trunk_ref, 1);
1942  break;
1943  }
1944  }
1945 
1946  return trunk_ref;
1947 }
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
Definition: search.h:40
A station's reference to a trunk.
Definition: app_sla.c:255
static struct sla_ringing_trunk* sla_choose_ringing_trunk ( struct sla_station station,
struct sla_trunk_ref **  trunk_ref,
int  rm 
)
static

Choose the highest priority ringing trunk for a station.

Parameters
stationthe station
rmremove the ringing trunk once selected
trunk_refa place to store the pointer to this stations reference to the selected trunk
Returns
a pointer to the selected ringing trunk, or NULL if none found
Note
Assumes that sla.lock is locked

Definition at line 1099 of file app_sla.c.

References ao2_ref, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, sla, and sla_check_timed_out_station().

Referenced by sla_calc_station_delays(), and sla_check_station_delay().

1100 {
1101  struct sla_trunk_ref *s_trunk_ref;
1102  struct sla_ringing_trunk *ringing_trunk = NULL;
1103 
1104  AST_LIST_TRAVERSE(&station->trunks, s_trunk_ref, entry) {
1105  AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) {
1106  /* Make sure this is the trunk we're looking for */
1107  if (s_trunk_ref->trunk != ringing_trunk->trunk) {
1108  continue;
1109  }
1110 
1111  /* This trunk on the station is ringing. But, make sure this station
1112  * didn't already time out while this trunk was ringing. */
1113  if (sla_check_timed_out_station(ringing_trunk, station)) {
1114  continue;
1115  }
1116 
1117  if (rm) {
1119  }
1120 
1121  if (trunk_ref) {
1122  ao2_ref(s_trunk_ref, 1);
1123  *trunk_ref = s_trunk_ref;
1124  }
1125 
1126  break;
1127  }
1129 
1130  if (ringing_trunk) {
1131  break;
1132  }
1133  }
1134 
1135  return ringing_trunk;
1136 }
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
Definition: linkedlists.h:615
A trunk that is ringing.
Definition: app_sla.c:303
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Definition: linkedlists.h:557
static int sla_check_timed_out_station(const struct sla_ringing_trunk *ringing_trunk, const struct sla_station *station)
Check to see if dialing this station already timed out for this ringing trunk.
Definition: app_sla.c:1078
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
Definition: search.h:40
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
Definition: linkedlists.h:529
A station's reference to a trunk.
Definition: app_sla.c:255
static struct @66 sla
A structure for data used by the sla thread.
static struct sla_trunk_ref* sla_find_trunk_ref_byname ( const struct sla_station station,
const char *  name 
)
static

Find a trunk reference on a station by name.

Parameters
stationthe station
namethe trunk's name
Precondition
sla_station is locked
Returns
a pointer to the station's trunk reference. If the trunk is not found, it is not idle and barge is disabled, or if it is on hold and private hold is set, then NULL will be returned.

Definition at line 759 of file app_sla.c.

References ao2_ref, ast_debug, AST_LIST_TRAVERSE, sla_trunk::barge_disabled, sla_trunk::hold_access, sla_trunk::hold_stations, and SLA_HOLD_PRIVATE.

760 {
761  struct sla_trunk_ref *trunk_ref = NULL;
762 
763  AST_LIST_TRAVERSE(&station->trunks, trunk_ref, entry) {
764  if (strcasecmp(trunk_ref->trunk->name, name)) {
765  continue;
766  }
767 
768  if (trunk_ref->trunk->barge_disabled && trunk_ref->state == SLA_TRUNK_STATE_UP) {
769  ast_debug(2, "Barge disabled, trunk not available\n");
770  trunk_ref = NULL;
771  } else if (trunk_ref->trunk->hold_stations && trunk_ref->trunk->hold_access == SLA_HOLD_PRIVATE && trunk_ref->state != SLA_TRUNK_STATE_ONHOLD_BYME) {
772  ast_debug(2, "Private hold by another station\n");
773  trunk_ref = NULL;
774  } else if (sla_check_station_hold_access(trunk_ref->trunk, station)) {
775  ast_debug(2, "No hold access\n");
776  trunk_ref = NULL;
777  }
778 
779  break;
780  }
781 
782  if (trunk_ref) {
783  ao2_ref(trunk_ref, 1);
784  }
785 
786  return trunk_ref;
787 }
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
unsigned int barge_disabled
Definition: app_sla.c:238
#define ast_debug(level,...)
Log a DEBUG message.
unsigned int hold_access
Definition: app_sla.c:241
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
unsigned int hold_stations
Definition: app_sla.c:233
Definition: search.h:40
A station's reference to a trunk.
Definition: app_sla.c:255
static int sla_process_timers ( struct timespec *  ts)
static

Calculate the time until the next known event.

Note
Called with sla.lock locked

Definition at line 1674 of file app_sla.c.

References ast_samp2tv(), ast_tvadd(), ast_tvnow(), sla_calc_station_delays(), sla_calc_station_timeouts(), sla_calc_trunk_timeouts(), and SLA_EVENT_RINGING_TRUNK.

1675 {
1676  unsigned int timeout = UINT_MAX;
1677  struct timeval wait;
1678  unsigned int change_made = 0;
1679 
1680  /* Check for ring timeouts on ringing trunks */
1681  if (sla_calc_trunk_timeouts(&timeout)) {
1682  change_made = 1;
1683  }
1684 
1685  /* Check for ring timeouts on ringing stations */
1686  if (sla_calc_station_timeouts(&timeout)) {
1687  change_made = 1;
1688  }
1689 
1690  /* Check for station ring delays */
1691  if (sla_calc_station_delays(&timeout)) {
1692  change_made = 1;
1693  }
1694 
1695  /* queue reprocessing of ringing trunks */
1696  if (change_made) {
1697  sla_queue_event_nolock(SLA_EVENT_RINGING_TRUNK);
1698  }
1699 
1700  /* No timeout */
1701  if (timeout == UINT_MAX) {
1702  return 0;
1703  }
1704 
1705  if (ts) {
1706  wait = ast_tvadd(ast_tvnow(), ast_samp2tv(timeout, 1000));
1707  ts->tv_sec = wait.tv_sec;
1708  ts->tv_nsec = wait.tv_usec * 1000;
1709  }
1710 
1711  return 1;
1712 }
static int sla_calc_trunk_timeouts(unsigned int *timeout)
Process trunk ring timeouts.
Definition: app_sla.c:1501
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:159
static int sla_calc_station_delays(unsigned int *timeout)
Calculate the ring delay for a station.
Definition: app_sla.c:1625
struct timeval ast_samp2tv(unsigned int _nsamp, unsigned int _rate)
Returns a timeval corresponding to the duration of n samples at rate r. Useful to convert samples to ...
Definition: time.h:282
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
Definition: extconf.c:2282
static int sla_calc_station_timeouts(unsigned int *timeout)
Process station ring timeouts.
Definition: app_sla.c:1533
static int sla_ring_station ( struct sla_ringing_trunk ringing_trunk,
struct sla_station station 
)
static

Ring a station.

Note
Assumes sla.lock is locked

Definition at line 1263 of file app_sla.c.

References ast_dial_append(), ast_dial_create(), ast_dial_destroy(), ast_dial_join(), AST_DIAL_RESULT_TRYING, ast_dial_run(), ast_dial_set_state_callback(), AST_LIST_INSERT_HEAD, ast_party_caller_free(), ast_party_caller_init(), ast_strdupa, and sla.

Referenced by sla_ring_stations().

1264 {
1265  char *tech, *tech_data;
1266  struct ast_dial *dial;
1267  struct sla_ringing_station *ringing_station;
1268  enum ast_dial_result res;
1269  int caller_is_saved;
1270  struct ast_party_caller caller;
1271 
1272  if (!(dial = ast_dial_create())) {
1273  return -1;
1274  }
1275 
1276  ast_dial_set_state_callback(dial, sla_dial_state_callback);
1277  tech_data = ast_strdupa(station->device);
1278  tech = strsep(&tech_data, "/");
1279 
1280  if (ast_dial_append(dial, tech, tech_data, NULL) == -1) {
1281  ast_dial_destroy(dial);
1282  return -1;
1283  }
1284 
1285  /* Do we need to save off the caller ID data? */
1286  caller_is_saved = 0;
1287  if (!sla.attempt_callerid) {
1288  caller_is_saved = 1;
1289  caller = *ast_channel_caller(ringing_trunk->trunk->chan);
1290  ast_party_caller_init(ast_channel_caller(ringing_trunk->trunk->chan));
1291  }
1292 
1293  res = ast_dial_run(dial, ringing_trunk->trunk->chan, 1);
1294 
1295  /* Restore saved caller ID */
1296  if (caller_is_saved) {
1297  ast_party_caller_free(ast_channel_caller(ringing_trunk->trunk->chan));
1298  ast_channel_caller_set(ringing_trunk->trunk->chan, &caller);
1299  }
1300 
1301  if (res != AST_DIAL_RESULT_TRYING) {
1302  struct sla_failed_station *failed_station;
1303  ast_dial_destroy(dial);
1304  if ((failed_station = sla_create_failed_station(station))) {
1305  AST_LIST_INSERT_HEAD(&sla.failed_stations, failed_station, entry);
1306  }
1307  return -1;
1308  }
1309  if (!(ringing_station = sla_create_ringing_station(station))) {
1310  ast_dial_join(dial);
1311  ast_dial_destroy(dial);
1312  return -1;
1313  }
1314 
1315  station->dial = dial;
1316 
1317  AST_LIST_INSERT_HEAD(&sla.ringing_stations, ringing_station, entry);
1318 
1319  return 0;
1320 }
int ast_dial_destroy(struct ast_dial *dial)
Destroys a dialing structure.
Definition: dial.c:1091
Main dialing structure. Contains global options, channels being dialed, and more! ...
Definition: dial.c:48
A station that is ringing.
Definition: app_sla.c:317
void ast_party_caller_free(struct ast_party_caller *doomed)
Destroy the caller party contents.
Definition: channel.c:2015
void ast_dial_set_state_callback(struct ast_dial *dial, ast_dial_state_callback callback)
Set a callback for state changes.
Definition: dial.c:1269
ast_dial_result
List of return codes for dial run API calls.
Definition: dial.h:54
enum ast_dial_result ast_dial_join(struct ast_dial *dial)
Cancel async thread.
Definition: dial.c:1017
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: astmm.h:298
Caller Party information.
Definition: channel.h:418
enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async)
Execute dialing synchronously or asynchronously.
Definition: dial.c:935
int ast_dial_append(struct ast_dial *dial, const char *tech, const char *device, const struct ast_assigned_ids *assignedids)
Append a channel.
Definition: dial.c:280
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
Definition: linkedlists.h:711
struct ast_dial * ast_dial_create(void)
New dialing structure.
Definition: dial.c:223
A station that failed to be dialed.
Definition: app_sla.c:296
Definition: search.h:40
static struct @66 sla
A structure for data used by the sla thread.
void ast_party_caller_init(struct ast_party_caller *init)
Initialize the given caller structure.
Definition: channel.c:1978
static void sla_ring_stations ( void  )
static

Ring stations based on current set of ringing trunks.

Note
Assumes that sla.lock is locked

Definition at line 1393 of file app_sla.c.

References AST_LIST_TRAVERSE, sla, sla_check_failed_station(), sla_check_inuse_station(), sla_check_ringing_station(), sla_check_station_delay(), sla_check_timed_out_station(), and sla_ring_station().

1394 {
1395  struct sla_station_ref *station_ref;
1396  struct sla_ringing_trunk *ringing_trunk;
1397 
1398  /* Make sure that every station that uses at least one of the ringing
1399  * trunks, is ringing. */
1400  AST_LIST_TRAVERSE(&sla.ringing_trunks, ringing_trunk, entry) {
1401  AST_LIST_TRAVERSE(&ringing_trunk->trunk->stations, station_ref, entry) {
1402  int time_left;
1403 
1404  /* Is this station already ringing? */
1405  if (sla_check_ringing_station(station_ref->station)) {
1406  continue;
1407  }
1408 
1409  /* Is this station already in a call? */
1410  if (sla_check_inuse_station(station_ref->station)) {
1411  continue;
1412  }
1413 
1414  /* Did we fail to dial this station earlier? If so, has it been
1415  * a minute since we tried? */
1416  if (sla_check_failed_station(station_ref->station)) {
1417  continue;
1418  }
1419 
1420  /* If this station already timed out while this trunk was ringing,
1421  * do not dial it again for this ringing trunk. */
1422  if (sla_check_timed_out_station(ringing_trunk, station_ref->station)) {
1423  continue;
1424  }
1425 
1426  /* Check for a ring delay in progress */
1427  time_left = sla_check_station_delay(station_ref->station, ringing_trunk);
1428  if (time_left != INT_MAX && time_left > 0) {
1429  continue;
1430  }
1431 
1432  /* It is time to make this station begin to ring. Do it! */
1433  sla_ring_station(ringing_trunk, station_ref->station);
1434  }
1435  }
1436  /* Now, all of the stations that should be ringing, are ringing. */
1437 }
static int sla_check_ringing_station(const struct sla_station *station)
Check to see if this station is already ringing.
Definition: app_sla.c:1223
A reference to a station.
Definition: app_sla.c:214
A trunk that is ringing.
Definition: app_sla.c:303
static int sla_check_timed_out_station(const struct sla_ringing_trunk *ringing_trunk, const struct sla_station *station)
Check to see if dialing this station already timed out for this ringing trunk.
Definition: app_sla.c:1078
static int sla_check_failed_station(const struct sla_station *station)
Check to see if this station has failed to be dialed in the past minute.
Definition: app_sla.c:1239
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
static int sla_check_station_delay(struct sla_station *station, struct sla_ringing_trunk *ringing_trunk)
Calculate the ring delay for a given ringing trunk on a station.
Definition: app_sla.c:1357
static int sla_ring_station(struct sla_ringing_trunk *ringing_trunk, struct sla_station *station)
Ring a station.
Definition: app_sla.c:1263
static int sla_check_inuse_station(const struct sla_station *station)
Check to see if a station is in use.
Definition: app_sla.c:1324
Definition: search.h:40
static struct @66 sla
A structure for data used by the sla thread.

Variable Documentation

unsigned int attempt_callerid

Attempt to handle CallerID, even though it is known not to work properly in some situations.

Definition at line 339 of file app_sla.c.

struct ast_cli_entry cli_sla[]
static
Initial value:
= {
{ .handler = sla_show_trunks , .summary = "Show SLA Trunks" ,},
{ .handler = sla_show_stations , .summary = "Show SLA Stations" ,},
}

Definition at line 514 of file app_sla.c.

struct { ... } sla
Initial value:
= {
.thread = AST_PTHREADT_NULL,
}

A structure for data used by the sla thread.

Referenced by sla_calc_station_timeouts(), sla_calc_trunk_timeouts(), sla_check_failed_station(), sla_check_ringing_station(), sla_choose_ringing_trunk(), sla_ring_station(), and sla_ring_stations().

const struct ast_datastore_info sla_framehook_datastore
static
Initial value:
= {
.type = "app_sla",
}

Definition at line 610 of file app_sla.c.

pthread_t thread