summaryrefslogtreecommitdiff
path: root/res/res_pjsip/config_global.c
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2015-03-17 18:22:20 +0000
committerKevin Harwell <kharwell@digium.com>2015-03-17 18:22:20 +0000
commitaef7278af6ef0832b7b1a330d29a929b6c07c12d (patch)
tree3d9c52964a35c6eaca3d58c3812dca29a04a136e /res/res_pjsip/config_global.c
parent259e833e88ec9d6cca6a017ac16a426a12165688 (diff)
res_pjsip: Allow configuration of endpoint identifier query order
This patch fixes previously reverted code that caused binary incompatibility problems with some modules. And like the original patch it makes sure that no matter what order the endpoint identifier modules were loaded, priority is given based on the ones specified in the new global 'endpoint_identifier_order' option. ASTERISK-24840 Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/4489/ ........ Merged revisions 433028 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip/config_global.c')
-rw-r--r--res/res_pjsip/config_global.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/res/res_pjsip/config_global.c b/res/res_pjsip/config_global.c
index 4cf26f2a4..682e3c0b1 100644
--- a/res/res_pjsip/config_global.c
+++ b/res/res_pjsip/config_global.c
@@ -31,6 +31,7 @@
#define DEFAULT_USERAGENT_PREFIX "Asterisk PBX"
#define DEFAULT_OUTBOUND_ENDPOINT "default_outbound_endpoint"
#define DEFAULT_DEBUG "no"
+#define DEFAULT_ENDPOINT_IDENTIFIER_ORDER "ip,username,anonymous"
static char default_useragent[256];
@@ -41,6 +42,8 @@ struct global_config {
AST_STRING_FIELD(default_outbound_endpoint);
/*! Debug logging yes|no|host */
AST_STRING_FIELD(debug);
+ /*! Order by which endpoint identifiers are checked (comma separated list) */
+ AST_STRING_FIELD(endpoint_identifier_order);
);
/* Value to put in Max-Forwards header */
unsigned int max_forwards;
@@ -127,6 +130,21 @@ char *ast_sip_get_debug(void)
return res;
}
+char *ast_sip_get_endpoint_identifier_order(void)
+{
+ char *res;
+ struct global_config *cfg;
+
+ cfg = get_global_cfg();
+ if (!cfg) {
+ return ast_strdup(DEFAULT_ENDPOINT_IDENTIFIER_ORDER);
+ }
+
+ res = ast_strdup(cfg->endpoint_identifier_order);
+ ao2_ref(cfg, -1);
+ return res;
+}
+
unsigned int ast_sip_get_keep_alive_interval(void)
{
unsigned int interval;
@@ -228,6 +246,9 @@ int ast_sip_initialize_sorcery_global(void)
OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, default_outbound_endpoint));
ast_sorcery_object_field_register(sorcery, "global", "debug", DEFAULT_DEBUG,
OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, debug));
+ ast_sorcery_object_field_register(sorcery, "global", "endpoint_identifier_order",
+ DEFAULT_ENDPOINT_IDENTIFIER_ORDER,
+ OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, endpoint_identifier_order));
ast_sorcery_object_field_register(sorcery, "global", "keep_alive_interval",
__stringify(DEFAULT_KEEPALIVE_INTERVAL),
OPT_UINT_T, 0, FLDSET(struct global_config, keep_alive_interval));