diff --git a/modules/registrar/save.c b/modules/registrar/save.c index 6e433bba3e1..b856a4af162 100644 --- a/modules/registrar/save.c +++ b/modules/registrar/save.c @@ -444,7 +444,7 @@ static inline int update_contacts(struct sip_msg* _m, urecord_t* _r, /* pack the contact_info */ if ( (ci=pack_ci( 0, _c, e, 0, ul.nat_flag, _sctx->flags, - &_sctx->ownership_tag, NULL))==0 ) { + &_sctx->ownership_tag, &_sctx->cmatch))==0 ) { LM_ERR("failed to extract contact info\n"); goto error; } @@ -511,7 +511,7 @@ static inline int update_contacts(struct sip_msg* _m, urecord_t* _r, /* pack the contact specific info */ if ( (ci=pack_ci( 0, _c, e, 0, ul.nat_flag, _sctx->flags, - &_sctx->ownership_tag, NULL))==0 ) { + &_sctx->ownership_tag, &_sctx->cmatch))==0 ) { LM_ERR("failed to pack contact specific info\n"); goto error; } diff --git a/modules/usrloc/urecord.c b/modules/usrloc/urecord.c index 9534c59ee75..7dc5afd9d8f 100644 --- a/modules/usrloc/urecord.c +++ b/modules/usrloc/urecord.c @@ -990,6 +990,9 @@ static inline struct ucontact* contact_params_match(ucontact_t* contacts, } for (param = _params; param; param = param->next) { + /* a bit counter-intuitive, but, according to RFC 3261 ยง 19.1.4, if + * an unknown URI parameter is missing from either URI, + * the matching of that parameter is successful! */ if (get_uri_param_val(&ct, ¶m->s, &v1) != 0 || get_uri_param_val(&cti, ¶m->s, &v2) != 0) continue; diff --git a/parser/parse_uri.h b/parser/parse_uri.h index 3c8f8516953..2f234968b37 100644 --- a/parser/parse_uri.h +++ b/parser/parse_uri.h @@ -111,7 +111,10 @@ static inline unsigned short get_uri_port(struct sip_uri* _uri, * @param - URI param name to search for * @val - output value * - * Return: 0 on parser-recognized parameters or success, -1 otherwise + * Return: + * 0 on RFC-recognized parameters (even if they are missing!) + * or successful search of unknown ones + * -1 otherwise */ static inline int get_uri_param_val(const struct sip_uri *uri, const str *param, str *val)