Module: kamailio
Branch: 5.3
Commit: 951da90aa25035c7bc70aa0c22afdcd78c6737c9
URL: 
https://github.com/kamailio/kamailio/commit/951da90aa25035c7bc70aa0c22afdcd78c6737c9

Author: Aleksandar Yosifov <[email protected]>
Committer: Henning Westerholt <[email protected]>
Date: 2020-02-09T17:18:27+01:00

ims_reqistrar_scscf: Fix bug with multi-notifications

- Added more accurate contact comparison when
  sending NOTIFY to a subscriber.

(cherry picked from commit c275110a07fdad8963a08f5ca210f0d5fb717986)

---

Modified: src/modules/ims_registrar_scscf/registrar_notify.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/951da90aa25035c7bc70aa0c22afdcd78c6737c9.diff
Patch: 
https://github.com/kamailio/kamailio/commit/951da90aa25035c7bc70aa0c22afdcd78c6737c9.patch

---

diff --git a/src/modules/ims_registrar_scscf/registrar_notify.c 
b/src/modules/ims_registrar_scscf/registrar_notify.c
index 5f15cf60d7..a40aa1d71f 100644
--- a/src/modules/ims_registrar_scscf/registrar_notify.c
+++ b/src/modules/ims_registrar_scscf/registrar_notify.c
@@ -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
@@ -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");


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to