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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-02-11T10:29:22+01:00

core: parser - field to keep the style of the to_body

- enclosed URI or quoted display

---

Modified: src/core/parser/parse_addr_spec.c
Modified: src/core/parser/parse_addr_spec.h

---

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

---

diff --git a/src/core/parser/parse_addr_spec.c 
b/src/core/parser/parse_addr_spec.c
index e9ed00a16e4..d57e0a21ae0 100644
--- a/src/core/parser/parse_addr_spec.c
+++ b/src/core/parser/parse_addr_spec.c
@@ -530,7 +530,7 @@ static char *parse_to_param(char *const buffer, const char 
*const end,
                                                goto error;
                                }
                } /*switch*/
-       }         /*for*/
+       } /*for*/
        if(!(status == F_CR || status == F_LF || status == F_CRLF))
                saved_status = status;
 
@@ -724,21 +724,25 @@ char *parse_addr_spec(char *const buffer, const char 
*const end,
                                switch(status) {
                                        case START_TO:
                                                to_b->body.s = tmp;
+                                               to_b->style |= TBS_URI_ENCLOSED;
                                                status = S_URI_ENCLOSED;
                                                break;
                                        case DISPLAY_QUOTED:
                                                break;
                                        case E_DISPLAY_QUOTED:
+                                               to_b->style |= TBS_URI_ENCLOSED;
                                                status = S_URI_ENCLOSED;
                                                break;
                                        case URI_OR_TOKEN:
                                        case DISPLAY_TOKEN:
                                                to_b->display.len = tmp - 
to_b->display.s;
+                                               to_b->style |= TBS_URI_ENCLOSED;
                                                status = S_URI_ENCLOSED;
                                                break;
                                        case DISPLAY_TOKEN_SP:
                                        case MAYBE_URI_END:
                                                to_b->display.len = foo - 
to_b->display.s;
+                                               to_b->style |= TBS_URI_ENCLOSED;
                                                status = S_URI_ENCLOSED;
                                                break;
                                        case F_CRLF:
@@ -782,6 +786,7 @@ char *parse_addr_spec(char *const buffer, const char *const 
end,
                                        case START_TO:
                                                to_b->body.s = tmp;
                                                to_b->display.s = tmp;
+                                               to_b->style |= 
TBS_DISPLAY_QUOTED;
                                                status = DISPLAY_QUOTED;
                                                break;
                                        case DISPLAY_QUOTED:
@@ -888,7 +893,7 @@ char *parse_addr_spec(char *const buffer, const char *const 
end,
                                                goto error;
                                }
                } /*char switch*/
-       }         /*for*/
+       } /*for*/
 
        /* Reached end of buffer */
        switch(status) {
diff --git a/src/core/parser/parse_addr_spec.h 
b/src/core/parser/parse_addr_spec.h
index ae194290736..5363c1ef020 100644
--- a/src/core/parser/parse_addr_spec.h
+++ b/src/core/parser/parse_addr_spec.h
@@ -47,13 +47,17 @@ typedef struct to_param
 } to_param_t;
 
 
+#define TBS_URI_ENCLOSED 1      /*!< URI is enclodes in angle brackets */
+#define TBS_DISPLAY_QUOTED 2 /*!< Display name is quoted */
+
 typedef struct to_body
 {
-       int error;         /*!< Error code */
-       str body;          /*!< The whole header field body */
-       str uri;           /*!< URI */
-       str display;   /*!< Display Name */
-       str tag_value; /*!< Value of tag */
+       int error;                      /*!< Error code */
+       str body;                       /*!< The whole header field body */
+       str uri;                        /*!< URI */
+       str display;            /*!< Display Name */
+       str tag_value;          /*!< Value of tag */
+       unsigned int style; /*!< Styles for the fields */
        struct sip_uri parsed_uri;
        struct to_param *param_lst;      /*!< Linked list of parameters */
        struct to_param *last_param; /*!< Last parameter in the list */

_______________________________________________
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