diff options
author | Alexei Gradinari <alex2grad@gmail.com> | 2016-04-15 15:26:15 -0400 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2016-05-02 09:59:08 -0300 |
commit | 3cb8934de0db468d600beddd3464b44d33759cdc (patch) | |
tree | 69f5c5807ad778eaf004852019afeb89113a8722 /res/res_pjsip/location.c | |
parent | 69ced86c6c1847e5c4b683e35ccd407f3eff594a (diff) |
pjsip: Added "reg_server" to contacts.
If the Asterisk system name is set in asterisk.conf, it will be stored
into the "reg_server" field in the ps_contacts table to facilitate
multi-server setups.
ASTERISK-25931
Change-Id: Ia8f6bd2267809c78753b52bcf21835b9b59f4cb8
Diffstat (limited to 'res/res_pjsip/location.c')
-rw-r--r-- | res/res_pjsip/location.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c index 2a7dbb54f..db1d0794b 100644 --- a/res/res_pjsip/location.c +++ b/res/res_pjsip/location.c @@ -23,6 +23,7 @@ #include "asterisk/res_pjsip.h" #include "asterisk/logger.h" #include "asterisk/astobj2.h" +#include "asterisk/paths.h" #include "asterisk/sorcery.h" #include "include/res_pjsip_private.h" #include "asterisk/res_pjsip_cli.h" @@ -120,6 +121,8 @@ static void *contact_alloc(const char *name) return NULL; } + ast_string_field_init_extended(contact, reg_server); + /* Dynamic contacts are delimited with ";@" and static ones with "@@" */ if ((aor_separator = strstr(id, ";@")) || (aor_separator = strstr(id, "@@"))) { *aor_separator = '\0'; @@ -335,6 +338,10 @@ int ast_sip_location_add_contact_nolock(struct ast_sip_aor *aor, const char *uri ast_string_field_set(contact, user_agent, user_agent); } + if (!ast_strlen_zero(ast_config_AST_SYSTEM_NAME)) { + ast_string_field_set(contact, reg_server, ast_config_AST_SYSTEM_NAME); + } + contact->endpoint = ao2_bump(endpoint); return ast_sorcery_create(ast_sip_get_sorcery(), contact); @@ -1116,6 +1123,7 @@ int ast_sip_initialize_sorcery_location(void) ast_sorcery_object_field_register(sorcery, "contact", "qualify_timeout", "3.0", OPT_DOUBLE_T, 0, FLDSET(struct ast_sip_contact, qualify_timeout)); ast_sorcery_object_field_register(sorcery, "contact", "outbound_proxy", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, outbound_proxy)); ast_sorcery_object_field_register(sorcery, "contact", "user_agent", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, user_agent)); + ast_sorcery_object_field_register(sorcery, "contact", "reg_server", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_contact, reg_server)); ast_sorcery_object_field_register(sorcery, "aor", "type", "", OPT_NOOP_T, 0, 0); ast_sorcery_object_field_register(sorcery, "aor", "minimum_expiration", "60", OPT_UINT_T, 0, FLDSET(struct ast_sip_aor, minimum_expiration)); |