Comments (12)
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.
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.
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.
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.
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.
Patch seems to have done the trick, many thanks
from rtpengine.
Hello guys, can you please tell how can I enable that feature using dpkg-buildpackage?
from rtpengine.
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.
Is there any way to utilize this with the repository version or will it absolutely require a manually compiled or dpkg version?
from rtpengine.
I think it's time to turn this into a regular config option...
from rtpengine.
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.
This is now merged to master as a default-on option, see f869c23
from rtpengine.
Related Issues (20)
- Codec / Transcoding information returned by ng query
- How to determine the multi-channel sequence of recording
- cannot compile mr8.5.12 HOT 2
- RFC 2833 issue - tripling of digits due to final 2 payloads getting new timestamp HOT 3
- Proposal to change this log from ERR to WARN HOT 1
- UBSAN: array-index-out-of-bounds in /var/lib/dkms/rtpengine/12.2.1.5/build/xt_RTPENGINE.c:5156:32
- compile rtpengine failed on ubuntu 22.04 with error "undefined reference to `av_channel_layout_default'" HOT 4
- SRTP output wanted, but no crypto suite was negotiated HOT 1
- rtpengine mr10.5 crashed in __dtx_send_later HOT 2
- `silent-timeout` not working HOT 1
- for rhel 8.9 mr11.5 there is an compilation issue HOT 1
- rtpengine not support H264 HOT 1
- call.h:921:7: error: unknown type name ‘__auto_type
- kamailio rtpengine re-INVITE HOT 1
- kzalloc() return 0. HOT 6
- DKMS Rebuild modules failed HOT 2
- libg729 crash on rtpengine 9.5.2
- Wrong IPv session stats HOT 3
- ipv4 only media current sessions number wrong after restart HOT 1
- numsessions "current sessions own" and "ipv4 only media" almost always differ HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rtpengine.