Commits

Shuge Lee committed 1dddb91

fixed NameError in captcha module; fixed sipc_proxy node not found in new version sys config

Comments (0)

Files changed (3)

         headers = {
             'Cookie' : 'ssic=%s' % self._ssi_cookie,
             "Connection" : "close",
-            "User-Agent" : "IIC2.0/PC %s" % sys_config.FETION_PROTOCOL_VERSION,
+            "User-Agent" : "IIC2.0/PC %s" % sys_config.SysConfig.FETION_PROTOCOL_VERSION,
             }
 
         httplib.HTTPConnection.response_class = http.HTTPResponse
 SERVICE_URI = "sip:10000@fetion.com.cn;p=100"
 SERVICE_USER_ID = "10000"
 
+SIPC_PROXY = "58.68.229.64:8080"
+#SIPC_SSL_PROXY = "58.68.229.64:443"
+SIPC_PROXY_BACKUP = "221.176.31.4:8080"
+#SIPC_SSL_PROXY_BACKUP = "221.176.31.4:443"
 
 OK = httplib.OK
 SEND_SMS_OK = 280

sipc/sipc_register.py

 def _get_digest(user_obj):
     sock = socket.socket()
 
-    splits = user_obj.sys_config.sipc_proxy.split(":")
+    sipc_proxy = getattr(user_obj.sys_config, "sipc_proxy", core.SIPC_PROXY)
+    splits = sipc_proxy.split(":")
     ip, port = splits[0], int(splits[1])
 
     try:
         sock.connect((ip, port))
     except socket.error:
         sock = socket.socket()
-        splits = user_obj.sys_config.sipc_proxy_backup.split(":")
+
+        sipc_proxy_backup = getattr(user_obj.sys_config, "sipc_proxy_backup", core.SIPC_PROXY_BACKUP)
+        splits = sipc_proxy_backup.split(":")
         ip, port = splits[0], int(splits[1])
 
         msg = "using SIP-C backup proxy server %s:%d" % (ip, port)
         "I" : call_id,
         "Q" : cseq,
         "CN" : _generate_cnouce(),
-        "CL" : 'type="%s" ,version="%s"' % (device_type, sys_config.FETION_PROTOCOL_VERSION),
+        "CL" : 'type="%s" ,version="%s"' % (device_type, sys_config.SysConfig.FETION_PROTOCOL_VERSION),
         }
 
     req_first_line = "%s fetion.com.cn SIP-C/4.0" % core.SIPC_METHOD_REGISTER