Asterisk - The Open Source Telephony Project  18.5.0
Macros | Functions | Variables
agent.c File Reference

SNMP Agent / SubAgent support for Asterisk. More...

#include "asterisk.h"
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "asterisk/paths.h"
#include "asterisk/channel.h"
#include "asterisk/logger.h"
#include "asterisk/options.h"
#include "asterisk/indications.h"
#include "asterisk/ast_version.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "agent.h"
Include dependency graph for agent.c:

Go to the source code of this file.

Macros

#define ASTCHANACCOUNTCODE   18
 
#define ASTCHANADSI   36
 
#define ASTCHANAMAFLAGS   35
 
#define ASTCHANAPP   10
 
#define ASTCHANBRIDGE   6
 
#define ASTCHANBRIDGECOUNT   1
 
#define ASTCHANCALLGROUP   21
 
#define ASTCHANCIDANI   29
 
#define ASTCHANCIDANI2   32
 
#define ASTCHANCIDDNID   26
 
#define ASTCHANCIDNAME   28
 
#define ASTCHANCIDNUM   27
 
#define ASTCHANCIDPRES   31
 
#define ASTCHANCIDRDNIS   30
 
#define ASTCHANCIDTNS   34
 
#define ASTCHANCIDTON   33
 
#define ASTCHANCONTEXT   12
 
#define ASTCHANCOUNT   1
 
#define ASTCHANDATA   11
 
#define ASTCHANEXTEN   16
 
#define ASTCHANFLAGS   40
 
#define ASTCHANFORWARDTO   19
 
#define ASTCHANHANGUPCAUSE   38
 
#define ASTCHANINDEX   1
 
#define ASTCHANLANGUAGE   3
 
#define ASTCHANMACROCONTEXT   13
 
#define ASTCHANMACROEXTEN   14
 
#define ASTCHANMACROPRI   15
 
#define ASTCHANMASQ   7
 
#define ASTCHANMASQR   8
 
#define ASTCHANMUSICCLASS   5
 
#define ASTCHANMUTED   24
 
#define ASTCHANNAME   2
 
#define ASTCHANNELS   5
 
#define ASTCHANPICKUPGROUP   22
 
#define ASTCHANPRI   17
 
#define ASTCHANRINGS   25
 
#define ASTCHANSCALARS   5
 
#define ASTCHANSTATE   23
 
#define ASTCHANTABLE   2
 
#define ASTCHANTONEZONE   37
 
#define ASTCHANTRANSFERCAP   41
 
#define ASTCHANTYPE   4
 
#define ASTCHANTYPECHANNELS   7
 
#define ASTCHANTYPECOUNT   3
 
#define ASTCHANTYPEDESC   3
 
#define ASTCHANTYPEDEVSTATE   4
 
#define ASTCHANTYPEINDEX   1
 
#define ASTCHANTYPEINDICATIONS   5
 
#define ASTCHANTYPENAME   2
 
#define ASTCHANTYPETABLE   4
 
#define ASTCHANTYPETRANSFER   6
 
#define ASTCHANUNIQUEID   20
 
#define ASTCHANVARIABLES   39
 
#define ASTCHANWHENHANGUP   9
 
#define ASTCONFACTIVECALLS   5
 
#define ASTCONFIGURATION   2
 
#define ASTCONFPID   3
 
#define ASTCONFPROCESSEDCALLS   6
 
#define ASTCONFRELOADTIME   2
 
#define ASTCONFSOCKET   4
 
#define ASTCONFUPTIME   1
 
#define ASTINDALIAS   3
 
#define ASTINDCOUNT   1
 
#define ASTINDCOUNTRY   2
 
#define ASTINDCURRENT   2
 
#define ASTINDDESCRIPTION   4
 
#define ASTINDICATIONS   4
 
#define ASTINDINDEX   1
 
#define ASTINDTABLE   3
 
#define ASTMM_LIBC   ASTMM_IGNORE
 
#define ASTMODCOUNT   1
 
#define ASTMODULES   3
 
#define ASTVERSION   1
 
#define ASTVERSTRING   1
 
#define ASTVERTAG   2
 
#define HAVE_DMALLOC_H   0 /* XXX we shouldn't do this */
 
#define unload_module   ast_unload_module
 

Functions

void * agent_thread (void *arg)
 
