Asterisk - The Open Source Telephony Project  18.5.0
config_global.c
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 2013, Digium, Inc.
5  *
6  * Mark Michelson <[email protected]>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 
19 #include "asterisk.h"
20 
21 #include <pjsip.h>
22 #include <pjlib.h>
23 
24 #include "asterisk/res_pjsip.h"
26 #include "asterisk/pbx.h"
27 #include "asterisk/sorcery.h"
28 #include "asterisk/taskprocessor.h"
29 #include "asterisk/ast_version.h"
30 #include "asterisk/res_pjsip_cli.h"
31 
32 #define DEFAULT_MAX_FORWARDS 70
33 #define DEFAULT_KEEPALIVE_INTERVAL 90
34 #define DEFAULT_USERAGENT_PREFIX "Asterisk PBX"
35 #define DEFAULT_OUTBOUND_ENDPOINT "default_outbound_endpoint"
36 #define DEFAULT_DEBUG "no"
37 #define DEFAULT_ENDPOINT_IDENTIFIER_ORDER "ip,username,anonymous"
38 #define DEFAULT_MAX_INITIAL_QUALIFY_TIME 0
39 #define DEFAULT_FROM_USER "asterisk"
40 #define DEFAULT_REALM "asterisk"
41 #define DEFAULT_REGCONTEXT ""
42 #define DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL 30
43 #define DEFAULT_DISABLE_MULTI_DOMAIN 0
44 #define DEFAULT_VOICEMAIL_EXTENSION ""
45 #define DEFAULT_UNIDENTIFIED_REQUEST_COUNT 5
46 #define DEFAULT_UNIDENTIFIED_REQUEST_PERIOD 5
47 #define DEFAULT_UNIDENTIFIED_REQUEST_PRUNE_INTERVAL 30
48 #define DEFAULT_MWI_TPS_QUEUE_HIGH AST_TASKPROCESSOR_HIGH_WATER_LEVEL
49 #define DEFAULT_MWI_TPS_QUEUE_LOW -1
50 #define DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED 0
51 #define DEFAULT_IGNORE_URI_USER_OPTIONS 0
52 #define DEFAULT_USE_CALLERID_CONTACT 0
53 #define DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION 0
54 #define DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER TASKPROCESSOR_OVERLOAD_TRIGGER_GLOBAL
55 #define DEFAULT_NOREFERSUB 1
56 
57 /*!
58  * \brief Cached global config object
59  *
60  * \details
61  * Cached so we don't have to keep asking sorcery for the config.
62  * We could ask for it hundreds of times a second if not more.
63  */
64 static AO2_GLOBAL_OBJ_STATIC(global_cfg);
65 
66 static char default_useragent[256];
67 
68 struct global_config {
69  SORCERY_OBJECT(details);
74  /*! Debug logging yes|no|host */
76  /*! Order by which endpoint identifiers are checked (comma separated list) */
78  /*! User name to place in From header if there is no better option */
80  /*! Default voicemail extension */
82  /*! Realm to use in challenges before an endpoint is identified */
84  );
85  /*! Value to put in Max-Forwards header */
86  unsigned int max_forwards;
87  /*! The interval at which to send keep alive messages to active connection-oriented transports */
88  unsigned int keep_alive_interval;
89  /*! The maximum time for all contacts to be qualified at startup */
91  /*! The interval at which to check for expired contacts */
93  /*! Nonzero to disable multi domain support */
94  unsigned int disable_multi_domain;
95  /*! The maximum number of unidentified requests per source IP address before a security event is logged */
97  /*! The period during which unidentified requests are accumulated */
99  /*! Interval at which expired unidentifed requests will be pruned */
101  struct {
102  /*! Taskprocessor high water alert trigger level */
103  unsigned int tps_queue_high;
104  /*! Taskprocessor low water clear alert level. */
106  /*! Nonzero to disable sending unsolicited mwi to all endpoints on startup */
108  } mwi;
109  /*! Nonzero if URI user field options are ignored. */
111  /*! Nonzero if CALLERID(num) is to be used as the default contact username instead of default_from_user */
112  unsigned int use_callerid_contact;
113  /*! Nonzero if need to send AMI ContactStatus event when a contact is updated */
115  /*! Trigger the distributor should use to pause accepting new dialogs */
117  /*! Nonzero if norefersub is to be sent in Supported header */
118  unsigned int norefersub;
119 };
120 
121 static void global_destructor(void *obj)
122 {
123  struct global_config *cfg = obj;
124 
126 }
127 
128 static void *global_alloc(const char *name)
129 {
130  struct global_config *cfg;
131 
132  cfg = ast_sorcery_generic_alloc(sizeof(*cfg), global_destructor);
133  if (!cfg || ast_string_field_init(cfg, 100)) {
134  ao2_cleanup(cfg);
135  return NULL;
136  }
137 
138  return cfg;
139 }
140 
141 /*
142  * There is ever only one global section, so we can use a single global
143  * value here to track the regcontext through reloads.
144  */
145 static char *previous_regcontext = NULL;
146 
147 static int check_regcontext(const struct global_config *cfg)
148 {
149  char *current = NULL;
150 
151  if (previous_regcontext && !strcmp(previous_regcontext, cfg->regcontext)) {
152  /* Nothing changed so nothing to do */
153  return 0;
154  }
155 
156  if (!ast_strlen_zero(cfg->regcontext)) {
157  current = ast_strdup(cfg->regcontext);
158  if (!current) {
159  return -1;
160  }
161 
163  ast_free(current);
164  return -1;
165  }
166  }
167 
172  }
173 
174  if (current) {
175  previous_regcontext = current;
176  }
177 
178  return 0;
179 }
180 
181 static int global_apply(const struct ast_sorcery *sorcery, void *obj)
182 {
183  struct global_config *cfg = obj;
184  char max_forwards[10];
185 
186  if (ast_strlen_zero(cfg->debug)) {
188  "Global option 'debug' can't be empty. Set it to a valid value or remove the entry to accept 'no' as the default\n");
189  return -1;
190  }
191 
194  "Global option 'default_from_user' can't be empty. Set it to a valid value or remove the entry to accept 'asterisk' as the default\n");
195  return -1;
196  }
197 
198  snprintf(max_forwards, sizeof(max_forwards), "%u", cfg->max_forwards);
199 
200  ast_sip_add_global_request_header("Max-Forwards", max_forwards, 1);
201  ast_sip_add_global_request_header("User-Agent", cfg->useragent, 1);
203 
204  if (check_regcontext(cfg)) {
205  return -1;
206  }
207 
208  ao2_t_global_obj_replace_unref(global_cfg, cfg, "Applying global settings");
209  return 0;
210 }
211 
212 static struct global_config *get_global_cfg(void)
213 {
214  return ao2_global_obj_ref(global_cfg);
215 }
216 
218 {
219  char *str;
220  struct global_config *cfg;
221 
222  cfg = get_global_cfg();
223  if (!cfg) {
225  }
226 
228  ao2_ref(cfg, -1);
229  return str;
230 }
231 
232 char *ast_sip_get_debug(void)
233 {
234  char *res;
235  struct global_config *cfg;
236 
237  cfg = get_global_cfg();
238  if (!cfg) {
239  return ast_strdup(DEFAULT_DEBUG);
240  }
241 
242  res = ast_strdup(cfg->debug);
243  ao2_ref(cfg, -1);
244  return res;
245 }
246 
248 {
249  char *res;
250  struct global_config *cfg;
251 
252  cfg = get_global_cfg();
253  if (!cfg) {
255  }
256 
257  res = ast_strdup(cfg->regcontext);
258  ao2_ref(cfg, -1);
259 
260  return res;
261 }
262 
264 {
265  char *res;
266  struct global_config *cfg;
267 
268  cfg = get_global_cfg();
269  if (!cfg) {
271  }
272 
274  ao2_ref(cfg, -1);
275 
276  return res;
277 }
278 
280 {
281  char *res;
282  struct global_config *cfg;
283 
284  cfg = get_global_cfg();
285  if (!cfg) {
287  }
288 
290  ao2_ref(cfg, -1);
291  return res;
292 }
293 
295 {
296  unsigned int interval;
297  struct global_config *cfg;
298 
299  cfg = get_global_cfg();
300  if (!cfg) {
302  }
303 
304  interval = cfg->keep_alive_interval;
305  ao2_ref(cfg, -1);
306  return interval;
307 }
308 
310 {
311  unsigned int interval;
312  struct global_config *cfg;
313 
314  cfg = get_global_cfg();
315  if (!cfg) {
317  }
318 
319  interval = cfg->contact_expiration_check_interval;
320  ao2_ref(cfg, -1);
321  return interval;
322 }
323 
325 {
326  unsigned int disable_multi_domain;
327  struct global_config *cfg;
328 
329  cfg = get_global_cfg();
330  if (!cfg) {
332  }
333 
334  disable_multi_domain = cfg->disable_multi_domain;
335  ao2_ref(cfg, -1);
336  return disable_multi_domain;
337 }
338 
340 {
341  unsigned int time;
342  struct global_config *cfg;
343 
344  cfg = get_global_cfg();
345  if (!cfg) {
347  }
348 
349  time = cfg->max_initial_qualify_time;
350  ao2_ref(cfg, -1);
351  return time;
352 }
353 
354 void ast_sip_get_unidentified_request_thresholds(unsigned int *count, unsigned int *period,
355  unsigned int *prune_interval)
356 {
357  struct global_config *cfg;
358 
359  cfg = get_global_cfg();
360  if (!cfg) {
364  return;
365  }
366 
367  *count = cfg->unidentified_request_count;
368  *period = cfg->unidentified_request_period;
369  *prune_interval = cfg->unidentified_request_prune_interval;
370 
371  ao2_ref(cfg, -1);
372  return;
373 }
374 
375 void ast_sip_get_default_realm(char *realm, size_t size)
376 {
377  struct global_config *cfg;
378 
379  cfg = get_global_cfg();
380  if (!cfg) {
381  ast_copy_string(realm, DEFAULT_REALM, size);
382  } else {
383  ast_copy_string(realm, cfg->default_realm, size);
384  ao2_ref(cfg, -1);
385  }
386 }
387 
388 void ast_sip_get_default_from_user(char *from_user, size_t size)
389 {
390  struct global_config *cfg;
391 
392  cfg = get_global_cfg();
393  if (!cfg) {
394  ast_copy_string(from_user, DEFAULT_FROM_USER, size);
395  } else {
396  ast_copy_string(from_user, cfg->default_from_user, size);
397  ao2_ref(cfg, -1);
398  }
399 }
400 
401 
403 {
404  unsigned int tps_queue_high;
405  struct global_config *cfg;
406 
407  cfg = get_global_cfg();
408  if (!cfg) {
410  }
411 
412  tps_queue_high = cfg->mwi.tps_queue_high;
413  ao2_ref(cfg, -1);
414  return tps_queue_high;
415 }
416 
418 {
419  int tps_queue_low;
420  struct global_config *cfg;
421 
422  cfg = get_global_cfg();
423  if (!cfg) {
425  }
426 
427  tps_queue_low = cfg->mwi.tps_queue_low;
428  ao2_ref(cfg, -1);
429  return tps_queue_low;
430 }
431 
433 {
434  unsigned int disable_initial_unsolicited;
435  struct global_config *cfg;
436 
437  cfg = get_global_cfg();
438  if (!cfg) {
440  }
441 
442  disable_initial_unsolicited = cfg->mwi.disable_initial_unsolicited;
443  ao2_ref(cfg, -1);
445 }
446 
448 {
449  unsigned int ignore_uri_user_options;
450  struct global_config *cfg;
451 
452  cfg = get_global_cfg();
453  if (!cfg) {
455  }
456 
457  ignore_uri_user_options = cfg->ignore_uri_user_options;
458  ao2_ref(cfg, -1);
460 }
461 
463 {
464  unsigned int use_callerid_contact;
465  struct global_config *cfg;
466 
467  cfg = get_global_cfg();
468  if (!cfg) {
470  }
471 
472  use_callerid_contact = cfg->use_callerid_contact;
473  ao2_ref(cfg, -1);
474  return use_callerid_contact;
475 }
476 
478 {
480  struct global_config *cfg;
481 
482  cfg = get_global_cfg();
483  if (!cfg) {
485  }
486 
487  send_contact_status_on_update_registration = cfg->send_contact_status_on_update_registration;
488  ao2_ref(cfg, -1);
490 }
491 
493 {
495  struct global_config *cfg;
496 
497  cfg = get_global_cfg();
498  if (!cfg) {
500  }
501 
502  trigger = cfg->overload_trigger;
503  ao2_ref(cfg, -1);
504  return trigger;
505 }
506 
507 unsigned int ast_sip_get_norefersub(void)
508 {
509  unsigned int norefersub;
510  struct global_config *cfg;
511 
512  cfg = get_global_cfg();
513  if (!cfg) {
514  return DEFAULT_NOREFERSUB;
515  }
516 
517  norefersub = cfg->norefersub;
518  ao2_ref(cfg, -1);
519  return norefersub;
520 }
521 
522 static int overload_trigger_handler(const struct aco_option *opt,
523  struct ast_variable *var, void *obj)
524 {
525  struct global_config *cfg = obj;
526  if (!strcasecmp(var->value, "none")) {
528  } else if (!strcasecmp(var->value, "global")) {
530  } else if (!strcasecmp(var->value, "pjsip_only")) {
532  } else {
533  ast_log(LOG_WARNING, "Unknown overload trigger '%s' specified for %s\n",
534  var->value, var->name);
535  return -1;
536  }
537  return 0;
538 }
539 
540 static const char *overload_trigger_map[] = {
544 };
545 
547 {
548  return ARRAY_IN_BOUNDS(trigger, overload_trigger_map) ?
549  overload_trigger_map[trigger] : "";
550 }
551 
552 static int overload_trigger_to_str(const void *obj, const intptr_t *args, char **buf)
553 {
554  const struct global_config *cfg = obj;
556  return 0;
557 }
558 
559 /*!
560  * \internal
561  * \brief Observer to set default global object if none exist.
562  *
563  * \param name Module name owning the sorcery instance.
564  * \param sorcery Instance being observed.
565  * \param object_type Name of object being observed.
566  * \param reloaded Non-zero if the object is being reloaded.
567  *
568  * \return Nothing
569  */
570 static void global_loaded_observer(const char *name, const struct ast_sorcery *sorcery, const char *object_type, int reloaded)
571 {
572  struct ao2_container *globals;
573  struct global_config *cfg;
574 
575  if (strcmp(object_type, "global")) {
576  /* Not interested */
577  return;
578  }
579 
580  globals = ast_sorcery_retrieve_by_fields(sorcery, "global",
582  if (globals) {
583  int count;
584 
585  count = ao2_container_count(globals);
586  ao2_ref(globals, -1);
587 
588  if (1 < count) {
590  "At most one pjsip.conf type=global object can be defined. You have %d defined.\n",
591  count);
592  return;
593  }
594  if (count) {
595  return;
596  }
597  }
598 
599  ast_debug(1, "No pjsip.conf type=global object exists so applying defaults.\n");
600  cfg = ast_sorcery_alloc(sorcery, "global", NULL);
601  if (!cfg) {
602  return;
603  }
604  global_apply(sorcery, cfg);
605  ao2_ref(cfg, -1);
606 }
607 
610 };
611 
613 {
614  struct global_config *cfg = get_global_cfg();
615 
616  if (!cfg) {
617  cfg = ast_sorcery_alloc(ast_sip_get_sorcery(), "global", NULL);
618  if (!cfg) {
619  return -1;
620  }
621  }
622 
623  ast_str_append(&context->output_buffer, 0, "\nGlobal Settings:\n\n");
624  ast_sip_cli_print_sorcery_objectset(cfg, context, 0);
625 
626  ao2_ref(cfg, -1);
627  return 0;
628 }
629 
631 {
633 
634  ast_sorcery_instance_observer_remove(sorcery, &observer_callbacks_global);
635 
636  if (previous_regcontext) {
639  }
640 
641  ao2_t_global_obj_release(global_cfg, "Module is unloading");
642 
643  return 0;
644 }
645 
646 
648 {
650 
651  snprintf(default_useragent, sizeof(default_useragent), "%s %s",
653 
654  ast_sorcery_apply_default(sorcery, "global", "config", "pjsip.conf,criteria=type=global,single_object=yes,explicit_name=global");
655 
656  if (ast_sorcery_object_register(sorcery, "global", global_alloc, NULL, global_apply)) {
657  return -1;
658  }
659 
660  ast_sorcery_object_field_register(sorcery, "global", "type", "", OPT_NOOP_T, 0, 0);
661  ast_sorcery_object_field_register(sorcery, "global", "max_forwards",
664  ast_sorcery_object_field_register(sorcery, "global", "user_agent", default_useragent,
666  ast_sorcery_object_field_register(sorcery, "global", "default_outbound_endpoint",
669  ast_sorcery_object_field_register(sorcery, "global", "debug", DEFAULT_DEBUG,
671  ast_sorcery_object_field_register(sorcery, "global", "endpoint_identifier_order",
674  ast_sorcery_object_field_register(sorcery, "global", "keep_alive_interval",
677  ast_sorcery_object_field_register(sorcery, "global", "max_initial_qualify_time",
680  ast_sorcery_object_field_register(sorcery, "global", "default_from_user", DEFAULT_FROM_USER,
682  ast_sorcery_object_field_register(sorcery, "global", "default_voicemail_extension",
685  ast_sorcery_object_field_register(sorcery, "global", "regcontext", DEFAULT_REGCONTEXT,
687  ast_sorcery_object_field_register(sorcery, "global", "contact_expiration_check_interval",
690  ast_sorcery_object_field_register(sorcery, "global", "disable_multi_domain",
691  DEFAULT_DISABLE_MULTI_DOMAIN ? "yes" : "no",
693  ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_count",
696  ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_period",
699  ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_prune_interval",
702  ast_sorcery_object_field_register(sorcery, "global", "default_realm", DEFAULT_REALM,
704  ast_sorcery_object_field_register(sorcery, "global", "mwi_tps_queue_high",
706  OPT_UINT_T, 0, FLDSET(struct global_config, mwi.tps_queue_high));
707  ast_sorcery_object_field_register(sorcery, "global", "mwi_tps_queue_low",
709  OPT_INT_T, 0, FLDSET(struct global_config, mwi.tps_queue_low));
710  ast_sorcery_object_field_register(sorcery, "global", "mwi_disable_initial_unsolicited",
712  OPT_BOOL_T, 1, FLDSET(struct global_config, mwi.disable_initial_unsolicited));
713  ast_sorcery_object_field_register(sorcery, "global", "ignore_uri_user_options",
714  DEFAULT_IGNORE_URI_USER_OPTIONS ? "yes" : "no",
716  ast_sorcery_object_field_register(sorcery, "global", "use_callerid_contact",
717  DEFAULT_USE_CALLERID_CONTACT ? "yes" : "no",
719  ast_sorcery_object_field_register(sorcery, "global", "send_contact_status_on_update_registration",
722  ast_sorcery_object_field_register_custom(sorcery, "global", "taskprocessor_overload_trigger",
725  ast_sorcery_object_field_register(sorcery, "global", "norefersub",
726  DEFAULT_NOREFERSUB ? "yes" : "no",
728 
729  if (ast_sorcery_instance_observer_add(sorcery, &observer_callbacks_global)) {
730  return -1;
731  }
732 
733  return 0;
734 }
struct ast_str * output_buffer
Definition: res_pjsip_cli.h:36
char * ast_sip_get_endpoint_identifier_order(void)
Retrieve the global endpoint_identifier_order setting.
unsigned int send_contact_status_on_update_registration
int sip_cli_print_global(struct ast_sip_cli_context *context)
#define ARRAY_IN_BOUNDS(v, a)
Checks to see if value is within the bounds of the given array.
Definition: utils.h:658
static char * previous_regcontext
Asterisk main include file. File version handling, generic pbx functions.
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define DEFAULT_MWI_TPS_QUEUE_HIGH
Definition: config_global.c:48
unsigned int contact_expiration_check_interval
Definition: config_global.c:92
static AO2_GLOBAL_OBJ_STATIC(global_cfg)
Cached global config object.
#define DEFAULT_UNIDENTIFIED_REQUEST_PRUNE_INTERVAL
Definition: config_global.c:47
Asterisk version information.
int ast_sip_get_mwi_tps_queue_low(void)
Retrieve the global MWI taskprocessor low water clear alert level.
#define DEFAULT_REALM
Definition: config_global.c:40
int ast_sorcery_instance_observer_add(struct ast_sorcery *sorcery, const struct ast_sorcery_instance_observer *callbacks)
Add an observer to a sorcery instance.
Definition: sorcery.c:520
#define DEFAULT_ENDPOINT_IDENTIFIER_ORDER
Definition: config_global.c:37
char * ast_sip_get_debug(void)
Retrieve the system debug setting (yes|no|host).
void ast_sip_get_unidentified_request_thresholds(unsigned int *count, unsigned int *period, unsigned int *prune_interval)
Retrieve the unidentified request security event thresholds.
unsigned int disable_multi_domain
Definition: config_global.c:94
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
const char * ast_get_version(void)
Retrieve the Asterisk version string.
Definition: version.c:16
#define ao2_t_global_obj_replace_unref(holder, obj, tag)
Replace an ao2 object in the global holder, throwing away any old object.
Definition: astobj2.h:906
#define DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL
Definition: config_global.c:42
#define LOG_WARNING
Definition: logger.h:274
enum ast_sip_taskprocessor_overload_trigger ast_sip_get_taskprocessor_overload_trigger(void)
#define DEFAULT_MWI_TPS_QUEUE_LOW
Definition: config_global.c:49
Structure for variables, used for configurations and for channel variables.
#define var
Definition: ast_expr2f.c:614
unsigned int keep_alive_interval
Definition: config_global.c:88
Perform no matching, return all objects.
Definition: sorcery.h:123
static const struct ast_sorcery_instance_observer observer_callbacks_global
unsigned int ast_sip_get_mwi_tps_queue_high(void)
Retrieve the global MWI taskprocessor high water alert trigger level.
Full structure for sorcery.
Definition: sorcery.c:230
Type for a default handler that should do nothing.
#define ao2_t_global_obj_release(holder, tag)
Release the ao2 object held in the global holder.
Definition: astobj2.h:863
static int overload_trigger_to_str(const void *obj, const intptr_t *args, char **buf)
#define DEFAULT_NOREFERSUB
Definition: config_global.c:55
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1091
#define DEFAULT_MAX_INITIAL_QUALIFY_TIME
Definition: config_global.c:38
#define ao2_global_obj_ref(holder)
Definition: astobj2.h:925
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
Definition: stringfields.h:337
Return all matching objects.
Definition: sorcery.h:120
const ast_string_field endpoint_identifier_order
Definition: config_global.c:84
unsigned int unidentified_request_prune_interval
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:243
const char * str
Definition: app_jack.c:147
const char * args
static int check_regcontext(const struct global_config *cfg)
#define NULL
Definition: resample.c:96
int ast_sip_add_global_request_header(const char *name, const char *value, int replace)
enum ast_sip_taskprocessor_overload_trigger overload_trigger
static void global_loaded_observer(const char *name, const struct ast_sorcery *sorcery, const char *object_type, int reloaded)
unsigned int ast_sip_get_use_callerid_contact(void)
Retrieve the global setting &#39;use_callerid_contact&#39;.
const ast_string_field useragent
Definition: config_global.c:84
const ast_string_field debug
Definition: config_global.c:84
unsigned int ast_sip_get_contact_expiration_check_interval(void)
Retrieve the system contact expiration check interval setting.
const ast_string_field default_realm
Definition: config_global.c:84
int ast_context_destroy_by_name(const char *context, const char *registrar)
Destroy a context by name.
Definition: pbx.c:8244
#define ast_strlen_zero(foo)
Definition: strings.h:52
unsigned int unidentified_request_count
Definition: config_global.c:96
Type for default option handler for bools (ast_true/ast_false)
unsigned int ast_sip_get_norefersub(void)
Retrieve the global setting &#39;norefersub&#39;.
const ast_string_field default_voicemail_extension
Definition: config_global.c:84
unsigned int ast_sip_get_keep_alive_interval(void)
Retrieve the system keep alive interval setting.
unsigned int ast_sip_get_max_initial_qualify_time(void)
Retrieve the system max initial qualify time.
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
#define ast_sorcery_object_field_register_custom(sorcery, type, name, default_val, config_handler, sorcery_handler, multiple_handler, flags,...)
Register a field within an object with custom handlers.
Definition: sorcery.h:1005
#define __stringify(x)
Definition: asterisk.h:214
#define DEFAULT_KEEPALIVE_INTERVAL
Definition: config_global.c:33
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
SORCERY_OBJECT(details)
#define DEFAULT_REGCONTEXT
Definition: config_global.c:41
unsigned int norefersub
static void * global_alloc(const char *name)
struct global_config::@477 mwi
Type for default option handler for unsigned integers.
#define DEFAULT_UNIDENTIFIED_REQUEST_COUNT
Definition: config_global.c:45
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
Definition: stringfields.h:353
Interface for the sorcery instance observer.
Definition: sorcery.h:237
#define DEFAULT_VOICEMAIL_EXTENSION
Definition: config_global.c:44
#define AST_STRING_FIELD(name)
Declare a string field.
Definition: stringfields.h:299
#define ao2_ref(o, delta)
Definition: astobj2.h:464
char * ast_sip_global_default_outbound_endpoint(void)
static struct console_pvt globals
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
Definition: sorcery.h:838
Core PBX routines and definitions.
void ast_sorcery_instance_observer_remove(struct ast_sorcery *sorcery, const struct ast_sorcery_instance_observer *callbacks)
Remove an observer from a sorcery instance.
Definition: sorcery.c:537
int ast_sip_add_global_response_header(const char *name, const char *value, int replace)
#define DEFAULT_USE_CALLERID_CONTACT
Definition: config_global.c:52
unsigned int max_forwards
Definition: config_global.c:86
static char default_useragent[256]
Definition: config_global.c:66
void ast_sip_get_default_realm(char *realm, size_t size)
Retrieve the global default realm.
#define LOG_ERROR
Definition: logger.h:285
static const char * overload_trigger_map[]
unsigned int ast_sip_get_mwi_disable_initial_unsolicited(void)
Retrieve the global setting &#39;disable sending unsolicited mwi on startup&#39;.
Type for default option handler for bools (ast_true/ast_false)
Channel datastore data for max forwards.
Definition: max_forwards.c:29
#define ast_sorcery_apply_default(sorcery, type, name, data)
Definition: sorcery.h:477
#define DEFAULT_FROM_USER
Definition: config_global.c:39
static int overload_trigger_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
const ast_string_field regcontext
Definition: config_global.c:84
char * ast_sip_get_default_voicemail_extension(void)
Retrieve the default voicemail extension.
void * ast_sorcery_alloc(const struct ast_sorcery *sorcery, const char *type, const char *id)
Allocate an object.
Definition: sorcery.c:1744
unsigned int use_callerid_contact
int ast_sip_destroy_sorcery_global(void)
#define DEFAULT_DISABLE_MULTI_DOMAIN
Definition: config_global.c:43
static const char name[]
Definition: cdr_mysql.c:74
#define ast_free(a)
Definition: astmm.h:182
char * ast_sip_get_regcontext(void)
Retrieve the global regcontext setting.
#define DEFAULT_USERAGENT_PREFIX
Definition: config_global.c:34
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
An API for managing task processing threads that can be shared across modules.
unsigned int ast_sip_get_disable_multi_domain(void)
Retrieve the system setting &#39;disable multi domain&#39;.
void ast_sip_get_default_from_user(char *from_user, size_t size)
Retrieve the global default from user.
void * ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const char *type, unsigned int flags, struct ast_variable *fields)
Retrieve an object or multiple objects using specific fields.
Definition: sorcery.c:1897
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
Definition: sorcery.h:955
unsigned int ast_sip_get_ignore_uri_user_options(void)
Retrieve the global setting &#39;ignore_uri_user_options&#39;.
#define DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED
Definition: config_global.c:50
void(* object_type_loaded)(const char *name, const struct ast_sorcery *sorcery, const char *object_type, int reloaded)
Callback after any object_type is loaded/reloaded.
Definition: sorcery.h:260
#define DEFAULT_IGNORE_URI_USER_OPTIONS
Definition: config_global.c:51
const char * ast_sip_overload_trigger_to_str(enum ast_sip_taskprocessor_overload_trigger trigger)
unsigned int ignore_uri_user_options
#define DEFAULT_DEBUG
Definition: config_global.c:36
static struct ast_sorcery * sorcery
#define DEFAULT_MAX_FORWARDS
Definition: config_global.c:32
unsigned int disable_initial_unsolicited
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
#define DEFAULT_UNIDENTIFIED_REQUEST_PERIOD
Definition: config_global.c:46
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
static struct global_config * get_global_cfg(void)
static int global_apply(const struct ast_sorcery *sorcery, void *obj)
unsigned int ast_sip_get_send_contact_status_on_update_registration(void)
Retrieve the global setting &#39;send_contact_status_on_update_registration&#39;.
int ast_sip_initialize_sorcery_global(void)
Type for default option handler for stringfields.
unsigned int unidentified_request_period
Definition: config_global.c:98
#define DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION
Definition: config_global.c:53
Generic container type.
unsigned int max_initial_qualify_time
Definition: config_global.c:90
const ast_string_field default_from_user
Definition: config_global.c:84
static char context[AST_MAX_CONTEXT]
Definition: chan_alsa.c:116
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
Definition: sorcery.c:1728
int ast_sip_persistent_endpoint_add_to_regcontext(const char *regcontext)
#define DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER
Definition: config_global.c:54
Type for default option handler for signed integers.
int ast_sip_cli_print_sorcery_objectset(void *obj, void *arg, int flags)
Prints a sorcery object&#39;s ast_variable list.
Definition: pjsip_cli.c:36
const ast_string_field default_outbound_endpoint
Definition: config_global.c:84
#define DEFAULT_OUTBOUND_ENDPOINT
Definition: config_global.c:35
ast_sip_taskprocessor_overload_trigger
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Definition: stringfields.h:368
unsigned int tps_queue_high
static void global_destructor(void *obj)
Sorcery Data Access Layer API.