<div dir="ltr">No, i was trying to fill msg->via2 using parse_via() but now, im
gonna try with a pre-script callback function (didnt known of their
existence) <br>
<br>
Thanks Daniel<br><br><div class="gmail_quote">On Tue, Sep 16, 2008 at 1:58 PM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
<br>
On 09/16/08 18:42, Francisco Seratti wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
All my work is done in a module, and im parsing the Via header into (struct via_body *)via2 of the struct sip_msg of the reply message. That struct is used when forward_reply() is called:<br>
<br>
forward.c:568<br>
/* we have to forward the reply stateless, so we need second via -bogdan*/<br>
if (parse_headers( msg, HDR_VIA2_F, 0 )==-1<br>
|| (msg->via2==0) || (msg->via2->error!=PARSE_OK))<br>
{<br>
/* no second via => error */<br>
LM_ERR("no 2nd via found in reply\n");<br>
goto error;<br>
}<br>
</blockquote>
<br></div>
do you fill msg->via2 by yourself? Do you set the appropriate header flag?<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">
<br>
<br>
On Tue, Sep 16, 2008 at 12:28 PM, Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a> <mailto:<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>> wrote:<br>
<br>
Hello,<br>
<br>
<br>
On 09/16/08 18:05, Francisco Seratti wrote:<br>
<br>
Hello,<br>
Im trying to hide my network topology by adding/removing Via<br>
headers. I can remove the correct header, but when adding it,<br>
in replies, im having trouble with the parse_via() function<br>
and i cant figure out where's the problem.<br>
To the moment, request are coming out from the proxy with only<br>
one Via (the proxy addr), but when replies come in, they are<br>
discarded because no 2nd via is found. So, im "saving" the<br>
removed Via from the request, to be inserted later in the<br>
response (using parse_via() into struct via_body *via2 of the<br>
sip_msg).<br>
The point is parse_via() waits 3 args: start of the header,<br>
some "end" pointer, and the via_body struct for saving parsed<br>
data. I think my problem is in that end pointer, as i could<br>
see in msg_parse.c:116 it is the end of the entire msg, but<br>
not sure.<br>
Ive tried many, many ways but i cant finally get via parsing<br>
OK. Im getting "ERROR:core:parse_via: invalid via - end of<br>
header in state 14" or different states (16). (i guarantee via<br>
header is well formed).<br>
<br>
Could someone orientate me, to know where im failiing??<br>
Askme for any extra data if you need, thanks a lot!<br>
<br>
the problem is that changes done to sip messages are not effective<br>
in the script. Even if you add a via in the reply message, the<br>
script interpreter works only on the sip message received, which<br>
has only one via, therefore, openser does not have an address<br>
where to forward the reply and discards it.<br>
<br>
I assume you develop some module to hide the topology and have the<br>
add/remove via logic there. You can try to register a pre-script<br>
callback and add at least one via there. This callback is executed<br>
before running the config script. There you can modify the<br>
original sip message and re-initiate the entire sip message parsing.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
-- Daniel-Constantin Mierla<br>
<a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a><br>
<br>
<br></div></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Devel mailing list<br>
<a href="mailto:Devel@lists.kamailio.org" target="_blank">Devel@lists.kamailio.org</a><br>
<a href="http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel" target="_blank">http://lists.kamailio.org/cgi-bin/mailman/listinfo/devel</a><br>
<br>
</blockquote><div><div></div><div class="Wj3C7c">
<br>
-- <br>
Daniel-Constantin Mierla<br>
<a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a><br>
<br>
</div></div></blockquote></div><br></div>