Skip to content

Commit

Permalink
ims_reqistrar_scscf: Fix bug with multi-notifications
Browse files Browse the repository at this point in the history
- Added more accurate contact comparison when
  sending NOTIFY to a subscriber.

(cherry picked from commit c275110)
  • Loading branch information
alexyosifov authored and henningw committed Feb 9, 2020
1 parent 79c5290 commit 951da90
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/modules/ims_registrar_scscf/registrar_notify.c
Expand Up @@ -1351,6 +1351,21 @@ int aor_to_contact(str* aor, str* contact) {
return ret;
}

/*!
* \brief Match two contacts with full string - ips, ports and aliases
* \param c1 contact string 1
* \param c2 contact string 2
* \return 1 when they match, 0 when they not match
*/
static int contact_match(str* c1, str* c2) {
LM_DBG("Matching full contact string - comparing [%.*s] and [%.*s]\n", c1->len, c1->s, c2->len, c2->s);
if ((c1->len == c2->len) && !memcmp(c1->s, c2->s, c1->len)) {
return 1;
}

return 0;
}

/*!
* \brief Match a contact record to a contact string but only compare the ip port portion
* \param ptr contact record
Expand Down Expand Up @@ -1438,7 +1453,7 @@ void create_notifications(udomain_t* _t, impurecord_t* r_passed, str *presentity

//This is a fix to ensure that when a user subscribes a full reg info is only sent to that UE
if (event_type == IMS_REGISTRAR_SUBSCRIBE) {
if (contact_port_ip_match(watcher_contact, &s->watcher_contact) &&
if (contact_match(watcher_contact, &s->watcher_contact) &&
(presentity_uri->len == s->presentity_uri.len) && (memcmp(s->presentity_uri.s, presentity_uri->s, presentity_uri->len) == 0)) {
LM_DBG("This is a fix to ensure that we only send full reg info XML to the UE that just subscribed.\n");
LM_DBG("About to make new notification! We always increment the local cseq and version before we send a new notification\n");
Expand Down

0 comments on commit 951da90

Please sign in to comment.