Beispiel #1
0
 def __init__(self, global_config, *address):
     #print 'Rtp_proxy_client', address
     if len(address) > 0 and type(address[0]) in (tuple, list):
         Rtp_proxy_client_udp.__init__(self, global_config, *address)
     else:            
         Rtp_proxy_client_local.__init__(self, global_config, *address)
     self.version_check()
Beispiel #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
             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
             rtpp_class = Rtp_proxy_client_udp
         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']
             rtpp_class = Rtp_proxy_client_local
         rtpp_class.__init__(self, global_config, rtppa, **kwargs)
     elif len(address) > 0 and type(address[0]) in (tuple, list):
         Rtp_proxy_client_udp.__init__(self, global_config, *address, \
           **kwargs)
         self.proxy_address = address[0]
     else:
         Rtp_proxy_client_local.__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
Beispiel #3
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
             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
             rtpp_class = Rtp_proxy_client_udp
         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"]
             rtpp_class = Rtp_proxy_client_local
         rtpp_class.__init__(self, global_config, rtppa, **kwargs)
     elif len(address) > 0 and type(address[0]) in (tuple, list):
         Rtp_proxy_client_udp.__init__(self, global_config, *address, **kwargs)
         self.proxy_address = address[0]
     else:
         Rtp_proxy_client_local.__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
Beispiel #4
0
 def __init__(self, global_config, *address, **kwargs):
     #print 'Rtp_proxy_client', address
     if len(address) > 0 and type(address[0]) in (tuple, list):
         Rtp_proxy_client_udp.__init__(self, global_config, *address, \
           **kwargs)
         self.proxy_address = address[0]
     else:            
         Rtp_proxy_client_local.__init__(self, global_config, *address, \
           **kwargs)
         self.proxy_address = global_config['_sip_address']
     self.version_check()
Beispiel #5
0
 def shutdown(self):
     if self.shut_down: # do not crash when shutdown() called twice
         return
     self.shut_down = True
     if self.is_local:
         return Rtp_proxy_client_local.shutdown(self)
     else:
         return Rtp_proxy_client_udp.shutdown(self)
Beispiel #6
0
 def send_command(self, *args, **kwargs):
     if self.is_local:
         Rtp_proxy_client_local.send_command(self, *args, **kwargs)
     else:
         Rtp_proxy_client_udp.send_command(self, *args, **kwargs)
Beispiel #7
0
 def shutdown(self):
     self.shut_down = True
     if self.is_local:
         return Rtp_proxy_client_local.shutdown(self)
     else:
         return Rtp_proxy_client_udp.shutdown(self)
Beispiel #8
0
 def get_rtpc_delay(self):
     if self.is_local:
         return Rtp_proxy_client_local.get_rtpc_delay(self)
     else:
         return Rtp_proxy_client_udp.get_rtpc_delay(self)
Beispiel #9
0
 def reconnect(self, *args, **kwargs):
     if self.is_local:
         Rtp_proxy_client_local.reconnect(self, *args, **kwargs)
     else:
         Rtp_proxy_client_udp.reconnect(self, *args, **kwargs)