0

I dumped The following SIP INVITE datagram from Linphone to a file with CR-LF line breaks, using wireshark:

INVITE sip:1002@172.16.76.21 SIP/2.0 
Via: SIP/2.0/UDP 172.16.76.21:5060;rport;branch=z9hG4bK1936726928 
From: <sip:1555@172.16.76.21>;tag=1350138383 
To: <sip:1002@172.16.76.21> 
Call-ID: 1393698667 
CSeq: 20 INVITE 
Contact: <sip:1555@172.16.76.20> 
Content-Type: application/sdp 
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO 
Max-Forwards: 70 
User-Agent: Linphone/3.5.2 (eXosip2/3.6.0) 
Subject: Phone call 
Content-Length:   205 

v=0 
o=1555 1125 1125 IN IP4 172.16.76.21 
s=Talk 
c=IN IP4 172.16.76.21
t=0 0 
m=audio 7078 RTP/AVP 8 0 101 
a=rtpmap:8 PCMA/8000 
a=rtpmap:0 PCMU/8000 
a=rtpmap:101 telephone-event/8000 
a=fmtp:101 0-11

I wrote a simple Python script that reads the file binary, puts in a UDP datagram and sends through a a socket bound to port 5060. When I send this to a client running user agent, I get 200 OK. When I try to send it to our SIP proxy, FreeSwitch, I get 400 Bad Session Description.

FreeSwitch responded with 200 OK when this message was originally sent by Linphone.

Atilla Filiz
  • 2,383
  • 8
  • 29
  • 47

2 Answers2

2

Apparently FreeSwitch does not tolerate them.

It's not an issue of FreeSwitch. As suggested by @Stanislav in his comment, your "Content-Length" value is wrong. It must be "Content-Length: 213" for your Session Description.

srkrish
  • 273
  • 4
  • 12
  • I am not blaming FreeSwitch, I am stating a fact. MY SIP message had extra white spaces and removing them fixed the problem. True, content-length is also wrong, but it did not matter in this case. – Atilla Filiz Nov 19 '13 at 14:35
  • Atilla, not completely true: your wrong content-length told the recpipient to cut off everything after 205 bytes. So, the last line is cut in the middle and it is indeed a broken format for session description – Stanislav Sinyagin Nov 19 '13 at 16:30
  • @AtillaFiliz Your SDP has 213 characters. So setting the Content-Length to 213 would work. Removing the whitespace worked because, after removing the trailing whitespaces the SDP indeed contained 205 characters. – srkrish Nov 20 '13 at 10:47
0

Most of these lines have trailing extra whitespaces. Apparently FreeSwitch does not tolerate them. Removing the trailing spaces works.

Also content-length is wrong. It should be 213.

Atilla Filiz
  • 2,383
  • 8
  • 29
  • 47