It looks like a bug of opensips. This problem can occur for those who use opensips as a bridge between SIP-I and SIP. For example, you received a SIP-I message with body, you will want to delete the ISUP part in the processing process in order to send a regular SIP further. If the incoming body (sdp+isup) is described by a single Content-Length header then everything will be fine. And if the incoming body will have three Content-Length headers (the first Content-Length-shared of all body, the second on ISUP body and the third on SDP body) Content-Length: 477 Content-Type: multipart/mixed;boundary=ssboundary --ssboundary Content-Length: 205 Content-Type: application/sdp v=0 o=xyz 1154444372 1154444373 IN IP4 10.111.18.3 s=SipCall c=IN IP4 10.249.66.133 t=0 0 m=audio 28644 RTP/AVP 8 116 a=rtpmap:8 PCMA/8000 a=rtpmap:116 telephone-event/8000 a=ptime:20 --ssboundary Content-Length: 100 Content-Type: application/isup;version=itu-t92+ )" )HB()EdRx1Z)EdRxa4}à§=?bñ£9 1À4À?ÀoÀuÀ --ssboundary--
and you delete ISUP body # delete a mime body from incoming INVITE remove_body_part("application/isup"); your outgoing INVITE will contain two identical Content-Length headers and the remote side will drop your call 400. Content-Length: 205 Content-Length: 205 Content-Type: application/sdp v=0 o=xyz 1154444372 1154444373 IN IP4 10.111.18.3 s=SipCall c=IN IP4 10.249.66.133 t=0 0 m=audio 28644 RTP/AVP 8 116 a=rtpmap:8 PCMA/8000 a=rtpmap:116 telephone-event/8000 a=ptime:20 One Content-Length header is automatically generated by the "remove_body_part" function. And the second is taken from the incoming INVITE probably Then the most interesting. You cannot remove this unnecessary extra Content-Length header. remove_hf("Content-Length"); - doesn't work. I don't know why. Helped here is such a deception. When you get an incoming INVITE (let me remind you in it a body with three Content-Length) Before all manipulations do like this: ## hack for removing Content-Length replace_all("Content-Length", "X-"); And then your outgoing invite will have only one Content-Length and the remote party will not send you 400. In General, all will be well. The only nuance you will send is an X-header that is not needed by the remote side)) >Пятница, 8 ноября 2019, 11:14 +03:00 от users-requ...@lists.opensips.org: > >Send Users mailing list submissions to >users@lists.opensips.org > >To subscribe or unsubscribe via the World Wide Web, visit >http://lists.opensips.org/cgi-bin/mailman/listinfo/users >or, via email, send a message with subject or body 'help' to >users-requ...@lists.opensips.org > >You can reach the person managing the list at >users-ow...@lists.opensips.org > >When replying, please edit your Subject line so it is more specific >than "Re: Contents of Users digest..." > > >Today's Topics: > > 1. Opensips generate two Content-lenth headers (Oleg Podguyko) > 2. Re: Opensips generate two Content-lenth headers (Alain Bieuzent) > > >---------------------------------------------------------------------- > >Message: 1 >Date: Thu, 07 Nov 2019 21:15:10 +0300 >From: Oleg Podguyko < podgu...@mail.ru > >To: users@lists.opensips.org >Subject: [OpenSIPS-Users] Opensips generate two Content-lenth headers >Message-ID: < 1573150510.509115...@f514.i.mail.ru > >Content-Type: text/plain; charset="utf-8" > > >I’m using opensips as proxy. I got INVITE from one side, do some logics >,remove ISUP body and send INVITE to destination via dispatcher module. >And I see that outgoing INVITE has two content-lenth headers. Remote side >after received such INVITE sends 400 >Bad Contenth-lenth header. > > > >Incoming INVITE: > >INVITE sip:9222992040@10.66.107.169;transport=sctp;user=phone SIP/2.0 >Via: SIP/2.0/SCTP >10.111.18.3:7010;branch=z9hG4bKiz5cvz9x5v5zi4bg84g4vx4zs;X-DispMsg=1408 >Route: <sip:10.66.107.169:5060;transport=sctp;lr> >Call-ID: i44czbcvax4gabcdst4iavdbaisji94s@10.18.5.64 >From: >"9269918424"<sip:9269918424@10.111.18.3;transport=sctp;user=phone>;tag=i4z5545v-CC-1027-TRC-613805-OFC-14 >To: "9222992040"<sip:9222992040@10.66.107.169;transport=sctp;user=phone> >CSeq: 1 INVITE >P-Access-Network-Info: GEN-ACCESS;"area-number= +79262000601 " >Max-Forwards: 70 >Contact: <sip:10.111.18.3:7010> >Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,INFO,PRACK,NOTIFY,MESSAGE,REFER,UPDATE >P-Asserted-Identity: <tel:9269918424> >History-Info: ><sip:9254462587@anonymous.invalid?reason=SIP%3Bcause%3D503%3Btext%3D%22Subscriber%20Not%20Reachable%22&Privacy=history>;index=1 >History-Info: <sip:9222992040@10.66.107.169:5060;transport=sctp>;index=1.1 >P-Early-Media: supported >Supported: 100rel,timer,histinfo >Min-SE: 90 >Session-Expires: 1800;refresher=uac >Content-Length: 477 >Content-Type: multipart/mixed;boundary=ssboundary >--ssboundary >Content-Length: 205 >Content-Type: application/sdp >v=0 >o=xyz 1154444372 1154444373 IN IP4 10.111.18.3 >s=SipCall >c=IN IP4 10.249.66.133 >t=0 0 >m=audio 28644 RTP/AVP 8 116 >a=rtpmap:8 PCMA/8000 >a=rtpmap:116 telephone-event/8000 >a=ptime:20 >--ssboundary >Content-Length: 100 >Content-Type: application/isup;version=itu-t92+ > >)" >)HB()EdRx1Z)EdRxa4}à§=?bñ£9 >1À4À?ÀoÀuÀ >--ssboundary-- > > >Outgoing INVITE > >INVITE sip:9222992040@10.66.107.169;transport=sctp;user=phone SIP/2.0 >Record-Route: <sip:192.168.9.84;r2=on;lr;did=876.0b9c196> >Record-Route: <sip:10.66.107.169;transport=sctp;r2=on;lr;did=876.0b9c196> >Via: SIP/2.0/UDP 192.168.9.84:5060;branch=z9hG4bKfa6a.b4f80a51.0 >Via: SIP/2.0/SCTP >10.111.18.3:7010;branch=z9hG4bKiz5cvz9x5v5zi4bg84g4vx4zs;X-DispMsg=1408 >Call-ID: i44czbcvax4gabcdst4iavdbaisji94s@10.18.5.64 >From: >"9269918424"<sip:9269918424@10.111.18.3;transport=sctp;user=phone>;tag=i4z5545v-CC-1027-TRC-613805-OFC-14 >To: "9222992040"<sip:9222992040@10.66.107.169;transport=sctp;user=phone> >CSeq: 1 INVITE >P-Access-Network-Info: GEN-ACCESS;"area-number= +79262000601 " >Max-Forwards: 69 >Contact: <sip:10.111.18.3:7010> >Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,INFO,PRACK,NOTIFY,MESSAGE,REFER,UPDATE >P-Asserted-Identity: <tel:9269918424> >History-Info: ><sip:9254462587@anonymous.invalid?reason=SIP%3Bcause%3D503%3Btext%3D%22Subscriber%20Not%20Reachable%22&Privacy=history>;index=1 >History-Info: <sip:9222992040@10.66.107.169:5060;transport=sctp>;index=1.1 >P-Early-Media: supported >Supported: 100rel,timer,histinfo >Min-SE: 90 >Session-Expires: 1800;refresher=uac >Content-Length: 205 >Content-Length: 205 >Content-Type: application/sdp >v=0 >o=xyz 1154444372 1154444373 IN IP4 10.111.18.3 >s=SipCall >c=IN IP4 10.249.66.133 >t=0 0 >m=audio 28644 RTP/AVP 8 116 >a=rtpmap:8 PCMA/8000 >a=rtpmap:116 telephone-event/8000 >a=ptime:20 > > > > > >-- >Oleg Podguyko >-------------- next part -------------- >An HTML attachment was scrubbed... >URL: < >http://lists.opensips.org/pipermail/users/attachments/20191107/99140cb6/attachment-0001.html > > > >------------------------------ > >Message: 2 >Date: Fri, 08 Nov 2019 09:13:43 +0100 >From: Alain Bieuzent < alain.bieuz...@free.fr > >To: Oleg Podguyko < podgu...@mail.ru >, OpenSIPS users mailling list >< users@lists.opensips.org > >Subject: Re: [OpenSIPS-Users] Opensips generate two Content-lenth >headers >Message-ID: < 56ecc46c-f074-4609-ae6b-79f3657f3...@free.fr > >Content-Type: text/plain; charset="utf-8" > >Hi Oleg, > > > >Is it normal your outgoing INVITE have twice « Content-Length: 205 » ? > > > >Regards > > > >De : Users < users-boun...@lists.opensips.org > au nom de Oleg Podguyko via >Users < users@lists.opensips.org > >Répondre à : Oleg Podguyko < podgu...@mail.ru >, OpenSIPS users mailling list >< users@lists.opensips.org > >Date : jeudi 7 novembre 2019 à 19:16 >À : < users@lists.opensips.org > >Objet : [OpenSIPS-Users] Opensips generate two Content-lenth headers > > > >I’m using opensips as proxy. I got INVITE from one side, do some logics >,remove ISUP body and send INVITE to destination via dispatcher module. > >And I see that outgoing INVITE has two content-lenth headers. Remote side >after received such INVITE sends 400 > >Bad Contenth-lenth header. > > > > > > > >Incoming INVITE: > > > >INVITE sip:9222992040@10.66.107.169;transport=sctp;user=phone SIP/2.0 >Via: SIP/2.0/SCTP >10.111.18.3:7010;branch=z9hG4bKiz5cvz9x5v5zi4bg84g4vx4zs;X-DispMsg=1408 >Route: <sip:10.66.107.169:5060;transport=sctp;lr> >Call-ID: i44czbcvax4gabcdst4iavdbaisji94s@10.18.5.64 >From: >"9269918424"<sip:9269918424@10.111.18.3;transport=sctp;user=phone>;tag=i4z5545v-CC-1027-TRC-613805-OFC-14 >To: "9222992040"<sip:9222992040@10.66.107.169;transport=sctp;user=phone> >CSeq: 1 INVITE >P-Access-Network-Info: GEN-ACCESS;"area-number= +79262000601 " >Max-Forwards: 70 >Contact: <sip:10.111.18.3:7010> >Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,INFO,PRACK,NOTIFY,MESSAGE,REFER,UPDATE >P-Asserted-Identity: <tel:9269918424> >History-Info: ><sip:9254462587@anonymous.invalid?reason=SIP%3Bcause%3D503%3Btext%3D%22Subscriber%20Not%20Reachable%22&Privacy=history>;index=1 >History-Info: <sip:9222992040@10.66.107.169:5060;transport=sctp>;index=1.1 >P-Early-Media: supported >Supported: 100rel,timer,histinfo >Min-SE: 90 >Session-Expires: 1800;refresher=uac >Content-Length: 477 >Content-Type: multipart/mixed;boundary=ssboundary > >--ssboundary >Content-Length: 205 >Content-Type: application/sdp > >v=0 >o=xyz 1154444372 1154444373 IN IP4 10.111.18.3 >s=SipCall >c=IN IP4 10.249.66.133 >t=0 0 >m=audio 28644 RTP/AVP 8 116 >a=rtpmap:8 PCMA/8000 >a=rtpmap:116 telephone-event/8000 >a=ptime:20 > >--ssboundary >Content-Length: 100 >Content-Type: application/isup;version=itu-t92+ > > > >)" >)HB()EdRx1Z >)EdRxa4}à§=?bñ£9 >1À4À?ÀoÀuÀ >--ssboundary-- > > > > > >Outgoing INVITE > > > >INVITE sip:9222992040@10.66.107.169;transport=sctp;user=phone SIP/2.0 >Record-Route: <sip:192.168.9.84;r2=on;lr;did=876.0b9c196> >Record-Route: <sip:10.66.107.169;transport=sctp;r2=on;lr;did=876.0b9c196> >Via: SIP/2.0/UDP 192.168.9.84:5060;branch=z9hG4bKfa6a.b4f80a51.0 >Via: SIP/2.0/SCTP >10.111.18.3:7010;branch=z9hG4bKiz5cvz9x5v5zi4bg84g4vx4zs;X-DispMsg=1408 >Call-ID: i44czbcvax4gabcdst4iavdbaisji94s@10.18.5.64 >From: >"9269918424"<sip:9269918424@10.111.18.3;transport=sctp;user=phone>;tag=i4z5545v-CC-1027-TRC-613805-OFC-14 >To: "9222992040"<sip:9222992040@10.66.107.169;transport=sctp;user=phone> >CSeq: 1 INVITE >P-Access-Network-Info: GEN-ACCESS;"area-number= +79262000601 " >Max-Forwards: 69 >Contact: <sip:10.111.18.3:7010> >Allow: INVITE,ACK,OPTIONS,BYE,CANCEL,INFO,PRACK,NOTIFY,MESSAGE,REFER,UPDATE >P-Asserted-Identity: <tel:9269918424> >History-Info: ><sip:9254462587@anonymous.invalid?reason=SIP%3Bcause%3D503%3Btext%3D%22Subscriber%20Not%20Reachable%22&Privacy=history>;index=1 >History-Info: <sip:9222992040@10.66.107.169:5060;transport=sctp>;index=1.1 >P-Early-Media: supported >Supported: 100rel,timer,histinfo >Min-SE: 90 >Session-Expires: 1800;refresher=uac >Content-Length: 205 >Content-Length: 205 >Content-Type: application/sdp >v=0 >o=xyz 1154444372 1154444373 IN IP4 10.111.18.3 >s=SipCall >c=IN IP4 10.249.66.133 >t=0 0 >m=audio 28644 RTP/AVP 8 116 >a=rtpmap:8 PCMA/8000 >a=rtpmap:116 telephone-event/8000 >a=ptime:20 > > > > > > > > > > >-- >Oleg Podguyko > >_______________________________________________ Users mailing list >Users@lists.opensips.org >http://lists.opensips.org/cgi-bin/mailman/listinfo/users > >-------------- next part -------------- >An HTML attachment was scrubbed... >URL: < >http://lists.opensips.org/pipermail/users/attachments/20191108/c6dfac88/attachment.html > > > >------------------------------ > >Subject: Digest Footer > >_______________________________________________ >Users mailing list >Users@lists.opensips.org >http://lists.opensips.org/cgi-bin/mailman/listinfo/users > > >------------------------------ > >End of Users Digest, Vol 136, Issue 11 >************************************** -- Oleg Podguiko
_______________________________________________ Users mailing list Users@lists.opensips.org http://lists.opensips.org/cgi-bin/mailman/listinfo/users