Module: sip-router Branch: master Commit: d0c862c76fda42b467d1543bf98eca5678a81db3 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d0c862c7...
Author: Jason Penton jason.penton@gmail.com Committer: Jason Penton jason.penton@gmail.com Date: Thu Dec 11 22:01:52 2014 +0200
modules/ims_usrloc_scscf: if no contacts left for IMPU change state from REGISTERED to UNREGISTERED
---
modules/ims_usrloc_scscf/impurecord.c | 13 +++++++++++-- modules/ims_usrloc_scscf/usrloc_db.c | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/modules/ims_usrloc_scscf/impurecord.c b/modules/ims_usrloc_scscf/impurecord.c index a50cfc4..a3d64c0 100644 --- a/modules/ims_usrloc_scscf/impurecord.c +++ b/modules/ims_usrloc_scscf/impurecord.c @@ -315,9 +315,10 @@ void mem_delete_ucontact(ucontact_t* _c) { */ static inline void nodb_timer(impurecord_t* _r) { ucontact_t* ptr; - int i, flag, mustdeleteimpu=1; + int i, flag, mustdeleteimpu=1, hascontacts=0; udomain_t* udomain; unsigned int hash_code = 0; + impurecord_t* tmp_impu;
reg_subscriber *s; subs_t* sub_dialog; @@ -370,6 +371,7 @@ static inline void nodb_timer(impurecord_t* _r) { ptr->c.len, ptr->c.s, (unsigned int) (ptr->expires - time(NULL))); mustdeleteimpu = 0; + hascontacts = 1; } } else { @@ -380,10 +382,17 @@ static inline void nodb_timer(impurecord_t* _r) { if (!flag) LM_DBG("no contacts\n");
- register_udomain("location", &udomain); if (mustdeleteimpu) { delete_impurecord(udomain, &_r->public_identity, _r); + } else { + if (!hascontacts) { + LM_DBG("This impu is not to be deleted but has no contacts - should change state to IMPU_UNREGISTERED\n"); + if (update_impurecord(udomain, &_r->public_identity, IMPU_UNREGISTERED, + -1/*do not change*/, -1 /*do not change */, -1/*do not change*/, NULL, NULL, NULL, NULL, NULL, &tmp_impu) != 0) { + LM_ERR("Unable to update impurecord for <%.*s>\n", _r->public_identity.len, _r->public_identity.s); + } + } } }
diff --git a/modules/ims_usrloc_scscf/usrloc_db.c b/modules/ims_usrloc_scscf/usrloc_db.c index d156649..7571ee5 100644 --- a/modules/ims_usrloc_scscf/usrloc_db.c +++ b/modules/ims_usrloc_scscf/usrloc_db.c @@ -507,7 +507,7 @@ int inline int_to_str_len(int i) { }
static inline int dbrow2contact(db_val_t* val, ucontact_info_t* ci) { - static str params, path, user_agent, callid; + static str path, user_agent, callid;
//TODO FIX PARAMS