Module: kamailio
Branch: master
Commit: 2db510a4a6719d47e56b807c66b6d2dc5a4c02aa
URL: 
https://github.com/kamailio/kamailio/commit/2db510a4a6719d47e56b807c66b6d2dc5a4c02aa

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-05-10T16:27:59+02:00

presence: check content type for publish

---

Modified: src/modules/presence/publish.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/2db510a4a6719d47e56b807c66b6d2dc5a4c02aa.diff
Patch: 
https://github.com/kamailio/kamailio/commit/2db510a4a6719d47e56b807c66b6d2dc5a4c02aa.patch

---

diff --git a/src/modules/presence/publish.c b/src/modules/presence/publish.c
index 3b629d682af..d1fe8075f14 100644
--- a/src/modules/presence/publish.c
+++ b/src/modules/presence/publish.c
@@ -501,9 +501,19 @@ int ki_handle_publish_uri(struct sip_msg *msg, str 
*sender_uri)
                }
                body.len = msg->buf + msg->len - body.s;
 
-               if(pres_sphere_enable && event->evp->type == EVENT_PRESENCE
-                               && get_content_type(msg) == SUBTYPE_PIDFXML) {
-                       sphere = extract_sphere(&body);
+               if(pres_sphere_enable && event->evp->type == EVENT_PRESENCE) {
+                       int mime = 0;
+                       mime = parse_content_type_hdr(msg);
+                       if(mime < 0) {
+                               LM_ERR("cannot parse Content-Type header\n");
+                               reply_code = 400;
+                               reply_str = pu_400a_rpl;
+                               goto error;
+                       }
+
+                       if(mime == SUBTYPE_PIDFXML) {
+                               sphere = extract_sphere(&body);
+                       }
                }
        }
        memset(&puri, 0, sizeof(struct sip_uri));

_______________________________________________
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