Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable parsing Video media from SDP #96

Closed
SEIDO-JP opened this issue Jan 17, 2023 · 4 comments · Fixed by #147
Closed

Disable parsing Video media from SDP #96

SEIDO-JP opened this issue Jan 17, 2023 · 4 comments · Fixed by #147
Labels
bug Something isn't working

Comments

@SEIDO-JP
Copy link
Contributor

SEIDO-JP commented Jan 17, 2023

Hi,
For now - when client e.g. answer for INVITE with SDP which contain Video Media type -> library is not working properly.

There is example SDP which I'm talking about:

b'SIP/2.0 200 OK\r\n
(...)
Content-Length: 363\r\n\r\n

v=0\r\n
o=INTTSI 901594 901594 IN IP4 192.168.44.199\r\n
s=SIP INT-TSI v1.0.0.0\r\n
c=IN IP4 192.168.44.199\r\n
t=0 0\r\n
m=audio 20007 RTP/AVP 0 8 101\r\n
a=rtpmap:0 PCMU/8000\r\n
a=rtpmap:8 PCMA/8000\r\n
a=rtpmap:101 telephone-event/8000\r\n
a=fmtp:101 0-15\r\n
a=sendrecv\r\n
m=video 10000 RTP/AVP 96\r\n
a=rtpmap:96 H264/90000\r\n
a=fmtp:96 profile-level-id=428016; packetization-mode=1\r\n
a=recvonly\r\n\r\n'

Maybe there is a possibility to disable parsing video part and treat such device as audio only (because PyVoIP do not support video).
My proposition just for now is add:
if i['type'] == 'video': continue

there:

pyVoIP/pyVoIP/VoIP.py

Lines 311 to 315 in 765cb1f

def answered(self, request: SIP.SIPMessage) -> None:
if self.state != CallState.DIALING:
return
for i in request.body["m"]:

and there:

for i in request.body["m"]:

I mean something like this:

(...)
      for i in request.body["m"]:
          if i['type'] == 'video': continue
          assoc = {}
          e = False
(...)

Best regards,
Jakub

@tayler6000
Copy link
Owner

What error are you getting? Can you post the stack trace here? Eventually, video may be supported by pyVoIP so I'd rather fix the error instead of using a continue line to kick the can down the road so to speak.

@SEIDO-JP
Copy link
Contributor Author

I can not reproduce this situation now because I don't have this device (which send 200 OK answer with SDP with video part) in my hands until monday, so I can't post stack trace.

But as I remember there was a problem with this method:

def answered(self, request: SIP.SIPMessage) -> None:

Where Payload Type in SDP message is H264 and then there is rised exception:
raise RTP.RTPParseError(f"RTP Payload type {p} not found.")

(BTW with incorrect {p} value - it isn't set anywhere when Exception occur)

I know that H264 isn't even on the list of Payloads but this device which I'm trying to use with PyVOIP library (touch panel for home alarm) is always sending m=video ... part in SDP message.

@tayler6000
Copy link
Owner

Ok, if there is an error because p is not set that might be what's going on then. I assume this is happening in master?

@SEIDO-JP
Copy link
Contributor Author

SEIDO-JP commented Jan 23, 2023

Yes, I'm using Master - version 1.6.3.
But this unset p it's only a side effect, not main problem here :) It's only showed incorrect in log.

For now - if there is m=video ... descriptor in SDP, in 200 OK response for INVITE (look at first message for the example I pasted), then any conversation cannot start.
Either because there is error raised if it's used unknown video codec (and no RTP client is created), or there are created two RTPClients (with "supported" video codec) which both of them are trying to socket.bind to these same IP and Port.

@tayler6000 tayler6000 added the bug Something isn't working label May 9, 2023
@tayler6000 tayler6000 added this to pyVoIP May 9, 2023
@github-project-automation github-project-automation bot moved this to Todo - Release in pyVoIP May 9, 2023
@tayler6000 tayler6000 moved this from Todo - Release to Todo - Patching in pyVoIP May 9, 2023
@tayler6000 tayler6000 moved this from Todo - Patching to Done in pyVoIP Jun 5, 2023
tayler6000 added a commit that referenced this issue Jun 7, 2023
Fixed #55
Fixed #96
Fixed #146

Co-authored-by: SEIDO-JP <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants