Skip to content

Commit

Permalink
Unify and streamline delayed SDP updates processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Jul 28, 2024
1 parent 0ea583d commit 82ea7c1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
8 changes: 3 additions & 5 deletions sippy/Rtp_proxy/Session/side.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,16 @@ def _stop_play(self, rtpps, result_callback = None, index = 0):
command = 'S %s %s %s' % ('%s-%d' % (rtpps.call_id, index), from_tag, to_tag)
rtpps.rtpp_seq.send_command(command, rtpps.command_result, result_callback)

def _on_sdp_change(self, rtpps, sdp_body, result_callback, en_excpt):
def on_sdp_change(self, rtpps, sdp_body, result_callback):
sects = []
try:
sdp_body.parse()
except Exception as exception:
is_spe = isinstance(exception, SdpParseError)
if not is_spe:
dump_exception('can\'t parse SDP body', extra = sdp_body.content)
if is_spe or en_excpt:
raise exception
else:
return
result_callback(None, ex=exception)
return
sdp_bc = sdp_body.content
if isinstance(sdp_bc, strtypes):
sdp_body.needs_update = False
Expand Down
6 changes: 0 additions & 6 deletions sippy/Rtp_proxy/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,6 @@ def delete(self):
self.rtp_proxy_client = None
self.rtpp_seq.delete()

def on_caller_sdp_change(self, sdp_body, result_callback, en_excpt = False):
self.caller._on_sdp_change(self, sdp_body, result_callback, en_excpt)

def on_callee_sdp_change(self, sdp_body, result_callback, en_excpt = False):
self.callee._on_sdp_change(self, sdp_body, result_callback, en_excpt)

def stats(self, result_callback, index = 0, *callback_parameters):
command = 'Q %s %s %s' % ('%s-%d' % (self.call_id, index), self.from_tag, self.to_tag)
self.rtp_proxy_client.send_command(command, self.stats_result, (result_callback, callback_parameters))
Expand Down
2 changes: 1 addition & 1 deletion sippy/UaStateConnected.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def recvEvent(self, event):
return None
if body != None and self.ua.on_local_sdp_change != None and body.needs_update:
try:
self.ua.on_local_sdp_change(body, partial(self.ua.delayed_local_sdp_update, event), en_excpt = True)
self.ua.on_local_sdp_change(body, partial(self.ua.delayed_local_sdp_update, event))
except Exception as e:
event = CCEventFail((400, 'Malformed SDP Body'), rtime = event.rtime)
event.setWarning(str(e))
Expand Down
2 changes: 1 addition & 1 deletion sippy/UacStateUpdating.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def recvResponse(self, resp, tr):
if self.ua.on_remote_sdp_change != None:
cb_func = partial(self.ua.delayed_remote_sdp_update, event)
try:
self.ua.on_remote_sdp_change(body, cb_func, en_excpt = True)
self.ua.on_remote_sdp_change(body, cb_func)
except Exception as e:
event = CCEventFail((502, 'Bad Gateway'), rtime = event.rtime)
event.setWarning('Malformed SDP Body received from ' \
Expand Down
4 changes: 2 additions & 2 deletions sippy/b2bua_radius.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ def placeOriginate(self, oroute):
if self.source != oroute.params.get('outbound_proxy', None):
self.uaO.outbound_proxy = oroute.params.get('outbound_proxy', None)
if self.rtp_proxy_session != None and oroute.params.get('rtpp', True):
self.uaO.on_local_sdp_change = self.rtp_proxy_session.on_caller_sdp_change
self.uaO.on_remote_sdp_change = self.rtp_proxy_session.on_callee_sdp_change
self.uaO.on_local_sdp_change = self.rtp_proxy_session.caller.on_sdp_change
self.uaO.on_remote_sdp_change = self.rtp_proxy_session.callee.on_sdp_change
if not nh_address[0].endswith('.invalid'):
self.rtp_proxy_session.caller.raddress = nh_address
elif oroute.hostport == DST_WSS_UA:
Expand Down

0 comments on commit 82ea7c1

Please sign in to comment.