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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-11-19T15:09:52+01:00

sca: use core function for parsing to header and uri

- instead of local implementation

---

Modified: src/modules/sca/sca_util.c

---

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

---

diff --git a/src/modules/sca/sca_util.c b/src/modules/sca/sca_util.c
index 3e8e6d16bd2..1d5d7178713 100644
--- a/src/modules/sca/sca_util.c
+++ b/src/modules/sca/sca_util.c
@@ -215,22 +215,11 @@ int sca_get_msg_to_header(sip_msg_t *msg, sca_to_body_t 
*to)
                        return (-1);
                }
                to->flags = SCA_UTIL_FLAG_TO_BODY_MSG;
-               to->hdr = get_to(msg);
-               if(to->hdr == NULL) {
-                       parse_to(msg->to->body.s,
-                                       msg->to->body.s + msg->to->body.len + 
1, // end of buffer
-                                       to->hdr);
-                       if(to->hdr->error != PARSE_OK) {
-                               LM_ERR("Bad To header\n");
-                               return (-1);
-                       }
-               }
-
-               // ensure the URI is parsed for future use
-               if(parse_uri(to->hdr->uri.s, to->hdr->uri.len, 
GET_TO_PURI(msg)) < 0) {
-                       LM_ERR("Failed to parse To URI %.*s\n", 
STR_FMT(&to->hdr->uri));
+               if(parse_to_uri(msg) == NULL) {
+                       LM_ERR("Bad To header\n");
                        return (-1);
                }
+               to->hdr = get_to(msg);
        } else {
                LM_DBG("using $avp(%.*s)[%.*s] as to uri\n",
                                STR_FMT(&sca->cfg->to_uri_avp.s), 
STR_FMT(&uri));

_______________________________________________
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