Asterisk - The Open Source Telephony Project  GIT-master-a24979a
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 <mmichelson@digium.com>
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_ALLOW_SENDING_180_AFTER_183 0
52 #define DEFAULT_IGNORE_URI_USER_OPTIONS 0
53 #define DEFAULT_USE_CALLERID_CONTACT 0
54 #define DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION 0
55 #define DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER TASKPROCESSOR_OVERLOAD_TRIGGER_GLOBAL
56 #define DEFAULT_NOREFERSUB 1
57 
58 /*!
59  * \brief Cached global config object
60  *
61  * \details
62  * Cached so we don't have to keep asking sorcery for the config.
63  * We could ask for it hundreds of times a second if not more.
64  */
65 static AO2_GLOBAL_OBJ_STATIC(global_cfg);
66 
67 static char default_useragent[256];
68 
69 struct global_config {
70  SORCERY_OBJECT(details);
75  /*! Debug logging yes|no|host */
77  /*! Order by which endpoint identifiers are checked (comma separated list) */
79  /*! User name to place in From header if there is no better option */
81  /*! Default voicemail extension */
83  /*! Realm to use in challenges before an endpoint is identified */
85  );
86  /*! Value to put in Max-Forwards header */
87  unsigned int max_forwards;
88  /*! The interval at which to send keep alive messages to active connection-oriented transports */
89  unsigned int keep_alive_interval;
90  /*! The maximum time for all contacts to be qualified at startup */
92  /*! The interval at which to check for expired contacts */
94  /*! Nonzero to disable multi domain support */
95  unsigned int disable_multi_domain;
96  /*! Nonzero to disable changing 180/SDP to 183/SDP */
98  /*! The maximum number of unidentified requests per source IP address before a security event is logged */
100  /*! The period during which unidentified requests are accumulated */
102  /*! Interval at which expired unidentified requests will be pruned */
104  struct {
105  /*! Taskprocessor high water alert trigger level */
106  unsigned int tps_queue_high;
107  /*! Taskprocessor low water clear alert level. */
109  /*! Nonzero to disable sending unsolicited mwi to all endpoints on startup */
111  } mwi;
112  /*! Nonzero if URI user field options are ignored. */
114  /*! Nonzero if CALLERID(num) is to be used as the default contact username instead of default_from_user */
115  unsigned int use_callerid_contact;
116  /*! Nonzero if need to send AMI ContactStatus event when a contact is updated */
118  /*! Trigger the distributor should use to pause accepting new dialogs */
120  /*! Nonzero if norefersub is to be sent in Supported header */
121  unsigned int norefersub;
122 };
123 
124 static void global_destructor(void *obj)
125 {
126  struct global_config *cfg = obj;
127 
129 }
130 
131 static void *global_alloc(const char *name)
132 {
133  struct global_config *cfg;
134 
135  cfg = ast_sorcery_generic_alloc(sizeof(*cfg), global_destructor);
136  if (!cfg || ast_string_field_init(cfg, 100)) {
137  ao2_cleanup(cfg);
138  return NULL;
139  }
140 
141  return cfg;
142 }
143 
144 /*
145  * There is ever only one global section, so we can use a single global
146  * value here to track the regcontext through reloads.
147  */
148 static char *previous_regcontext = NULL;
149 
150 static int check_regcontext(const struct global_config *cfg)
151 {
152  char *current = NULL;
153 
154  if (previous_regcontext && !strcmp(previous_regcontext, cfg->regcontext)) {
155  /* Nothing changed so nothing to do */
156  return 0;
157  }
158 
159  if (!ast_strlen_zero(cfg->regcontext)) {
160  current = ast_strdup(cfg->regcontext);
161  if (!current) {
162  return -1;
163  }
164 
166  ast_free(current);
167  return -1;
168  }
169  }
170 
175  }
176 
177  if (current) {
179  }
180 
181  return 0;
182 }
183 
184 static int global_apply(const struct ast_sorcery *sorcery, void *obj)
185 {
186  struct global_config *cfg = obj;
187  char max_forwards[10];
188 
189  if (ast_strlen_zero(cfg->debug)) {
191  "Global option 'debug' can't be empty. Set it to a valid value or remove the entry to accept 'no' as the default\n");
192  return -1;
193  }
194 
197  "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");
198  return -1;
199  }
200 
201  snprintf(max_forwards, sizeof(max_forwards), "%u", cfg->max_forwards);
202 
204  ast_sip_add_global_request_header("User-Agent", cfg->useragent, 1);
206 
207  if (check_regcontext(cfg)) {
208  return -1;
209  }
210 
211  ao2_t_global_obj_replace_unref(global_cfg, cfg, "Applying global settings");
212  return 0;
213 }
214 
215 static struct global_config *get_global_cfg(void)
216 {
217  return ao2_global_obj_ref(global_cfg);
218 }
219 
221 {
222  char *str;
223  struct global_config *cfg;
224 
225  cfg = get_global_cfg();
226  if (!cfg) {
228  }
229 
231  ao2_ref(cfg, -1);
232  return str;
233 }
234 
235 char *ast_sip_get_debug(void)
236 {
237  char *res;
238  struct global_config *cfg;
239 
240  cfg = get_global_cfg();
241  if (!cfg) {
242  return ast_strdup(DEFAULT_DEBUG);
243  }
244 
245  res = ast_strdup(cfg->debug);
246  ao2_ref(cfg, -1);
247  return res;
248 }
249 
251 {
252  char *res;
253  struct global_config *cfg;
254 
255  cfg = get_global_cfg();
256  if (!cfg) {
258  }
259 
260  res = ast_strdup(cfg->regcontext);
261  ao2_ref(cfg, -1);
262 
263  return res;
264 }
265 
267 {
268  char *res;
269  struct global_config *cfg;
270 
271  cfg = get_global_cfg();
272  if (!cfg) {
274  }
275 
277  ao2_ref(cfg, -1);
278 
279  return res;
280 }
281 
283 {
284  char *res;
285  struct global_config *cfg;
286 
287  cfg = get_global_cfg();
288  if (!cfg) {
290  }
291 
293  ao2_ref(cfg, -1);
294  return res;
295 }
296 
298 {
299  unsigned int interval;
300  struct global_config *cfg;
301 
302  cfg = get_global_cfg();
303  if (!cfg) {
305  }
306 
307  interval = cfg->keep_alive_interval;
308  ao2_ref(cfg, -1);
309  return interval;
310 }
311 
313 {
314  unsigned int interval;
315  struct global_config *cfg;
316 
317  cfg = get_global_cfg();
318  if (!cfg) {
320  }
321 
322  interval = cfg->contact_expiration_check_interval;
323  ao2_ref(cfg, -1);
324  return interval;
325 }
326 
328 {
329  unsigned int disable_multi_domain;
330  struct global_config *cfg;
331 
332  cfg = get_global_cfg();
333  if (!cfg) {
335  }
336 
338  ao2_ref(cfg, -1);
339  return disable_multi_domain;
340 }
341 
343 {
344  unsigned int time;
345  struct global_config *cfg;
346 
347  cfg = get_global_cfg();
348  if (!cfg) {
350  }
351 
352  time = cfg->max_initial_qualify_time;
353  ao2_ref(cfg, -1);
354  return time;
355 }
356 
357 void ast_sip_get_unidentified_request_thresholds(unsigned int *count, unsigned int *period,
358  unsigned int *prune_interval)
359 {
360  struct global_config *cfg;
361 
362  cfg = get_global_cfg();
363  if (!cfg) {
367  return;
368  }
369 
370  *count = cfg->unidentified_request_count;
371  *period = cfg->unidentified_request_period;
372  *prune_interval = cfg->unidentified_request_prune_interval;
373 
374  ao2_ref(cfg, -1);
375  return;
376 }
377 
378 void ast_sip_get_default_realm(char *realm, size_t size)
379 {
380  struct global_config *cfg;
381 
382  cfg = get_global_cfg();
383  if (!cfg) {
384  ast_copy_string(realm, DEFAULT_REALM, size);
385  } else {
386  ast_copy_string(realm, cfg->default_realm, size);
387  ao2_ref(cfg, -1);
388  }
389 }
390 
391 void ast_sip_get_default_from_user(char *from_user, size_t size)
392 {
393  struct global_config *cfg;
394 
395  cfg = get_global_cfg();
396  if (!cfg) {
397  ast_copy_string(from_user, DEFAULT_FROM_USER, size);
398  } else {
399  ast_copy_string(from_user, cfg->default_from_user, size);
400  ao2_ref(cfg, -1);
401  }
402 }
403 
404 
406 {
407  unsigned int tps_queue_high;
408  struct global_config *cfg;
409 
410  cfg = get_global_cfg();
411  if (!cfg) {
413  }
414 
416  ao2_ref(cfg, -1);
417  return tps_queue_high;
418 }
419 
421 {
422  int tps_queue_low;
423  struct global_config *cfg;
424 
425  cfg = get_global_cfg();
426  if (!cfg) {
428  }
429 
431  ao2_ref(cfg, -1);
432  return tps_queue_low;
433 }
434 
436 {
437  unsigned int disable_initial_unsolicited;
438  struct global_config *cfg;
439 
440  cfg = get_global_cfg();
441  if (!cfg) {
443  }
444 
446  ao2_ref(cfg, -1);
448 }
449 
451 {
452  unsigned int allow_sending_180_after_183;
453  struct global_config *cfg;
454 
455  cfg = get_global_cfg();
456  if (!cfg) {
458  }
459 
461  ao2_ref(cfg, -1);
463 }
464 
466 {
467  unsigned int ignore_uri_user_options;
468  struct global_config *cfg;
469 
470  cfg = get_global_cfg();
471  if (!cfg) {
473  }
474 
476  ao2_ref(cfg, -1);
478 }
479 
481 {
482  unsigned int use_callerid_contact;
483  struct global_config *cfg;
484 
485  cfg = get_global_cfg();
486  if (!cfg) {
488  }
489 
491  ao2_ref(cfg, -1);
492  return use_callerid_contact;
493 }
494 
496 {
498  struct global_config *cfg;
499 
500  cfg = get_global_cfg();
501  if (!cfg) {
503  }
504 
506  ao2_ref(cfg, -1);
508 }
509 
511 {
513  struct global_config *cfg;
514 
515  cfg = get_global_cfg();
516  if (!cfg) {
518  }
519 
520  trigger = cfg->overload_trigger;
521  ao2_ref(cfg, -1);
522  return trigger;
523 }
524 
525 unsigned int ast_sip_get_norefersub(void)
526 {
527  unsigned int norefersub;
528  struct global_config *cfg;
529 
530  cfg = get_global_cfg();
531  if (!cfg) {
532  return DEFAULT_NOREFERSUB;
533  }
534 
535  norefersub = cfg->norefersub;
536  ao2_ref(cfg, -1);
537  return norefersub;
538 }
539 
540 static int overload_trigger_handler(const struct aco_option *opt,
541  struct ast_variable *var, void *obj)
542 {
543  struct global_config *cfg = obj;
544  if (!strcasecmp(var->value, "none")) {
546  } else if (!strcasecmp(var->value, "global")) {
548  } else if (!strcasecmp(var->value, "pjsip_only")) {
550  } else {
551  ast_log(LOG_WARNING, "Unknown overload trigger '%s' specified for %s\n",
552  var->value, var->name);
553  return -1;
554  }
555  return 0;
556 }
557 
558 static const char *overload_trigger_map[] = {
562 };
563 
565 {
566  return ARRAY_IN_BOUNDS(trigger, overload_trigger_map) ?
567  overload_trigger_map[trigger] : "";
568 }
569 
570 static int overload_trigger_to_str(const void *obj, const intptr_t *args, char **buf)
571 {
572  const struct global_config *cfg = obj;
574  return 0;
575 }
576 
577 /*!
578  * \internal
579  * \brief Observer to set default global object if none exist.
580  *
581  * \param name Module name owning the sorcery instance.
582  * \param sorcery Instance being observed.
583  * \param object_type Name of object being observed.
584  * \param reloaded Non-zero if the object is being reloaded.
585  */
586 static void global_loaded_observer(const char *name, const struct ast_sorcery *sorcery, const char *object_type, int reloaded)
587 {
588  struct ao2_container *globals;
589  struct global_config *cfg;
590 
591  if (strcmp(object_type, "global")) {
592  /* Not interested */
593  return;
594  }
595 
598  if (globals) {
599  int count;
600 
601  count = ao2_container_count(globals);
602  ao2_ref(globals, -1);
603 
604  if (1 < count) {
606  "At most one pjsip.conf type=global object can be defined. You have %d defined.\n",
607  count);
608  return;
609  }
610  if (count) {
611  return;
612  }
613  }
614 
615  ast_debug(1, "No pjsip.conf type=global object exists so applying defaults.\n");
616  cfg = ast_sorcery_alloc(sorcery, "global", NULL);
617  if (!cfg) {
618  return;
619  }
620  global_apply(sorcery, cfg);
621  ao2_ref(cfg, -1);
622 }
623 
626 };
627 
629 {
630  struct global_config *cfg = get_global_cfg();
631 
632  if (!cfg) {
633  cfg = ast_sorcery_alloc(ast_sip_get_sorcery(), "global", NULL);
634  if (!cfg) {
635  return -1;
636  }
637  }
638 
639  ast_str_append(&context->output_buffer, 0, "\nGlobal Settings:\n\n");
641 
642  ao2_ref(cfg, -1);
643  return 0;
644 }
645 
647 {
649 
651 
652  if (previous_regcontext) {
655  }
656 
657  ao2_t_global_obj_release(global_cfg, "Module is unloading");
658 
659  return 0;
660 }
661 
662 
664 {
666 
667  snprintf(default_useragent, sizeof(default_useragent), "%s %s",
669 
670  ast_sorcery_apply_default(sorcery, "global", "config", "pjsip.conf,criteria=type=global,single_object=yes,explicit_name=global");
671 
673  return -1;
674  }
675 
676  ast_sorcery_object_field_register(sorcery, "global", "type", "", OPT_NOOP_T, 0, 0);
677  ast_sorcery_object_field_register(sorcery, "global", "max_forwards",
681  OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, useragent));
682  ast_sorcery_object_field_register(sorcery, "global", "default_outbound_endpoint",
684  OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, default_outbound_endpoint));
687  ast_sorcery_object_field_register(sorcery, "global", "endpoint_identifier_order",
689  OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, endpoint_identifier_order));
690  ast_sorcery_object_field_register(sorcery, "global", "keep_alive_interval",
692  OPT_UINT_T, 0, FLDSET(struct global_config, keep_alive_interval));
693  ast_sorcery_object_field_register(sorcery, "global", "max_initial_qualify_time",
695  OPT_UINT_T, 0, FLDSET(struct global_config, max_initial_qualify_time));
696  ast_sorcery_object_field_register(sorcery, "global", "default_from_user", DEFAULT_FROM_USER,
697  OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, default_from_user));
698  ast_sorcery_object_field_register(sorcery, "global", "default_voicemail_extension",
703  ast_sorcery_object_field_register(sorcery, "global", "contact_expiration_check_interval",
705  OPT_UINT_T, 0, FLDSET(struct global_config, contact_expiration_check_interval));
706  ast_sorcery_object_field_register(sorcery, "global", "disable_multi_domain",
707  DEFAULT_DISABLE_MULTI_DOMAIN ? "yes" : "no",
708  OPT_BOOL_T, 1, FLDSET(struct global_config, disable_multi_domain));
709  ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_count",
711  OPT_UINT_T, 0, FLDSET(struct global_config, unidentified_request_count));
712  ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_period",
714  OPT_UINT_T, 0, FLDSET(struct global_config, unidentified_request_period));
715  ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_prune_interval",
717  OPT_UINT_T, 0, FLDSET(struct global_config, unidentified_request_prune_interval));
718  ast_sorcery_object_field_register(sorcery, "global", "default_realm", DEFAULT_REALM,
720  ast_sorcery_object_field_register(sorcery, "global", "mwi_tps_queue_high",
722  OPT_UINT_T, 0, FLDSET(struct global_config, mwi.tps_queue_high));
723  ast_sorcery_object_field_register(sorcery, "global", "mwi_tps_queue_low",
725  OPT_INT_T, 0, FLDSET(struct global_config, mwi.tps_queue_low));
726  ast_sorcery_object_field_register(sorcery, "global", "mwi_disable_initial_unsolicited",
729  ast_sorcery_object_field_register(sorcery, "global", "allow_sending_180_after_183",
731  OPT_BOOL_T, 1, FLDSET(struct global_config, allow_sending_180_after_183));
732  ast_sorcery_object_field_register(sorcery, "global", "ignore_uri_user_options",
733  DEFAULT_IGNORE_URI_USER_OPTIONS ? "yes" : "no",
734  OPT_BOOL_T, 1, FLDSET(struct global_config, ignore_uri_user_options));
735  ast_sorcery_object_field_register(sorcery, "global", "use_callerid_contact",
736  DEFAULT_USE_CALLERID_CONTACT ? "yes" : "no",
737  OPT_YESNO_T, 1, FLDSET(struct global_config, use_callerid_contact));
738  ast_sorcery_object_field_register(sorcery, "global", "send_contact_status_on_update_registration",
740  OPT_YESNO_T, 1, FLDSET(struct global_config, send_contact_status_on_update_registration));
741  ast_sorcery_object_field_register_custom(sorcery, "global", "taskprocessor_overload_trigger",
744  ast_sorcery_object_field_register(sorcery, "global", "norefersub",
745  DEFAULT_NOREFERSUB ? "yes" : "no",
746  OPT_YESNO_T, 1, FLDSET(struct global_config, norefersub));
747 
749  return -1;
750  }
751 
752  return 0;
753 }
const char * str
Definition: app_jack.c:147
#define var
Definition: ast_expr2f.c:614
Asterisk version information.
const char * ast_get_version(void)
Retrieve the Asterisk version string.
Asterisk main include file. File version handling, generic pbx functions.
#define __stringify(x)
Definition: asterisk.h:216
#define ast_free(a)
Definition: astmm.h:180
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:241
#define ast_log
Definition: astobj2.c:42
#define ao2_t_global_obj_replace_unref(holder, obj, tag)
Definition: astobj2.h:904
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
#define ao2_global_obj_ref(holder)
Get a reference to the object stored in the global holder.
Definition: astobj2.h:918
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
#define ao2_t_global_obj_release(holder, tag)
Definition: astobj2.h:861
static char context[AST_MAX_CONTEXT]
Definition: chan_alsa.c:120
static struct console_pvt globals
static char regcontext[AST_MAX_CONTEXT]
Definition: chan_iax2.c:318
unsigned int ast_sip_get_norefersub(void)
Retrieve the global setting 'norefersub'.
unsigned int ast_sip_get_max_initial_qualify_time(void)
Retrieve the system max initial qualify time.
unsigned int ast_sip_get_keep_alive_interval(void)
Retrieve the system keep alive interval setting.
#define DEFAULT_FROM_USER
Definition: config_global.c:39
char * ast_sip_get_default_voicemail_extension(void)
Retrieve the default voicemail extension.
static void global_loaded_observer(const char *name, const struct ast_sorcery *sorcery, const char *object_type, int reloaded)
unsigned int ast_sip_get_allow_sending_180_after_183(void)
Retrieve the global setting 'allow_sending_180_after_183'.
static void global_destructor(void *obj)
char * ast_sip_get_endpoint_identifier_order(void)
Retrieve the global endpoint_identifier_order setting.
static int overload_trigger_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
#define DEFAULT_NOREFERSUB
Definition: config_global.c:56
static AO2_GLOBAL_OBJ_STATIC(global_cfg)
Cached global config object.
static char default_useragent[256]
Definition: config_global.c:67
int ast_sip_destroy_sorcery_global(void)
#define DEFAULT_UNIDENTIFIED_REQUEST_COUNT
Definition: config_global.c:45
#define DEFAULT_USERAGENT_PREFIX
Definition: config_global.c:34
#define DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL
Definition: config_global.c:42
static const char * overload_trigger_map[]
static int check_regcontext(const struct global_config *cfg)
int ast_sip_initialize_sorcery_global(void)
enum ast_sip_taskprocessor_overload_trigger ast_sip_get_taskprocessor_overload_trigger(void)
#define DEFAULT_SEND_CONTACT_STATUS_ON_UPDATE_REGISTRATION
Definition: config_global.c:54
#define DEFAULT_MAX_FORWARDS
Definition: config_global.c:32
#define DEFAULT_MAX_INITIAL_QUALIFY_TIME
Definition: config_global.c:38
#define DEFAULT_VOICEMAIL_EXTENSION
Definition: config_global.c:44
#define DEFAULT_DEBUG
Definition: config_global.c:36
static const struct ast_sorcery_instance_observer observer_callbacks_global
unsigned int ast_sip_get_send_contact_status_on_update_registration(void)
Retrieve the global setting 'send_contact_status_on_update_registration'.
char * ast_sip_get_regcontext(void)
Retrieve the global regcontext setting.
const char * ast_sip_overload_trigger_to_str(enum ast_sip_taskprocessor_overload_trigger trigger)
static char * previous_regcontext
static void * global_alloc(const char *name)
#define DEFAULT_DISABLE_MULTI_DOMAIN
Definition: config_global.c:43
unsigned int ast_sip_get_use_callerid_contact(void)
Retrieve the global setting 'use_callerid_contact'.
unsigned int ast_sip_get_contact_expiration_check_interval(void)
Retrieve the system contact expiration check interval setting.
#define DEFAULT_MWI_DISABLE_INITIAL_UNSOLICITED
Definition: config_global.c:50
static struct global_config * get_global_cfg(void)
#define DEFAULT_UNIDENTIFIED_REQUEST_PRUNE_INTERVAL
Definition: config_global.c:47
#define DEFAULT_REALM
Definition: config_global.c:40
void ast_sip_get_default_realm(char *realm, size_t size)
Retrieve the global default realm.
unsigned int ast_sip_get_disable_multi_domain(void)
Retrieve the system setting 'disable multi domain'.
static int overload_trigger_to_str(const void *obj, const intptr_t *args, char **buf)
unsigned int ast_sip_get_ignore_uri_user_options(void)
Retrieve the global setting 'ignore_uri_user_options'.
#define DEFAULT_ALLOW_SENDING_180_AFTER_183
Definition: config_global.c:51
#define DEFAULT_TASKPROCESSOR_OVERLOAD_TRIGGER
Definition: config_global.c:55
#define DEFAULT_ENDPOINT_IDENTIFIER_ORDER
Definition: config_global.c:37
#define DEFAULT_REGCONTEXT
Definition: config_global.c:41
unsigned int ast_sip_get_mwi_disable_initial_unsolicited(void)
Retrieve the global setting 'disable sending unsolicited mwi on startup'.
int ast_sip_get_mwi_tps_queue_low(void)
Retrieve the global MWI taskprocessor low water clear alert level.
#define DEFAULT_USE_CALLERID_CONTACT
Definition: config_global.c:53
#define DEFAULT_OUTBOUND_ENDPOINT
Definition: config_global.c:35
#define DEFAULT_IGNORE_URI_USER_OPTIONS
Definition: config_global.c:52
char * ast_sip_get_debug(void)
Retrieve the system debug setting (yes|no|host).
char * ast_sip_global_default_outbound_endpoint(void)
#define DEFAULT_MWI_TPS_QUEUE_HIGH
Definition: config_global.c:48
#define DEFAULT_UNIDENTIFIED_REQUEST_PERIOD
Definition: config_global.c:46
void ast_sip_get_default_from_user(char *from_user, size_t size)
Retrieve the global default from user.
unsigned int ast_sip_get_mwi_tps_queue_high(void)
Retrieve the global MWI taskprocessor high water alert trigger level.
#define DEFAULT_KEEPALIVE_INTERVAL
Definition: config_global.c:33
static int global_apply(const struct ast_sorcery *sorcery, void *obj)
int sip_cli_print_global(struct ast_sip_cli_context *context)
void ast_sip_get_unidentified_request_thresholds(unsigned int *count, unsigned int *period, unsigned int *prune_interval)
Retrieve the unidentified request security event thresholds.
#define DEFAULT_MWI_TPS_QUEUE_LOW
Definition: config_global.c:49
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
@ OPT_UINT_T
Type for default option handler for unsigned integers.
@ OPT_NOOP_T
Type for a default handler that should do nothing.
@ OPT_BOOL_T
Type for default option handler for bools (ast_true/ast_false)
@ OPT_YESNO_T
Type for default option handler for bools (ast_true/ast_false)
@ OPT_INT_T
Type for default option handler for signed integers.
@ OPT_STRINGFIELD_T
Type for default option handler for stringfields.
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
static const char name[]
Definition: format_mp3.c:68
#define ast_debug(level,...)
Log a DEBUG message.
#define LOG_ERROR
#define LOG_WARNING
size_t current
Definition: main/cli.c:113
Core PBX routines and definitions.
int ast_context_destroy_by_name(const char *context, const char *registrar)
Destroy a context by name.
struct ast_sorcery * ast_sip_get_sorcery(void)
Get a pointer to the SIP sorcery structure.
int ast_sip_add_global_request_header(const char *name, const char *value, int replace)
int ast_sip_add_global_response_header(const char *name, const char *value, int replace)
static char default_realm[MAX_REALM_LENGTH+1]
int ast_sip_cli_print_sorcery_objectset(void *obj, void *arg, int flags)
Prints a sorcery object's ast_variable list.
Definition: pjsip_cli.c:36
static char * default_voicemail_extension
Definition: res_pjsip_mwi.c:49
static struct ast_sorcery * sorcery
ast_sip_taskprocessor_overload_trigger
@ TASKPROCESSOR_OVERLOAD_TRIGGER_GLOBAL
@ TASKPROCESSOR_OVERLOAD_TRIGGER_PJSIP_ONLY
@ TASKPROCESSOR_OVERLOAD_TRIGGER_NONE
int ast_sip_persistent_endpoint_add_to_regcontext(const char *regcontext)
static int debug
Global debug status.
Definition: res_xmpp.c:441
#define NULL
Definition: resample.c:96
Sorcery Data Access Layer API.
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
@ AST_RETRIEVE_FLAG_MULTIPLE
Return all matching objects.
Definition: sorcery.h:120
@ AST_RETRIEVE_FLAG_ALL
Perform no matching, return all objects.
Definition: sorcery.h:123
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
Definition: sorcery.c:1728
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
Definition: sorcery.h:837
#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 ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
Definition: sorcery.h:955
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
void * ast_sorcery_alloc(const struct ast_sorcery *sorcery, const char *type, const char *id)
Allocate an object.
Definition: sorcery.c:1744
#define ast_sorcery_apply_default(sorcery, type, name, data)
Definition: sorcery.h:476
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 AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
Definition: stringfields.h:341
#define AST_STRING_FIELD(name)
Declare a string field.
Definition: stringfields.h:303
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
Definition: stringfields.h:359
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Definition: stringfields.h:374
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:1117
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:406
Generic container type.
CLI Formatter Context passed to all formatters.
Definition: res_pjsip_cli.h:34
Interface for the sorcery instance observer.
Definition: sorcery.h:237
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
Full structure for sorcery.
Definition: sorcery.c:230
Structure for variables, used for configurations and for channel variables.
const ast_string_field default_outbound_endpoint
Definition: config_global.c:85
unsigned int tps_queue_high
unsigned int send_contact_status_on_update_registration
unsigned int max_initial_qualify_time
Definition: config_global.c:91
SORCERY_OBJECT(details)
unsigned int keep_alive_interval
Definition: config_global.c:89
enum ast_sip_taskprocessor_overload_trigger overload_trigger
const ast_string_field regcontext
Definition: config_global.c:85
unsigned int unidentified_request_prune_interval
const ast_string_field useragent
Definition: config_global.c:85
const ast_string_field default_from_user
Definition: config_global.c:85
unsigned int use_callerid_contact
unsigned int max_forwards
Definition: config_global.c:87
unsigned int norefersub
unsigned int disable_multi_domain
Definition: config_global.c:95
unsigned int disable_initial_unsolicited
const ast_string_field default_voicemail_extension
Definition: config_global.c:85
unsigned int ignore_uri_user_options
struct global_config::@479 mwi
unsigned int contact_expiration_check_interval
Definition: config_global.c:93
unsigned int allow_sending_180_after_183
Definition: config_global.c:97
unsigned int unidentified_request_count
Definition: config_global.c:99
const ast_string_field endpoint_identifier_order
Definition: config_global.c:85
const ast_string_field default_realm
Definition: config_global.c:85
const ast_string_field debug
Definition: config_global.c:85
unsigned int unidentified_request_period
Channel datastore data for max forwards.
Definition: max_forwards.c:29
An API for managing task processing threads that can be shared across modules.
const char * args
#define ARRAY_IN_BOUNDS(v, a)
Checks to see if value is within the bounds of the given array.
Definition: utils.h:682