Git Product home page Git Product logo

Comments (12)

rfuchs avatar rfuchs commented on June 24, 2024

Can you post the culprit SIP/SDP message?

Generally speaking, the SDP RFC (4566) is quite strict and doesn't allow for blank lines, not even at the end of the SDP body. Not to my knowledge, anyway. As such, SDP bodies containing blank lines should be considered broken.

from rtpengine.

nakchak avatar nakchak commented on June 24, 2024

Here are the relevant lines from the rtpengine log
Dec 18 18:40:27 vs-kam-prod02 rtpengine[9856]: Got valid command from 127.0.0.1:55267: offer - { "sdp": "v=0#015#012o=CiscoSystemsSIP-GW-UserAgent 6600 7421 IN IP4 172.16.52.4#015#012s=SIP Call#015#012c=IN IP4 172.16.52.4#015#012t=0 0#015#012m=audio 19494 RTP/AVP 8 0 18 101#015#012c=IN IP4 172.16.52.4#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:18 G729/8000#015#012a=fmtp:18 annexb=no#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-15#015#012a=ptime:20#015#012", "media-address": "172.16.52.71", "direction": [ "internal", "internal" ], "replace": [ "origin", "session-connection" ], "transport-protocol": "RTP/AVP", "call-id": "[email protected]", "received-from": [ "IP4", "172.16.52.4" ], "from-tag": "1F8449E1-78", "command": "offer" } Dec 18 18:40:27 vs-kam-prod02 rtpengine[9856]: [[email protected]] Creating new call Dec 18 18:40:27 vs-kam-prod02 rtpengine[9856]: [[email protected]] Returning to SIP proxy: d3:sdp568:v=0#015#012o=CiscoSystemsSIP-GW-UserAgent 6600 7421 IN IP4 172.16.52.71#015#012s=SIP Call#015#012c=IN IP4 172.16.52.71#015#012t=0 0#015#012a=ice-lite#015#012m=audio 35068 RTP/AVP 8 0 18 101#015#012c=IN IP4 172.16.52.71#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:18 G729/8000#015#012a=fmtp:18 annexb=no#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-15#015#012a=ptime:20#015#012a=sendrecv#015#012a=rtcp:35069#015#012a=ice-ufrag:qDSenMx1#015#012a=ice-pwd:nYszQEVd2bwuQVQmflBintxO4n0s#015#012a=candidate:MlbXIWO3TtCUQm3F 1 UDP 2130706431 172.16.52.71 35068 typ host#015#012a=candidate:MlbXIWO3TtCUQm3F 2 UDP 2130706430 172.16.52.71 35069 typ host#015#0126:result2:oke Dec 18 18:40:28 vs-kam-prod02 rtpengine[9856]: Got valid command from 127.0.0.1:55267: answer - { "sdp": "v=0#015#012o=Holly-HVP-6-0 217 0 IN IP4 172.16.52.60#015#012s=hvg#015#012c=IN IP4 172.16.52.60#015#012t=0 0#015#012m=audio 13470 RTP/AVP 8 0 101#015#012c=IN IP4 172.16.52.60#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-15#015#012a=ptime:20#015#012a=maxptime:20#015#012#015#012", "media-address": "172.16.52.71", "direction": [ "internal", "internal" ], "replace": [ "origin", "session-connection" ], "transport-protocol": "RTP/AVP", "call-id": "[email protected]", "received-from": [ "IP4", "172.16.52.60" ], "from-tag": "1F8449E1-78", "to-tag": "hvg-6A5-3CCB70-54931FF2-74DE0EE3", "command": "answer" } Dec 18 18:40:28 vs-kam-prod02 rtpengine[9856]: Error parsing SDP at offset 262: Missing '=' sign Dec 18 18:40:28 vs-kam-prod02 rtpengine[9856]: Protocol error in packet from 127.0.0.1:55267: Failed to parse SDP [d3:sdp264:v=0#015#012o=Holly-HVP-6-0 217 0 IN IP4 172.16.52.60#015#012s=hvg#015#012c=IN IP4 172.16.52.60#015#012t=0 0#015#012m=audio 13470 RTP/AVP 8 0 101#015#012c=IN IP4 172.16.52.60#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-15#015#012a=ptime:20#015#012a=maxptime:20#015#012#015#01213:media-address12:172.16.52.719:directionl8:internal8:internale7:replacel6:origin18:session-connectione18:transport-protocol7:RTP/AVP7:call-id47:[email protected]:received-froml3:IP412:172.16.52.60e8:from-tag11:1F8449E1-786:to-tag32:hvg-6A5-3CCB70-54931FF2-74DE0EE37:command6:answere] Dec 18 18:40:28 vs-kam-prod02 rtpengine[9856]: Returning to SIP proxy: d6:result5:error12:error-reason19:Failed to parse SDPe