static u_char * ast_var_channel_bridge (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
 
static u_char * ast_var_channel_types (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
 
static u_char * ast_var_channel_types_table (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
 
static u_char * ast_var_channels (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
 
static u_char * ast_var_channels_table (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
 
static u_char * ast_var_Config (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
 
static u_char * ast_var_indications (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
 
static u_char * ast_var_indications_table (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
 
static u_char * ast_var_Modules (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
 
static u_char * ast_var_Version (struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
 
static int countmodule (const char *mod, const char *desc, int use, const char *status, const char *like, enum ast_module_support_level support_level)
 
int header_generic (struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
 
int header_simple_table (struct variable *, oid *, size_t *, int, size_t *, WriteMethod **, int)
 
static void init_asterisk_mib (void)
 
int register_sysORTable (oid *, size_t, const char *)
 
static int term_asterisk_mib (int majorID, int minorID, void *serverarg, void *clientarg)
 
int unregister_sysORTable (oid *, size_t)
 

Variables

static oid asterisk_oid [] = { 1, 3, 6, 1, 4, 1, 22736, 1 }
 

Detailed Description

SNMP Agent / SubAgent support for Asterisk.

Author
Thorsten Lockert tholo.nosp@m.@voo.nosp@m.p.as

Definition in file agent.c.

Macro Definition Documentation

◆ ASTCHANACCOUNTCODE

#define ASTCHANACCOUNTCODE   18

Definition at line 150 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANADSI

#define ASTCHANADSI   36

Definition at line 168 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANAMAFLAGS

#define ASTCHANAMAFLAGS   35

Definition at line 167 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANAPP

#define ASTCHANAPP   10

Definition at line 142 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANBRIDGE

#define ASTCHANBRIDGE   6

Definition at line 138 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANBRIDGECOUNT

#define ASTCHANBRIDGECOUNT   1

Definition at line 187 of file agent.c.

Referenced by ast_var_channel_bridge(), and init_asterisk_mib().

◆ ASTCHANCALLGROUP

#define ASTCHANCALLGROUP   21

Definition at line 153 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANCIDANI

#define ASTCHANCIDANI   29

Definition at line 161 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANCIDANI2

#define ASTCHANCIDANI2   32

Definition at line 164 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANCIDDNID

#define ASTCHANCIDDNID   26

Definition at line 158 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANCIDNAME

#define ASTCHANCIDNAME   28

Definition at line 160 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANCIDNUM

#define ASTCHANCIDNUM   27

Definition at line 159 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANCIDPRES

#define ASTCHANCIDPRES   31

Definition at line 163 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANCIDRDNIS

#define ASTCHANCIDRDNIS   30

Definition at line 162 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANCIDTNS

#define ASTCHANCIDTNS   34

Definition at line 166 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANCIDTON

#define ASTCHANCIDTON   33

Definition at line 165 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANCONTEXT

#define ASTCHANCONTEXT   12

Definition at line 144 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANCOUNT

#define ASTCHANCOUNT   1

Definition at line 130 of file agent.c.

Referenced by ast_var_channels(), and init_asterisk_mib().

◆ ASTCHANDATA

#define ASTCHANDATA   11

Definition at line 143 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANEXTEN

#define ASTCHANEXTEN   16

Definition at line 148 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANFLAGS

#define ASTCHANFLAGS   40

Definition at line 172 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANFORWARDTO

#define ASTCHANFORWARDTO   19

Definition at line 151 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANHANGUPCAUSE

#define ASTCHANHANGUPCAUSE   38

Definition at line 170 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANINDEX

#define ASTCHANINDEX   1

Definition at line 133 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANLANGUAGE

#define ASTCHANLANGUAGE   3

Definition at line 135 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANMACROCONTEXT

#define ASTCHANMACROCONTEXT   13

Definition at line 145 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANMACROEXTEN

#define ASTCHANMACROEXTEN   14

Definition at line 146 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANMACROPRI

#define ASTCHANMACROPRI   15

Definition at line 147 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANMASQ

#define ASTCHANMASQ   7

Definition at line 139 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANMASQR

#define ASTCHANMASQR   8

Definition at line 140 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANMUSICCLASS

#define ASTCHANMUSICCLASS   5

Definition at line 137 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANMUTED

#define ASTCHANMUTED   24

Definition at line 156 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANNAME

#define ASTCHANNAME   2

Definition at line 134 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANNELS

#define ASTCHANNELS   5

Definition at line 129 of file agent.c.

Referenced by init_asterisk_mib().

◆ ASTCHANPICKUPGROUP

#define ASTCHANPICKUPGROUP   22

Definition at line 154 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANPRI

#define ASTCHANPRI   17

Definition at line 149 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANRINGS

#define ASTCHANRINGS   25

Definition at line 157 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANSCALARS

#define ASTCHANSCALARS   5

Definition at line 186 of file agent.c.

Referenced by init_asterisk_mib().

◆ ASTCHANSTATE

#define ASTCHANSTATE   23

Definition at line 155 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANTABLE

#define ASTCHANTABLE   2

Definition at line 132 of file agent.c.

Referenced by init_asterisk_mib().

◆ ASTCHANTONEZONE

#define ASTCHANTONEZONE   37

Definition at line 169 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANTRANSFERCAP

#define ASTCHANTRANSFERCAP   41

Definition at line 173 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANTYPE

#define ASTCHANTYPE   4

Definition at line 136 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANTYPECHANNELS

#define ASTCHANTYPECHANNELS   7

Definition at line 184 of file agent.c.

Referenced by ast_var_channel_types_table(), and init_asterisk_mib().

◆ ASTCHANTYPECOUNT

#define ASTCHANTYPECOUNT   3

Definition at line 175 of file agent.c.

Referenced by ast_var_channel_types(), and init_asterisk_mib().

◆ ASTCHANTYPEDESC

#define ASTCHANTYPEDESC   3

Definition at line 180 of file agent.c.

Referenced by ast_var_channel_types_table(), and init_asterisk_mib().

◆ ASTCHANTYPEDEVSTATE

#define ASTCHANTYPEDEVSTATE   4

Definition at line 181 of file agent.c.

Referenced by ast_var_channel_types_table(), and init_asterisk_mib().

◆ ASTCHANTYPEINDEX

#define ASTCHANTYPEINDEX   1

Definition at line 178 of file agent.c.

Referenced by ast_var_channel_types_table(), and init_asterisk_mib().

◆ ASTCHANTYPEINDICATIONS

#define ASTCHANTYPEINDICATIONS   5

Definition at line 182 of file agent.c.

Referenced by ast_var_channel_types_table(), and init_asterisk_mib().

◆ ASTCHANTYPENAME

#define ASTCHANTYPENAME   2

Definition at line 179 of file agent.c.

Referenced by ast_var_channel_types_table(), and init_asterisk_mib().

◆ ASTCHANTYPETABLE

#define ASTCHANTYPETABLE   4

Definition at line 177 of file agent.c.

Referenced by init_asterisk_mib().

◆ ASTCHANTYPETRANSFER

#define ASTCHANTYPETRANSFER   6

Definition at line 183 of file agent.c.

Referenced by ast_var_channel_types_table(), and init_asterisk_mib().

◆ ASTCHANUNIQUEID

#define ASTCHANUNIQUEID   20

Definition at line 152 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANVARIABLES

#define ASTCHANVARIABLES   39

Definition at line 171 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCHANWHENHANGUP

#define ASTCHANWHENHANGUP   9

Definition at line 141 of file agent.c.

Referenced by ast_var_channels_table(), and init_asterisk_mib().

◆ ASTCONFACTIVECALLS

#define ASTCONFACTIVECALLS   5

Definition at line 113 of file agent.c.

Referenced by ast_var_Config(), and init_asterisk_mib().

◆ ASTCONFIGURATION

#define ASTCONFIGURATION   2

Definition at line 108 of file agent.c.

Referenced by init_asterisk_mib().

◆ ASTCONFPID

#define ASTCONFPID   3

Definition at line 111 of file agent.c.

Referenced by ast_var_Config(), and init_asterisk_mib().

◆ ASTCONFPROCESSEDCALLS

#define ASTCONFPROCESSEDCALLS   6

Definition at line 114 of file agent.c.

Referenced by ast_var_Config(), and init_asterisk_mib().

◆ ASTCONFRELOADTIME

#define ASTCONFRELOADTIME   2

Definition at line 110 of file agent.c.

Referenced by ast_var_Config(), and init_asterisk_mib().

◆ ASTCONFSOCKET

#define ASTCONFSOCKET   4

Definition at line 112 of file agent.c.

Referenced by ast_var_Config(), and init_asterisk_mib().

◆ ASTCONFUPTIME

#define ASTCONFUPTIME   1

Definition at line 109 of file agent.c.

Referenced by ast_var_Config(), and init_asterisk_mib().

◆ ASTINDALIAS

#define ASTINDALIAS   3

Definition at line 126 of file agent.c.

Referenced by ast_var_indications_table(), and init_asterisk_mib().

◆ ASTINDCOUNT

#define ASTINDCOUNT   1

Definition at line 120 of file agent.c.

Referenced by ast_var_indications(), and init_asterisk_mib().

◆ ASTINDCOUNTRY

#define ASTINDCOUNTRY   2

Definition at line 125 of file agent.c.

Referenced by ast_var_indications_table(), and init_asterisk_mib().

◆ ASTINDCURRENT

#define ASTINDCURRENT   2

Definition at line 121 of file agent.c.

Referenced by ast_var_indications(), and init_asterisk_mib().

◆ ASTINDDESCRIPTION

#define ASTINDDESCRIPTION   4

Definition at line 127 of file agent.c.

Referenced by ast_var_indications_table(), and init_asterisk_mib().

◆ ASTINDICATIONS

#define ASTINDICATIONS   4

Definition at line 119 of file agent.c.

Referenced by init_asterisk_mib().

◆ ASTINDINDEX

#define ASTINDINDEX   1

Definition at line 124 of file agent.c.

Referenced by ast_var_indications_table(), and init_asterisk_mib().

◆ ASTINDTABLE

#define ASTINDTABLE   3

Definition at line 123 of file agent.c.

Referenced by init_asterisk_mib().

◆ ASTMM_LIBC

#define ASTMM_LIBC   ASTMM_IGNORE

Definition at line 22 of file agent.c.

◆ ASTMODCOUNT

#define ASTMODCOUNT   1

Definition at line 117 of file agent.c.

Referenced by ast_var_Modules(), and init_asterisk_mib().

◆ ASTMODULES

#define ASTMODULES   3

Definition at line 116 of file agent.c.

Referenced by init_asterisk_mib().

◆ ASTVERSION

#define ASTVERSION   1

Definition at line 104 of file agent.c.

Referenced by init_asterisk_mib().

◆ ASTVERSTRING

#define ASTVERSTRING   1

Definition at line 105 of file agent.c.

Referenced by ast_var_Version(), and init_asterisk_mib().

◆ ASTVERTAG

#define ASTVERTAG   2

Definition at line 106 of file agent.c.

Referenced by ast_var_Version(), and init_asterisk_mib().

◆ HAVE_DMALLOC_H

#define HAVE_DMALLOC_H   0 /* XXX we shouldn't do this */

Definition at line 51 of file agent.c.

◆ unload_module

#define unload_module   ast_unload_module

Definition at line 79 of file agent.c.

Referenced by load_values_config().

Function Documentation

◆ agent_thread()

void* agent_thread ( void *  arg)

Definition at line 189 of file agent.c.

References ast_verb, init_asterisk_mib(), NULL, res_snmp_agentx_subagent, and res_snmp_dont_stop.

Referenced by load_module().

190 {
191  ast_verb(2, "Starting %sAgent\n", res_snmp_agentx_subagent ? "Sub" : "");
192 
193  snmp_enable_stderrlog();
194 
196  netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
197  NETSNMP_DS_AGENT_ROLE,
198  1);
199 
200  init_agent("asterisk");
201 
203 
204  init_snmp("asterisk");
205 
207  init_master_agent();
208 
209  while (res_snmp_dont_stop)
210  agent_check_and_process(1);
211 
212  snmp_shutdown("asterisk");
213 
214  ast_verb(2, "Terminating %sAgent\n", res_snmp_agentx_subagent ? "Sub" : "");
215 
216  return NULL;
217 }
#define NULL
Definition: resample.c:96
#define ast_verb(level,...)
Definition: logger.h:463
int res_snmp_dont_stop
Definition: res_snmp.c:44
int res_snmp_agentx_subagent
Definition: res_snmp.c:43
static void init_asterisk_mib(void)
Definition: agent.c:826

◆ ast_var_channel_bridge()

static u_char* ast_var_channel_bridge ( struct variable *  vp,
oid *  name,
size_t *  length,
int  exact,
size_t *  var_len,
WriteMethod **  write_method 
)
static

Definition at line 605 of file agent.c.

References ast_channel_is_bridged(), ast_channel_iterator_all_new(), ast_channel_iterator_destroy(), ast_channel_iterator_next(), ast_channel_lock, ast_channel_unlock, ast_channel_unref, ASTCHANBRIDGECOUNT, header_generic(), and NULL.

Referenced by init_asterisk_mib().

607 {
608  static unsigned long long_ret;
609  struct ast_channel *chan = NULL;
610  struct ast_channel_iterator *iter;
611 
612  long_ret = 0;
613 
614  if (header_generic(vp, name, length, exact, var_len, write_method)) {
615  return NULL;
616  }
617 
618  if (!(iter = ast_channel_iterator_all_new())) {
619  return NULL;
620  }
621 
622  while ((chan = ast_channel_iterator_next(iter))) {
623  ast_channel_lock(chan);
624  if (ast_channel_is_bridged(chan)) {
625  long_ret++;
626  }
627  ast_channel_unlock(chan);
628  chan = ast_channel_unref(chan);
629  }
630 
632 
633  *var_len = sizeof(long_ret);
634 
635  return (vp->magic == ASTCHANBRIDGECOUNT) ? (u_char *) &long_ret : NULL;
636 }
#define ast_channel_lock(chan)
Definition: channel.h:2945
Main Channel structure associated with a channel.
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Definition: channel.c:1422
#define ast_channel_unref(c)
Decrease channel reference count.
Definition: channel.h:2981
#define NULL
Definition: resample.c:96
#define ASTCHANBRIDGECOUNT
Definition: agent.c:187
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
int ast_channel_is_bridged(const struct ast_channel *chan)
Determine if a channel is in a bridge.
Definition: channel.c:10746
#define ast_channel_unlock(chan)
Definition: channel.h:2946
static const char name[]
Definition: cdr_mysql.c:74
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
Definition: channel.c:1360
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
Definition: channel.c:1408

◆ ast_var_channel_types()

static u_char* ast_var_channel_types ( struct variable *  vp,
oid *  name,
size_t *  length,
int  exact,
size_t *  var_len,
WriteMethod **  write_method 
)
static

Definition at line 519 of file agent.c.

References ast_channeltype_list(), ast_variables_destroy(), ASTCHANTYPECOUNT, header_generic(), ast_variable::next, and NULL.

Referenced by init_asterisk_mib().

521 {
522  static unsigned long long_ret;
523  struct ast_variable *channel_types, *next;
524 
525  if (header_generic(vp, name, length, exact, var_len, write_method))
526  return NULL;
527 
528  if (vp->magic != ASTCHANTYPECOUNT)
529  return NULL;
530 
531  for (long_ret = 0, channel_types = next = ast_channeltype_list(); next; next = next->next)
532  long_ret++;
533  ast_variables_destroy(channel_types);
534 
535  return (u_char *)&long_ret;
536 }
struct ast_variable * next
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Definition: extconf.c:1263
struct ast_variable * ast_channeltype_list(void)
return an ast_variable list of channeltypes
Definition: channel.c:188
Structure for variables, used for configurations and for channel variables.
#define NULL
Definition: resample.c:96
#define ASTCHANTYPECOUNT
Definition: agent.c:175
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
static const char name[]
Definition: cdr_mysql.c:74

◆ ast_var_channel_types_table()

static u_char* ast_var_channel_types_table ( struct variable *  vp,
oid *  name,
size_t *  length,
int  exact,
size_t *  var_len,
WriteMethod **  write_method 
)
static

Definition at line 538 of file agent.c.

References ast_channel_iterator_all_new(), ast_channel_iterator_destroy(), ast_channel_iterator_next(), ast_channel_tech(), ast_channel_unref, ast_channeltype_list(), ast_get_channel_tech(), ast_variables_destroy(), ASTCHANTYPECHANNELS, ASTCHANTYPEDESC, ASTCHANTYPEDEVSTATE, ASTCHANTYPEINDEX, ASTCHANTYPEINDICATIONS, ASTCHANTYPENAME, ASTCHANTYPETRANSFER, ast_channel_tech::description, ast_channel_tech::devicestate, header_simple_table(), ast_channel_tech::indicate, ast_variable::name, ast_variable::next, NULL, ast_channel_tech::transfer, and ast_channel_tech::type.

Referenced by init_asterisk_mib().

540 {
541  const struct ast_channel_tech *tech = NULL;
542  struct ast_variable *channel_types, *next;
543  static unsigned long long_ret;
544  struct ast_channel *chan;
545  u_long i;
546 
547  if (header_simple_table(vp, name, length, exact, var_len, write_method, -1))
548  return NULL;
549 
550  channel_types = ast_channeltype_list();
551  for (i = 1, next = channel_types; next && i != name[*length - 1]; next = next->next, i++)
552  ;
553  if (next != NULL)
554  tech = ast_get_channel_tech(next->name);
555  ast_variables_destroy(channel_types);
556  if (next == NULL || tech == NULL)
557  return NULL;
558 
559  switch (vp->magic) {
560  case ASTCHANTYPEINDEX:
561  long_ret = name[*length - 1];
562  return (u_char *)&long_ret;
563  case ASTCHANTYPENAME:
564  *var_len = strlen(tech->type);
565  return (u_char *)tech->type;
566  case ASTCHANTYPEDESC:
567  *var_len = strlen(tech->description);
568  return (u_char *)tech->description;
569  case ASTCHANTYPEDEVSTATE:
570  long_ret = tech->devicestate ? 1 : 2;
571  return (u_char *)&long_ret;
573  long_ret = tech->indicate ? 1 : 2;
574  return (u_char *)&long_ret;
575  case ASTCHANTYPETRANSFER:
576  long_ret = tech->transfer ? 1 : 2;
577  return (u_char *)&long_ret;
578  case ASTCHANTYPECHANNELS:
579  {
580  struct ast_channel_iterator *iter;
581 
582  long_ret = 0;
583 
584  if (!(iter = ast_channel_iterator_all_new())) {
585  return NULL;
586  }
587 
588  while ((chan = ast_channel_iterator_next(iter))) {
589  if (ast_channel_tech(chan) == tech) {
590  long_ret++;
591  }
592  chan = ast_channel_unref(chan);
593  }
594 
596 
597  return (u_char *)&long_ret;
598  }
599  default:
600  break;
601  }
602  return NULL;
603 }
struct ast_variable * next
Main Channel structure associated with a channel.
int(*const transfer)(struct ast_channel *chan, const char *newdest)
Blind transfer other side (see app_transfer.c and ast_transfer()
Definition: channel.h:784
const char *const type
Definition: channel.h:630
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Definition: channel.c:1422
#define ASTCHANTYPEINDEX
Definition: agent.c:178
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Definition: extconf.c:1263
const struct ast_channel_tech * ast_get_channel_tech(const char *name)
Get a channel technology structure by name.
Definition: channel.c:592
#define ast_channel_unref(c)
Decrease channel reference count.
Definition: channel.h:2981
#define ASTCHANTYPENAME
Definition: agent.c:179
struct ast_variable * ast_channeltype_list(void)
return an ast_variable list of channeltypes
Definition: channel.c:188
Structure for variables, used for configurations and for channel variables.
#define NULL
Definition: resample.c:96
Structure to describe a channel "technology", ie a channel driver See for examples: ...
Definition: channel.h:629
#define ASTCHANTYPECHANNELS
Definition: agent.c:184
#define ASTCHANTYPEDEVSTATE
Definition: agent.c:181
#define ASTCHANTYPEDESC
Definition: agent.c:180
#define ASTCHANTYPETRANSFER
Definition: agent.c:183
static const char name[]
Definition: cdr_mysql.c:74
const char *const description
Definition: channel.h:631
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
Definition: channel.c:1360
int(*const devicestate)(const char *device_number)
Definition: channel.h:676
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
Definition: channel.c:1408
int(*const indicate)(struct ast_channel *c, int condition, const void *data, size_t datalen)
Indicate a particular condition (e.g. AST_CONTROL_BUSY or AST_CONTROL_RINGING or AST_CONTROL_CONGESTI...
Definition: channel.h:772
int header_simple_table(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **, int)
#define ASTCHANTYPEINDICATIONS
Definition: agent.c:182
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)

◆ ast_var_channels()

static u_char* ast_var_channels ( struct variable *  vp,
oid *  name,
size_t *  length,
int  exact,
size_t *  var_len,
WriteMethod **  write_method 
)
static

Definition at line 220 of file agent.c.

References ast_active_channels(), ASTCHANCOUNT, header_generic(), and NULL.

Referenced by init_asterisk_mib().

222 {
223  static unsigned long long_ret;
224 
225  if (header_generic(vp, name, length, exact, var_len, write_method))
226  return NULL;
227 
228  if (vp->magic != ASTCHANCOUNT)
229  return NULL;
230 
231  long_ret = ast_active_channels();
232 
233  return (u_char *)&long_ret;
234 }
#define NULL
Definition: resample.c:96
#define ASTCHANCOUNT
Definition: agent.c:130
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
static const char name[]
Definition: cdr_mysql.c:74
int ast_active_channels(void)
returns number of active/allocated channels
Definition: channel.c:499

◆ ast_var_channels_table()

static u_char* ast_var_channels_table ( struct variable *  vp,
oid *  name,
size_t *  length,
int  exact,
size_t *  var_len,
WriteMethod **  write_method 
)
static

Definition at line 236 of file agent.c.

References ast_party_caller::ani, ast_party_caller::ani2, ast_active_channels(), ast_channel_accountcode(), ast_channel_amaflags(), ast_channel_appl(), ast_channel_bridge_peer(), ast_channel_call_forward(), ast_channel_caller(), ast_channel_callgroup(), ast_channel_context(), ast_channel_data(), ast_channel_dialed(), ast_channel_exten(), ast_channel_flags(), ast_channel_hangupcause(), ast_channel_iterator_all_new(), ast_channel_iterator_destroy(), ast_channel_iterator_next(), ast_channel_language(), ast_channel_lock, ast_channel_macrocontext(), ast_channel_macroexten(), ast_channel_macropriority(), ast_channel_masq(), ast_channel_masqr(), ast_channel_musicclass(), ast_channel_name(), ast_channel_pickupgroup(), ast_channel_priority(), ast_channel_redirecting(), ast_channel_rings(), ast_channel_tech(), ast_channel_transfercapability(), ast_channel_uniqueid(), ast_channel_unlock, ast_channel_unref, ast_channel_whentohangup(), ast_channel_zone(), ast_copy_string(), ast_party_id_presentation(), AST_STATE_MUTE, ast_str_alloca, ast_str_buffer(), ast_str_strlen(), ast_strlen_zero, ast_tvzero(), ASTCHANACCOUNTCODE, ASTCHANADSI, ASTCHANAMAFLAGS, ASTCHANAPP, ASTCHANBRIDGE, ASTCHANCALLGROUP, ASTCHANCIDANI, ASTCHANCIDANI2, ASTCHANCIDDNID, ASTCHANCIDNAME, ASTCHANCIDNUM, ASTCHANCIDPRES, ASTCHANCIDRDNIS, ASTCHANCIDTNS, ASTCHANCIDTON, ASTCHANCONTEXT, ASTCHANDATA, ASTCHANEXTEN, ASTCHANFLAGS, ASTCHANFORWARDTO, ASTCHANHANGUPCAUSE, ASTCHANINDEX, ASTCHANLANGUAGE, ASTCHANMACROCONTEXT, ASTCHANMACROEXTEN, ASTCHANMACROPRI, ASTCHANMASQ, ASTCHANMASQR, ASTCHANMUSICCLASS, ASTCHANMUTED, ASTCHANNAME, ASTCHANPICKUPGROUP, ASTCHANPRI, ASTCHANRINGS, ASTCHANSTATE, ASTCHANTONEZONE, ASTCHANTRANSFERCAP, ASTCHANTYPE, ASTCHANUNIQUEID, ASTCHANVARIABLES, ASTCHANWHENHANGUP, country, ast_party_redirecting::from, header_simple_table(), ast_party_caller::id, ast_party_id::name, NULL, ast_party_id::number, ast_party_dialed::number, out, pbx_builtin_serialize_variables(), ast_party_number::plan, ast_party_name::str, ast_party_number::str, ast_party_dialed::str, ast_party_dialed::transit_network_select, type, ast_party_name::valid, and ast_party_number::valid.

Referenced by init_asterisk_mib().

238 {
239  static unsigned long long_ret;
240  static u_char bits_ret[2];
241  static char string_ret[256];
242  struct ast_channel *chan, *bridge;
243  struct timeval tval;
244  u_char *ret = NULL;
245  int i, bit;
246  struct ast_str *out = ast_str_alloca(2048);
247  struct ast_channel_iterator *iter;
248 
249  if (header_simple_table(vp, name, length, exact, var_len, write_method, ast_active_channels()))
250  return NULL;
251 
252  i = name[*length - 1] - 1;
253 
254  if (!(iter = ast_channel_iterator_all_new())) {
255  return NULL;
256  }
257 
258  while ((chan = ast_channel_iterator_next(iter)) && i) {
259  ast_channel_unref(chan);
260  i--;
261  }
262 
263  iter = ast_channel_iterator_destroy(iter);
264 
265  if (chan == NULL) {
266  return NULL;
267  }
268 
269  *var_len = sizeof(long_ret);
270 
271  ast_channel_lock(chan);
272 
273  switch (vp->magic) {
274  case ASTCHANINDEX:
275  long_ret = name[*length - 1];
276  ret = (u_char *)&long_ret;
277  break;
278  case ASTCHANNAME:
279  if (!ast_strlen_zero(ast_channel_name(chan))) {
280  ast_copy_string(string_ret, ast_channel_name(chan), sizeof(string_ret));
281  *var_len = strlen(string_ret);
282  ret = (u_char *)string_ret;
283  }
284  break;
285  case ASTCHANLANGUAGE:
287  ast_copy_string(string_ret, ast_channel_language(chan), sizeof(string_ret));
288  *var_len = strlen(string_ret);
289  ret = (u_char *)string_ret;
290  }
291  break;
292  case ASTCHANTYPE:
293  ast_copy_string(string_ret, ast_channel_tech(chan)->type, sizeof(string_ret));
294  *var_len = strlen(string_ret);
295  ret = (u_char *)string_ret;
296  break;
297  case ASTCHANMUSICCLASS:
299  ast_copy_string(string_ret, ast_channel_musicclass(chan), sizeof(string_ret));
300  *var_len = strlen(string_ret);
301  ret = (u_char *)string_ret;
302  }
303  break;
304  case ASTCHANBRIDGE:
305  ast_channel_unlock(chan);
306  bridge = ast_channel_bridge_peer(chan);
307  if (bridge) {
308  ast_channel_lock(bridge);
309  ast_copy_string(string_ret, ast_channel_name(bridge), sizeof(string_ret));
310  ast_channel_unlock(bridge);
311  ast_channel_unref(bridge);
312 
313  *var_len = strlen(string_ret);
314  ret = (u_char *)string_ret;
315  }
316  ast_channel_lock(chan);
317  break;
318  case ASTCHANMASQ:
320  ast_copy_string(string_ret, ast_channel_name(ast_channel_masq(chan)), sizeof(string_ret));
321  *var_len = strlen(string_ret);
322  ret = (u_char *)string_ret;
323  }
324  break;
325  case ASTCHANMASQR:
327  ast_copy_string(string_ret, ast_channel_name(ast_channel_masqr(chan)), sizeof(string_ret));
328  *var_len = strlen(string_ret);
329  ret = (u_char *)string_ret;
330  }
331  break;
332  case ASTCHANWHENHANGUP:
333  if (!ast_tvzero(*ast_channel_whentohangup(chan))) {
334  gettimeofday(&tval, NULL);
335  long_ret = difftime(ast_channel_whentohangup(chan)->tv_sec, tval.tv_sec) * 100 - tval.tv_usec / 10000;
336  ret= (u_char *)&long_ret;
337  }
338  break;
339  case ASTCHANAPP:
340  if (ast_channel_appl(chan)) {
341  ast_copy_string(string_ret, ast_channel_appl(chan), sizeof(string_ret));
342  *var_len = strlen(string_ret);
343  ret = (u_char *)string_ret;
344  }
345  break;
346  case ASTCHANDATA:
347  if (ast_channel_data(chan)) {
348  ast_copy_string(string_ret, ast_channel_data(chan), sizeof(string_ret));
349  *var_len = strlen(string_ret);
350  ret = (u_char *)string_ret;
351  }
352  break;
353  case ASTCHANCONTEXT:
354  ast_copy_string(string_ret, ast_channel_context(chan), sizeof(string_ret));
355  *var_len = strlen(string_ret);
356  ret = (u_char *)string_ret;
357  break;
358  case ASTCHANMACROCONTEXT:
359  ast_copy_string(string_ret, ast_channel_macrocontext(chan), sizeof(string_ret));
360  *var_len = strlen(string_ret);
361  ret = (u_char *)string_ret;
362  break;
363  case ASTCHANMACROEXTEN:
364  ast_copy_string(string_ret, ast_channel_macroexten(chan), sizeof(string_ret));
365  *var_len = strlen(string_ret);
366  ret = (u_char *)string_ret;
367  break;
368  case ASTCHANMACROPRI:
369  long_ret = ast_channel_macropriority(chan);
370  ret = (u_char *)&long_ret;
371  break;
372  case ASTCHANEXTEN:
373  ast_copy_string(string_ret, ast_channel_exten(chan), sizeof(string_ret));
374  *var_len = strlen(string_ret);
375  ret = (u_char *)string_ret;
376  break;
377  case ASTCHANPRI:
378  long_ret = ast_channel_priority(chan);
379  ret = (u_char *)&long_ret;
380  break;
381  case ASTCHANACCOUNTCODE:
383  ast_copy_string(string_ret, ast_channel_accountcode(chan), sizeof(string_ret));
384  *var_len = strlen(string_ret);
385  ret = (u_char *)string_ret;
386  }
387  break;
388  case ASTCHANFORWARDTO:
390  ast_copy_string(string_ret, ast_channel_call_forward(chan), sizeof(string_ret));
391  *var_len = strlen(string_ret);
392  ret = (u_char *)string_ret;
393  }
394  break;
395  case ASTCHANUNIQUEID:
396  ast_copy_string(string_ret, ast_channel_uniqueid(chan), sizeof(string_ret));
397  *var_len = strlen(string_ret);
398  ret = (u_char *)string_ret;
399  break;
400  case ASTCHANCALLGROUP:
401  long_ret = ast_channel_callgroup(chan);
402  ret = (u_char *)&long_ret;
403  break;
404  case ASTCHANPICKUPGROUP:
405  long_ret = ast_channel_pickupgroup(chan);
406  ret = (u_char *)&long_ret;
407  break;
408  case ASTCHANSTATE:
409  long_ret = ast_channel_state(chan) & 0xffff;
410  ret = (u_char *)&long_ret;
411  break;
412  case ASTCHANMUTED:
413  long_ret = ast_channel_state(chan) & AST_STATE_MUTE ? 1 : 2;
414  ret = (u_char *)&long_ret;
415  break;
416  case ASTCHANRINGS:
417  long_ret = ast_channel_rings(chan);
418  ret = (u_char *)&long_ret;
419  break;
420  case ASTCHANCIDDNID:
421  if (ast_channel_dialed(chan)->number.str) {
422  ast_copy_string(string_ret, ast_channel_dialed(chan)->number.str, sizeof(string_ret));
423  *var_len = strlen(string_ret);
424  ret = (u_char *)string_ret;
425  }
426  break;
427  case ASTCHANCIDNUM:
429  ast_copy_string(string_ret, ast_channel_caller(chan)->id.number.str, sizeof(string_ret));
430  *var_len = strlen(string_ret);
431  ret = (u_char *)string_ret;
432  }
433  break;
434  case ASTCHANCIDNAME:
435  if (ast_channel_caller(chan)->id.name.valid && ast_channel_caller(chan)->id.name.str) {
436  ast_copy_string(string_ret, ast_channel_caller(chan)->id.name.str, sizeof(string_ret));
437  *var_len = strlen(string_ret);
438  ret = (u_char *)string_ret;
439  }
440  break;
441  case ASTCHANCIDANI:
443  ast_copy_string(string_ret, ast_channel_caller(chan)->ani.number.str, sizeof(string_ret));
444  *var_len = strlen(string_ret);
445  ret = (u_char *)string_ret;
446  }
447  break;
448  case ASTCHANCIDRDNIS:
450  ast_copy_string(string_ret, ast_channel_redirecting(chan)->from.number.str, sizeof(string_ret));
451  *var_len = strlen(string_ret);
452  ret = (u_char *)string_ret;
453  }
454  break;
455  case ASTCHANCIDPRES:
456  long_ret = ast_party_id_presentation(&ast_channel_caller(chan)->id);
457  ret = (u_char *)&long_ret;
458  break;
459  case ASTCHANCIDANI2:
460  long_ret = ast_channel_caller(chan)->ani2;
461  ret = (u_char *)&long_ret;
462  break;
463  case ASTCHANCIDTON:
464  long_ret = ast_channel_caller(chan)->id.number.plan;
465  ret = (u_char *)&long_ret;
466  break;
467  case ASTCHANCIDTNS:
468  long_ret = ast_channel_dialed(chan)->transit_network_select;
469  ret = (u_char *)&long_ret;
470  break;
471  case ASTCHANAMAFLAGS:
472  long_ret = ast_channel_amaflags(chan);
473  ret = (u_char *)&long_ret;
474  break;
475  case ASTCHANADSI:
476  long_ret = ast_channel_adsicpe(chan);
477  ret = (u_char *)&long_ret;
478  break;
479  case ASTCHANTONEZONE:
480  if (ast_channel_zone(chan)) {
481  ast_copy_string(string_ret, ast_channel_zone(chan)->country, sizeof(string_ret));
482  *var_len = strlen(string_ret);
483  ret = (u_char *)string_ret;
484  }
485  break;
486  case ASTCHANHANGUPCAUSE:
487  long_ret = ast_channel_hangupcause(chan);
488  ret = (u_char *)&long_ret;
489  break;
490  case ASTCHANVARIABLES:
491  if (pbx_builtin_serialize_variables(chan, &out)) {
492  *var_len = ast_str_strlen(out);
493  ret = (u_char *)ast_str_buffer(out);
494  }
495  break;
496  case ASTCHANFLAGS:
497  bits_ret[0] = 0;
498  for (bit = 0; bit < 8; bit++)
499  bits_ret[0] |= ((ast_channel_flags(chan)->flags & (1 << bit)) >> bit) << (7 - bit);
500  bits_ret[1] = 0;
501  for (bit = 0; bit < 8; bit++)
502  bits_ret[1] |= (((ast_channel_flags(chan)->flags >> 8) & (1 << bit)) >> bit) << (7 - bit);
503  *var_len = 2;
504  ret = bits_ret;
505  break;
506  case ASTCHANTRANSFERCAP:
507  long_ret = ast_channel_transfercapability(chan);
508  ret = (u_char *)&long_ret;
509  default:
510  break;
511  }
512 
513  ast_channel_unlock(chan);
514  chan = ast_channel_unref(chan);
515 
516  return ret;
517 }
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
static const char type[]
Definition: chan_ooh323.c:109
#define ASTCHANCIDNUM
Definition: agent.c:159
#define ast_channel_lock(chan)
Definition: channel.h:2945
Main Channel structure associated with a channel.
struct ast_party_dialed::@246 number
Dialed/Called number.
char * str
Subscriber phone number (Malloced)
Definition: channel.h:292
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Definition: channel.c:1422
char * str
Subscriber phone number (Malloced)
Definition: channel.h:387
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
#define ast_channel_unref(c)
Decrease channel reference count.
Definition: channel.h:2981
#define ASTCHANMUTED
Definition: agent.c:156
struct ast_party_name name
Subscriber name.
Definition: channel.h:341
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
Definition: channel.h:528
#define ASTCHANVARIABLES
Definition: agent.c:171
#define ASTCHANCIDTON
Definition: agent.c:165
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:714
#define ASTCHANBRIDGE
Definition: agent.c:138
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
Definition: channel.c:1821
#define ASTCHANMASQ
Definition: agent.c:139
struct ast_tone_zone * ast_channel_zone(const struct ast_channel *chan)
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
Definition: time.h:108
#define ASTCHANADSI
Definition: agent.c:168
#define ASTCHANCONTEXT
Definition: agent.c:144
ast_channel_state
ast_channel states
Definition: channelstate.h:35
char * str
Subscriber name (Malloced)
Definition: channel.h:265
#define ASTCHANINDEX
Definition: agent.c:133
#define ASTCHANWHENHANGUP
Definition: agent.c:141
#define ASTCHANCIDANI
Definition: agent.c:161
#define ASTCHANUNIQUEID
Definition: agent.c:152
#define ASTCHANDATA
Definition: agent.c:143
#define ast_str_alloca(init_len)
Definition: strings.h:800
#define ASTCHANMACROEXTEN
Definition: agent.c:146
#define ASTCHANCIDTNS
Definition: agent.c:166
#define NULL
Definition: resample.c:96
#define ASTCHANHANGUPCAUSE
Definition: agent.c:170
#define ASTCHANCIDRDNIS
Definition: agent.c:162
const char * ast_channel_call_forward(const struct ast_channel *chan)
int ast_channel_priority(const struct ast_channel *chan)
#define ASTCHANACCOUNTCODE
Definition: agent.c:150
#define ast_strlen_zero(foo)
Definition: strings.h:52
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
#define ASTCHANRINGS
Definition: agent.c:157
Number structure.
Definition: app_followme.c:154
struct ast_party_id id
Caller party ID.
Definition: channel.h:421
#define ASTCHANAMAFLAGS
Definition: agent.c:167
#define ASTCHANEXTEN
Definition: agent.c:148
struct ast_party_id ani
Automatic Number Identification (ANI)
Definition: channel.h:428
const char * ast_channel_accountcode(const struct ast_channel *chan)
int ast_channel_macropriority(const struct ast_channel *chan)
#define ASTCHANLANGUAGE
Definition: agent.c:135
#define ASTCHANAPP
Definition: agent.c:142
const char * ast_channel_exten(const struct ast_channel *chan)
#define ASTCHANCIDANI2
Definition: agent.c:164
#define ASTCHANCIDDNID
Definition: agent.c:158
#define ASTCHANMUSICCLASS
Definition: agent.c:137
#define ASTCHANTYPE
Definition: agent.c:136
const char * ast_channel_uniqueid(const struct ast_channel *chan)
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Definition: strings.h:584
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
Definition: channel.h:294
static char country[80]
Definition: pbx_dundi.c:205
#define ASTCHANTRANSFERCAP
Definition: agent.c:173
int ani2
Automatic Number Identification 2 (Info Digits)
Definition: channel.h:434
struct ast_channel * ast_channel_masq(const struct ast_channel *chan)
ast_channel_adsicpe
Definition: channel.h:869
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
#define ASTCHANMACROPRI
Definition: agent.c:147
#define ASTCHANTONEZONE
Definition: agent.c:169
const char * ast_channel_appl(const struct ast_channel *chan)
#define ast_channel_unlock(chan)
Definition: channel.h:2946
#define ASTCHANCIDPRES
Definition: agent.c:163
static const char name[]
Definition: cdr_mysql.c:74
#define ASTCHANCALLGROUP
Definition: agent.c:153
#define ASTCHANFLAGS
Definition: agent.c:172
#define ASTCHANMACROCONTEXT
Definition: agent.c:145
#define ASTCHANCIDNAME
Definition: agent.c:160
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
#define ASTCHANMASQR
Definition: agent.c:140
const char * ast_channel_data(const struct ast_channel *chan)
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
Definition: strings.h:688
int transit_network_select
Transit Network Select.
Definition: channel.h:398
FILE * out
Definition: utils/frame.c:33
int ast_channel_hangupcause(const struct ast_channel *chan)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel&#39;s bridge peer only if the bridge is two-party.
Definition: channel.c:10765
const char * ast_channel_name(const struct ast_channel *chan)
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
Definition: channel.c:1360
#define ASTCHANSTATE
Definition: agent.c:155
const char * ast_channel_language(const struct ast_channel *chan)
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
#define ASTCHANPICKUPGROUP
Definition: agent.c:154
const char * ast_channel_context(const struct ast_channel *chan)
int ast_channel_rings(const struct ast_channel *chan)
unsigned char valid
TRUE if the name information is valid/present.
Definition: channel.h:280
#define ASTCHANNAME
Definition: agent.c:134
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
struct ast_flags * ast_channel_flags(struct ast_channel *chan)
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
Definition: channel.c:1408
const char * ast_channel_macrocontext(const struct ast_channel *chan)
int ast_active_channels(void)
returns number of active/allocated channels
Definition: channel.c:499
enum ama_flags ast_channel_amaflags(const struct ast_channel *chan)
int header_simple_table(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **, int)
unsigned char valid
TRUE if the number information is valid/present.
Definition: channel.h:298
const struct ast_channel_tech * ast_channel_tech(const struct ast_channel *chan)
struct ast_channel * ast_channel_masqr(const struct ast_channel *chan)
const char * ast_channel_macroexten(const struct ast_channel *chan)
#define ASTCHANFORWARDTO
Definition: agent.c:151
const char * ast_channel_musicclass(const struct ast_channel *chan)
#define ASTCHANPRI
Definition: agent.c:149
int pbx_builtin_serialize_variables(struct ast_channel *chan, struct ast_str **buf)
Create a human-readable string, specifying all variables and their corresponding values.
struct ast_party_number number
Subscriber phone number.
Definition: channel.h:343

◆ ast_var_Config()

static u_char* ast_var_Config ( struct variable *  vp,
oid *  name,
size_t *  length,
int  exact,
size_t *  var_len,
WriteMethod **  write_method 
)
static

Definition at line 638 of file agent.c.

References ast_active_calls(), ast_config_AST_SOCKET, ast_lastreloadtime, ast_processed_calls(), ast_startuptime, ASTCONFACTIVECALLS, ASTCONFPID, ASTCONFPROCESSEDCALLS, ASTCONFRELOADTIME, ASTCONFSOCKET, ASTCONFUPTIME, header_generic(), and NULL.

Referenced by init_asterisk_mib().

640 {
641  static unsigned long long_ret;
642  struct timeval tval;
643 
644  if (header_generic(vp, name, length, exact, var_len, write_method))
645  return NULL;
646 
647  switch (vp->magic) {
648  case ASTCONFUPTIME:
649  gettimeofday(&tval, NULL);
650  long_ret = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000;
651  return (u_char *)&long_ret;
652  case ASTCONFRELOADTIME:
653  gettimeofday(&tval, NULL);
654  if (ast_lastreloadtime.tv_sec)
655  long_ret = difftime(tval.tv_sec, ast_lastreloadtime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_lastreloadtime.tv_usec / 10000;
656  else
657  long_ret = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000;
658  return (u_char *)&long_ret;
659  case ASTCONFPID:
660  long_ret = getpid();
661  return (u_char *)&long_ret;
662  case ASTCONFSOCKET:
663  *var_len = strlen(ast_config_AST_SOCKET);
664  return (u_char *)ast_config_AST_SOCKET;
665  case ASTCONFACTIVECALLS:
666  long_ret = ast_active_calls();
667  return (u_char *)&long_ret;
669  long_ret = ast_processed_calls();
670  return (u_char *)&long_ret;
671  default:
672  break;
673  }
674  return NULL;
675 }
#define ASTCONFUPTIME
Definition: agent.c:109
int ast_active_calls(void)
Retrieve the number of active calls.
Definition: pbx.c:4764
#define ASTCONFSOCKET
Definition: agent.c:112
#define NULL
Definition: resample.c:96
#define ASTCONFRELOADTIME
Definition: agent.c:110
struct timeval ast_lastreloadtime
Definition: asterisk.c:337
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
int ast_processed_calls(void)
Retrieve the total number of calls processed through the PBX since last restart.
Definition: pbx.c:4769
#define ASTCONFACTIVECALLS
Definition: agent.c:113
static const char name[]
Definition: cdr_mysql.c:74
struct timeval ast_startuptime
Definition: asterisk.c:336
const char * ast_config_AST_SOCKET
Definition: options.c:167
#define ASTCONFPID
Definition: agent.c:111
#define ASTCONFPROCESSEDCALLS
Definition: agent.c:114

◆ ast_var_indications()

static u_char* ast_var_indications ( struct variable *  vp,
oid *  name,
size_t *  length,
int  exact,
size_t *  var_len,
WriteMethod **  write_method 
)
static

Definition at line 677 of file agent.c.

References ao2_iterator_destroy(), ao2_iterator_next, ast_copy_string(), ast_get_indication_zone(), ast_tone_zone_iterator_init(), ast_tone_zone_unref(), ASTINDCOUNT, ASTINDCURRENT, ast_tone_zone::country, header_generic(), NULL, and tz.

Referenced by init_asterisk_mib().

679 {
680  static unsigned long long_ret;
681  static char ret_buf[128];
682  struct ast_tone_zone *tz = NULL;
683 
684  if (header_generic(vp, name, length, exact, var_len, write_method))
685  return NULL;
686 
687  switch (vp->magic) {
688  case ASTINDCOUNT:
689  {
690  struct ao2_iterator i;
691 
692  long_ret = 0;
693 
695  while ((tz = ao2_iterator_next(&i))) {
696  tz = ast_tone_zone_unref(tz);
697  long_ret++;
698  }
700 
701  return (u_char *) &long_ret;
702  }
703  case ASTINDCURRENT:
705  if (tz) {
706  ast_copy_string(ret_buf, tz->country, sizeof(ret_buf));
707  *var_len = strlen(ret_buf);
708  tz = ast_tone_zone_unref(tz);
709  return (u_char *) ret_buf;
710  }
711  *var_len = 0;
712  return NULL;
713  default:
714  break;
715  }
716  return NULL;
717 }
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
Definition: indications.h:205
char country[MAX_TONEZONE_COUNTRY]
Country code that this set of tones is for.
Definition: indications.h:76
#define ASTINDCURRENT
Definition: agent.c:121
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define NULL
Definition: resample.c:96
A set of tones for a given locale.
Definition: indications.h:74
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
#define ASTINDCOUNT
Definition: agent.c:120
static char * tz
Definition: cdr_pgsql.c:75
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
Definition: indications.c:433
#define ao2_iterator_next(iter)
Definition: astobj2.h:1933
static const char name[]
Definition: cdr_mysql.c:74
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1841
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
struct ao2_iterator ast_tone_zone_iterator_init(void)
Get an iterator for the available tone zones.
Definition: indications.c:403

◆ ast_var_indications_table()

static u_char* ast_var_indications_table ( struct variable *  vp,
oid *  name,
size_t *  length,
int  exact,
size_t *  var_len,
WriteMethod **  write_method 
)
static

Definition at line 719 of file agent.c.

References ao2_iterator_destroy(), ao2_iterator_next, ast_copy_string(), ast_tone_zone_iterator_init(), ast_tone_zone_lock, ast_tone_zone_unlock, ast_tone_zone_unref(), ASTINDALIAS, ASTINDCOUNTRY, ASTINDDESCRIPTION, ASTINDINDEX, ast_tone_zone::country, ast_tone_zone::description, header_simple_table(), NULL, and tz.

Referenced by init_asterisk_mib().

721 {
722  static unsigned long long_ret;
723  static char ret_buf[256];
724  struct ast_tone_zone *tz = NULL;
725  int i;
726  struct ao2_iterator iter;
727 
728  if (header_simple_table(vp, name, length, exact, var_len, write_method, -1)) {
729  return NULL;
730  }
731 
732  i = name[*length - 1] - 1;
733 
735 
736  while ((tz = ao2_iterator_next(&iter)) && i) {
737  tz = ast_tone_zone_unref(tz);
738  i--;
739  }
740  ao2_iterator_destroy(&iter);
741 
742  if (tz == NULL) {
743  return NULL;
744  }
745 
746  switch (vp->magic) {
747  case ASTINDINDEX:
749  long_ret = name[*length - 1];
750  return (u_char *)&long_ret;
751  case ASTINDCOUNTRY:
752  ast_copy_string(ret_buf, tz->country, sizeof(ret_buf));
754  *var_len = strlen(ret_buf);
755  return (u_char *) ret_buf;
756  case ASTINDALIAS:
757  /* No longer exists */
759  return NULL;
760  case ASTINDDESCRIPTION:
761  ast_tone_zone_lock(tz);
762  ast_copy_string(ret_buf, tz->description, sizeof(ret_buf));
765  *var_len = strlen(ret_buf);
766  return (u_char *) ret_buf;
767  default:
769  break;
770  }
771  return NULL;
772 }
char description[40]
Text description of the given country.
Definition: indications.h:82
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
Definition: indications.h:205
char country[MAX_TONEZONE_COUNTRY]
Country code that this set of tones is for.
Definition: indications.h:76
#define ast_tone_zone_unlock(tz)
Unlock an ast_tone_zone.
Definition: indications.h:193
#define ASTINDINDEX
Definition: agent.c:124
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define NULL
Definition: resample.c:96
A set of tones for a given locale.
Definition: indications.h:74
#define ASTINDDESCRIPTION
Definition: agent.c:127
#define ASTINDALIAS
Definition: agent.c:126
static char * tz
Definition: cdr_pgsql.c:75
#define ao2_iterator_next(iter)
Definition: astobj2.h:1933
static const char name[]
Definition: cdr_mysql.c:74
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1841
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
struct ao2_iterator ast_tone_zone_iterator_init(void)
Get an iterator for the available tone zones.
Definition: indications.c:403
#define ast_tone_zone_lock(tz)
Lock an ast_tone_zone.
Definition: indications.h:188
#define ASTINDCOUNTRY
Definition: agent.c:125
int header_simple_table(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **, int)

◆ ast_var_Modules()

static u_char* ast_var_Modules ( struct variable *  vp,
oid *  name,
size_t *  length,
int  exact,
size_t *  var_len,
WriteMethod **  write_method 
)
static

Definition at line 780 of file agent.c.

References ast_update_module_list(), ASTMODCOUNT, countmodule(), header_generic(), and NULL.

Referenced by init_asterisk_mib().

782 {
783  static unsigned long long_ret;
784 
785  if (header_generic(vp, name, length, exact, var_len, write_method))
786  return NULL;
787 
788  if (vp->magic != ASTMODCOUNT)
789  return NULL;
790 
792 
793  return (u_char *)&long_ret;
794 }
static int countmodule(const char *mod, const char *desc, int use, const char *status, const char *like, enum ast_module_support_level support_level)
Definition: agent.c:774
#define NULL
Definition: resample.c:96
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
static const char name[]
Definition: cdr_mysql.c:74
#define ASTMODCOUNT
Definition: agent.c:117
int ast_update_module_list(int(*modentry)(const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level), const char *like)
Ask for a list of modules, descriptions, use counts and status.
Definition: loader.c:2567

◆ ast_var_Version()

static u_char* ast_var_Version ( struct variable *  vp,
oid *  name,
size_t *  length,
int  exact,
size_t *  var_len,
WriteMethod **  write_method 
)
static

Definition at line 796 of file agent.c.

References ast_get_version(), ast_get_version_num(), ASTVERSTRING, ASTVERTAG, header_generic(), NULL, and version.

Referenced by init_asterisk_mib().

798 {
799  static unsigned long long_ret;
800 
801  if (header_generic(vp, name, length, exact, var_len, write_method))
802  return NULL;
803 
804  switch (vp->magic) {
805  case ASTVERSTRING:
806  {
807  const char *version = ast_get_version();
808  *var_len = strlen(version);
809  return (u_char *)version;
810  }
811  case ASTVERTAG:
812  sscanf(ast_get_version_num(), "%30lu", &long_ret);
813  return (u_char *)&long_ret;
814  default:
815  break;
816  }
817  return NULL;
818 }
const char * ast_get_version(void)
Retrieve the Asterisk version string.
Definition: version.c:16
#define ASTVERTAG
Definition: agent.c:106
#define NULL
Definition: resample.c:96
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
#define ASTVERSTRING
Definition: agent.c:105
static char version[AST_MAX_EXTENSION]
Definition: chan_ooh323.c:391
static const char name[]
Definition: cdr_mysql.c:74
const char * ast_get_version_num(void)
Retrieve the numeric Asterisk version.
Definition: version.c:21

◆ countmodule()

static int countmodule ( const char *  mod,
const char *  desc,
int  use,
const char *  status,
const char *  like,
enum ast_module_support_level  support_level 
)
static

Definition at line 774 of file agent.c.

Referenced by ast_var_Modules().

776 {
777  return 1;
778 }

◆ header_generic()

int header_generic ( struct variable *  ,
oid *  ,
size_t *  ,
int  ,
size_t *  ,
WriteMethod **   
)

◆ header_simple_table()

int header_simple_table ( struct variable *  ,
oid *  ,
size_t *  ,
int  ,
size_t *  ,
WriteMethod **  ,
int   
)

◆ init_asterisk_mib()

static void init_asterisk_mib ( void  )
static

Definition at line 826 of file agent.c.

References ast_var_channel_bridge(), ast_var_channel_types(), ast_var_channel_types_table(), ast_var_channels(), ast_var_channels_table(), ast_var_Config(), ast_var_indications(), ast_var_indications_table(), ast_var_Modules(), ast_var_Version(), ASTCHANACCOUNTCODE, ASTCHANADSI, ASTCHANAMAFLAGS, ASTCHANAPP, ASTCHANBRIDGE, ASTCHANBRIDGECOUNT, ASTCHANCALLGROUP, ASTCHANCIDANI, ASTCHANCIDANI2, ASTCHANCIDDNID, ASTCHANCIDNAME, ASTCHANCIDNUM, ASTCHANCIDPRES, ASTCHANCIDRDNIS, ASTCHANCIDTNS, ASTCHANCIDTON, ASTCHANCONTEXT, ASTCHANCOUNT, ASTCHANDATA, ASTCHANEXTEN, ASTCHANFLAGS, ASTCHANFORWARDTO, ASTCHANHANGUPCAUSE, ASTCHANINDEX, ASTCHANLANGUAGE, ASTCHANMACROCONTEXT, ASTCHANMACROEXTEN, ASTCHANMACROPRI, ASTCHANMASQ, ASTCHANMASQR, ASTCHANMUSICCLASS, ASTCHANMUTED, ASTCHANNAME, ASTCHANNELS, ASTCHANPICKUPGROUP, ASTCHANPRI, ASTCHANRINGS, ASTCHANSCALARS, ASTCHANSTATE, ASTCHANTABLE, ASTCHANTONEZONE, ASTCHANTRANSFERCAP, ASTCHANTYPE, ASTCHANTYPECHANNELS, ASTCHANTYPECOUNT, ASTCHANTYPEDESC, ASTCHANTYPEDEVSTATE, ASTCHANTYPEINDEX, ASTCHANTYPEINDICATIONS, ASTCHANTYPENAME, ASTCHANTYPETABLE, ASTCHANTYPETRANSFER, ASTCHANUNIQUEID, ASTCHANVARIABLES, ASTCHANWHENHANGUP, ASTCONFACTIVECALLS, ASTCONFIGURATION, ASTCONFPID, ASTCONFPROCESSEDCALLS, ASTCONFRELOADTIME, ASTCONFSOCKET, ASTCONFUPTIME, asterisk_oid, ASTINDALIAS, ASTINDCOUNT, ASTINDCOUNTRY, ASTINDCURRENT, ASTINDDESCRIPTION, ASTINDICATIONS, ASTINDINDEX, ASTINDTABLE, ASTMODCOUNT, ASTMODULES, ASTVERSION, ASTVERSTRING, ASTVERTAG, NULL, register_sysORTable(), and term_asterisk_mib().

Referenced by agent_thread().

827 {
828  static struct variable4 asterisk_vars[] = {
829  {ASTVERSTRING, ASN_OCTET_STR, RONLY, ast_var_Version, 2, {ASTVERSION, ASTVERSTRING}},
830  {ASTVERTAG, ASN_UNSIGNED, RONLY, ast_var_Version, 2, {ASTVERSION, ASTVERTAG}},
831  {ASTCONFUPTIME, ASN_TIMETICKS, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFUPTIME}},
832  {ASTCONFRELOADTIME, ASN_TIMETICKS, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFRELOADTIME}},
833  {ASTCONFPID, ASN_INTEGER, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFPID}},
834  {ASTCONFSOCKET, ASN_OCTET_STR, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFSOCKET}},
837  {ASTMODCOUNT, ASN_INTEGER, RONLY, ast_var_Modules , 2, {ASTMODULES, ASTMODCOUNT}},
838  {ASTINDCOUNT, ASN_INTEGER, RONLY, ast_var_indications, 2, {ASTINDICATIONS, ASTINDCOUNT}},
839  {ASTINDCURRENT, ASN_OCTET_STR, RONLY, ast_var_indications, 2, {ASTINDICATIONS, ASTINDCURRENT}},
842  {ASTINDALIAS, ASN_OCTET_STR, RONLY, ast_var_indications_table, 4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDALIAS}},
844  {ASTCHANCOUNT, ASN_GAUGE, RONLY, ast_var_channels, 2, {ASTCHANNELS, ASTCHANCOUNT}},
845  {ASTCHANINDEX, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANINDEX}},
846  {ASTCHANNAME, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANNAME}},
848  {ASTCHANTYPE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANTYPE}},
850  {ASTCHANBRIDGE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANBRIDGE}},
851  {ASTCHANMASQ, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMASQ}},
852  {ASTCHANMASQR, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMASQR}},
854  {ASTCHANAPP, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANAPP}},
855  {ASTCHANDATA, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANDATA}},
860  {ASTCHANEXTEN, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANEXTEN}},
861  {ASTCHANPRI, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANPRI}},
867  {ASTCHANSTATE, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANSTATE}},
868  {ASTCHANMUTED, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMUTED}},
869  {ASTCHANRINGS, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANRINGS}},
871  {ASTCHANCIDNUM, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDNUM}},
873  {ASTCHANCIDANI, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDANI}},
880  {ASTCHANADSI, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANADSI}},
884  {ASTCHANFLAGS, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANFLAGS}},
895  };
896 
898  "ASTERISK-MIB implementation for Asterisk.");
899 
900  REGISTER_MIB("res_snmp", asterisk_vars, variable4, asterisk_oid);
901 
902  snmp_register_callback(SNMP_CALLBACK_LIBRARY,
903  SNMP_CALLBACK_SHUTDOWN,
905 }
#define ASTINDTABLE
Definition: agent.c:123
static u_char * ast_var_indications(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:677
#define ASTCHANCIDNUM
Definition: agent.c:159
#define ASTCONFUPTIME
Definition: agent.c:109
static u_char * ast_var_Modules(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:780
#define ASTCHANTYPEINDEX
Definition: agent.c:178
#define ASTVERSION
Definition: agent.c:104
#define ASTCHANTYPENAME
Definition: agent.c:179
#define ASTCHANMUTED
Definition: agent.c:156
#define ASTCHANVARIABLES
Definition: agent.c:171
static u_char * ast_var_channel_types_table(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:538
#define ASTCHANCIDTON
Definition: agent.c:165
#define ASTCHANBRIDGE
Definition: agent.c:138
#define ASTCHANMASQ
Definition: agent.c:139
#define ASTINDINDEX
Definition: agent.c:124
#define ASTCHANADSI
Definition: agent.c:168
#define ASTCHANCONTEXT
Definition: agent.c:144
#define ASTINDCURRENT
Definition: agent.c:121
#define ASTVERTAG
Definition: agent.c:106
#define ASTCHANINDEX
Definition: agent.c:133
#define ASTCHANWHENHANGUP
Definition: agent.c:141
#define ASTCHANCIDANI
Definition: agent.c:161
#define ASTCHANUNIQUEID
Definition: agent.c:152
static u_char * ast_var_indications_table(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:719
#define ASTCONFSOCKET
Definition: agent.c:112
#define ASTCHANDATA
Definition: agent.c:143
static int term_asterisk_mib(int majorID, int minorID, void *serverarg, void *clientarg)
Definition: agent.c:820
#define ASTCHANMACROEXTEN
Definition: agent.c:146
#define ASTCHANCIDTNS
Definition: agent.c:166
#define NULL
Definition: resample.c:96
#define ASTCHANHANGUPCAUSE
Definition: agent.c:170
#define ASTCHANCIDRDNIS
Definition: agent.c:162
static oid asterisk_oid[]
Definition: agent.c:97
#define ASTCHANCOUNT
Definition: agent.c:130
#define ASTCHANACCOUNTCODE
Definition: agent.c:150
#define ASTCHANTYPECOUNT
Definition: agent.c:175
#define ASTCHANRINGS
Definition: agent.c:157
#define ASTCONFRELOADTIME
Definition: agent.c:110
#define ASTCHANAMAFLAGS
Definition: agent.c:167
#define ASTCHANEXTEN
Definition: agent.c:148
#define ASTCHANBRIDGECOUNT
Definition: agent.c:187
#define ASTCHANLANGUAGE
Definition: agent.c:135
#define ASTCHANAPP
Definition: agent.c:142
#define ASTCHANCIDANI2
Definition: agent.c:164
#define ASTCHANCIDDNID
Definition: agent.c:158
#define ASTCHANMUSICCLASS
Definition: agent.c:137
#define ASTINDCOUNT
Definition: agent.c:120
#define ASTCHANTYPE
Definition: agent.c:136
#define ASTCHANTYPETABLE
Definition: agent.c:177
static u_char * ast_var_Config(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:638
#define ASTCONFACTIVECALLS
Definition: agent.c:113
#define ASTINDDESCRIPTION
Definition: agent.c:127
#define ASTINDALIAS
Definition: agent.c:126
#define ASTCHANTRANSFERCAP
Definition: agent.c:173
#define ASTCONFIGURATION
Definition: agent.c:108
#define ASTCHANTYPECHANNELS
Definition: agent.c:184
#define ASTCHANTYPEDEVSTATE
Definition: agent.c:181
#define ASTCHANTABLE
Definition: agent.c:132
#define ASTVERSTRING
Definition: agent.c:105
#define ASTCHANMACROPRI
Definition: agent.c:147
static u_char * ast_var_channel_bridge(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:605
#define ASTCHANTONEZONE
Definition: agent.c:169
#define ASTCHANTYPEDESC
Definition: agent.c:180
static u_char * ast_var_channels_table(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:236
#define ASTCHANTYPETRANSFER
Definition: agent.c:183
static u_char * ast_var_channels(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:220
#define ASTCHANCIDPRES
Definition: agent.c:163
#define ASTCHANCALLGROUP
Definition: agent.c:153
static u_char * ast_var_channel_types(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:519
#define ASTCHANFLAGS
Definition: agent.c:172
#define ASTCHANMACROCONTEXT
Definition: agent.c:145
#define ASTCHANCIDNAME
Definition: agent.c:160
#define ASTMODCOUNT
Definition: agent.c:117
#define ASTCHANMASQR
Definition: agent.c:140
#define ASTCHANSCALARS
Definition: agent.c:186
#define ASTMODULES
Definition: agent.c:116
#define ASTCHANSTATE
Definition: agent.c:155
static u_char * ast_var_Version(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
Definition: agent.c:796
#define ASTCHANPICKUPGROUP
Definition: agent.c:154
#define ASTCHANNAME
Definition: agent.c:134
#define ASTINDICATIONS
Definition: agent.c:119
#define ASTCHANNELS
Definition: agent.c:129
#define ASTCONFPID
Definition: agent.c:111
#define ASTINDCOUNTRY
Definition: agent.c:125
#define ASTCHANTYPEINDICATIONS
Definition: agent.c:182
#define ASTCHANFORWARDTO
Definition: agent.c:151
int register_sysORTable(oid *, size_t, const char *)
#define ASTCONFPROCESSEDCALLS
Definition: agent.c:114
#define ASTCHANPRI
Definition: agent.c:149

◆ register_sysORTable()

int register_sysORTable ( oid *  ,
size_t  ,
const char *   
)

Referenced by init_asterisk_mib().

◆ term_asterisk_mib()

static int term_asterisk_mib ( int  majorID,
int  minorID,
void *  serverarg,
void *  clientarg 
)
static

Definition at line 820 of file agent.c.

References asterisk_oid, and unregister_sysORTable().

Referenced by init_asterisk_mib().

821 {
823  return 0;
824 }
static oid asterisk_oid[]
Definition: agent.c:97
int unregister_sysORTable(oid *, size_t)

◆ unregister_sysORTable()

int unregister_sysORTable ( oid *  ,
size_t   
)

Referenced by term_asterisk_mib().

Variable Documentation

◆ asterisk_oid

oid asterisk_oid[] = { 1, 3, 6, 1, 4, 1, 22736, 1 }
static

Definition at line 97 of file agent.c.

Referenced by init_asterisk_mib(), and term_asterisk_mib().