Skip to content

Commit

Permalink
Merge pull request #147 from tayler6000/bugfix/Issue-96
Browse files Browse the repository at this point in the history
Fixes #96
  • Loading branch information
tayler6000 committed Jun 7, 2023
2 parents 0eafe8c + e490193 commit be2e18c
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions pyVoIP/VoIP.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ def __init__(
return

for i in request.body["m"]:
if i["type"] == "video": # Disable Video
continue
assoc = {}
e = False
for x in i["methods"]:
Expand Down Expand Up @@ -159,8 +161,12 @@ def __init__(
assoc[int(x)] = p

if e:
if pt:
raise RTP.RTPParseError(
f"RTP Payload type {pt} not found."
)
raise RTP.RTPParseError(
f"RTP Payload type {pt} not found."
"RTP Payload type could not be derived from SDP."
)

# Make sure codecs are compatible.
Expand Down Expand Up @@ -290,6 +296,8 @@ def renegotiate(self, request: SIP.SIPMessage) -> None:
message.encode("utf8"), (self.phone.server, self.phone.port)
)
for i in request.body["m"]:
if i["type"] == "video": # Disable Video
continue
for ii, client in zip(
range(len(request.body["c"])), self.RTPClients
):
Expand All @@ -313,8 +321,9 @@ def answered(self, request: SIP.SIPMessage) -> None:
return

for i in request.body["m"]:
if i["type"] == "video": # Disable Video
continue
assoc = {}
e = False
for x in i["methods"]:
try:
p = RTP.PayloadType(int(x))
Expand All @@ -326,10 +335,13 @@ def answered(self, request: SIP.SIPMessage) -> None:
)
assoc[int(x)] = p
except ValueError:
e = True

if e:
raise RTP.RTPParseError(f"RTP Payload type {p} not found.")
if p:
raise RTP.RTPParseError(
f"RTP Payload type {p} not found."
)
raise RTP.RTPParseError(
"RTP Payload type could not be derived from SDP."
)

self.createRTPClients(
assoc, self.myIP, self.port, request, i["port"]
Expand Down

0 comments on commit be2e18c

Please sign in to comment.