Wed Jan 8 2020 09:49:39

Asterisk developer's documentation


agent.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006 Voop as
3  * Thorsten Lockert <tholo@voop.as>
4  *
5  * This program is free software, distributed under the terms of
6  * the GNU General Public License Version 2. See the LICENSE file
7  * at the top of the source tree.
8  */
9 
10 /*! \file
11  *
12  * \brief SNMP Agent / SubAgent support for Asterisk
13  *
14  * \author Thorsten Lockert <tholo@voop.as>
15  */
16 
17 /*** MODULEINFO
18  <support_level>extended</support_level>
19  ***/
20 
21 #include "asterisk.h"
22 
23 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 369001 $")
24 
25 /*
26  * There is some collision collision between netsmp and asterisk names,
27  * causing build under AST_DEVMODE to fail.
28  *
29  * The following PACKAGE_* macros are one place.
30  * Also netsnmp has an improper check for HAVE_DMALLOC_H, using
31  * #if HAVE_DMALLOC_H instead of #ifdef HAVE_DMALLOC_H
32  * As a countermeasure we define it to 0, however this will fail
33  * when the proper check is implemented.
34  */
35 #ifdef PACKAGE_NAME
36 #undef PACKAGE_NAME
37 #endif
38 #ifdef PACKAGE_BUGREPORT
39 #undef PACKAGE_BUGREPORT
40 #endif
41 #ifdef PACKAGE_STRING
42 #undef PACKAGE_STRING
43 #endif
44 #ifdef PACKAGE_TARNAME
45 #undef PACKAGE_TARNAME
46 #endif
47 #ifdef PACKAGE_VERSION
48 #undef PACKAGE_VERSION
49 #endif
50 #ifndef HAVE_DMALLOC_H
51 #define HAVE_DMALLOC_H 0 /* XXX we shouldn't do this */
52 #endif
53 
54 #if defined(__OpenBSD__)
55 /*
56  * OpenBSD uses old "legacy" cc which has a rather pedantic builtin preprocessor.
57  * Using a macro which is not #defined throws an error.
58  */
59 #define __NetBSD_Version__ 0
60 #endif
61 
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>
65 
66 #include "asterisk/paths.h" /* need ast_config_AST_SOCKET */
67 #include "asterisk/channel.h"
68 #include "asterisk/logger.h"
69 #include "asterisk/options.h"
70 #include "asterisk/indications.h"
71 #include "asterisk/ast_version.h"
72 #include "asterisk/pbx.h"
73 
74 /* Colission between Net-SNMP and Asterisk */
75 #define unload_module ast_unload_module
76 #include "asterisk/module.h"
77 #undef unload_module
78 
79 #include "agent.h"
80 
81 /* Helper functions in Net-SNMP, header file not installed by default */
82 int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
83 int header_simple_table(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **, int);
84 int register_sysORTable(oid *, size_t, const char *);
85 int unregister_sysORTable(oid *, size_t);
86 
87 /* Forward declaration */
88 static void init_asterisk_mib(void);
89 
90 /*
91  * Anchor for all the Asterisk MIB values
92  */
93 static oid asterisk_oid[] = { 1, 3, 6, 1, 4, 1, 22736, 1 };
94 
95 /*
96  * MIB values -- these correspond to values in the Asterisk MIB,
97  * and MUST be kept in sync with the MIB for things to work as
98  * expected.
99  */
100 #define ASTVERSION 1
101 #define ASTVERSTRING 1
102 #define ASTVERTAG 2
103 
104 #define ASTCONFIGURATION 2
105 #define ASTCONFUPTIME 1
106 #define ASTCONFRELOADTIME 2
107 #define ASTCONFPID 3
108 #define ASTCONFSOCKET 4
109 #define ASTCONFACTIVECALLS 5
110 #define ASTCONFPROCESSEDCALLS 6
111 
112 #define ASTMODULES 3
113 #define ASTMODCOUNT 1
114 
115 #define ASTINDICATIONS 4
116 #define ASTINDCOUNT 1
117 #define ASTINDCURRENT 2
118 
119 #define ASTINDTABLE 3
120 #define ASTINDINDEX 1
121 #define ASTINDCOUNTRY 2
122 #define ASTINDALIAS 3
123 #define ASTINDDESCRIPTION 4
124 
125 #define ASTCHANNELS 5
126 #define ASTCHANCOUNT 1
127 
128 #define ASTCHANTABLE 2
129 #define ASTCHANINDEX 1
130 #define ASTCHANNAME 2
131 #define ASTCHANLANGUAGE 3
132 #define ASTCHANTYPE 4
133 #define ASTCHANMUSICCLASS 5
134 #define ASTCHANBRIDGE 6
135 #define ASTCHANMASQ 7
136 #define ASTCHANMASQR 8
137 #define ASTCHANWHENHANGUP 9
138 #define ASTCHANAPP 10
139 #define ASTCHANDATA 11
140 #define ASTCHANCONTEXT 12
141 #define ASTCHANMACROCONTEXT 13
142 #define ASTCHANMACROEXTEN 14
143 #define ASTCHANMACROPRI 15
144 #define ASTCHANEXTEN 16
145 #define ASTCHANPRI 17
146 #define ASTCHANACCOUNTCODE 18
147 #define ASTCHANFORWARDTO 19
148 #define ASTCHANUNIQUEID 20
149 #define ASTCHANCALLGROUP 21
150 #define ASTCHANPICKUPGROUP 22
151 #define ASTCHANSTATE 23
152 #define ASTCHANMUTED 24
153 #define ASTCHANRINGS 25
154 #define ASTCHANCIDDNID 26
155 #define ASTCHANCIDNUM 27
156 #define ASTCHANCIDNAME 28
157 #define ASTCHANCIDANI 29
158 #define ASTCHANCIDRDNIS 30
159 #define ASTCHANCIDPRES 31
160 #define ASTCHANCIDANI2 32
161 #define ASTCHANCIDTON 33
162 #define ASTCHANCIDTNS 34
163 #define ASTCHANAMAFLAGS 35
164 #define ASTCHANADSI 36
165 #define ASTCHANTONEZONE 37
166 #define ASTCHANHANGUPCAUSE 38
167 #define ASTCHANVARIABLES 39
168 #define ASTCHANFLAGS 40
169 #define ASTCHANTRANSFERCAP 41
170 
171 #define ASTCHANTYPECOUNT 3
172 
173 #define ASTCHANTYPETABLE 4
174 #define ASTCHANTYPEINDEX 1
175 #define ASTCHANTYPENAME 2
176 #define ASTCHANTYPEDESC 3
177 #define ASTCHANTYPEDEVSTATE 4
178 #define ASTCHANTYPEINDICATIONS 5
179 #define ASTCHANTYPETRANSFER 6
180 #define ASTCHANTYPECHANNELS 7
181 
182 #define ASTCHANSCALARS 5
183 #define ASTCHANBRIDGECOUNT 1
184 
185 void *agent_thread(void *arg)
186 {
187  ast_verb(2, "Starting %sAgent\n", res_snmp_agentx_subagent ? "Sub" : "");
188 
189  snmp_enable_stderrlog();
190 
192  netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
193  NETSNMP_DS_AGENT_ROLE,
194  1);
195 
196  init_agent("asterisk");
197 
199 
200  init_snmp("asterisk");
201 
203  init_master_agent();
204 
205  while (res_snmp_dont_stop)
206  agent_check_and_process(1);
207 
208  snmp_shutdown("asterisk");
209 
210  ast_verb(2, "Terminating %sAgent\n", res_snmp_agentx_subagent ? "Sub" : "");
211 
212  return NULL;
213 }
214 
215 static u_char *
216 ast_var_channels(struct variable *vp, oid *name, size_t *length,
217  int exact, size_t *var_len, WriteMethod **write_method)
218 {
219  static unsigned long long_ret;
220 
221  if (header_generic(vp, name, length, exact, var_len, write_method))
222  return NULL;
223 
224  if (vp->magic != ASTCHANCOUNT)
225  return NULL;
226 
227  long_ret = ast_active_channels();
228 
229  return (u_char *)&long_ret;
230 }
231 
232 static u_char *ast_var_channels_table(struct variable *vp, oid *name, size_t *length,
233  int exact, size_t *var_len, WriteMethod **write_method)
234 {
235  static unsigned long long_ret;
236  static u_char bits_ret[2];
237  static char string_ret[256];
238  struct ast_channel *chan, *bridge;
239  struct timeval tval;
240  u_char *ret = NULL;
241  int i, bit;
242  struct ast_str *out = ast_str_alloca(2048);
243  struct ast_channel_iterator *iter;
244 
245  if (header_simple_table(vp, name, length, exact, var_len, write_method, ast_active_channels()))
246  return NULL;
247 
248  i = name[*length - 1] - 1;
249 
250  if (!(iter = ast_channel_iterator_all_new())) {
251  return NULL;
252  }
253 
254  while ((chan = ast_channel_iterator_next(iter)) && i) {
255  ast_channel_unref(chan);
256  i--;
257  }
258 
259  iter = ast_channel_iterator_destroy(iter);
260 
261  if (chan == NULL) {
262  return NULL;
263  }
264 
265  *var_len = sizeof(long_ret);
266 
267  ast_channel_lock(chan);
268 
269  switch (vp->magic) {
270  case ASTCHANINDEX:
271  long_ret = name[*length - 1];
272  ret = (u_char *)&long_ret;
273  break;
274  case ASTCHANNAME:
275  if (!ast_strlen_zero(chan->name)) {
276  strncpy(string_ret, chan->name, sizeof(string_ret));
277  string_ret[sizeof(string_ret) - 1] = '\0';
278  *var_len = strlen(string_ret);
279  ret = (u_char *)string_ret;
280  }
281  break;
282  case ASTCHANLANGUAGE:
283  if (!ast_strlen_zero(chan->language)) {
284  strncpy(string_ret, chan->language, sizeof(string_ret));
285  string_ret[sizeof(string_ret) - 1] = '\0';
286  *var_len = strlen(string_ret);
287  ret = (u_char *)string_ret;
288  }
289  break;
290  case ASTCHANTYPE:
291  strncpy(string_ret, chan->tech->type, sizeof(string_ret));
292  string_ret[sizeof(string_ret) - 1] = '\0';
293  *var_len = strlen(string_ret);
294  ret = (u_char *)string_ret;
295  break;
296  case ASTCHANMUSICCLASS:
297  if (!ast_strlen_zero(chan->musicclass)) {
298  strncpy(string_ret, chan->musicclass, sizeof(string_ret));
299  string_ret[sizeof(string_ret) - 1] = '\0';
300  *var_len = strlen(string_ret);
301  ret = (u_char *)string_ret;
302  }
303  break;
304  case ASTCHANBRIDGE:
305  if ((bridge = ast_bridged_channel(chan)) != NULL) {
306  strncpy(string_ret, bridge->name, sizeof(string_ret));
307  string_ret[sizeof(string_ret) - 1] = '\0';
308  *var_len = strlen(string_ret);
309  ret = (u_char *)string_ret;
310  }
311  break;
312  case ASTCHANMASQ:
313  if (chan->masq && !ast_strlen_zero(chan->masq->name)) {
314  strncpy(string_ret, chan->masq->name, sizeof(string_ret));
315  string_ret[sizeof(string_ret) - 1] = '\0';
316  *var_len = strlen(string_ret);
317  ret = (u_char *)string_ret;
318  }
319  break;
320  case ASTCHANMASQR:
321  if (chan->masqr && !ast_strlen_zero(chan->masqr->name)) {
322  strncpy(string_ret, chan->masqr->name, sizeof(string_ret));
323  string_ret[sizeof(string_ret) - 1] = '\0';
324  *var_len = strlen(string_ret);
325  ret = (u_char *)string_ret;
326  }
327  break;
328  case ASTCHANWHENHANGUP:
329  if (!ast_tvzero(chan->whentohangup)) {
330  gettimeofday(&tval, NULL);
331  long_ret = difftime(chan->whentohangup.tv_sec, tval.tv_sec) * 100 - tval.tv_usec / 10000;
332  ret= (u_char *)&long_ret;
333  }
334  break;
335  case ASTCHANAPP:
336  if (chan->appl) {
337  strncpy(string_ret, chan->appl, sizeof(string_ret));
338  string_ret[sizeof(string_ret) - 1] = '\0';
339  *var_len = strlen(string_ret);
340  ret = (u_char *)string_ret;
341  }
342  break;
343  case ASTCHANDATA:
344  if (chan->data) {
345  strncpy(string_ret, chan->data, sizeof(string_ret));
346  string_ret[sizeof(string_ret) - 1] = '\0';
347  *var_len = strlen(string_ret);
348  ret = (u_char *)string_ret;
349  }
350  break;
351  case ASTCHANCONTEXT:
352  strncpy(string_ret, chan->context, sizeof(string_ret));
353  string_ret[sizeof(string_ret) - 1] = '\0';
354  *var_len = strlen(string_ret);
355  ret = (u_char *)string_ret;
356  break;
357  case ASTCHANMACROCONTEXT:
358  strncpy(string_ret, chan->macrocontext, sizeof(string_ret));
359  string_ret[sizeof(string_ret) - 1] = '\0';
360  *var_len = strlen(string_ret);
361  ret = (u_char *)string_ret;
362  break;
363  case ASTCHANMACROEXTEN:
364  strncpy(string_ret, chan->macroexten, sizeof(string_ret));
365  string_ret[sizeof(string_ret) - 1] = '\0';
366  *var_len = strlen(string_ret);
367  ret = (u_char *)string_ret;
368  break;
369  case ASTCHANMACROPRI:
370  long_ret = chan->macropriority;
371  ret = (u_char *)&long_ret;
372  break;
373  case ASTCHANEXTEN:
374  strncpy(string_ret, chan->exten, sizeof(string_ret));
375  string_ret[sizeof(string_ret) - 1] = '\0';
376  *var_len = strlen(string_ret);
377  ret = (u_char *)string_ret;
378  break;
379  case ASTCHANPRI:
380  long_ret = chan->priority;
381  ret = (u_char *)&long_ret;
382  break;
383  case ASTCHANACCOUNTCODE:
384  if (!ast_strlen_zero(chan->accountcode)) {
385  strncpy(string_ret, chan->accountcode, sizeof(string_ret));
386  string_ret[sizeof(string_ret) - 1] = '\0';
387  *var_len = strlen(string_ret);
388  ret = (u_char *)string_ret;
389  }
390  break;
391  case ASTCHANFORWARDTO:
392  if (!ast_strlen_zero(chan->call_forward)) {
393  strncpy(string_ret, chan->call_forward, sizeof(string_ret));
394  string_ret[sizeof(string_ret) - 1] = '\0';
395  *var_len = strlen(string_ret);
396  ret = (u_char *)string_ret;
397  }
398  break;
399  case ASTCHANUNIQUEID:
400  strncpy(string_ret, chan->uniqueid, sizeof(string_ret));
401  string_ret[sizeof(string_ret) - 1] = '\0';
402  *var_len = strlen(string_ret);
403  ret = (u_char *)string_ret;
404  break;
405  case ASTCHANCALLGROUP:
406  long_ret = chan->callgroup;
407  ret = (u_char *)&long_ret;
408  break;
409  case ASTCHANPICKUPGROUP:
410  long_ret = chan->pickupgroup;
411  ret = (u_char *)&long_ret;
412  break;
413  case ASTCHANSTATE:
414  long_ret = chan->_state & 0xffff;
415  ret = (u_char *)&long_ret;
416  break;
417  case ASTCHANMUTED:
418  long_ret = chan->_state & AST_STATE_MUTE ? 1 : 2;
419  ret = (u_char *)&long_ret;
420  break;
421  case ASTCHANRINGS:
422  long_ret = chan->rings;
423  ret = (u_char *)&long_ret;
424  break;
425  case ASTCHANCIDDNID:
426  if (chan->dialed.number.str) {
427  strncpy(string_ret, chan->dialed.number.str, sizeof(string_ret));
428  string_ret[sizeof(string_ret) - 1] = '\0';
429  *var_len = strlen(string_ret);
430  ret = (u_char *)string_ret;
431  }
432  break;
433  case ASTCHANCIDNUM:
434  if (chan->caller.id.number.valid && chan->caller.id.number.str) {
435  strncpy(string_ret, chan->caller.id.number.str, sizeof(string_ret));
436  string_ret[sizeof(string_ret) - 1] = '\0';
437  *var_len = strlen(string_ret);
438  ret = (u_char *)string_ret;
439  }
440  break;
441  case ASTCHANCIDNAME:
442  if (chan->caller.id.name.valid && chan->caller.id.name.str) {
443  strncpy(string_ret, chan->caller.id.name.str, sizeof(string_ret));
444  string_ret[sizeof(string_ret) - 1] = '\0';
445  *var_len = strlen(string_ret);
446  ret = (u_char *)string_ret;
447  }
448  break;
449  case ASTCHANCIDANI:
450  if (chan->caller.ani.number.valid && chan->caller.ani.number.str) {
451  strncpy(string_ret, chan->caller.ani.number.str, sizeof(string_ret));
452  string_ret[sizeof(string_ret) - 1] = '\0';
453  *var_len = strlen(string_ret);
454  ret = (u_char *)string_ret;
455  }
456  break;
457  case ASTCHANCIDRDNIS:
458  if (chan->redirecting.from.number.valid && chan->redirecting.from.number.str) {
459  strncpy(string_ret, chan->redirecting.from.number.str, sizeof(string_ret));
460  string_ret[sizeof(string_ret) - 1] = '\0';
461  *var_len = strlen(string_ret);
462  ret = (u_char *)string_ret;
463  }
464  break;
465  case ASTCHANCIDPRES:
466  long_ret = ast_party_id_presentation(&chan->caller.id);
467  ret = (u_char *)&long_ret;
468  break;
469  case ASTCHANCIDANI2:
470  long_ret = chan->caller.ani2;
471  ret = (u_char *)&long_ret;
472  break;
473  case ASTCHANCIDTON:
474  long_ret = chan->caller.id.number.plan;
475  ret = (u_char *)&long_ret;
476  break;
477  case ASTCHANCIDTNS:
478  long_ret = chan->dialed.transit_network_select;
479  ret = (u_char *)&long_ret;
480  break;
481  case ASTCHANAMAFLAGS:
482  long_ret = chan->amaflags;
483  ret = (u_char *)&long_ret;
484  break;
485  case ASTCHANADSI:
486  long_ret = chan->adsicpe;
487  ret = (u_char *)&long_ret;
488  break;
489  case ASTCHANTONEZONE:
490  if (chan->zone) {
491  strncpy(string_ret, chan->zone->country, sizeof(string_ret));
492  string_ret[sizeof(string_ret) - 1] = '\0';
493  *var_len = strlen(string_ret);
494  ret = (u_char *)string_ret;
495  }
496  break;
497  case ASTCHANHANGUPCAUSE:
498  long_ret = chan->hangupcause;
499  ret = (u_char *)&long_ret;
500  break;
501  case ASTCHANVARIABLES:
502  if (pbx_builtin_serialize_variables(chan, &out)) {
503  *var_len = ast_str_strlen(out);
504  ret = (u_char *)ast_str_buffer(out);
505  }
506  break;
507  case ASTCHANFLAGS:
508  bits_ret[0] = 0;
509  for (bit = 0; bit < 8; bit++)
510  bits_ret[0] |= ((chan->flags & (1 << bit)) >> bit) << (7 - bit);
511  bits_ret[1] = 0;
512  for (bit = 0; bit < 8; bit++)
513  bits_ret[1] |= (((chan->flags >> 8) & (1 << bit)) >> bit) << (7 - bit);
514  *var_len = 2;
515  ret = bits_ret;
516  break;
517  case ASTCHANTRANSFERCAP:
518  long_ret = chan->transfercapability;
519  ret = (u_char *)&long_ret;
520  default:
521  break;
522  }
523 
524  ast_channel_unlock(chan);
525  chan = ast_channel_unref(chan);
526 
527  return ret;
528 }
529 
530 static u_char *ast_var_channel_types(struct variable *vp, oid *name, size_t *length,
531  int exact, size_t *var_len, WriteMethod **write_method)
532 {
533  static unsigned long long_ret;
534  struct ast_variable *channel_types, *next;
535 
536  if (header_generic(vp, name, length, exact, var_len, write_method))
537  return NULL;
538 
539  if (vp->magic != ASTCHANTYPECOUNT)
540  return NULL;
541 
542  for (long_ret = 0, channel_types = next = ast_channeltype_list(); next; next = next->next)
543  long_ret++;
544  ast_variables_destroy(channel_types);
545 
546  return (u_char *)&long_ret;
547 }
548 
549 static u_char *ast_var_channel_types_table(struct variable *vp, oid *name, size_t *length,
550  int exact, size_t *var_len, WriteMethod **write_method)
551 {
552  const struct ast_channel_tech *tech = NULL;
553  struct ast_variable *channel_types, *next;
554  static unsigned long long_ret;
555  struct ast_channel *chan;
556  u_long i;
557 
558  if (header_simple_table(vp, name, length, exact, var_len, write_method, -1))
559  return NULL;
560 
561  channel_types = ast_channeltype_list();
562  for (i = 1, next = channel_types; next && i != name[*length - 1]; next = next->next, i++)
563  ;
564  if (next != NULL)
565  tech = ast_get_channel_tech(next->name);
566  ast_variables_destroy(channel_types);
567  if (next == NULL || tech == NULL)
568  return NULL;
569 
570  switch (vp->magic) {
571  case ASTCHANTYPEINDEX:
572  long_ret = name[*length - 1];
573  return (u_char *)&long_ret;
574  case ASTCHANTYPENAME:
575  *var_len = strlen(tech->type);
576  return (u_char *)tech->type;
577  case ASTCHANTYPEDESC:
578  *var_len = strlen(tech->description);
579  return (u_char *)tech->description;
580  case ASTCHANTYPEDEVSTATE:
581  long_ret = tech->devicestate ? 1 : 2;
582  return (u_char *)&long_ret;
584  long_ret = tech->indicate ? 1 : 2;
585  return (u_char *)&long_ret;
586  case ASTCHANTYPETRANSFER:
587  long_ret = tech->transfer ? 1 : 2;
588  return (u_char *)&long_ret;
589  case ASTCHANTYPECHANNELS:
590  {
591  struct ast_channel_iterator *iter;
592 
593  long_ret = 0;
594 
595  if (!(iter = ast_channel_iterator_all_new())) {
596  return NULL;
597  }
598 
599  while ((chan = ast_channel_iterator_next(iter))) {
600  if (chan->tech == tech) {
601  long_ret++;
602  }
603  chan = ast_channel_unref(chan);
604  }
605 
607 
608  return (u_char *)&long_ret;
609  }
610  default:
611  break;
612  }
613  return NULL;
614 }
615 
616 static u_char *ast_var_channel_bridge(struct variable *vp, oid *name, size_t *length,
617  int exact, size_t *var_len, WriteMethod **write_method)
618 {
619  static unsigned long long_ret;
620  struct ast_channel *chan = NULL;
621  struct ast_channel_iterator *iter;
622 
623  long_ret = 0;
624 
625  if (header_generic(vp, name, length, exact, var_len, write_method)) {
626  return NULL;
627  }
628 
629  if (!(iter = ast_channel_iterator_all_new())) {
630  return NULL;
631  }
632 
633  while ((chan = ast_channel_iterator_next(iter))) {
634  ast_channel_lock(chan);
635  if (ast_bridged_channel(chan)) {
636  long_ret++;
637  }
638  ast_channel_unlock(chan);
639  chan = ast_channel_unref(chan);
640  }
641 
643 
644  *var_len = sizeof(long_ret);
645 
646  return (vp->magic == ASTCHANBRIDGECOUNT) ? (u_char *) &long_ret : NULL;
647 }
648 
649 static u_char *ast_var_Config(struct variable *vp, oid *name, size_t *length,
650  int exact, size_t *var_len, WriteMethod **write_method)
651 {
652  static unsigned long long_ret;
653  struct timeval tval;
654 
655  if (header_generic(vp, name, length, exact, var_len, write_method))
656  return NULL;
657 
658  switch (vp->magic) {
659  case ASTCONFUPTIME:
660  gettimeofday(&tval, NULL);
661  long_ret = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000;
662  return (u_char *)&long_ret;
663  case ASTCONFRELOADTIME:
664  gettimeofday(&tval, NULL);
665  if (ast_lastreloadtime.tv_sec)
666  long_ret = difftime(tval.tv_sec, ast_lastreloadtime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_lastreloadtime.tv_usec / 10000;
667  else
668  long_ret = difftime(tval.tv_sec, ast_startuptime.tv_sec) * 100 + tval.tv_usec / 10000 - ast_startuptime.tv_usec / 10000;
669  return (u_char *)&long_ret;
670  case ASTCONFPID:
671  long_ret = getpid();
672  return (u_char *)&long_ret;
673  case ASTCONFSOCKET:
674  *var_len = strlen(ast_config_AST_SOCKET);
675  return (u_char *)ast_config_AST_SOCKET;
676  case ASTCONFACTIVECALLS:
677  long_ret = ast_active_calls();
678  return (u_char *)&long_ret;
680  long_ret = ast_processed_calls();
681  return (u_char *)&long_ret;
682  default:
683  break;
684  }
685  return NULL;
686 }
687 
688 static u_char *ast_var_indications(struct variable *vp, oid *name, size_t *length,
689  int exact, size_t *var_len, WriteMethod **write_method)
690 {
691  static unsigned long long_ret;
692  static char ret_buf[128];
693  struct ast_tone_zone *tz = NULL;
694 
695  if (header_generic(vp, name, length, exact, var_len, write_method))
696  return NULL;
697 
698  switch (vp->magic) {
699  case ASTINDCOUNT:
700  {
701  struct ao2_iterator i;
702 
703  long_ret = 0;
704 
706  while ((tz = ao2_iterator_next(&i))) {
707  tz = ast_tone_zone_unref(tz);
708  long_ret++;
709  }
711 
712  return (u_char *) &long_ret;
713  }
714  case ASTINDCURRENT:
715  tz = ast_get_indication_zone(NULL);
716  if (tz) {
717  ast_copy_string(ret_buf, tz->country, sizeof(ret_buf));
718  *var_len = strlen(ret_buf);
719  tz = ast_tone_zone_unref(tz);
720  return (u_char *) ret_buf;
721  }
722  *var_len = 0;
723  return NULL;
724  default:
725  break;
726  }
727  return NULL;
728 }
729 
730 static u_char *ast_var_indications_table(struct variable *vp, oid *name, size_t *length,
731  int exact, size_t *var_len, WriteMethod **write_method)
732 {
733  static unsigned long long_ret;
734  static char ret_buf[256];
735  struct ast_tone_zone *tz = NULL;
736  int i;
737  struct ao2_iterator iter;
738 
739  if (header_simple_table(vp, name, length, exact, var_len, write_method, -1)) {
740  return NULL;
741  }
742 
743  i = name[*length - 1] - 1;
744 
746 
747  while ((tz = ao2_iterator_next(&iter)) && i) {
748  tz = ast_tone_zone_unref(tz);
749  i--;
750  }
751  ao2_iterator_destroy(&iter);
752 
753  if (tz == NULL) {
754  return NULL;
755  }
756 
757  switch (vp->magic) {
758  case ASTINDINDEX:
760  long_ret = name[*length - 1];
761  return (u_char *)&long_ret;
762  case ASTINDCOUNTRY:
763  ast_copy_string(ret_buf, tz->country, sizeof(ret_buf));
765  *var_len = strlen(ret_buf);
766  return (u_char *) ret_buf;
767  case ASTINDALIAS:
768  /* No longer exists */
770  return NULL;
771  case ASTINDDESCRIPTION:
772  ast_tone_zone_lock(tz);
773  ast_copy_string(ret_buf, tz->description, sizeof(ret_buf));
776  *var_len = strlen(ret_buf);
777  return (u_char *) ret_buf;
778  default:
780  break;
781  }
782  return NULL;
783 }
784 
785 static int countmodule(const char *mod, const char *desc, int use, const char *like)
786 {
787  return 1;
788 }
789 
790 static u_char *ast_var_Modules(struct variable *vp, oid *name, size_t *length,
791  int exact, size_t *var_len, WriteMethod **write_method)
792 {
793  static unsigned long long_ret;
794 
795  if (header_generic(vp, name, length, exact, var_len, write_method))
796  return NULL;
797 
798  if (vp->magic != ASTMODCOUNT)
799  return NULL;
800 
801  long_ret = ast_update_module_list(countmodule, NULL);
802 
803  return (u_char *)&long_ret;
804 }
805 
806 static u_char *ast_var_Version(struct variable *vp, oid *name, size_t *length,
807  int exact, size_t *var_len, WriteMethod **write_method)
808 {
809  static unsigned long long_ret;
810 
811  if (header_generic(vp, name, length, exact, var_len, write_method))
812  return NULL;
813 
814  switch (vp->magic) {
815  case ASTVERSTRING:
816  {
817  const char *version = ast_get_version();
818  *var_len = strlen(version);
819  return (u_char *)version;
820  }
821  case ASTVERTAG:
822  sscanf(ast_get_version_num(), "%30lu", &long_ret);
823  return (u_char *)&long_ret;
824  default:
825  break;
826  }
827  return NULL;
828 }
829 
830 static int term_asterisk_mib(int majorID, int minorID, void *serverarg, void *clientarg)
831 {
832  unregister_sysORTable(asterisk_oid, OID_LENGTH(asterisk_oid));
833  return 0;
834 }
835 
836 static void init_asterisk_mib(void)
837 {
838  static struct variable4 asterisk_vars[] = {
839  {ASTVERSTRING, ASN_OCTET_STR, RONLY, ast_var_Version, 2, {ASTVERSION, ASTVERSTRING}},
840  {ASTVERTAG, ASN_UNSIGNED, RONLY, ast_var_Version, 2, {ASTVERSION, ASTVERTAG}},
841  {ASTCONFUPTIME, ASN_TIMETICKS, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFUPTIME}},
842  {ASTCONFRELOADTIME, ASN_TIMETICKS, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFRELOADTIME}},
843  {ASTCONFPID, ASN_INTEGER, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFPID}},
844  {ASTCONFSOCKET, ASN_OCTET_STR, RONLY, ast_var_Config, 2, {ASTCONFIGURATION, ASTCONFSOCKET}},
847  {ASTMODCOUNT, ASN_INTEGER, RONLY, ast_var_Modules , 2, {ASTMODULES, ASTMODCOUNT}},
848  {ASTINDCOUNT, ASN_INTEGER, RONLY, ast_var_indications, 2, {ASTINDICATIONS, ASTINDCOUNT}},
849  {ASTINDCURRENT, ASN_OCTET_STR, RONLY, ast_var_indications, 2, {ASTINDICATIONS, ASTINDCURRENT}},
852  {ASTINDALIAS, ASN_OCTET_STR, RONLY, ast_var_indications_table, 4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDALIAS}},
854  {ASTCHANCOUNT, ASN_GAUGE, RONLY, ast_var_channels, 2, {ASTCHANNELS, ASTCHANCOUNT}},
855  {ASTCHANINDEX, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANINDEX}},
856  {ASTCHANNAME, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANNAME}},
858  {ASTCHANTYPE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANTYPE}},
860  {ASTCHANBRIDGE, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANBRIDGE}},
861  {ASTCHANMASQ, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMASQ}},
862  {ASTCHANMASQR, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMASQR}},
864  {ASTCHANAPP, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANAPP}},
865  {ASTCHANDATA, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANDATA}},
870  {ASTCHANEXTEN, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANEXTEN}},
871  {ASTCHANPRI, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANPRI}},
877  {ASTCHANSTATE, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANSTATE}},
878  {ASTCHANMUTED, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANMUTED}},
879  {ASTCHANRINGS, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANRINGS}},
881  {ASTCHANCIDNUM, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDNUM}},
883  {ASTCHANCIDANI, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANCIDANI}},
890  {ASTCHANADSI, ASN_INTEGER, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANADSI}},
894  {ASTCHANFLAGS, ASN_OCTET_STR, RONLY, ast_var_channels_table, 4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANFLAGS}},
905  };
906 
907  register_sysORTable(asterisk_oid, OID_LENGTH(asterisk_oid),
908  "ASTERISK-MIB implementation for Asterisk.");
909 
910  REGISTER_MIB("res_snmp", asterisk_vars, variable4, asterisk_oid);
911 
912  snmp_register_callback(SNMP_CALLBACK_LIBRARY,
913  SNMP_CALLBACK_SHUTDOWN,
914  term_asterisk_mib, NULL);
915 }
916 
917 /*
918  * Local Variables:
919  * c-basic-offset: 4
920  * c-file-offsets: ((case-label . 0))
921  * tab-width: 4
922  * indent-tabs-mode: t
923  * End:
924  */
#define ASTINDTABLE
Definition: agent.c:119
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:688
#define ASTCHANCIDNUM
Definition: agent.c:155
Tone Indication Support.
struct ast_channel * masqr
Definition: channel.h:752
#define ast_channel_lock(chan)
Definition: channel.h:2466
static int countmodule(const char *mod, const char *desc, int use, const char *like)
Definition: agent.c:785
void * agent_thread(void *arg)
Definition: agent.c:185
Main Channel structure associated with a channel.
Definition: channel.h:742
char * str
Subscriber phone number (Malloced)
Definition: channel.h:241
#define ASTCONFUPTIME
Definition: agent.c:105
struct ast_channel * masq
Definition: channel.h:751
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:790
uint32_t version
const char *const type
Definition: channel.h:508
struct ast_channel * ast_channel_iterator_next(struct ast_channel_iterator *i)
Get the next channel for a channel iterator.
Definition: channel.c:1715
Asterisk main include file. File version handling, generic pbx functions.
int rings
Definition: channel.h:840
char description[40]
Text description of the given country.
Definition: indications.h:81
char * str
Subscriber phone number (Malloced)
Definition: channel.h:336
int ast_active_calls(void)
Retrieve the number of active calls.
Definition: pbx.c:5931
struct ast_party_caller caller
Channel Caller ID information.
Definition: channel.h:804
struct ast_tone_zone * zone
Definition: channel.h:767
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:204
int priority
Definition: channel.h:841
struct ast_channel_tech * ast_get_channel_tech(const char *name)
Get a channel technology structure by name.
Definition: channel.c:960
const ast_string_field uniqueid
Definition: channel.h:787
#define ASTCHANTYPEINDEX
Definition: agent.c:174
#define ASTVERSION
Definition: agent.c:100
Asterisk version information.
#define ast_channel_unref(c)
Decrease channel reference count.
Definition: channel.h:2502
#define ASTCHANTYPENAME
Definition: agent.c:175
#define ASTCHANMUTED
Definition: agent.c:152
struct ast_party_name name
Subscriber name.
Definition: channel.h:290
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
Definition: channel.h:449
#define ASTCHANVARIABLES
Definition: agent.c:167
const char * ast_get_version(void)
Retrieve the Asterisk version string.
Definition: version.c:14
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:549
char context[AST_MAX_CONTEXT]
Definition: channel.h:868
struct ast_variable * ast_channeltype_list(void)
return an ast_variable list of channeltypes
Definition: channel.c:261
#define ASTCHANCIDTON
Definition: agent.c:161
#define ao2_iterator_next(arg1)
Definition: astobj2.h:1126
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:497
#define ASTCHANBRIDGE
Definition: agent.c:134
#define ast_tone_zone_unlock(tz)
Unlock an ast_tone_zone.
Definition: indications.h:192
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
Definition: channel.c:2151
#define ASTCHANMASQ
Definition: agent.c:135
Structure for variables, used for configurations and for channel variables.
Definition: config.h:75
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
Definition: time.h:100
#define ASTINDINDEX
Definition: agent.c:120
struct ast_party_redirecting redirecting
Redirecting/Diversion information.
Definition: channel.h:814
#define ASTCHANADSI
Definition: agent.c:164
#define ASTCHANCONTEXT
Definition: agent.c:140
#define ASTVERTAG
Definition: agent.c:102
#define ASTINDCURRENT
Definition: agent.c:117
char * str
Subscriber name (Malloced)
Definition: channel.h:214
#define ASTCHANINDEX
Definition: agent.c:129
#define ASTCHANWHENHANGUP
Definition: agent.c:137
#define ASTCHANCIDANI
Definition: agent.c:157
#define ASTCHANUNIQUEID
Definition: agent.c:148
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:730
#define ASTCONFSOCKET
Definition: agent.c:108
#define ASTCHANDATA
Definition: agent.c:139
unsigned short transfercapability
Definition: channel.h:863
static char * tz
Definition: cdr_pgsql.c:56
#define ast_str_alloca(init_len)
Definition: strings.h:608
static int term_asterisk_mib(int majorID, int minorID, void *serverarg, void *clientarg)
Definition: agent.c:830
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Definition: config.c:586
#define ASTCHANMACROEXTEN
Definition: agent.c:142
#define ASTCHANCIDTNS
Definition: agent.c:162
const char * data
Definition: channel.h:755
#define ASTCHANHANGUPCAUSE
Definition: agent.c:166
#define ASTCHANCIDRDNIS
Definition: agent.c:158
static oid asterisk_oid[]
Definition: agent.c:93
enum ast_channel_adsicpe adsicpe
Definition: channel.h:844
ast_group_t pickupgroup
Definition: channel.h:819
#define ASTCHANCOUNT
Definition: agent.c:126
#define ast_verb(level,...)
Definition: logger.h:243
const char * appl
Definition: channel.h:754
ast_group_t callgroup
Definition: channel.h:818
#define ASTCHANACCOUNTCODE
Definition: agent.c:146
#define ASTCHANTYPECOUNT
Definition: agent.c:171
#define ASTCHANRINGS
Definition: agent.c:153
#define ASTCONFRELOADTIME
Definition: agent.c:106
unsigned int flags
Definition: channel.h:850
struct ast_party_id id
Caller party ID.
Definition: channel.h:370
#define ASTCHANAMAFLAGS
Definition: agent.c:163
#define ASTCHANEXTEN
Definition: agent.c:144
int macropriority
Definition: channel.h:842
struct ast_party_id ani
Automatic Number Identification (ANI)
Definition: channel.h:377
General Asterisk PBX channel definitions.
struct ast_party_dialed::@155 number
Dialed/Called number.
Asterisk file paths, configured in asterisk.conf.
A set of tones for a given locale.
Definition: indications.h:73
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
#define ASTCHANBRIDGECOUNT
Definition: agent.c:183
struct timeval ast_lastreloadtime
Definition: asterisk.c:219
const char * name
Definition: config.h:77
int header_generic(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **)
#define ASTCHANLANGUAGE
Definition: agent.c:131
#define ASTCHANAPP
Definition: agent.c:138
Structure to describe a channel &quot;technology&quot;, ie a channel driver See for examples: ...
Definition: channel.h:507
Core PBX routines and definitions.
#define ASTCHANCIDANI2
Definition: agent.c:160
#define ASTCHANCIDDNID
Definition: agent.c:154
#define ASTCHANMUSICCLASS
Definition: agent.c:133
#define ASTINDCOUNT
Definition: agent.c:116
#define ASTCHANTYPE
Definition: agent.c:132
int res_snmp_dont_stop
Definition: res_snmp.c:37
#define ASTCHANTYPETABLE
Definition: agent.c:173
struct ast_party_dialed dialed
Dialed/Called information.
Definition: channel.h:797
static const char desc[]
Definition: cdr_radius.c:85
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:649
int ast_processed_calls(void)
Retrieve the total number of calls processed through the PBX since last restart.
Definition: pbx.c:5936
#define ASTCONFACTIVECALLS
Definition: agent.c:109
#define ASTINDDESCRIPTION
Definition: agent.c:123
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Definition: strings.h:364
#define ASTINDALIAS
Definition: agent.c:122
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
Definition: channel.h:243
#define ASTCHANTRANSFERCAP
Definition: agent.c:169
#define ASTCONFIGURATION
Definition: agent.c:104
const ast_string_field call_forward
Definition: channel.h:787
struct ast_tone_zone * ast_get_indication_zone(const char *country)
locate ast_tone_zone
Definition: indications.c:451
#define ASTCHANTYPECHANNELS
Definition: agent.c:180
#define ASTCHANTYPEDEVSTATE
Definition: agent.c:177
int ani2
Automatic Number Identification 2 (Info Digits)
Definition: channel.h:380
#define ASTCHANTABLE
Definition: agent.c:128
enum ast_channel_state _state
Definition: channel.h:839
struct ast_channel * ast_bridged_channel(struct ast_channel *chan)
Find bridged channel.
Definition: channel.c:7160
const ast_string_field name
Definition: channel.h:787
#define ASTVERSTRING
Definition: agent.c:101
#define ASTCHANMACROPRI
Definition: agent.c:143
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:616
#define ASTCHANTONEZONE
Definition: agent.c:165
#define ASTCHANTYPEDESC
Definition: agent.c:176
struct ast_bridge * bridge
Definition: channel.h:865
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:232
#define ASTCHANTYPETRANSFER
Definition: agent.c:179
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:216
#define ast_channel_unlock(chan)
Definition: channel.h:2467
int(*const transfer)(struct ast_channel *chan, const char *newdest)
Blind transfer other side (see app_transfer.c and ast_transfer()
Definition: channel.h:588
static const char name[]
#define ASTCHANCIDPRES
Definition: agent.c:159
char macrocontext[AST_MAX_CONTEXT]
Definition: channel.h:870
#define ASTCHANCALLGROUP
Definition: agent.c:149
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:530
#define ASTCHANFLAGS
Definition: agent.c:168
#define ASTCHANMACROCONTEXT
Definition: agent.c:141
char country[16]
Country code that this set of tones is for.
Definition: indications.h:75
const char *const description
Definition: channel.h:509
void ao2_iterator_destroy(struct ao2_iterator *i)
Destroy a container iterator.
Definition: astobj2.c:833
#define ASTCHANCIDNAME
Definition: agent.c:156
#define ASTMODCOUNT
Definition: agent.c:113
Support for logging to various files, console and syslog Configuration in file logger.conf.
#define ASTCHANMASQR
Definition: agent.c:136
const char * ast_get_version_num(void)
Retrieve the numeric Asterisk version.
Definition: version.c:19
char macroexten[AST_MAX_EXTENSION]
Definition: channel.h:871
int res_snmp_agentx_subagent
Definition: res_snmp.c:36
struct timeval ast_startuptime
Definition: asterisk.c:218
#define ASTCHANSCALARS
Definition: agent.c:182
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
Definition: strings.h:471
int transit_network_select
Transit Network Select.
Definition: channel.h:347
int(*const devicestate)(void *data)
Definition: channel.h:521
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...
Definition: astobj2.h:1053
int ast_update_module_list(int(*modentry)(const char *module, const char *description, int usecnt, const char *like), const char *like)
Ask for a list of modules, descriptions, and use counts.
Definition: loader.c:1234
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:223
struct ao2_iterator ast_tone_zone_iterator_init(void)
Get an iterator for the available tone zones.
Definition: indications.c:421
struct ast_channel_iterator * ast_channel_iterator_destroy(struct ast_channel_iterator *i)
Destroy a channel iterator.
Definition: channel.c:1649
const char * ast_config_AST_SOCKET
Definition: asterisk.c:270
const ast_string_field musicclass
Definition: channel.h:787
const ast_string_field accountcode
Definition: channel.h:787
#define ASTMODULES
Definition: agent.c:112
int hangupcause
Definition: channel.h:849
#define ASTCHANSTATE
Definition: agent.c:151
Options provided by main asterisk program.
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:806
#define ASTCHANPICKUPGROUP
Definition: agent.c:150
struct timeval whentohangup
Definition: channel.h:789
#define ast_tone_zone_lock(tz)
Lock an ast_tone_zone.
Definition: indications.h:187
struct ast_variable * next
Definition: config.h:82
unsigned char valid
TRUE if the name information is valid/present.
Definition: channel.h:229
#define ASTCHANNAME
Definition: agent.c:130
struct ast_channel_iterator * ast_channel_iterator_all_new(void)
Create a new channel iterator.
Definition: channel.c:1701
#define ASTINDICATIONS
Definition: agent.c:115
#define ASTCHANNELS
Definition: agent.c:125
#define ASTCONFPID
Definition: agent.c:107
Asterisk module definitions.
int amaflags
Definition: channel.h:843
#define ASTINDCOUNTRY
Definition: agent.c:121
struct ast_channel_tech * tech
Definition: channel.h:743
int ast_active_channels(void)
returns number of active/allocated channels
Definition: channel.c:848
int header_simple_table(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **, int)
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:576
unsigned char valid
TRUE if the number information is valid/present.
Definition: channel.h:247
#define ASTCHANTYPEINDICATIONS
Definition: agent.c:178
const ast_string_field language
Definition: channel.h:787
static void init_asterisk_mib(void)
Definition: agent.c:836
char exten[AST_MAX_EXTENSION]
Definition: channel.h:869
#define ASTCHANFORWARDTO
Definition: agent.c:147
int register_sysORTable(oid *, size_t, const char *)
#define ASTCONFPROCESSEDCALLS
Definition: agent.c:110
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
Definition: asterisk.h:180
#define ASTCHANPRI
Definition: agent.c:145
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.
Definition: pbx.c:10444
struct ast_party_number number
Subscriber phone number.
Definition: channel.h:292
int unregister_sysORTable(oid *, size_t)