Joe-Palmer / rtmplite

Automatically exported from code.google.com/p/rtmplite
0 stars 0 forks source link

Bad file descriptor error in siprtmp when receiving call #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Reported by Nico <nbrenner@gmail.com> on Aug 30, 2010

Hi, I'm trying to use rtmplite for a project and whenever I make a call to the 
flash client, I get an error like the one below, I was wondering if you know 
how to fix it, although it looks like it is a problem with p2p-sip. Thanks!

rtmp-accept
create answer failed to create an answer
receive RTP exception (<class 'socket.error'>, error(9, 'Bad file descriptor'), 
<traceback object at 0xb7bcb4dc>)
Traceback (most recent call last):
  File "/root/downloads/p2p-sip/src/std/rfc3550.py", line 689, in receiveRTP
    data, remote = yield multitask.recvfrom(sock, self.maxsize)
  File "/root/downloads/rtmplite/multitask.py", line 544, in recvfrom
    return FDAction(sock, sock.recvfrom, args, kwargs, read=True)
  File "/root/downloads/rtmplite/multitask.py", line 409, in __init__
    super(FDAction, self).__init__(fd, read, write, exc, timeout)
  File "/root/downloads/rtmplite/multitask.py", line 299, in __init__
    self.fd = (fd if _is_file_descriptor(fd) else fd.fileno())
  File "<string>", line 1, in fileno
  File "/opt/python-2.6.6/lib/python2.6/socket.py", line 167, in _dummy
    raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor
