Module: sip-router Branch: master Commit: a7cad776a514b0ec73a5c40b7971af8e0f0da92b URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a7cad776...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Mon Jul 30 12:55:36 2012 +0200
usrloc(k): on ul update, re-clone uri and callid if instance is set
- changes can happen when gruu/ob is enabled as the UA can get different address for same instance
---
modules_k/usrloc/ucontact.c | 11 ++++++++--- modules_k/usrloc/usrloc.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules_k/usrloc/ucontact.c b/modules_k/usrloc/ucontact.c index 2d07a26..ac76e9b 100644 --- a/modules_k/usrloc/ucontact.c +++ b/modules_k/usrloc/ucontact.c @@ -218,9 +218,14 @@ int mem_update_ucontact(ucontact_t* _c, ucontact_info_t* _ci)
char* ptr;
- /* No need to update Callid as it is constant - * per ucontact (set at insert time) -bogdan */ - + if(_ci->instance.s!=NULL && _ci->instance.len>0) + { + /* when we have instance set, update contact address and call-id */ + if(_ci->c!=NULL && _ci->c->s!=NULL && _ci->c->len>0) + update_str( &_c->c, _ci->c); + if(_ci->callid!=NULL && _ci->callid->s!=NULL && _ci->callid->len>0) + update_str( &_c->callid, _ci->callid); + } update_str( &_c->user_agent, _ci->user_agent);
if (_ci->received.s && _ci->received.len) { diff --git a/modules_k/usrloc/usrloc.h b/modules_k/usrloc/usrloc.h index d08632b..bfd225a 100644 --- a/modules_k/usrloc/usrloc.h +++ b/modules_k/usrloc/usrloc.h @@ -94,6 +94,7 @@ typedef struct ucontact { /*! \brief Informations related to a contact */ typedef struct ucontact_info { str ruid; /*!< Pointer to record internal unique id */ + str *c; /*!< Contact address */ str received; /*!< Received interface */ str* path; /*!< Path informations */ time_t expires; /*!< Contact expires */