[OpenSIPS-Users] How to fix Content-Length header?

Dmitry Kravchenko dimskraft at gmail.com
Tue Oct 19 18:47:43 CEST 2010


I wrote in the following way:

route{

        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                exit;
        }

        # DIMS fixing wrong content length (due to SIP ALG)
        $var(actlen)=$(rb{s.len})-2;
        if( $var(actlen)>0 && !$var(actlen)==$cl ) {
            xlog("Will fix content length from [$cl] to [$var(actlen)]");

            if(remove_hf("Content-Length"))
            {
                append_hf("Content-Length: $var(actlen)\r\n");
            }
        }

        ## NAT Detection
...

but still getting some errors in log:

Oct 19 20:16:07 scisbo /usr/sbin/opensips[16394]:
ERROR:nathelper:force_rtp_proxy_body: incorrect port 0 in reply from
rtp proxy
Oct 19 20:38:16 scisbo /usr/sbin/opensips[16388]: Will fix content
length from [232] to [230]
Oct 19 20:38:16 scisbo /usr/sbin/opensips[16392]: Will fix content
length from [232] to [230]
Oct 19 20:38:16 scisbo /usr/sbin/opensips[16392]:
ERROR:core:get_all_bodies: Message is shorter than indicated by
content length: got 230 expected 232
Oct 19 20:38:16 scisbo /usr/sbin/opensips[16392]:
ERROR:nathelper:force_rtp_proxy: Unable to parse body
Oct 19 20:38:16 scisbo /usr/sbin/opensips[16392]: new branch at
sip:dims at 217.10.34.83:51858;rinstance=0ae6721dad1df336
Oct 19 20:38:17 scisbo /usr/sbin/opensips[16394]: incoming reply
Oct 19 20:38:17 scisbo /usr/sbin/opensips[16389]: incoming reply

Other words: relaying frame became good (previously callee phone was
reporting SIP/2.0 400 Bad Request(Bad Content-Length (larger than
datagram) now it is ok) but "inprocess" frame looks like remaining
bad.

So, how to fix "inprocess" frame?

Thanks.


2010/10/19 Anca Vamanu <anca at opensips.org>:
> Hi,
>
> Yes, use remove_hf and append_hf from textops module -
> http://www.opensips.org/html/docs/modules/1.6.x/textops.html, and to get
> the length use the string transformation s.len
> -http://www.opensips.org/Resources/DocsCoreTran#toc2.
>
> Regards,
>
> --
> Anca Vamanu
> www.voice-system.ro
>
>
>
> PS: Don't post the same question in more places.
>
>
> On 10/19/2010 03:48 PM, Dmitry Kravchenko wrote:
>> I would like to try to use SIP ALG option turned on on routers. But I
>> found, that these gateways sometimes forget to change Content-Length
>> header while changing a content (for examle, changing an IP address).
>>
>> So, is it possible to fix content length with opensips script?
>>
>> Thanks.
>>
>>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>



More information about the Users mailing list