[SR-Users] How to eliminate Content-Length:0 from sl_send_reply

Daniel-Constantin Mierla miconda at gmail.com
Tue Apr 25 15:41:38 CEST 2017


Hello,

you don't need to set the Content-Length yourself, kamailio does it
automatically when the body of a message is changed.

Cheers,
Daniel

On 25.04.17 15:06, Pranathi Venkatayogi wrote:
> Hi Alex,
>   I am adding my own SDP body to the reply and set the content-length to 350 already. 
>   The extra content-length: 0 is causing it to be malformed.
>
>   Question: Is there a way to generate SIP reply with SDP payload from config file. I saw there is uac_send_req but no support for reply so far...Please suggest.
>
>   I want to send this message from Kamailio:
> SIP/2.0 200 OK
> Via: SIP/2.0/UDP 10.0.0.5:52653;rport=52653;branch=z9hG4bKPj60f74c5d68574dc5ae3cbfdd21ba5f12;received=10.11.200.48
> From: "cust1" <sip:cust1 at devtranslation.sms-test.cyracom.com>;tag=0cba06eab62d47d1ace9c8834bbe0396
> To: <sip:spanish at devtranslation.sms-test.cyracom.com>;tag=02eb90a2953b26682001111237ca6e13-e339
> Call-ID: 7d383971684b44f792cfe84043bf8b5a
> CSeq: 15351 INVITE
> Content-Type: application/sdp
> Content-Length:   350
>
> v=0
> o=- 3688213899 3688213900 IN IP4 10.99.52.17
> s=Blink 1.4.2 (Windows)
> t=0 0
> m=message 2855 TCP/MSRP *
> c=IN IP4 10.99.52.17
> a=path:msrps://10.99.52.17:2855/12673656159856;tcp
> a=accept-types:message/cpim text/* image/* application/im-iscomposing+xml
> a=accept-wrapped-types:text/* image/* application/im-iscomposing+xml
> a=setup:active
>
> -----Original Message-----
> From: sr-users [mailto:sr-users-bounces at lists.kamailio.org] On Behalf Of Alex Balashov
> Sent: Tuesday, April 25, 2017 7:24 AM
> To: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
> Subject: Re: [SR-Users] How to eliminate Content-Length:0 from sl_send_reply
>
> Hello,
>
> What leads you to the conclusion that the 
>
>    Content-Length: 0 
>
> header is "extra", and in need of a "workaround"?
>
> -- Alex
>
> On Tue, Apr 25, 2017 at 12:21:32PM +0000, Pranathi Venkatayogi wrote:
>
>> Hi,
>>   How do I eliminate Content-Length:0 from sip reply when using sl_send_reply?
>>   I wanted to generate 200 ok, with SDP payload. I appended headers like below. The packet seems ok except there is extra "Content-Length:0", which is causing problems. Any workarounds?
>>
>>    The packet being generated is: Note the extra content-length: 0 at the end.
>> SIP/2.0 200 OK
>> Via: SIP/2.0/UDP 
>> 10.0.0.12:59404;rport=59404;branch=z9hG4bKPjb7d0391f8f7f479b812f6e5fea
>> dfa3c5;received=10.11.200.46
>> From: "cust1" 
>> <sip:cust1 at devtranslation.sms-test.cyracom.com>;tag=afcffa277e2a43dc88
>> fafc612f538864
>> To: 
>> <sip:spanish at devtranslation.sms-test.cyracom.com>;tag=37b119f34ca40c15
>> 8c5b7306e1aa8d72.b73a
>> Call-ID: 7f73e5d03e15425395fac930eae423bd
>> CSeq: 31419 INVITE
>> Content-Type: application/sdp
>> Content-Length: 350
>>
>> v=0
>> o=- 3688213899 3688213900 IN IP4 10.99.52.17 s=Blink 1.4.2 (Windows)
>> t=0 0
>> m=message 2855 TCP/MSRP *
>> c=IN IP4 10.99.52.17
>> a=path:msrps://10.99.52.17:2855/116701522521345;tcp
>> a=accept-types:message/cpim text/* image/* 
>> application/im-iscomposing+xml
>> a=accept-wrapped-types:text/* image/* application/im-iscomposing+xml 
>> a=setup:active
>> Content-Length: 0
>>
>> Code in config is:
>>         append_to_reply("Content-Type: application/sdp\r\n");
>>         append_to_reply("Content-Length:   350\r\n");
>>         append_to_reply("\r\n");
>>         append_to_reply("v=0\r\n");
>>         append_to_reply("o=- 3688213899 3688213900 IN IP4 MY_IP_ADDR\r\n");
>>         append_to_reply("s=Blink 1.4.2 (Windows)\r\n");
>>         append_to_reply("t=0 0\r\n");
>>         append_to_reply("m=message 2855 TCP/MSRP *\r\n");
>>         append_to_reply("c=IN IP4 MY_IP_ADDR\r\n");
>>         append_to_reply("a=path:msrps://MY_IP_ADDR:2855/$var(ssessid);tcp\r\n");
>>         append_to_reply("a=accept-types:message/cpim text/* image/* application/im-iscomposing+xml\r\n");
>>         append_to_reply("a=accept-wrapped-types:text/* image/* application/im-iscomposing+xml\r\n");
>>         append_to_reply("a=setup:active\r\n");
>>
>>         sl_send_reply("200", "OK");
>>
>> Thanks,
>> Pranathi Venkatayogi
>> System Developer II
>> (520) 745-9447 x4466
>> www.cyracom.com<http://www.cyracom.com/>
>>
>> Join us:   [cid:image001.gif at 01D1C9C9.C4E8B6D0] <https://www.facebook.com/pages/CyraCom-LLC/134704783312720>  [cid:image002.gif at 01D1C9C9.C4E8B6D0] <https://twitter.com/cyracom>  [cid:image003.gif at 01D1C9C9.C4E8B6D0] <http://www.linkedin.com/company/cyracom>  [cid:image004.gif at 01D1C9C9.C4E8B6D0] <http://www.cyracom.com/blog/>
>>
>> [cid:image005.png at 01D1C9C9.C4E8B6D0]
>>
>> DISCLAIMER: This e-mail and any attached content may contain confidential or privileged material delivered for the sole use of the intended recipient(s). Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender immediately by reply e-mail and delete all copies of this message. It is the recipient's responsibility to scan this e-mail and any attachments for viruses. The content of this e-mail message, including any attachments, does not comprise a contract or a portion of a contract, and so does not bind CyraCom International, Inc. or any of its agents or subsidiaries. CyraCom, LLC and Voiance Language Services, LLC are wholly owned subsidiaries of CyraCom International, Inc.
>>
>
>
>
>
>
>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> --
> Alex Balashov | Principal | Evariste Systems LLC
>
> Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
> Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - May 22-24 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com




More information about the sr-users mailing list