receive RTCP exception (<class 'socket.error'>, error(9, 'Bad file 
descriptor'), <traceback object at 0xb7bcb464>)
receive RTP exception (<class 'socket.error'>, error(9, 'Bad file descriptor'), 
<traceback object at 0xb7bcb4dc>)
Traceback (most recent call last):
  File "/root/downloads/p2p-sip/src/std/rfc3550.py", line 689, in receiveRTP
    data, remote = yield multitask.recvfrom(sock, self.maxsize)
  File "/root/downloads/rtmplite/multitask.py", line 544, in recvfrom
    return FDAction(sock, sock.recvfrom, args, kwargs, read=True)
  File "/root/downloads/rtmplite/multitask.py", line 409, in __init__
    super(FDAction, self).__init__(fd, read, write, exc, timeout)
  File "/root/downloads/rtmplite/multitask.py", line 299, in __init__
    self.fd = (fd if _is_file_descriptor(fd) else fd.fileno())
  File "<string>", line 1, in fileno
  File "/opt/python-2.6.6/lib/python2.6/socket.py", line 167, in _dummy
    raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor
receive RTCP exception (<class 'socket.error'>, error(9, 'Bad file 
descriptor'), <traceback object at 0xb7bcb464>)
sending[307] to ('74.55.36.250', 5060)
SIP/2.0 488 Incompatible SDP

---

Hi Nico,

This might be a bug in the code that both sides are not using the same
SDP session. I see the following error: "SIP/2.0 488 Incompatible SDP"

Can you enable trace log using "-d" option or setting "_debug = True"
in appropriate .py files, so that it prints the full SIP messages.
Then send me the sender and receiver's INVITE and 200 OK message
traces. That will give good deal of information about why SDP m= lines
are incompatible.

Keep in touch and good luck!

---

Thank you very much for your reply, here's the whole trace, from when I start 
the server to when the call is terminated with the error. The flow is as 
follows:
* Start siprtmp
* Connect with flash
* Originate a call to the extension registered by flash through siprtmp
* When the called is answered in flash, siprtmp throughs an error and send an 
SDP saying incompatible destination

This happens only when calling flash. If I make the call from flash, there's no 
problem.

received[1139] from ('myserver_ip', 5060)
INVITE sip:1000@127.0.0.1:60640 SIP/2.0
Via: SIP/2.0/UDP myserver_ip;rport;branch=z9hG4bKrg9D9XB2BXpvg
Max-Forwards: 70
From: "FreeSWITCH" <sip:0000000000@myserver_ip>;tag=r3474y38cjBcj
To: <sip:1000@127.0.0.1:60640>
Call-ID: cf7b348c-332c-122e-688d-001d09ef4a24
CSeq: 1488363 INVITE
Contact: <sip:mod_sofia@myserver_ip:5060>
User-Agent: FreeSWITCH-mod_sofia/1.0.trunk-15979
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, 
REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: timer, precondition, path, replaces
Allow-Events: talk, presence, dialog, line-seize, call-info, sla, 
include-session-description, presence.winfo, message-summary, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 247
X-FS-Support: update_display
Remote-Party-ID: "FreeSWITCH" 
<sip:0000000000@myserver_ip>;party=calling;screen=yes;privacy=off

v=0

o=FreeSWITCH 1283617883 1283617884 IN IP4 myserver_ip
s=FreeSWITCH
c=IN IP4 myserver_ip
t=0 0
m=audio 30972 RTP/AVP 98 101 13
a=rtpmap:98 SPEEX/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:13 CN/8000
a=ptime:20

createServer <UserAgent call-id=cf7b348c-332c-122e-688d-001d09ef4a24>
sending[280] to ('myserver_ip', 5060)
SIP/2.0 100 Trying
Content-Length: 0
Via: SIP/2.0/UDP myserver_ip;rport=5060;branch=z9hG4bKrg9D9XB2BXpvg
From: "FreeSWITCH" <sip:0000000000@myserver_ip>;tag=r3474y38cjBcj
To: <sip:1000@127.0.0.1:60640>
CSeq: 1488363 INVITE
Call-ID: cf7b348c-332c-122e-688d-001d09ef4a24

receivedRequest method= INVITE ua= <UserAgent 
call-id=cf7b348c-332c-122e-688d-001d09ef4a24>  for ua without queue
incominghandler connect
Gateway[0] onResult None
Gateway[0] onPublish sip/1000@myserver.com local
Gateway[0] onPlay sip/1000@myserver.com remote
rtmp-accept
create answer failed to create an answer
receive RTP exception (<class 'socket.error'>, error(9, 'Bad file descriptor'), 
<traceback object at 0xb7b47414>)
Traceback (most recent call last):
  File "/root/downloads/p2p-sip/src/std/rfc3550.py", line 689, in receiveRTP
    data, remote = yield multitask.recvfrom(sock, self.maxsize)
  File "/root/downloads/rtmplite/multitask.py", line 544, in recvfrom
    return FDAction(sock, sock.recvfrom, args, kwargs, read=True)
  File "/root/downloads/rtmplite/multitask.py", line 409, in __init__
    super(FDAction, self).__init__(fd, read, write, exc, timeout)

  File "/root/downloads/rtmplite/multitask.py", line 299, in __init__
    self.fd = (fd if _is_file_descriptor(fd) else fd.fileno())
  File "<string>", line 1, in fileno
  File "/opt/python-2.6.6/lib/python2.6/socket.py", line 167, in _dummy
    raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor
receive RTCP exception (<class 'socket.error'>, error(9, 'Bad file 
descriptor'), <traceback object at 0xb7b4716c>)
receive RTP exception (<class 'socket.error'>, error(9, 'Bad file descriptor'), 
<traceback object at 0xb7b473ec>)
Traceback (most recent call last):
  File "/root/downloads/p2p-sip/src/std/rfc3550.py", line 689, in receiveRTP
    data, remote = yield multitask.recvfrom(sock, self.maxsize)
  File "/root/downloads/rtmplite/multitask.py", line 544, in recvfrom
    return FDAction(sock, sock.recvfrom, args, kwargs, read=True)
  File "/root/downloads/rtmplite/multitask.py", line 409, in __init__
    super(FDAction, self).__init__(fd, read, write, exc, timeout)
  File "/root/downloads/rtmplite/multitask.py", line 299, in __init__
    self.fd = (fd if _is_file_descriptor(fd) else fd.fileno())
  File "<string>", line 1, in fileno
  File "/opt/python-2.6.6/lib/python2.6/socket.py", line 167, in _dummy
    raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor
receive RTCP exception (<class 'socket.error'>, error(9, 'Bad file 
descriptor'), <traceback object at 0xb7b4743c>)
sending[307] to ('myserver_ip', 5060)
SIP/2.0 488 Incompatible SDP
Content-Length: 0
Via: SIP/2.0/UDP myserver_ip;rport=5060;branch=z9hG4bKrg9D9XB2BXpvg
From: "FreeSWITCH" <sip:0000000000@myserver_ip>;tag=r3474y38cjBcj
To: <sip:1000@127.0.0.1:60640>;tag=109646747812
CSeq: 1488363 INVITE
Call-ID: cf7b348c-332c-122e-688d-001d09ef4a24

received[325] from ('myserver_ip', 5060)
ACK sip:1000@127.0.0.1:60640 SIP/2.0
Via: SIP/2.0/UDP myserver_ip;rport;branch=z9hG4bKrg9D9XB2BXpvg
Max-Forwards: 70
From: "FreeSWITCH" <sip:0000000000@myserver_ip>;tag=r3474y38cjBcj
To: <sip:1000@127.0.0.1:60640>;tag=109646747812
Call-ID: cf7b348c-332c-122e-688d-001d09ef4a24
CSeq: 1488363 ACK
Content-Length: 0

Gateway[0] onClose sip/1000@myserver.com local
Gateway[0] onStop sip/1000@myserver.com remote
Gateway[0] onResult None

Original issue reported on code.google.com by voiprese...@gmail.com on 5 Feb 2011 at 2:24

GoogleCodeExporter commented 9 years ago
The problem seems to be that remote sends Speex/8000 whereas by default the 
local is configured only for Speex/16000, so it cannot agree on session, 
resulting in '488 Incompatible SDP'.

To make it work, you can try changing the Flash Application's codec to 
Speex/8000. This can be done when doing the initial registration using 
rate="narrowband" parameter in NetConnection.connect(...). When using the 
testClient, you can right-click to change the codec to narrowband before 
registration.

The exception itself is not problematic: it is just that when call is 
terminated, the RTP/RTCP tasks are closed by closing the socket and detecting 
the exception.

Original comment by voiprese...@gmail.com on 5 Feb 2011 at 2:48