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);
88 int register_sysORTable(oid *,
size_t,
const char *);
89 int unregister_sysORTable(oid *,
size_t);
92 static void init_asterisk_mib(
void);
97 static oid asterisk_oid[] = { 1, 3, 6, 1, 4, 1, 22736, 1 };
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 ASTCHANEXTEN 16
146 #define ASTCHANPRI 17
147 #define ASTCHANACCOUNTCODE 18
148 #define ASTCHANFORWARDTO 19
149 #define ASTCHANUNIQUEID 20
150 #define ASTCHANCALLGROUP 21
151 #define ASTCHANPICKUPGROUP 22
152 #define ASTCHANSTATE 23
153 #define ASTCHANMUTED 24
154 #define ASTCHANRINGS 25
155 #define ASTCHANCIDDNID 26
156 #define ASTCHANCIDNUM 27
157 #define ASTCHANCIDNAME 28
158 #define ASTCHANCIDANI 29
159 #define ASTCHANCIDRDNIS 30
160 #define ASTCHANCIDPRES 31
161 #define ASTCHANCIDANI2 32
162 #define ASTCHANCIDTON 33
163 #define ASTCHANCIDTNS 34
164 #define ASTCHANAMAFLAGS 35
165 #define ASTCHANADSI 36
166 #define ASTCHANTONEZONE 37
167 #define ASTCHANHANGUPCAUSE 38
168 #define ASTCHANVARIABLES 39
169 #define ASTCHANFLAGS 40
170 #define ASTCHANTRANSFERCAP 41
172 #define ASTCHANTYPECOUNT 3
174 #define ASTCHANTYPETABLE 4
175 #define ASTCHANTYPEINDEX 1
176 #define ASTCHANTYPENAME 2
177 #define ASTCHANTYPEDESC 3
178 #define ASTCHANTYPEDEVSTATE 4
179 #define ASTCHANTYPEINDICATIONS 5
180 #define ASTCHANTYPETRANSFER 6
181 #define ASTCHANTYPECHANNELS 7
183 #define ASTCHANSCALARS 5
184 #define ASTCHANBRIDGECOUNT 1
186 void *agent_thread(
void *arg)
188 ast_verb(2,
"Starting %sAgent\n", res_snmp_agentx_subagent ?
"Sub" :
"");
190 snmp_enable_stderrlog();
192 if (res_snmp_agentx_subagent)
193 netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
194 NETSNMP_DS_AGENT_ROLE,
197 init_agent(
"asterisk");
201 init_snmp(
"asterisk");
203 if (!res_snmp_agentx_subagent)
206 while (res_snmp_dont_stop)
207 agent_check_and_process(1);
209 snmp_shutdown(
"asterisk");
211 ast_verb(2,
"Terminating %sAgent\n", res_snmp_agentx_subagent ?
"Sub" :
"");
217 ast_var_channels(
struct variable *vp, oid *name,
size_t *length,
218 int exact,
size_t *var_len, WriteMethod **write_method)
220 static unsigned long long_ret;
222 if (header_generic(vp, name, length, exact, var_len, write_method))
225 if (vp->magic != ASTCHANCOUNT)
230 return (u_char *)&long_ret;
233 static u_char *ast_var_channels_table(
struct variable *vp, oid *name,
size_t *length,
234 int exact,
size_t *var_len, WriteMethod **write_method)
236 static unsigned long long_ret;
237 static u_char bits_ret[2];
238 static char string_ret[256];
243 struct ast_str *out = ast_str_alloca(2048);
246 if (header_simple_table(vp, name, length, exact, var_len, write_method,
ast_active_channels()))
249 i = name[*length - 1] - 1;
266 *var_len =
sizeof(long_ret);
268 ast_channel_lock(chan);
272 long_ret = name[*length - 1];
273 ret = (u_char *)&long_ret;
276 if (!ast_strlen_zero(ast_channel_name(chan))) {
277 ast_copy_string(string_ret, ast_channel_name(chan),
sizeof(string_ret));
278 *var_len = strlen(string_ret);
279 ret = (u_char *)string_ret;
282 case ASTCHANLANGUAGE:
283 if (!ast_strlen_zero(ast_channel_language(chan))) {
284 ast_copy_string(string_ret, ast_channel_language(chan),
sizeof(string_ret));
285 *var_len = strlen(string_ret);
286 ret = (u_char *)string_ret;
291 *var_len = strlen(string_ret);
292 ret = (u_char *)string_ret;
294 case ASTCHANMUSICCLASS:
295 if (!ast_strlen_zero(ast_channel_musicclass(chan))) {
296 ast_copy_string(string_ret, ast_channel_musicclass(chan),
sizeof(string_ret));
297 *var_len = strlen(string_ret);
298 ret = (u_char *)string_ret;
302 ast_channel_unlock(chan);
305 ast_channel_lock(bridge);
306 ast_copy_string(string_ret, ast_channel_name(bridge),
sizeof(string_ret));
307 ast_channel_unlock(bridge);
310 *var_len = strlen(string_ret);
311 ret = (u_char *)string_ret;
313 ast_channel_lock(chan);
316 if (ast_channel_masq(chan) && !ast_strlen_zero(ast_channel_name(ast_channel_masq(chan)))) {
317 ast_copy_string(string_ret, ast_channel_name(ast_channel_masq(chan)),
sizeof(string_ret));
318 *var_len = strlen(string_ret);
319 ret = (u_char *)string_ret;
323 if (ast_channel_masqr(chan) && !ast_strlen_zero(ast_channel_name(ast_channel_masqr(chan)))) {
324 ast_copy_string(string_ret, ast_channel_name(ast_channel_masqr(chan)),
sizeof(string_ret));
325 *var_len = strlen(string_ret);
326 ret = (u_char *)string_ret;
329 case ASTCHANWHENHANGUP:
330 if (!
ast_tvzero(*ast_channel_whentohangup(chan))) {
331 gettimeofday(&tval, NULL);
332 long_ret = difftime(ast_channel_whentohangup(chan)->tv_sec, tval.tv_sec) * 100 - tval.tv_usec / 10000;
333 ret= (u_char *)&long_ret;
337 if (ast_channel_appl(chan)) {
338 ast_copy_string(string_ret, ast_channel_appl(chan),
sizeof(string_ret));
339 *var_len = strlen(string_ret);
340 ret = (u_char *)string_ret;
344 if (ast_channel_data(chan)) {
345 ast_copy_string(string_ret, ast_channel_data(chan),
sizeof(string_ret));
346 *var_len = strlen(string_ret);
347 ret = (u_char *)string_ret;
351 ast_copy_string(string_ret, ast_channel_context(chan),
sizeof(string_ret));
352 *var_len = strlen(string_ret);
353 ret = (u_char *)string_ret;
356 ast_copy_string(string_ret, ast_channel_exten(chan),
sizeof(string_ret));
357 *var_len = strlen(string_ret);
358 ret = (u_char *)string_ret;
361 long_ret = ast_channel_priority(chan);
362 ret = (u_char *)&long_ret;
364 case ASTCHANACCOUNTCODE:
365 if (!ast_strlen_zero(ast_channel_accountcode(chan))) {
366 ast_copy_string(string_ret, ast_channel_accountcode(chan),
sizeof(string_ret));
367 *var_len = strlen(string_ret);
368 ret = (u_char *)string_ret;
371 case ASTCHANFORWARDTO:
372 if (!ast_strlen_zero(ast_channel_call_forward(chan))) {
373 ast_copy_string(string_ret, ast_channel_call_forward(chan),
sizeof(string_ret));
374 *var_len = strlen(string_ret);
375 ret = (u_char *)string_ret;
378 case ASTCHANUNIQUEID:
379 ast_copy_string(string_ret, ast_channel_uniqueid(chan),
sizeof(string_ret));
380 *var_len = strlen(string_ret);
381 ret = (u_char *)string_ret;
383 case ASTCHANCALLGROUP:
384 long_ret = ast_channel_callgroup(chan);
385 ret = (u_char *)&long_ret;
387 case ASTCHANPICKUPGROUP:
388 long_ret = ast_channel_pickupgroup(chan);
389 ret = (u_char *)&long_ret;
393 ret = (u_char *)&long_ret;
397 ret = (u_char *)&long_ret;
400 long_ret = ast_channel_rings(chan);
401 ret = (u_char *)&long_ret;
404 if (ast_channel_dialed(chan)->
number.
str) {
406 *var_len = strlen(string_ret);
407 ret = (u_char *)string_ret;
413 *var_len = strlen(string_ret);
414 ret = (u_char *)string_ret;
419 ast_copy_string(string_ret, ast_channel_caller(chan)->
id.name.str,
sizeof(string_ret));
420 *var_len = strlen(string_ret);
421 ret = (u_char *)string_ret;
426 ast_copy_string(string_ret, ast_channel_caller(chan)->ani.number.str,
sizeof(string_ret));
427 *var_len = strlen(string_ret);
428 ret = (u_char *)string_ret;
431 case ASTCHANCIDRDNIS:
433 ast_copy_string(string_ret, ast_channel_redirecting(chan)->from.number.str,
sizeof(string_ret));
434 *var_len = strlen(string_ret);
435 ret = (u_char *)string_ret;
440 ret = (u_char *)&long_ret;
443 long_ret = ast_channel_caller(chan)->
ani2;
444 ret = (u_char *)&long_ret;
448 ret = (u_char *)&long_ret;
452 ret = (u_char *)&long_ret;
454 case ASTCHANAMAFLAGS:
455 long_ret = ast_channel_amaflags(chan);
456 ret = (u_char *)&long_ret;
459 long_ret = ast_channel_adsicpe(chan);
460 ret = (u_char *)&long_ret;
462 case ASTCHANTONEZONE:
463 if (ast_channel_zone(chan)) {
464 ast_copy_string(string_ret, ast_channel_zone(chan)->country,
sizeof(string_ret));
465 *var_len = strlen(string_ret);
466 ret = (u_char *)string_ret;
469 case ASTCHANHANGUPCAUSE:
470 long_ret = ast_channel_hangupcause(chan);
471 ret = (u_char *)&long_ret;
473 case ASTCHANVARIABLES:
481 for (bit = 0; bit < 8; bit++)
482 bits_ret[0] |= ((ast_channel_flags(chan)->flags & (1 << bit)) >> bit) << (7 - bit);
484 for (bit = 0; bit < 8; bit++)
485 bits_ret[1] |= (((ast_channel_flags(chan)->flags >> 8) & (1 << bit)) >> bit) << (7 - bit);
489 case ASTCHANTRANSFERCAP:
490 long_ret = ast_channel_transfercapability(chan);
491 ret = (u_char *)&long_ret;
496 ast_channel_unlock(chan);
502 static u_char *ast_var_channel_types(
struct variable *vp, oid *name,
size_t *length,
503 int exact,
size_t *var_len, WriteMethod **write_method)
505 static unsigned long long_ret;
508 if (header_generic(vp, name, length, exact, var_len, write_method))
511 if (vp->magic != ASTCHANTYPECOUNT)
518 return (u_char *)&long_ret;
521 static u_char *ast_var_channel_types_table(
struct variable *vp, oid *name,
size_t *length,
522 int exact,
size_t *var_len, WriteMethod **write_method)
526 static unsigned long long_ret;
530 if (header_simple_table(vp, name, length, exact, var_len, write_method, -1))
534 for (i = 1, next = channel_types; next && i != name[*length - 1]; next = next->
next, i++)
539 if (next == NULL || tech == NULL)
543 case ASTCHANTYPEINDEX:
544 long_ret = name[*length - 1];
545 return (u_char *)&long_ret;
546 case ASTCHANTYPENAME:
547 *var_len = strlen(tech->type);
548 return (u_char *)tech->type;
549 case ASTCHANTYPEDESC:
550 *var_len = strlen(tech->description);
551 return (u_char *)tech->description;
552 case ASTCHANTYPEDEVSTATE:
554 return (u_char *)&long_ret;
555 case ASTCHANTYPEINDICATIONS:
557 return (u_char *)&long_ret;
558 case ASTCHANTYPETRANSFER:
560 return (u_char *)&long_ret;
561 case ASTCHANTYPECHANNELS:
580 return (u_char *)&long_ret;
588 static u_char *ast_var_channel_bridge(
struct variable *vp, oid *name,
size_t *length,
589 int exact,
size_t *var_len, WriteMethod **write_method)
591 static unsigned long long_ret;
597 if (header_generic(vp, name, length, exact, var_len, write_method)) {
606 ast_channel_lock(chan);
610 ast_channel_unlock(chan);
616 *var_len =
sizeof(long_ret);
618 return (vp->magic == ASTCHANBRIDGECOUNT) ? (u_char *) &long_ret : NULL;
621 static u_char *ast_var_Config(
struct variable *vp, oid *name,
size_t *length,
622 int exact,
size_t *var_len, WriteMethod **write_method)
624 static unsigned long long_ret;
627 if (header_generic(vp, name, length, exact, var_len, write_method))
632 gettimeofday(&tval, NULL);
633 long_ret = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000;
634 return (u_char *)&long_ret;
635 case ASTCONFRELOADTIME:
636 gettimeofday(&tval, NULL);
637 if (ast_lastreloadtime.tv_sec)
638 long_ret = difftime(tval.tv_sec, ast_lastreloadtime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_lastreloadtime.tv_usec / 10000;
640 long_ret = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000;
641 return (u_char *)&long_ret;
644 return (u_char *)&long_ret;
646 *var_len = strlen(ast_config_AST_SOCKET);
647 return (u_char *)ast_config_AST_SOCKET;
648 case ASTCONFACTIVECALLS:
650 return (u_char *)&long_ret;
651 case ASTCONFPROCESSEDCALLS:
653 return (u_char *)&long_ret;
660 static u_char *ast_var_indications(
struct variable *vp, oid *name,
size_t *length,
661 int exact,
size_t *var_len, WriteMethod **write_method)
663 static unsigned long long_ret;
664 static char ret_buf[128];
667 if (header_generic(vp, name, length, exact, var_len, write_method))
678 while ((tz = ao2_iterator_next(&i))) {
684 return (u_char *) &long_ret;
690 *var_len = strlen(ret_buf);
692 return (u_char *) ret_buf;
702 static u_char *ast_var_indications_table(
struct variable *vp, oid *name,
size_t *length,
703 int exact,
size_t *var_len, WriteMethod **write_method)
705 static unsigned long long_ret;
706 static char ret_buf[256];
711 if (header_simple_table(vp, name, length, exact, var_len, write_method, -1)) {
715 i = name[*length - 1] - 1;
719 while ((tz = ao2_iterator_next(&iter)) && i) {
732 long_ret = name[*length - 1];
733 return (u_char *)&long_ret;
737 *var_len = strlen(ret_buf);
738 return (u_char *) ret_buf;
743 case ASTINDDESCRIPTION:
748 *var_len = strlen(ret_buf);
749 return (u_char *) ret_buf;
757 static int countmodule(
const char *mod,
const char *desc,
int use,
const char *status,
758 const char *like,
enum ast_module_support_level support_level)
763 static u_char *ast_var_Modules(
struct variable *vp, oid *name,
size_t *length,
764 int exact,
size_t *var_len, WriteMethod **write_method)
766 static unsigned long long_ret;
768 if (header_generic(vp, name, length, exact, var_len, write_method))
771 if (vp->magic != ASTMODCOUNT)
776 return (u_char *)&long_ret;
779 static u_char *ast_var_Version(
struct variable *vp, oid *name,
size_t *length,
780 int exact,
size_t *var_len, WriteMethod **write_method)
782 static unsigned long long_ret;
784 if (header_generic(vp, name, length, exact, var_len, write_method))
791 *var_len = strlen(version);
792 return (u_char *)version;
796 return (u_char *)&long_ret;
803 static int term_asterisk_mib(
int majorID,
int minorID,
void *serverarg,
void *clientarg)
805 unregister_sysORTable(asterisk_oid, OID_LENGTH(asterisk_oid));
809 static void init_asterisk_mib(
void)
811 static struct variable4 asterisk_vars[] = {
812 {ASTVERSTRING, ASN_OCTET_STR, RONLY, ast_var_Version, 2, {ASTVERSION, ASTVERSTRING}},
813 {ASTVERTAG, ASN_UNSIGNED, RONLY, ast_var_Version, 2, {ASTVERSION, ASTVERTAG}},
814 {ASTCONFUPTIME, ASN_TIMETICKS, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFUPTIME}},
815 {ASTCONFRELOADTIME, ASN_TIMETICKS, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFRELOADTIME}},
816 {ASTCONFPID, ASN_INTEGER, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFPID}},
817 {ASTCONFSOCKET, ASN_OCTET_STR, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFSOCKET}},
818 {ASTCONFACTIVECALLS, ASN_GAUGE, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFACTIVECALLS}},
819 {ASTCONFPROCESSEDCALLS, ASN_COUNTER, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFPROCESSEDCALLS}},
820 {ASTMODCOUNT, ASN_INTEGER, RONLY, ast_var_Modules , 2, {ASTMODULES, ASTMODCOUNT}},
821 {ASTINDCOUNT, ASN_INTEGER, RONLY, ast_var_indications, 2, {ASTINDICATIONS, ASTINDCOUNT}},
822 {ASTINDCURRENT, ASN_OCTET_STR, RONLY, ast_var_indications, 2, {ASTINDICATIONS, ASTINDCURRENT}},
823 {ASTINDINDEX, ASN_INTEGER, RONLY, ast_var_indications_table, 4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDINDEX}},
824 {ASTINDCOUNTRY, ASN_OCTET_STR, RONLY, ast_var_indications_table, 4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDCOUNTRY}},
825 {ASTINDALIAS, ASN_OCTET_STR, RONLY, ast_var_indications_table, 4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDALIAS}},
826 {ASTINDDESCRIPTION, ASN_OCTET_STR, RONLY, ast_var_indications_table, 4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDDESCRIPTION}},
827 {ASTCHANCOUNT, ASN_GAUGE, RONLY, ast_var_channels, 2, {ASTCHANNELS, ASTCHANCOUNT}},
828 {ASTCHANINDEX, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANINDEX}},
829 {ASTCHANNAME, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANNAME}},
830 {ASTCHANLANGUAGE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANLANGUAGE}},
831 {ASTCHANTYPE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANTYPE}},
832 {ASTCHANMUSICCLASS, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMUSICCLASS}},
833 {ASTCHANBRIDGE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANBRIDGE}},
834 {ASTCHANMASQ, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMASQ}},
835 {ASTCHANMASQR, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMASQR}},
836 {ASTCHANWHENHANGUP, ASN_TIMETICKS, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANWHENHANGUP}},
837 {ASTCHANAPP, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANAPP}},
838 {ASTCHANDATA, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANDATA}},
839 {ASTCHANCONTEXT, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCONTEXT}},
840 {ASTCHANEXTEN, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANEXTEN}},
841 {ASTCHANPRI, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANPRI}},
842 {ASTCHANACCOUNTCODE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANACCOUNTCODE}},
843 {ASTCHANFORWARDTO, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANFORWARDTO}},
844 {ASTCHANUNIQUEID, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANUNIQUEID}},
845 {ASTCHANCALLGROUP, ASN_UNSIGNED, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCALLGROUP}},
846 {ASTCHANPICKUPGROUP, ASN_UNSIGNED, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANPICKUPGROUP}},
847 {ASTCHANSTATE, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANSTATE}},
848 {ASTCHANMUTED, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMUTED}},
849 {ASTCHANRINGS, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANRINGS}},
850 {ASTCHANCIDDNID, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDDNID}},
851 {ASTCHANCIDNUM, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDNUM}},
852 {ASTCHANCIDNAME, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDNAME}},
853 {ASTCHANCIDANI, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDANI}},
854 {ASTCHANCIDRDNIS, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDRDNIS}},
855 {ASTCHANCIDPRES, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDPRES}},
856 {ASTCHANCIDANI2, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDANI2}},
857 {ASTCHANCIDTON, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDTON}},
858 {ASTCHANCIDTNS, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDTNS}},
859 {ASTCHANAMAFLAGS, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANAMAFLAGS}},
860 {ASTCHANADSI, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANADSI}},
861 {ASTCHANTONEZONE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANTONEZONE}},
862 {ASTCHANHANGUPCAUSE, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANHANGUPCAUSE}},
863 {ASTCHANVARIABLES, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANVARIABLES}},
864 {ASTCHANFLAGS, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANFLAGS}},
865 {ASTCHANTRANSFERCAP, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANTRANSFERCAP}},
866 {ASTCHANTYPECOUNT, ASN_INTEGER, RONLY, ast_var_channel_types, 2, {ASTCHANNELS, ASTCHANTYPECOUNT}},
867 {ASTCHANTYPEINDEX, ASN_INTEGER, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPEINDEX}},
868 {ASTCHANTYPENAME, ASN_OCTET_STR, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPENAME}},
869 {ASTCHANTYPEDESC, ASN_OCTET_STR, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPEDESC}},
870 {ASTCHANTYPEDEVSTATE, ASN_INTEGER, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPEDEVSTATE}},
871 {ASTCHANTYPEINDICATIONS, ASN_INTEGER, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPEINDICATIONS}},
872 {ASTCHANTYPETRANSFER, ASN_INTEGER, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPETRANSFER}},
873 {ASTCHANTYPECHANNELS, ASN_GAUGE, RONLY, ast_var_channel_types_table, 4, {ASTCHANNELS, ASTCHANTYPETABLE, 1, ASTCHANTYPECHANNELS}},
874 {ASTCHANBRIDGECOUNT, ASN_GAUGE, RONLY, ast_var_channel_bridge, 3, {ASTCHANNELS, ASTCHANSCALARS, ASTCHANBRIDGECOUNT}},
877 register_sysORTable(asterisk_oid, OID_LENGTH(asterisk_oid),
878 "ASTERISK-MIB implementation for Asterisk.");
880 REGISTER_MIB(
"res_snmp", asterisk_vars, variable4, asterisk_oid);
882 snmp_register_callback(SNMP_CALLBACK_LIBRARY,
883 SNMP_CALLBACK_SHUTDOWN,
884 term_asterisk_mib, NULL);
struct ast_variable * next
Main Channel structure associated with a channel.
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()
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.
static struct ast_tone_zone * ast_tone_zone_unref(struct ast_tone_zone *tz)
Release a reference to an ast_tone_zone.
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.
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.
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)
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
struct ast_party_id id
Caller party ID.
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.
struct ast_party_id ani
Automatic Number Identification (ANI)
General Asterisk PBX channel definitions.
Asterisk file paths, configured in asterisk.conf.
A set of tones for a given locale.
Structure to describe a channel "technology", ie a channel driver See for examples: ...
Core PBX routines and definitions.
int ast_processed_calls(void)
Retrieve the total number of calls processed through the PBX since last restart.
Support for dynamic strings.
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
int ani2
Automatic Number Identification 2 (Info Digits)
int ast_channel_is_bridged(const struct ast_channel *chan)
Determine if a channel is in a bridge.
struct ast_bridge * bridge
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.
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...
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.
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.
struct ast_party_dialed::@206 number
Dialed/Called number.
int(*const devicestate)(const char *device_number)
Options provided by main asterisk program.
#define ast_tone_zone_lock(tz)
Lock an ast_tone_zone.
unsigned char valid
TRUE if the name information is valid/present.
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
Asterisk module definitions.
int ast_active_channels(void)
returns number of active/allocated channels
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...
unsigned char valid
TRUE if the number information is valid/present.
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.