Module: kamailio
Branch: master
Commit: 65e51b776290a1981e9ac27fbe6b47813516bc8b
URL: 
https://github.com/kamailio/kamailio/commit/65e51b776290a1981e9ac27fbe6b47813516bc8b

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-01-24T16:53:10+01:00

presence: do not break on one notify sending failure

- try all of them, debug message with successful and failure counters
- GH #4118

---

Modified: src/modules/presence/notify.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/65e51b776290a1981e9ac27fbe6b47813516bc8b.diff
Patch: 
https://github.com/kamailio/kamailio/commit/65e51b776290a1981e9ac27fbe6b47813516bc8b.patch

---

diff --git a/src/modules/presence/notify.c b/src/modules/presence/notify.c
index 47a11b23183..191cac0d04b 100644
--- a/src/modules/presence/notify.c
+++ b/src/modules/presence/notify.c
@@ -1557,6 +1557,8 @@ int query_db_notify(str *pres_uri, pres_ev_t *event, 
subs_t *watcher_subs)
        subs_t *subs_array = NULL, *s = NULL;
        str *notify_body = NULL, *aux_body = NULL;
        int ret_code = -1;
+       int retOK = 0;
+       int retErr = 0;
 
        subs_array = get_subs_dialog(pres_uri, event, NULL);
        if(subs_array == NULL) {
@@ -1586,7 +1588,9 @@ int query_db_notify(str *pres_uri, pres_ev_t *event, 
subs_t *watcher_subs)
                                        < 0) {
                                LM_ERR("Could not send notify for 
[event]=%.*s\n",
                                                event->name.len, event->name.s);
-                               goto done;
+                               retErr++;
+                       } else {
+                               retOK++;
                        }
 
                        if(aux_body != NULL) {
@@ -1599,7 +1603,10 @@ int query_db_notify(str *pres_uri, pres_ev_t *event, 
subs_t *watcher_subs)
                }
        }
 
-       ret_code = 1;
+       LM_DBG("sent ok: %d - err: %d\n", retOK, retErr);
+       if(retOK > 0) {
+               ret_code = 1;
+       }
 
 done:
        free_subs_list(subs_array, PKG_MEM_TYPE, 0);

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to