Module: sip-router
Branch: master
Commit: 4875c53d467c973c07213a13975add4b7ca4f560
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4875c53…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Jun 4 11:40:11 2012 +0200
registrar(k): moved realm prefix as first field in cfg registrar struct
- added debug message to print the realm prefix
---
modules_k/registrar/common.c | 8 ++++++--
modules_k/registrar/config.c | 8 ++++----
modules_k/registrar/config.h | 2 +-
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/modules_k/registrar/common.c b/modules_k/registrar/common.c
index c8a1948..c682f15 100644
--- a/modules_k/registrar/common.c
+++ b/modules_k/registrar/common.c
@@ -95,8 +95,12 @@ int extract_aor(str* _uri, str* _a, sip_uri_t *_pu)
/* strip prefix (if defined) */
realm_prefix.s = cfg_get(registrar, registrar_cfg, realm_pref).s;
realm_prefix.len = cfg_get(registrar, registrar_cfg, realm_pref).len;
- if (realm_prefix.len>0 && realm_prefix.len<puri->host.len &&
- (memcmp(realm_prefix.s, puri->host.s, realm_prefix.len)==0) ) {
+ LM_DBG("realm prefix is [%.*s]\n", realm_prefix.len,
+ (realm_prefix.len>0)?realm_prefix.s:"");
+ if (realm_prefix.len>0
+ && realm_prefix.len<puri->host.len
+ && (memcmp(realm_prefix.s, puri->host.s, realm_prefix.len)==0))
+ {
memcpy(aor_buf + _a->len, puri->host.s + realm_prefix.len,
puri->host.len - realm_prefix.len);
_a->len += puri->host.len - realm_prefix.len;
diff --git a/modules_k/registrar/config.c b/modules_k/registrar/config.c
index 038a68c..f183511 100644
--- a/modules_k/registrar/config.c
+++ b/modules_k/registrar/config.c
@@ -31,6 +31,7 @@
#include "config.h"
struct cfg_group_registrar default_registrar_cfg = {
+ STR_NULL, /* realm_pref */
3600, /* default_expires */
0, /* default_expires_range */
60, /* min_expires */
@@ -39,13 +40,14 @@ struct cfg_group_registrar default_registrar_cfg = {
0, /* retry_after */
0, /* case_sensitive */
Q_UNSPECIFIED, /* default_q */
- 1, /* append_branches */
- STR_NULL /* realm_pref */
+ 1 /* append_branches */
};
void *registrar_cfg = &default_registrar_cfg;
cfg_def_t registrar_cfg_def[] = {
+ {"realm_pref", CFG_VAR_STR, 0, 0, 0, 0,
+ "Realm prefix to be removed. Default is \"\""},
{"default_expires", CFG_VAR_INT | CFG_CB_ONLY_ONCE, 0, 0, 0,
default_expires_stats_update,
"Contains number of second to expire if no expire hf or contact expire
present" },
{"default_expires_range", CFG_VAR_INT | CFG_CB_ONLY_ONCE, 0, 100, 0,
default_expires_range_update,
@@ -64,7 +66,5 @@ cfg_def_t registrar_cfg_def[] = {
"The parameter represents default q value for new contacts."}, /*
Q_UNSPECIFIED is -1 */
{"append_branches", CFG_VAR_INT , 0, 0, 0, 0,
"If set to 1(default), lookup will put all contacts found in msg
structure"},
- {"realm_pref", CFG_VAR_STR, 0, 0, 0, 0,
- "Realm prefix to be removed. Default is \"\""},
{0, 0, 0, 0, 0, 0}
};
diff --git a/modules_k/registrar/config.h b/modules_k/registrar/config.h
index f2708d6..496a14b 100644
--- a/modules_k/registrar/config.h
+++ b/modules_k/registrar/config.h
@@ -27,6 +27,7 @@
#include "../../str.h"
struct cfg_group_registrar {
+ str realm_pref;
unsigned int default_expires;
unsigned int default_expires_range;
unsigned int min_expires;
@@ -36,7 +37,6 @@ struct cfg_group_registrar {
unsigned int case_sensitive;
qvalue_t default_q;
unsigned int append_branches;
- str realm_pref;
};
extern struct cfg_group_registrar default_registrar_cfg;