Davidliu 2 月之前
父節點
當前提交
44ce93e3ee
共有 3 個文件被更改,包括 25 次插入2 次删除
  1. 二進制
      src.tar.gz
  2. 4 2
      src/core/callcenter/api.py
  3. 21 0
      src/core/callcenter/test.py

二進制
src.tar.gz


+ 4 - 2
src/core/callcenter/api.py

@@ -284,12 +284,14 @@ class MakeCallContext(BaseApi):
 
         if self.device_type == DeviceType.CUSTOMER.code:
             headers += [
-                "RECORD_STEREO_SWAP=true"
+                "RECORD_STEREO_SWAP=true",
+                "rx_gain=30"
             ]
         else:
             headers += [
                 "RECORD_STEREO_SWAP=false",
-                "continue_on_fail=true"
+                "continue_on_fail=true",
+                "rx_gain=30"
             ]
 
         if self.sip_header_map:

+ 21 - 0
src/core/callcenter/test.py

@@ -4,3 +4,24 @@
 # TestStr = "能帮我查一下,我家水费欠多少"
 # seg_list = jieba.cut(TestStr, cut_all=False, HMM=True)
 # print ("Default Mode:", "/ ".join(seg_list))
+
+import uuid
+import mmh3
+
+from src.core.callcenter.dao import Bucket
+
+def get_bucket(custom_uuid=None, buckets=[]):
+    random_id = abs(mmh3.hash(custom_uuid))
+    for bucket in buckets:
+        num = (random_id % 100 + 100) % 100
+        if bucket.lower <= num < bucket.upper:
+            return num, bucket
+    return -1, buckets[0]
+
+if __name__ == '__main__':
+    arr = ['C1879412349555838976','C1879412206890782720','C1879411969535119360','C1879411406290423808','C1879408024871899136','C1879407680997691392','C1879406254007390208','C1879404740748644352','C1879403850650226688','C1879402961977872384','C1879402509785763840','C1879402237567045632','C1879402005592674304','C1879400827102302208','C1879400778024751104','C1879400705488457728','C1879400533513605120','C1879400336188379136','C1879400327959154688','C1879399300082044928','C1879399233669435392','C1879396009050771456','C1879394097295396864','C1879393224498483200','C1879381728368398336','C1879381287505104896','C1879379466774515712','C1879376723787780096','C1879374004641468416','C1879373548330553344','C1879372415646175232','C1879367459866284032','C1879365634769424384','C1879364921326702592','C1879364787436130304','C1879363948554358784','C1879362454358724608','C1879360081448013824','C1879358294565457920','C1879358151116066816','C1879357497190518784','C1879357257641234432','C1879357023229972480','C1879355792935751680','C1879355755749052416','C1879354039309832192']
+    buckets=[Bucket(id=1, name="传统", lower=0, upper=90), Bucket(id=2, name="AI",lower=90, upper=100)]
+    for custom_uuid in arr:
+        num, bucket = get_bucket(custom_uuid=custom_uuid, buckets=buckets)
+        print(custom_uuid, num, bucket.name)
+