summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2016-05-03 14:05:45 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-05-03 14:05:45 -0500
commitc339d4c6edafcc007c7de345a5f97388f5de84de (patch)
tree214a826afdce77be20af4e6798f7e4646059e3c4 /res
parent96de8836760b66dd62cf3e21c479d4ffa6ef9c89 (diff)
parent2b1edee772ae3690d060bd067b489cbbb72b24f5 (diff)
Merge "pjsip: Added "reg_server" to contacts."
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip.c6
-rw-r--r--res/res_pjsip/location.c8
-rw-r--r--res/res_pjsip_registrar.c4
3 files changed, 18 insertions, 0 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 6890e637b..db3395fa7 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -1112,6 +1112,12 @@
REGISTER requests and is not intended to be configured manually.
</para></description>
</configOption>
+ <configOption name="reg_server">
+ <synopsis>Asterisk Server name</synopsis>
+ <description><para>
+ Asterisk Server name on which SIP endpoint registered.
+ </para></description>
+ </configOption>
</configObject>
<configObject name="aor">
<synopsis>The configuration for a location of an endpoint</synopsis>
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index db4f9ac09..2779fe396 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"
@@ -119,6 +120,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';
@@ -330,6 +333,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);
@@ -1111,6 +1118,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));
diff --git a/res/res_pjsip_registrar.c b/res/res_pjsip_registrar.c
index ae8440aab..65fd56c02 100644
--- a/res/res_pjsip_registrar.c
+++ b/res/res_pjsip_registrar.c
@@ -30,6 +30,7 @@
#include "asterisk/res_pjsip.h"
#include "asterisk/module.h"
+#include "asterisk/paths.h"
#include "asterisk/test.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/manager.h"
@@ -555,6 +556,9 @@ static int rx_task_core(struct rx_task_data *task_data, struct ao2_container *co
if (user_agent) {
ast_string_field_set(contact_update, user_agent, user_agent);
}
+ if (!ast_strlen_zero(ast_config_AST_SYSTEM_NAME)) {
+ ast_string_field_set(contact_update, reg_server, ast_config_AST_SYSTEM_NAME);
+ }
if (ast_sip_location_update_contact(contact_update)) {
ast_log(LOG_ERROR, "Failed to update contact '%s' expiration time to %d seconds.\n",