signalwire / freeswitch

FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device.
https://freeswitch.com/#getting-started
Other
3.54k stars 1.41k forks source link

Too long Reason header swallowed #1481

Open dcw67 opened 2 years ago

dcw67 commented 2 years ago

Describe the bug

A BYE message with a Reason: header that is longer than 128 characters get responded to on the B leg with a 200 OK as expected but is not forwarded across a bridge back to the A leg.

To Reproduce

Send a BYE packet containing a Reason head with a long text description. For example:

BYE sip:mod_sofia@103.26.173.43:5060 SIP/2.0 Via: SIP/2.0/UDP 139.162.48.4:5060;branch=z9hG4bK-10866-1-6 Route: <sip:103.26.173.62;lr;ftag=9ra9N222HeQ8e> From: sip:617xxxxxxxx@139.162.48.4;tag=10866SIPpTag011 To: "614xxxxxxxx" sip:614xxxxxxxx@103.26.173.43;tag=9ra9N222HeQ8e Call-ID: 690b9544-d34d-123a-a98a-b2ad0b93b34a CSeq: 2 BYE Contact: sip:sipp@139.162.48.4:5060 Max-Forwards: 70 Content-Length: 0 Reason: Q.850;cause=16;text="The call has ended because there is no longer any parties left in the call. This is an exceptionally long reason header and will probably break things" User-Agent: SONUS SBCSWeLite 9.0.4v316 Azure Ribbon

Expected behaviour Expected the BYE to pass back through the bridge to the A leg. This does not occur resulting in the A leg remaining up until the A leg hangs up.

Package version or git hash

FreeSWITCH Version 1.10.7-release-19-883d2cb662~64bit (-release-19-883d2cb662 64bit)

Trace logs FS log and PCAPS attached

Network topology is:

offnet -> routing node routing_node -> FS SBC (2 x interfaces) FS SBC -> proxy proxy -> CPE

In attached PCAPS:

offnet -> 192.168.153.38 192.168.153.38 -> 192.168.153.39 (private interface) 103.26.173.42 (public interface) -> 103.26.173.62 103.26.173.62 -> 139.162.48.4

In LongReasonHeaderCustomerLeg.pcap the BYE arrives at SBC In LongReasonHeaderInternalLeg.pcap te BYE is not sent to the routing node

LongReasonHeader.zip

backtrace from core file n/a

gilles0606 commented 2 years ago

Hello, has anyone made a patch? This problem happens frequently for me.

kukies007 commented 2 years ago

Long Reason headers will be truncated to 128 bytes in mod_sofia.c:490+501. A quick hack could be to enhance the char array.

1293 is the same issue

gilles0606 commented 2 years ago

A quick hack could be to enhance the char array.

hello, increasing the size is not a solution, since the next sbc freeswitch in the call, will have the same problem I made a patch that corrects the field https://github.com/signalwire/freeswitch/pull/1789

bit4bit commented 1 year ago

hello @dcw67 i recently had the same problem and my partial solution is fix with

<action application="export" data="disable_q850_reason=true"/>