summaryrefslogtreecommitdiff
path: root/res/res_pjsip
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2015-03-09 16:13:40 +0000
committerKevin Harwell <kharwell@digium.com>2015-03-09 16:13:40 +0000
commit1ce529d30e900054b9d2417380945d451012313f (patch)
treed22e4bf5bd4562cb21237677e86ee2b8744b307c /res/res_pjsip
parenta5f80f17813241cdfe32947722f9845bc32bcd87 (diff)
res_pjsip: allow configuration of endpoint identifier query order
It's possible to have a scenario that will create a conflict between endpoint identifiers. For instance an incoming call could be identified by two different endpoint identifiers and the one chosen depended upon which identifier module loaded first. This of course causes problems when, for example, the incoming call is expected to be identified by username, but instead is identified by ip. This patch adds a new 'global' option to res_pjsip called 'endpoint_identifier_order'. It is a comma separated list of endpoint identifier names that specifies the order by which identifiers are processed and checked. ASTERISK-24840 #close Reported by: Mark Michelson Review: https://reviewboard.asterisk.org/r/4455/ ........ Merged revisions 432638 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip')
-rw-r--r--res/res_pjsip/config_global.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/res/res_pjsip/config_global.c b/res/res_pjsip/config_global.c
index 1779c535d..21800850e 100644
--- a/res/res_pjsip/config_global.c
+++ b/res/res_pjsip/config_global.c
@@ -39,6 +39,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;
@@ -57,7 +59,7 @@ static void *global_alloc(const char *name)
{
struct global_config *cfg = ast_sorcery_generic_alloc(sizeof(*cfg), global_destructor);
- if (!cfg || ast_string_field_init(cfg, 80)) {
+ if (!cfg || ast_string_field_init(cfg, 100)) {
return NULL;
}
@@ -116,6 +118,21 @@ char *ast_sip_get_debug(void)
return res;
}
+char *ast_sip_get_endpoint_identifier_order(void)
+{
+ char *res;
+ struct global_config *cfg = get_global_cfg();
+
+ if (!cfg) {
+ return ast_strdup("ip,username,anonymous");
+ }
+
+ 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;
@@ -152,6 +169,8 @@ 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", "no",
OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, debug));
+ ast_sorcery_object_field_register(sorcery, "global", "endpoint_identifier_order", "ip,username,anonymous",
+ OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, endpoint_identifier_order));
ast_sorcery_object_field_register(sorcery, "global", "keep_alive_interval", "",
OPT_UINT_T, 0, FLDSET(struct global_config, keep_alive_interval));