On Jun 21, 2004 at 14:00, Linus Surguy <linus(a)magrathea-telecom.co.uk> wrote:
> Thanks
all (especially Alex), I know now why, and it does seem that the
> 'NAT' device - in this case a Draytek Vigor ADSL router is rewriteing
the
SIP
packet incorrectly. However, if I wanted to be tolerant of this, is
there a way to instruct SER to re-evaluate the 'content-length' and
rewrite it correctly?
You might be better fixing the Draytech - who knows what information the
NAT box is losing. The problem you have here is it's done 3 rewrites (Via,
Call-ID, & RTP o=) each adding five characters but only added 10 to
Content-Length; I expect you can imagine the piece of C doing this and
that
If it were just for personal use that would be fine, but we have to support
a wide range of clients where we don't have control over their hardware. I
think we're going to have to 'correct' the Content-Length field - is there
any way we can add additional data to the body and force SER to recalculate
it that way?
If you really want to try to fix this from ser there is a way. In fact
there are 2 ways, one involves editing the sources and the other a
config hack.
1. editing the sources (ser 0.8.12 from cvs or ser unstable)
- edit msg_translator.c. In the adjust_clent function you should
find the following line:
if ((anchor==0) && body_delta){
(line 1231 in ser 0.8.12-tcp_nonb & 1235 in ser unstable).
Change it into:
if (anchor==0){
(just remove the body_delta test).
Now ser will recompute the content length for all the packets. This will
also add a small performance hit (because now ser will have to parse
more headers: it will have to find and parse at least content-length).
2. config hack: ser will automatically recompute content-length if the
body of the message changed (ser added or removed something from it).
Try the following:
is_present_hf("foobar"); /* it doesn't matter what, this just has the
side-effect of forcing ser to parse all the headers */
subst('/^(s=.*)$/\1\r\ni=Ser-fixed session/'); /* adds something to
the sdp to force ser to recompute clen*/
You will need to load the textops module for is_present_hf & subst.
Andrei