Search code examples
sipfreeswitchsdp

Why am I getting SIP response 400: Bad Session Description?


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.


Solution

  • 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.