22 #define ASTMM_LIBC ASTMM_IGNORE 38 #ifdef PACKAGE_BUGREPORT 39 #undef PACKAGE_BUGREPORT 44 #ifdef PACKAGE_TARNAME 45 #undef PACKAGE_TARNAME 47 #ifdef PACKAGE_VERSION 48 #undef PACKAGE_VERSION 50 #ifndef HAVE_DMALLOC_H 51 #define HAVE_DMALLOC_H 0 54 #if defined(__OpenBSD__) 59 #define __NetBSD_Version__ 0 62 #include <net-snmp/net-snmp-config.h> 63 #include <net-snmp/net-snmp-includes.h> 64 #include <net-snmp/agent/net-snmp-agent-includes.h> 66 #if !defined(RONLY) && defined(NETSNMP_OLDAPI_RONLY) 67 #define RONLY NETSNMP_OLDAPI_RONLY 79 #define unload_module ast_unload_module 86 int header_generic(
struct variable *, oid *,
size_t *,
int,
size_t *, WriteMethod **);
87 int header_simple_table(
struct variable *, oid *,
size_t *,
int,
size_t *, WriteMethod **,
int);
105 #define ASTVERSTRING 1 108 #define ASTCONFIGURATION 2 109 #define ASTCONFUPTIME 1 110 #define ASTCONFRELOADTIME 2 112 #define ASTCONFSOCKET 4 113 #define ASTCONFACTIVECALLS 5 114 #define ASTCONFPROCESSEDCALLS 6 117 #define ASTMODCOUNT 1 119 #define ASTINDICATIONS 4 120 #define ASTINDCOUNT 1 121 #define ASTINDCURRENT 2 123 #define ASTINDTABLE 3 124 #define ASTINDINDEX 1 125 #define ASTINDCOUNTRY 2 126 #define ASTINDALIAS 3 127 #define ASTINDDESCRIPTION 4 129 #define ASTCHANNELS 5 130 #define ASTCHANCOUNT 1 132 #define ASTCHANTABLE 2 133 #define ASTCHANINDEX 1 134 #define ASTCHANNAME 2 135 #define ASTCHANLANGUAGE 3 136 #define ASTCHANTYPE 4 137 #define ASTCHANMUSICCLASS 5 138 #define ASTCHANBRIDGE 6 139 #define ASTCHANMASQ 7 140 #define ASTCHANMASQR 8 141 #define ASTCHANWHENHANGUP 9 142 #define ASTCHANAPP 10 143 #define ASTCHANDATA 11 144 #define ASTCHANCONTEXT 12 145 #define ASTCHANMACROCONTEXT 13 146 #define ASTCHANMACROEXTEN 14 147 #define ASTCHANMACROPRI 15 148 #define ASTCHANEXTEN 16 149 #define ASTCHANPRI 17 150 #define ASTCHANACCOUNTCODE 18 151 #define ASTCHANFORWARDTO 19 152 #define ASTCHANUNIQUEID 20 153 #define ASTCHANCALLGROUP 21 154 #define ASTCHANPICKUPGROUP 22 155 #define ASTCHANSTATE 23 156 #define ASTCHANMUTED 24 157 #define ASTCHANRINGS 25 158 #define ASTCHANCIDDNID 26 159 #define ASTCHANCIDNUM 27 160 #define ASTCHANCIDNAME 28 161 #define ASTCHANCIDANI 29 162 #define ASTCHANCIDRDNIS 30 163 #define ASTCHANCIDPRES 31 164 #define ASTCHANCIDANI2 32 165 #define ASTCHANCIDTON 33 166 #define ASTCHANCIDTNS 34 167 #define ASTCHANAMAFLAGS 35 168 #define ASTCHANADSI 36 169 #define ASTCHANTONEZONE 37 170 #define ASTCHANHANGUPCAUSE 38 171 #define ASTCHANVARIABLES 39 172 #define ASTCHANFLAGS 40 173 #define ASTCHANTRANSFERCAP 41 175 #define ASTCHANTYPECOUNT 3 177 #define ASTCHANTYPETABLE 4 178 #define ASTCHANTYPEINDEX 1 179 #define ASTCHANTYPENAME 2 180 #define ASTCHANTYPEDESC 3 181 #define ASTCHANTYPEDEVSTATE 4 182 #define ASTCHANTYPEINDICATIONS 5 183 #define ASTCHANTYPETRANSFER 6 184 #define ASTCHANTYPECHANNELS 7 186 #define ASTCHANSCALARS 5 187 #define ASTCHANBRIDGECOUNT 1 193 snmp_enable_stderrlog();
196 netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
197 NETSNMP_DS_AGENT_ROLE,
200 init_agent(
"asterisk");
204 init_snmp(
"asterisk");
210 agent_check_and_process(1);
212 snmp_shutdown(
"asterisk");
221 int exact,
size_t *var_len, WriteMethod **write_method)
223 static unsigned long long_ret;
225 if (
header_generic(vp, name, length, exact, var_len, write_method))
233 return (u_char *)&long_ret;
237 int exact,
size_t *var_len, WriteMethod **write_method)
239 static unsigned long long_ret;
240 static u_char bits_ret[2];
241 static char string_ret[256];
252 i = name[*length - 1] - 1;
269 *var_len =
sizeof(long_ret);
275 long_ret = name[*length - 1];
276 ret = (u_char *)&long_ret;
281 *var_len = strlen(string_ret);
282 ret = (u_char *)string_ret;
288 *var_len = strlen(string_ret);
289 ret = (u_char *)string_ret;
294 *var_len = strlen(string_ret);
295 ret = (u_char *)string_ret;
300 *var_len = strlen(string_ret);
301 ret = (u_char *)string_ret;
313 *var_len = strlen(string_ret);
314 ret = (u_char *)string_ret;
321 *var_len = strlen(string_ret);
322 ret = (u_char *)string_ret;
328 *var_len = strlen(string_ret);
329 ret = (u_char *)string_ret;
334 gettimeofday(&tval,
NULL);
336 ret= (u_char *)&long_ret;
342 *var_len = strlen(string_ret);
343 ret = (u_char *)string_ret;
349 *var_len = strlen(string_ret);
350 ret = (u_char *)string_ret;
355 *var_len = strlen(string_ret);
356 ret = (u_char *)string_ret;
360 *var_len = strlen(string_ret);
361 ret = (u_char *)string_ret;
365 *var_len = strlen(string_ret);
366 ret = (u_char *)string_ret;
370 ret = (u_char *)&long_ret;
374 *var_len = strlen(string_ret);
375 ret = (u_char *)string_ret;
379 ret = (u_char *)&long_ret;
384 *var_len = strlen(string_ret);
385 ret = (u_char *)string_ret;
391 *var_len = strlen(string_ret);
392 ret = (u_char *)string_ret;
397 *var_len = strlen(string_ret);
398 ret = (u_char *)string_ret;
402 ret = (u_char *)&long_ret;
406 ret = (u_char *)&long_ret;
410 ret = (u_char *)&long_ret;
414 ret = (u_char *)&long_ret;
418 ret = (u_char *)&long_ret;
423 *var_len = strlen(string_ret);
424 ret = (u_char *)string_ret;
430 *var_len = strlen(string_ret);
431 ret = (u_char *)string_ret;
437 *var_len = strlen(string_ret);
438 ret = (u_char *)string_ret;
444 *var_len = strlen(string_ret);
445 ret = (u_char *)string_ret;
451 *var_len = strlen(string_ret);
452 ret = (u_char *)string_ret;
457 ret = (u_char *)&long_ret;
461 ret = (u_char *)&long_ret;
465 ret = (u_char *)&long_ret;
469 ret = (u_char *)&long_ret;
473 ret = (u_char *)&long_ret;
477 ret = (u_char *)&long_ret;
482 *var_len = strlen(string_ret);
483 ret = (u_char *)string_ret;
488 ret = (u_char *)&long_ret;
498 for (bit = 0; bit < 8; bit++)
499 bits_ret[0] |= ((
ast_channel_flags(chan)->flags & (1 << bit)) >> bit) << (7 - bit);
501 for (bit = 0; bit < 8; bit++)
502 bits_ret[1] |= (((
ast_channel_flags(chan)->flags >> 8) & (1 << bit)) >> bit) << (7 - bit);
508 ret = (u_char *)&long_ret;
520 int exact,
size_t *var_len, WriteMethod **write_method)
522 static unsigned long long_ret;
525 if (
header_generic(vp, name, length, exact, var_len, write_method))
535 return (u_char *)&long_ret;
539 int exact,
size_t *var_len, WriteMethod **write_method)
543 static unsigned long long_ret;
551 for (i = 1, next = channel_types; next && i != name[*length - 1]; next = next->
next, i++)
561 long_ret = name[*length - 1];
562 return (u_char *)&long_ret;
564 *var_len = strlen(tech->
type);
565 return (u_char *)tech->
type;
571 return (u_char *)&long_ret;
574 return (u_char *)&long_ret;
577 return (u_char *)&long_ret;
597 return (u_char *)&long_ret;
606 int exact,
size_t *var_len, WriteMethod **write_method)
608 static unsigned long long_ret;
614 if (
header_generic(vp, name, length, exact, var_len, write_method)) {
633 *var_len =
sizeof(long_ret);
639 int exact,
size_t *var_len, WriteMethod **write_method)
641 static unsigned long long_ret;
644 if (
header_generic(vp, name, length, exact, var_len, write_method))
649 gettimeofday(&tval,
NULL);
651 return (u_char *)&long_ret;
653 gettimeofday(&tval,
NULL);
658 return (u_char *)&long_ret;
661 return (u_char *)&long_ret;
667 return (u_char *)&long_ret;
670 return (u_char *)&long_ret;
678 int exact,
size_t *var_len, WriteMethod **write_method)
680 static unsigned long long_ret;
681 static char ret_buf[128];
684 if (
header_generic(vp, name, length, exact, var_len, write_method))
701 return (u_char *) &long_ret;
707 *var_len = strlen(ret_buf);
709 return (u_char *) ret_buf;
720 int exact,
size_t *var_len, WriteMethod **write_method)
722 static unsigned long long_ret;
723 static char ret_buf[256];
732 i = name[*length - 1] - 1;
749 long_ret = name[*length - 1];
750 return (u_char *)&long_ret;
754 *var_len = strlen(ret_buf);
755 return (u_char *) ret_buf;
765 *var_len = strlen(ret_buf);
766 return (u_char *) ret_buf;
781 int exact,
size_t *var_len, WriteMethod **write_method)
783 static unsigned long long_ret;
785 if (
header_generic(vp, name, length, exact, var_len, write_method))
793 return (u_char *)&long_ret;
797 int exact,
size_t *var_len, WriteMethod **write_method)
799 static unsigned long long_ret;
801 if (
header_generic(vp, name, length, exact, var_len, write_method))
808 *var_len = strlen(version);
813 return (u_char *)&long_ret;
828 static struct variable4 asterisk_vars[] = {
898 "ASTERISK-MIB implementation for Asterisk.");
900 REGISTER_MIB(
"res_snmp", asterisk_vars, variable4,
asterisk_oid);
902 snmp_register_callback(SNMP_CALLBACK_LIBRARY,
903 SNMP_CALLBACK_SHUTDOWN,
struct ast_party_caller * ast_channel_caller(struct ast_channel *chan)
struct ast_variable * next
static u_char * ast_var_indications(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ast_channel_lock(chan)
void * agent_thread(void *arg)
Main Channel structure associated with a channel.
struct ast_party_dialed::@246 number
Dialed/Called number.
char * str
Subscriber phone number (Malloced)
int(*const transfer)(struct ast_channel *chan, const char *newdest)
Blind transfer other side (see app_transfer.c and ast_transfer()
static u_char * ast_var_Modules(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Asterisk main include file. File version handling, generic pbx functions.
char description[40]
Text description of the given country.
char * str
Subscriber phone number (Malloced)
int ast_active_calls(void)
Retrieve the number of active calls.
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
static int countmodule(const char *mod, const char *desc, int use, const char *status, const char *like, enum ast_module_support_level support_level)
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Asterisk version information.
const struct ast_channel_tech * ast_get_channel_tech(const char *name)
Get a channel technology structure by name.
#define ast_channel_unref(c)
Decrease channel reference count.
char country[MAX_TONEZONE_COUNTRY]
Country code that this set of tones is for.
struct ast_party_name name
Subscriber name.
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
const char * ast_get_version(void)
Retrieve the Asterisk version string.
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)
struct ast_variable * ast_channeltype_list(void)
return an ast_variable list of channeltypes
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define ast_tone_zone_unlock(tz)
Unlock an ast_tone_zone.
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
Structure for variables, used for configurations and for channel variables.
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.
ast_channel_state
ast_channel states
char * str
Subscriber name (Malloced)
#define ASTCHANWHENHANGUP
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
static u_char * ast_var_indications_table(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ast_str_alloca(init_len)
static int term_asterisk_mib(int majorID, int minorID, void *serverarg, void *clientarg)
#define ASTCHANMACROEXTEN
#define ASTCHANHANGUPCAUSE
static oid asterisk_oid[]
const char * ast_channel_call_forward(const struct ast_channel *chan)
int ast_channel_priority(const struct ast_channel *chan)
#define ast_verb(level,...)
#define ASTCHANACCOUNTCODE
#define ast_strlen_zero(foo)
struct timeval * ast_channel_whentohangup(struct ast_channel *chan)
#define ASTCONFRELOADTIME
struct ast_party_id id
Caller party ID.
struct ast_party_id ani
Automatic Number Identification (ANI)
General Asterisk PBX channel definitions.
const char * ast_channel_accountcode(const struct ast_channel *chan)
Asterisk file paths, configured in asterisk.conf.
A set of tones for a given locale.
int ast_channel_macropriority(const struct ast_channel *chan)
#define ASTCHANBRIDGECOUNT
struct timeval ast_lastreloadtime
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
Structure to describe a channel "technology", ie a channel driver See for examples: ...
const char * ast_channel_exten(const struct ast_channel *chan)
Core PBX routines and definitions.
#define ASTCHANMUSICCLASS
const char * ast_channel_uniqueid(const struct ast_channel *chan)
static u_char * ast_var_Config(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
int ast_processed_calls(void)
Retrieve the total number of calls processed through the PBX since last restart.
#define ASTCONFACTIVECALLS
#define ASTINDDESCRIPTION
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
#define ASTCHANTRANSFERCAP
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
#define ASTCHANTYPECHANNELS
#define ASTCHANTYPEDEVSTATE
int ani2
Automatic Number Identification 2 (Info Digits)
struct ast_channel * ast_channel_masq(const struct ast_channel *chan)
struct ast_party_dialed * ast_channel_dialed(struct ast_channel *chan)
#define ao2_iterator_next(iter)
static u_char * ast_var_channel_bridge(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
const char * ast_channel_appl(const struct ast_channel *chan)
int ast_channel_is_bridged(const struct ast_channel *chan)
Determine if a channel is in a bridge.
static u_char * ast_var_channels_table(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ASTCHANTYPETRANSFER
static u_char * ast_var_channels(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ast_channel_unlock(chan)
static char version[AST_MAX_EXTENSION]
static u_char * ast_var_channel_types(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ASTCHANMACROCONTEXT
const char *const description
struct ast_party_redirecting * ast_channel_redirecting(struct ast_channel *chan)
Support for logging to various files, console and syslog Configuration in file logger.conf.
const char * ast_get_version_num(void)
Retrieve the numeric Asterisk version.
int res_snmp_agentx_subagent
const char * ast_channel_data(const struct ast_channel *chan)
struct timeval ast_startuptime
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
int transit_network_select
Transit Network Select.
SNMP Agent / SubAgent support for Asterisk.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
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.
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
const char * ast_channel_name(const struct ast_channel *chan)
struct ao2_iterator ast_tone_zone_iterator_init(void)
Get an iterator for the available tone zones.
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
const char * ast_config_AST_SOCKET
int(*const devicestate)(const char *device_number)
const char * ast_channel_language(const struct ast_channel *chan)
Options provided by main asterisk program.
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
static u_char * ast_var_Version(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
#define ASTCHANPICKUPGROUP
const char * ast_channel_context(const struct ast_channel *chan)
#define ast_tone_zone_lock(tz)
Lock an ast_tone_zone.
int ast_channel_rings(const struct ast_channel *chan)
unsigned char valid
TRUE if the name information is valid/present.
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.
const char * ast_channel_macrocontext(const struct ast_channel *chan)
Asterisk module definitions.
int ast_active_channels(void)
returns number of active/allocated channels
enum ama_flags ast_channel_amaflags(const struct ast_channel *chan)
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...
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.
#define ASTCHANTYPEINDICATIONS
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)
static void init_asterisk_mib(void)
int register_sysORTable(oid *, size_t, const char *)
#define ASTCONFPROCESSEDCALLS
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.
const char * ast_channel_musicclass(const struct ast_channel *chan)
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.
int unregister_sysORTable(oid *, size_t)