Module: kamailio
Branch: master
Commit: 634c2ab9f9abcd9d12cca7fa7deeea04e2fe9705
URL: 
https://github.com/kamailio/kamailio/commit/634c2ab9f9abcd9d12cca7fa7deeea04e2fe9705

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-08-13T08:55:47+02:00

dispatcher: support for hexadecimal flags format in the list file

---

Modified: src/modules/dispatcher/dispatch.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/634c2ab9f9abcd9d12cca7fa7deeea04e2fe9705.diff
Patch: 
https://github.com/kamailio/kamailio/commit/634c2ab9f9abcd9d12cca7fa7deeea04e2fe9705.patch

---

diff --git a/src/modules/dispatcher/dispatch.c 
b/src/modules/dispatcher/dispatch.c
index 9aac29e2f79..27e60bf56a6 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -1127,17 +1127,34 @@ int ds_load_list(char *lfile)
                while(*p && (*p == ' ' || *p == '\t' || *p == '\r' || *p == 
'\n'))
                        p++;
 
-               /* get flags */
                flags = 0;
                priority = 0;
                attrs.s = 0;
                attrs.len = 0;
+
+               /* get flags */
                if(*p == '\0' || *p == '#')
                        goto add_destination; /* no flags given */
 
-               while(*p >= '0' && *p <= '9') {
-                       flags = flags * 10 + (*p - '0');
-                       p++;
+               if(*p == '0' && *(p + 1) == 'x') {
+                       p += 2;
+                       while((*p >= '0' && *p <= '9') || (*p >= 'a' && *p <= 
'f')
+                                       || (*p >= 'A' && *p <= 'F')) {
+                               uint8_t bv = *p;
+                               if(bv >= '0' && bv <= '9')
+                                       bv = bv - '0';
+                               else if(bv >= 'a' && bv <= 'f')
+                                       bv = bv - 'a' + 10;
+                               else if(bv >= 'A' && bv <= 'F')
+                                       bv = bv - 'A' + 10;
+                               flags = (flags << 4) | (bv & 0xF);
+                               p++;
+                       }
+               } else {
+                       while(*p >= '0' && *p <= '9') {
+                               flags = flags * 10 + (*p - '0');
+                               p++;
+                       }
                }
 
                /* eat all white spaces */

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to