diff --git a/sippy/b2bua_radius.py b/sippy/b2bua_radius.py index 7334cfa..7815930 100755 --- a/sippy/b2bua_radius.py +++ b/sippy/b2bua_radius.py @@ -27,6 +27,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import sys +from functools import partial from os.path import dirname, join as p_join sys.path.append(p_join(dirname(sys.argv[0]), '..')) @@ -151,7 +152,7 @@ def __init__(self, remote_ip, source, req_source, req_target, global_config, pas if '_allowed_pts' in self.global_config: self.uaA.on_remote_sdp_change = self.filter_SDP - def filter_SDP(self, body, done_cb): + def filter_SDP(self, body, done_cb, prev_orc = None): try: body.parse() except Exception as ex: @@ -171,6 +172,8 @@ def filter_SDP(self, body, done_cb): raise SdpParseError() if old_len > len(mbody.formats): sect.optimize_a() + if prev_orc is not None: + return prev_orc(body, done_cb) return body def recvEvent(self, event, ua): @@ -345,6 +348,9 @@ def placeOriginate(self, oroute): if body is not None: body = body.getCopy() self.proxied = True + if '_allowed_pts' in self.global_config: + prev_orc = self.uaO.on_remote_sdp_change + self.uaO.on_remote_sdp_change = partial(self.filter_SDP, prev_orc=prev_orc) self.uaO.kaInterval = self.global_config['keepalive_orig'] if 'group_timeout' in oroute.params: timeout, skipto = oroute.params['group_timeout']