[sr-dev] git:3.1: registrar(s): support for disabled aor_attr and server_id_attr
Andrei Pelinescu-Onciul
andrei at iptel.org
Wed Oct 13 08:21:45 CEST 2010
Module: sip-router
Branch: 3.1
Commit: 9747285971a598365ea941ee553a0a7a15259751
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9747285971a598365ea941ee553a0a7a15259751
Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date: Wed Oct 6 18:53:14 2010 +0200
registrar(s): support for disabled aor_attr and server_id_attr
If aor_attr or server_id_attr are empty ("") don't try to use
them.
(cherry picked from commit 5f94dececcbf709f92b9a4b022731d4ee17e7e42)
---
modules_s/registrar/save.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/modules_s/registrar/save.c b/modules_s/registrar/save.c
index a491526..045e139 100644
--- a/modules_s/registrar/save.c
+++ b/modules_s/registrar/save.c
@@ -697,10 +697,12 @@ static int get_server_id(void)
int sid;
- name.s.s = server_id_attr.s + 1; /* Skip the 1st char which is $ */
- name.s.len = server_id_attr.len - 1;
- if (search_first_avp(AVP_TRACK_FROM | AVP_NAME_STR, name, &val, 0)) {
- if (str2sint(&val.s, &sid) == 0) return sid;
+ if (server_id_attr.len && server_id_attr.s) {
+ name.s.s = server_id_attr.s + 1; /* Skip the 1st char which is $ */
+ name.s.len = server_id_attr.len - 1;
+ if (search_first_avp(AVP_TRACK_FROM | AVP_NAME_STR, name, &val, 0)) {
+ if (str2sint(&val.s, &sid) == 0) return sid;
+ }
}
/* No server_id attribute found or the attribute doesn't have
@@ -721,12 +723,16 @@ static inline int contacts(struct sip_msg* _m, contact_t* _c, udomain_t* _d, str
str* aor;
int_str name, val;
- name.s.s = aor_attr.s + 1; /* Skip the 1st char which is $ */
- name.s.len = aor_attr.len - 1;
- if (search_first_avp(AVP_TRACK_TO | AVP_NAME_STR, name, &val, 0)) {
- aor = &val.s;
+ if (aor_attr.len && aor_attr.s) {
+ name.s.s = aor_attr.s + 1; /* Skip the 1st char which is $ */
+ name.s.len = aor_attr.len - 1;
+ if (search_first_avp(AVP_TRACK_TO | AVP_NAME_STR, name, &val, 0)) {
+ aor = &val.s;
+ } else {
+ aor = &get_to(_m)->uri;
+ }
} else {
- aor = &get_to(_m)->uri;
+ aor = &get_to(_m)->uri;
}
sid = get_server_id();
More information about the sr-dev
mailing list