Пример #1
0
 def __init__(self, global_config, address = '/var/run/rtpproxy.sock', \
   bind_address = None, nworkers = 1):
     Rtp_proxy_client_stream.__init__(self, global_config = global_config, \
       address = address, bind_address = bind_address, nworkers = nworkers, \
       family = socket.AF_UNIX)
Пример #2
0
 def __init__(self, global_config, *address, **kwargs):
     #print 'Rtp_proxy_client', address
     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:
         self.version_check()
     else:
         self.caps_done = True
         self.online = True
Пример #3
0
 def __init__(self, global_config, address = '/var/run/rtpproxy.sock', \
   bind_address = None, nworkers = 1):
     Rtp_proxy_client_stream.__init__(self, global_config = global_config, \
       address = address, bind_address = bind_address, nworkers = nworkers, \
       family == socket.AF_UNIX)
Пример #4
0
 def __init__(self, global_config, *address, **kwargs):
     #print 'Rtp_proxy_client', address
     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
         self.proxy_address = address[0][0]
         Rtp_proxy_client_udp.__init__(self, global_config, *address, \
           **kwargs)
     else:
         self.rtpp_class = Rtp_proxy_client_stream
         self.proxy_address = global_config['_sip_address']
         Rtp_proxy_client_stream.__init__(self, global_config, *address, \
           **kwargs)
     if not no_version_check:
         self.version_check()
     else:
         self.caps_done = True
         self.online = True