[Kamailio-Devel] parse_via()
Daniel-Constantin Mierla
miconda at gmail.com
Tue Sep 16 17:28:35 CEST 2008
Hello,
On 09/16/08 18:05, Francisco Seratti wrote:
> Hello,
> Im trying to hide my network topology by adding/removing Via
> headers. I can remove the correct header, but when adding it, in
> replies, im having trouble with the parse_via() function and i cant
> figure out where's the problem.
> To the moment, request are coming out from the proxy with only one Via
> (the proxy addr), but when replies come in, they are discarded because
> no 2nd via is found. So, im "saving" the removed Via from the request,
> to be inserted later in the response (using parse_via() into struct
> via_body *via2 of the sip_msg).
> The point is parse_via() waits 3 args: start of the header, some "end"
> pointer, and the via_body struct for saving parsed data. I think my
> problem is in that end pointer, as i could see in msg_parse.c:116 it
> is the end of the entire msg, but not sure.
> Ive tried many, many ways but i cant finally get via parsing OK. Im
> getting "ERROR:core:parse_via: invalid via - end of header in state
> 14" or different states (16). (i guarantee via header is well formed).
>
> Could someone orientate me, to know where im failiing??
> Askme for any extra data if you need, thanks a lot!
the problem is that changes done to sip messages are not effective in
the script. Even if you add a via in the reply message, the script
interpreter works only on the sip message received, which has only one
via, therefore, openser does not have an address where to forward the
reply and discards it.
I assume you develop some module to hide the topology and have the
add/remove via logic there. You can try to register a pre-script
callback and add at least one via there. This callback is executed
before running the config script. There you can modify the original sip
message and re-initiate the entire sip message parsing.
Cheers,
Daniel
--
Daniel-Constantin Mierla
http://www.asipto.com
More information about the Devel
mailing list