Module: sip-router Branch: master Commit: d5b8c86bfacdf495cdd46e6a306d7aee02d3dfb2 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d5b8c86b...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Mon Oct 4 19:34:22 2010 +0200
registrar(s): by default trust contact received info
- by default trust contact received info (to maintain compatibility with old configs). - the possible settings for the trust_received_flag modparam are: * -2 (default) - always trust contact received info (added when replicating REGISTERs) * -1 - disable (never trust received info) * >=0 - trust only the messages with the corresponding flag set (it can also be a flag name).
---
modules_s/registrar/reg_mod.c | 7 +++++-- modules_s/registrar/save.c | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/modules_s/registrar/reg_mod.c b/modules_s/registrar/reg_mod.c index b8f87e4..f623d1b 100644 --- a/modules_s/registrar/reg_mod.c +++ b/modules_s/registrar/reg_mod.c @@ -67,9 +67,12 @@ int append_branches = 1; /* If set to 1, lookup will put all contac int case_sensitive = 0; /* If set to 1, username in aor will be case sensitive */ int save_nat_flag = 4; /* The contact will be marked as behind NAT if this flag is set before calling save */ int load_nat_flag = 4; /* This flag will be set by lookup if a contact is behind NAT*/ -int trust_received_flag = -1; /* if this flag is set, a contact +int trust_received_flag = -2; /* if this flag is set (>=0), a contact received param. will be trusted - (otherwise it will be ignored) */ + (otherwise it will be ignored) + -1 = disable + -2 = trust all. + */ int min_expires = 60; /* Minimum expires the phones are allowed to use in seconds, * use 0 to switch expires checking off */ int max_expires = 0; /* Minimum expires the phones are allowed to use in seconds, diff --git a/modules_s/registrar/save.c b/modules_s/registrar/save.c index 08fcb9f..f87fd3c 100644 --- a/modules_s/registrar/save.c +++ b/modules_s/registrar/save.c @@ -420,8 +420,10 @@ static inline int insert(struct sip_msg* _m, str* aor, contact_t* _c, udomain_t* } send_sock = 0; - if (_c->received && (trust_received_flag >=0) && - (isflagset(_m, trust_received_flag) == 1)) { + if (_c->received && + (((trust_received_flag >= 0) && + (isflagset(_m, trust_received_flag) == 1)) || + (trust_received_flag == -2)) ) { recv = &_c->received->body; send_sock = find_send_socket(recv); } else if (flags & FL_NAT && _m->first_line.type == SIP_REQUEST) { @@ -591,8 +593,10 @@ static inline int update(struct sip_msg* _m, urecord_t* _r, str* aor, contact_t* } send_sock = 0; - if (_c->received && (trust_received_flag >=0) && - (isflagset(_m, trust_received_flag) == 1)) { + if (_c->received && + (((trust_received_flag >=0 ) && + (isflagset(_m, trust_received_flag) == 1)) || + (trust_received_flag == -2)) ) { recv = &_c->received->body; send_sock = find_send_socket(recv); } else if (nated & FL_NAT && @@ -649,8 +653,10 @@ static inline int update(struct sip_msg* _m, urecord_t* _r, str* aor, contact_t* } send_sock = 0; - if (_c->received && (trust_received_flag >=0) && - (isflagset(_m, trust_received_flag) == 1)) { + if (_c->received && + (((trust_received_flag >=0 ) && + (isflagset(_m, trust_received_flag) == 1)) || + (trust_received_flag == -2)) ) { recv = &_c->received->body; send_sock = find_send_socket(recv); } else if (nated & FL_NAT && _m->first_line.type == SIP_REQUEST) {