as far as i can tell the SDP reported looks valid, but a capture from ngrep seems to indicate an extra line at the end of the body, i will be contacting the developers of holly as well to see if they can fix at there end.

from rtpengine.

rfuchs avatar rfuchs commented on June 24, 2024

Yes, and the log here agrees. Any clues as to where this extra line comes from? A broken client or victim of a failed SDP rewrite somewhere along the way?

from rtpengine.

nakchak avatar nakchak commented on June 24, 2024

As far as i can tell its a bug in the IVR platform we are using, however past experience with them has shown they are very hesitant to change sip messages i.e. they wanted us to strip early media rather than have them ignore it, especially as far as they are concerned it works, when the IVR is directly connected to the Cisco ASR we were using as an SBC it works perfectly.

Which was why i was wondering if it would be possible to either add additional guard clauses to report the exact cause, as whilst a missing = sign is technically correct the real fault is the blank line, or ideally to rewrite the broken sdp to ensure interoperability with RFC complaint systems

from rtpengine.

rfuchs avatar rfuchs commented on June 24, 2024

I have the following patch ready to commit to master, which I think will fix your issue. It adds a compile time flags which instructs the SDP parser to stop parsing when it encounters a blank line and also truncate the SDP at this point. It can be enabled with the compile flag -DTERMINATE_SDP_AT_BLANK_LINE, but it won't be enabled by default. Please try the patch and see if this fixes you problem.

diff --git a/daemon/Makefile b/daemon/Makefile
index af42efe..38efa60 100644
--- a/daemon/Makefile
+++ b/daemon/Makefile
@@ -32,6 +32,7 @@ CFLAGS+=      -DRTPENGINE_VERSION="\"$(RTPENGINE_VERSION)\""
 CFLAGS+=       -DMP_PLUGIN_DIR="\"/usr/lib/rtpengine\""

 #CFLAGS+=      -DSRTCP_KEY_DERIVATION_RFC_COMPLIANCE
+CFLAGS+=       -DTERMINATE_SDP_AT_BLANK_LINE

 ifeq ($(DBG),yes)
 CFLAGS+=       -D__DEBUG=1
diff --git a/daemon/sdp.c b/daemon/sdp.c
index 1d88439..2e8e3a5 100644
--- a/daemon/sdp.c
+++ b/daemon/sdp.c
@@ -759,6 +759,12 @@ int sdp_parse(str *body, GQueue *sessions) {
        end = str_end(body);

        while (b && b < end - 1) {
+#ifdef TERMINATE_SDP_AT_BLANK_LINE
+               if (b[0] == '\n' || b[0] == '\r') {
+                       body->len = b - body->s;
+                       break;
+               }
+#endif
                errstr = "Missing '=' sign";
                if (b[1] != '=')
                        goto error;

from rtpengine.

nakchak avatar nakchak commented on June 24, 2024

Patch seems to have done the trick, many thanks

from rtpengine.

covalschi avatar covalschi commented on June 24, 2024

Hello guys, can you please tell how can I enable that feature using dpkg-buildpackage?

from rtpengine.

rfuchs avatar rfuchs commented on June 24, 2024

You can override the build flags through environment variables supported by dpkg-buildflags

For example:

$ DEB_CFLAGS_APPEND=-DTERMINATE_SDP_AT_BLANK_LINE dpkg-buildpackage

from rtpengine.

brooksbridges-call48 avatar brooksbridges-call48 commented on June 24, 2024

Is there any way to utilize this with the repository version or will it absolutely require a manually compiled or dpkg version?

from rtpengine.

rfuchs avatar rfuchs commented on June 24, 2024

I think it's time to turn this into a regular config option...

from rtpengine.

brooksbridges-call48 avatar brooksbridges-call48 commented on June 24, 2024

Please let me know if I can be of any assistance with testing. We have a full development environment for this, so just say the word!

from rtpengine.

rfuchs avatar rfuchs commented on June 24, 2024

This is now merged to master as a default-on option, see f869c23

from rtpengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.