Hi all,
does anyone know if there is a C function available in some module/header that assembles parsed sip_uri struct back into a single buffer? I’ve been looking at msg_parser.h (where sip_uri struct is defined) and parse_uri.h, but I can’t see anything of that kind.
Thanks in advance, Ivan
Hello,
after sip_msg is parsed , parsed flag is up. even if msg is parsed , whole header stores in body variable in typedef struct hdr_field { hdr_types_t type; /*!< Header field type */ str name; /*!< Header field name */ str body; /*!< Header field body (may not include CRLF) */ int len; /*!< length from hdr start until EoHF (incl.CRLF) */ void* parsed; /*!< Parsed data structures */ struct hdr_field* next; /*!< Next header field in the list */ } hdr_field_t;
Good luck. Yasin CANER
________________________________ From: sr-users sr-users-bounces@lists.kamailio.org on behalf of Ivan Ribakov i.ribakov@zaleos.net Sent: Thursday, February 14, 2019 6:27 PM To: Kamailio (SER) - Users Mailing List Subject: [SR-Users] Assemble struct sip_uri back to string?
Hi all,
does anyone know if there is a C function available in some module/header that assembles parsed sip_uri struct back into a single buffer? I’ve been looking at msg_parser.h (where sip_uri struct is defined) and parse_uri.h, but I can’t see anything of that kind.
Thanks in advance, Ivan _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello,
I do not recal now any place in the code where the sip_uri structure is printed back in a string. Mainly because the sip_uri structure is used read-only, its fields are pointing inside the buffer where the URI that was parsed was stored.
If you want to get the URI, at least in the kamailio code I am very familair with, there should be already available somewhere in another variable or field, otherwise the sip_uri structure is invalid, pointing to nowhere.
So, if you look a specific part of code where you want to get the URI, then give more details (file/line/function/) and I can eventually give hints how to access the URI buffer.
Cheers, Daniel
On 14.02.19 16:27, Ivan Ribakov wrote:
Hi all,
does anyone know if there is a C function available in some module/header that assembles parsed sip_uri struct back into a single buffer? I’ve been looking at msg_parser.h (where sip_uri struct is defined) and parse_uri.h, but I can’t see anything of that kind.
Thanks in advance, Ivan _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi Daniel,
after posting the question and spending some time figuring out how I might be able to assemble sip_uri into a string myself I finally came to the same realisation that you mentioned in your response - that sip_uri is used as read-only and not meant to be used for URI modifications or as a generic URI builder.
I think I will have to explore options to convert sip_uri to string with additional changes that apply to my particular use case.
Thanks all.
Regards, Ivan
On 15 Feb 2019, at 08:28, Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
I do not recal now any place in the code where the sip_uri structure is printed back in a string. Mainly because the sip_uri structure is used read-only, its fields are pointing inside the buffer where the URI that was parsed was stored.
If you want to get the URI, at least in the kamailio code I am very familair with, there should be already available somewhere in another variable or field, otherwise the sip_uri structure is invalid, pointing to nowhere.
So, if you look a specific part of code where you want to get the URI, then give more details (file/line/function/) and I can eventually give hints how to access the URI buffer.
Cheers, Daniel
On 14.02.19 16:27, Ivan Ribakov wrote:
Hi all,
does anyone know if there is a C function available in some module/header that assembles parsed sip_uri struct back into a single buffer? I’ve been looking at msg_parser.h (where sip_uri struct is defined) and parse_uri.h, but I can’t see anything of that kind.
Thanks in advance, Ivan _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com Kamailio Advanced Training - Mar 4-6, 2019 in Berlin; Mar 25-27, 2019, in Washington, DC, USA -- www.asipto.com