[SEMS] Content-Length duplicating when failure rerouting
denyspozniak opened this issue · 9 comments
denyspozniak commented
Hello!
We are using sems 1.7.1 and looks like there is a bug in sbc application in case of call rerouting via option next_hop.
Here is a sbcprofile main settings:
RURI = sip:$rU@10.10.10.10:5060
To = <sip:$tU@10.10.10.10>
From = <sip:$fU@$rd>
next_hop=10.10.10.10/UDP,10.10.10.20/UDP
enable_rtprelay=no
sdp_filter=transparent
sdp_anonymize=no
enable_transcoder=never
When primary node (10.10.10.10) does not respond, call goes to secondary (10.10.10.20), but outgoing INVITE has two Content-Length fields, like below:
2018/12/18 11:39:17.293209 10.10.10.1:5060 -> 10.10.10.20:5060
INVITE sip:+12345@10.10.10.20:5060 SIP/2.0
...
Content-Type: application/sdp
Content-Length: 283
Contact: <sip:10.10.10.1:5060;transport=udp>
Content-Length: 283
denyspozniak commented
denyspozniak commented
Some additional information.
If next_hop has 3 IPs, there will be 3 Content-Length headers...
juha-h commented
denyspozniak writes:
When primary node (10.10.10.10) does not respond, call goes to
secondary (10.10.10.20), but outgoing INVITE has two Content-Length
fields, like below:
```
2018/12/18 11:39:17.293209 10.10.10.1:5060 -> 10.10.10.20:5060
INVITE ***@***.***:5060 SIP/2.0
...
Content-Type: application/sdp
Content-Length: 283
Contact: <sip:10.10.10.1:5060;transport=udp>
Content-Length: 283
```
Try if the patch below fixes the issue.
…-- Juha
-------------------------------------------------------------------------
```
diff --git a/core/sip/msg_hdrs.cpp b/core/sip/msg_hdrs.cpp
index ef182f8b..71dc6e04 100644
--- a/core/sip/msg_hdrs.cpp
+++ b/core/sip/msg_hdrs.cpp
@@ -107,6 +107,7 @@ void copy_hdrs_wr_no_via_contact(char** c, const list<sip_header*>& hdrs)
switch((*it)->type) {
case sip_header::H_VIA:
case sip_header::H_CONTACT:
+ case sip_header::H_CONTENT_LENGTH:
continue;
default:
```
denyspozniak commented
Hello!
Looks like it does not work well, sems crashes before rerouting.
sems-syslog.txt
juha-h commented
denyspozniak writes:
Looks like it does not work well, sems crashes before rerouting.
[sems-syslog.txt](https://github.com/sems-server/sems/files/2754988/sems-syslog.txt)
Please provide gdb backtrace (bt) of the crash:
# gdb <sems binary> <core dump file>
bt
…-- Juha
denyspozniak commented
Attached
sems_gdb.txt
juha-h commented
Try with the patch below. It worked in my tests.
```
diff --git a/core/sip/msg_hdrs.cpp b/core/sip/msg_hdrs.cpp
index ef182f8b..c8b8ea0a 100644
--- a/core/sip/msg_hdrs.cpp
+++ b/core/sip/msg_hdrs.cpp
@@ -69,6 +69,7 @@ int copy_hdrs_len_no_via_contact(const list<sip_header*>& hdrs)
switch((*it)->type) {
case sip_header::H_VIA:
case sip_header::H_CONTACT:
+ case sip_header::H_CONTENT_LENGTH:
continue;
default:
@@ -107,6 +108,7 @@ void copy_hdrs_wr_no_via_contact(char** c, const list<sip_header*>& hdrs)
switch((*it)->type) {
case sip_header::H_VIA:
case sip_header::H_CONTACT:
+ case sip_header::H_CONTENT_LENGTH:
continue;
default:
```
denyspozniak commented
Hello!
Looks like your patch fixed this issue.
Thanks!