summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
Diffstat (limited to 'res')
-rw-r--r--res/ari/resource_channels.c2
-rw-r--r--res/res.xml6
-rw-r--r--res/res_pjsip/config_global.c17
-rw-r--r--res/res_pjsip/location.c36
-rw-r--r--res/res_pjsip/pjsip_configuration.c4
-rw-r--r--res/res_pjsip_registrar.c28
6 files changed, 52 insertions, 41 deletions
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 35b757267..8d3292129 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -886,6 +886,8 @@ void ast_ari_channels_hangup(struct ast_variable *headers,
cause = AST_CAUSE_CONGESTION;
} else if (!strcmp(args->reason, "no_answer")) {
cause = AST_CAUSE_NOANSWER;
+ } else if(!strcmp(args->reason, "answered_elsewhere")) {
+ cause = AST_CAUSE_ANSWERED_ELSEWHERE;
} else {
ast_ari_response_error(
response, 400, "Invalid Reason",
diff --git a/res/res.xml b/res/res.xml
new file mode 100644
index 000000000..e9cb5f962
--- /dev/null
+++ b/res/res.xml
@@ -0,0 +1,6 @@
+<member name="res_digium_phone" displayname="Download the Digium Phone Module for Asterisk. See http://downloads.digium.com/pub/telephony/res_digium_phone/README.">
+ <support_level>external</support_level>
+ <depend>xmlstarlet</depend>
+ <depend>bash</depend>
+ <defaultenabled>no</defaultenabled>
+</member>
diff --git a/res/res_pjsip/config_global.c b/res/res_pjsip/config_global.c
index 1d0c11c35..281630ae4 100644
--- a/res/res_pjsip/config_global.c
+++ b/res/res_pjsip/config_global.c
@@ -76,21 +76,21 @@ struct global_config {
/*! Realm to use in challenges before an endpoint is identified */
AST_STRING_FIELD(default_realm);
);
- /* Value to put in Max-Forwards header */
+ /*! Value to put in Max-Forwards header */
unsigned int max_forwards;
- /* The interval at which to send keep alive messages to active connection-oriented transports */
+ /*! The interval at which to send keep alive messages to active connection-oriented transports */
unsigned int keep_alive_interval;
- /* The maximum time for all contacts to be qualified at startup */
+ /*! The maximum time for all contacts to be qualified at startup */
unsigned int max_initial_qualify_time;
- /* The interval at which to check for expired contacts */
+ /*! The interval at which to check for expired contacts */
unsigned int contact_expiration_check_interval;
/*! Nonzero to disable multi domain support */
unsigned int disable_multi_domain;
- /* The maximum number of unidentified requests per source IP address before a security event is logged */
+ /*! The maximum number of unidentified requests per source IP address before a security event is logged */
unsigned int unidentified_request_count;
- /* The period during which unidentified requests are accumulated */
+ /*! The period during which unidentified requests are accumulated */
unsigned int unidentified_request_period;
- /* Interval at which expired unidentifed requests will be pruned */
+ /*! Interval at which expired unidentifed requests will be pruned */
unsigned int unidentified_request_prune_interval;
struct {
/*! Taskprocessor high water alert trigger level */
@@ -510,7 +510,8 @@ int ast_sip_initialize_sorcery_global(void)
ast_sorcery_object_field_register(sorcery, "global", "contact_expiration_check_interval",
__stringify(DEFAULT_CONTACT_EXPIRATION_CHECK_INTERVAL),
OPT_UINT_T, 0, FLDSET(struct global_config, contact_expiration_check_interval));
- ast_sorcery_object_field_register(sorcery, "global", "disable_multi_domain", "no",
+ ast_sorcery_object_field_register(sorcery, "global", "disable_multi_domain",
+ DEFAULT_DISABLE_MULTI_DOMAIN ? "yes" : "no",
OPT_BOOL_T, 1, FLDSET(struct global_config, disable_multi_domain));
ast_sorcery_object_field_register(sorcery, "global", "unidentified_request_count",
__stringify(DEFAULT_UNIDENTIFIED_REQUEST_COUNT),
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 0ab69ec5b..5abfcabad 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -49,11 +49,22 @@ static void aor_destroy(void *obj)
/*! \brief Allocator for AOR */
static void *aor_alloc(const char *name)
{
- struct ast_sip_aor *aor = ast_sorcery_generic_alloc(sizeof(struct ast_sip_aor), aor_destroy);
+ void *lock;
+ struct ast_sip_aor *aor;
+
+ lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_MUTEX, "aor", name);
+ if (!lock) {
+ return NULL;
+ }
+
+ aor = ast_sorcery_lockable_alloc(sizeof(struct ast_sip_aor), aor_destroy, lock);
+ ao2_ref(lock, -1);
+
if (!aor) {
return NULL;
}
ast_string_field_init(aor, 128);
+
return aor;
}
@@ -206,17 +217,11 @@ struct ao2_container *ast_sip_location_retrieve_aor_contacts_nolock(const struct
struct ao2_container *ast_sip_location_retrieve_aor_contacts(const struct ast_sip_aor *aor)
{
struct ao2_container *contacts;
- struct ast_named_lock *lock;
- lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_MUTEX, "aor", ast_sorcery_object_get_id(aor));
- if (!lock) {
- return NULL;
- }
-
- ao2_lock(lock);
+ /* ao2_lock / ao2_unlock do not actually write aor since it has an ao2 lockobj. */
+ ao2_lock((void*)aor);
contacts = ast_sip_location_retrieve_aor_contacts_nolock(aor);
- ao2_unlock(lock);
- ast_named_lock_put(lock);
+ ao2_unlock((void*)aor);
return contacts;
}
@@ -369,19 +374,12 @@ int ast_sip_location_add_contact(struct ast_sip_aor *aor, const char *uri,
struct ast_sip_endpoint *endpoint)
{
int res;
- struct ast_named_lock *lock;
-
- lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_MUTEX, "aor", ast_sorcery_object_get_id(aor));
- if (!lock) {
- return -1;
- }
- ao2_lock(lock);
+ ao2_lock(aor);
res = ast_sip_location_add_contact_nolock(aor, uri, expiration_time, path_info, user_agent,
via_addr, via_port, call_id,
endpoint);
- ao2_unlock(lock);
- ast_named_lock_put(lock);
+ ao2_unlock(aor);
return res;
}
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 333be7143..d8ae9e0a3 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -603,6 +603,10 @@ static int ident_handler(const struct aco_option *opt, struct ast_variable *var,
endpoint->ident_method = 0;
return -1;
}
+ if (endpoint->ident_method & method) {
+ /* We are already indentifying by this method. No need to do it again. */
+ continue;
+ }
endpoint->ident_method |= method;
AST_VECTOR_APPEND(&endpoint->ident_method_order, method);
diff --git a/res/res_pjsip_registrar.c b/res/res_pjsip_registrar.c
index f99a3b84d..fd87ef7bb 100644
--- a/res/res_pjsip_registrar.c
+++ b/res/res_pjsip_registrar.c
@@ -523,25 +523,17 @@ static int register_aor(pjsip_rx_data *rdata,
{
int res;
struct ao2_container *contacts = NULL;
- struct ast_named_lock *lock;
- lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_MUTEX, "aor", aor_name);
- if (!lock) {
- return PJ_TRUE;
- }
-
- ao2_lock(lock);
+ ao2_lock(aor);
contacts = ast_sip_location_retrieve_aor_contacts_nolock(aor);
if (!contacts) {
- ao2_unlock(lock);
- ast_named_lock_put(lock);
+ ao2_unlock(aor);
return PJ_TRUE;
}
res = register_aor_core(rdata, endpoint, aor, aor_name, contacts);
ao2_cleanup(contacts);
- ao2_unlock(lock);
- ast_named_lock_put(lock);
+ ao2_unlock(aor);
return res;
}
@@ -563,6 +555,7 @@ static int match_aor(const char *aor_name, const char *id)
static char *find_aor_name(const char *username, const char *domain, const char *aors)
{
char *configured_aors;
+ char *aors_buf;
char *aor_name;
char *id_domain;
struct ast_sip_domain_alias *alias;
@@ -570,8 +563,10 @@ static char *find_aor_name(const char *username, const char *domain, const char
id_domain = ast_alloca(strlen(username) + strlen(domain) + 2);
sprintf(id_domain, "%s@%s", username, domain);
+ aors_buf = ast_strdupa(aors);
+
/* Look for exact match on username@domain */
- configured_aors = ast_strdupa(aors);
+ configured_aors = aors_buf;
while ((aor_name = ast_strip(strsep(&configured_aors, ",")))) {
if (match_aor(aor_name, id_domain)) {
return ast_strdup(aor_name);
@@ -586,7 +581,7 @@ static char *find_aor_name(const char *username, const char *domain, const char
sprintf(id_domain, "%s@%s", username, alias->domain);
ao2_cleanup(alias);
- configured_aors = ast_strdupa(aors);
+ configured_aors = strcpy(aors_buf, aors);/* Safe */
while ((aor_name = ast_strip(strsep(&configured_aors, ",")))) {
if (match_aor(aor_name, id_domain_alias)) {
return ast_strdup(aor_name);
@@ -594,8 +589,13 @@ static char *find_aor_name(const char *username, const char *domain, const char
}
}
+ if (ast_strlen_zero(username)) {
+ /* No username, no match */
+ return NULL;
+ }
+
/* Look for exact match on username only */
- configured_aors = ast_strdupa(aors);
+ configured_aors = strcpy(aors_buf, aors);/* Safe */
while ((aor_name = ast_strip(strsep(&configured_aors, ",")))) {
if (match_aor(aor_name, username)) {
return ast_strdup(aor_name);