

def __init__(self, global_config, *address, **kwargs):
    no_version_check = False
    if kwargs.has_key('no_version_check'):
        no_version_check = kwargs['no_version_check']
        del kwargs['no_version_check']
    if ((len(address) == 0) and kwargs.has_key('spath')):
        a = kwargs['spath']
        del kwargs['spath']
        if a.startswith('udp:'):
            a = a.split(':', 2)
            if (len(a) == 2):
                rtppa = (a[1], 22222)
            else:
                rtppa = (a[1], int(a[2]))
            self.proxy_address = rtppa[0]
            kwargs['family'] = socket.AF_INET
            self.rtpp_class = Rtp_proxy_client_udp
        elif a.startswith('udp6:'):
            (proto, a) = a.split(':', 1)
            if (not a.endswith(']')):
                a = a.rsplit(':', 1)
                if (len(a) == 1):
                    (rtp_proxy_host, rtp_proxy_port) = (a[0], 22222)
                else:
                    (rtp_proxy_host, rtp_proxy_port) = (a[0], int(a[1]))
            else:
                (rtp_proxy_host, rtp_proxy_port) = (a, 22222)
            if (not rtp_proxy_host.startswith('[')):
                rtp_proxy_host = ('[%s]' % rtp_proxy_host)
            rtppa = (rtp_proxy_host, rtp_proxy_port)
            self.proxy_address = rtppa[0]
            kwargs['family'] = socket.AF_INET6
            self.rtpp_class = Rtp_proxy_client_udp
        elif a.startswith('tcp:'):
            a = a.split(':', 2)
            if (len(a) == 2):
                rtppa = (a[1], 22222)
            else:
                rtppa = (a[1], int(a[2]))
            self.proxy_address = rtppa[0]
            kwargs['family'] = socket.AF_INET
            self.rtpp_class = Rtp_proxy_client_stream
        elif a.startswith('tcp6:'):
            (proto, a) = a.split(':', 1)
            if (not a.endswith(']')):
                a = a.rsplit(':', 1)
                if (len(a) == 1):
                    (rtp_proxy_host, rtp_proxy_port) = (a[0], 22222)
                else:
                    (rtp_proxy_host, rtp_proxy_port) = (a[0], int(a[1]))
            else:
                (rtp_proxy_host, rtp_proxy_port) = (a, 22222)
            if (not rtp_proxy_host.startswith('[')):
                rtp_proxy_host = ('[%s]' % rtp_proxy_host)
            rtppa = (rtp_proxy_host, rtp_proxy_port)
            self.proxy_address = rtppa[0]
            kwargs['family'] = socket.AF_INET6
            self.rtpp_class = Rtp_proxy_client_stream
        else:
            if a.startswith('unix:'):
                rtppa = a[5:]
            elif a.startswith('cunix:'):
                rtppa = a[6:]
            else:
                rtppa = a
            self.proxy_address = global_config['_sip_address']
            kwargs['family'] = socket.AF_UNIX
            self.rtpp_class = Rtp_proxy_client_stream
        self.rtpp_class.__init__(self, global_config, rtppa, **kwargs)
    elif ((len(address) > 0) and (type(address[0]) in (tuple, list))):
        self.rtpp_class = Rtp_proxy_client_udp
        Rtp_proxy_client_udp.__init__(self, global_config, *address, **kwargs)
        self.proxy_address = address[0]
    else:
        self.rtpp_class = Rtp_proxy_client_stream
        Rtp_proxy_client_stream.__init__(self, global_config, *address, **kwargs)
        self.proxy_address = global_config['_sip_address']
    if (not no_version_check):
        proto.version_check()
    else:
        self.caps_done = True
        self.online = True

dataset/ETHPy150Open sippy/b2bua/sippy/Rtp_proxy_client.py Rtp_proxy_client.__init__/VarMisuse@813/1121 `self`->`proto`