lmx 1 неделя назад
Родитель
Сommit
9bb15c7b46

+ 21 - 0
src/main/java/com/telerobot/fs/entity/dao/InboundCallInfo.java

@@ -0,0 +1,21 @@
+package com.telerobot.fs.entity.dao;
+
+import lombok.Data;
+
+/**
+ * @author MixLiu
+ * @date 2026/4/28 16:43
+ * @description
+ */
+@Data
+public class InboundCallInfo {
+
+    private String uuid;
+
+    private String callBackUrl;
+
+    private Long fsCompanyId;
+
+    private Integer fsSceneType;
+
+}

+ 33 - 5
src/main/java/com/telerobot/fs/global/CdrPush.java

@@ -3,6 +3,7 @@ package com.telerobot.fs.global;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.telerobot.fs.config.SystemConfig;
 import com.telerobot.fs.config.SystemConfig;
+import com.telerobot.fs.entity.dao.InboundCallInfo;
 import com.telerobot.fs.entity.po.CdrDetail;
 import com.telerobot.fs.entity.po.CdrDetail;
 import com.telerobot.fs.entity.po.CdrEntity;
 import com.telerobot.fs.entity.po.CdrEntity;
 import com.telerobot.fs.mybatis.dao.SysDao;
 import com.telerobot.fs.mybatis.dao.SysDao;
@@ -55,12 +56,26 @@ public class CdrPush implements ApplicationListener<ApplicationReadyEvent> {
     private boolean postCdr(CdrDetail cdr){
     private boolean postCdr(CdrDetail cdr){
         try {
         try {
             String url = SystemConfig.getValue("post_cdr_url");
             String url = SystemConfig.getValue("post_cdr_url");
-            //如果有自定义回调地址 替换回调地址为自定义回调地址 否则默认回调
-            String callBackUrl = getCallBackUrlByUuid(cdr.getUuid());
-            logger.info("测试日志cdrUUid:{} ,callBackUrlByUuid: {}", cdr.getUuid(), callBackUrl);
-            if(org.apache.commons.lang3.StringUtils.isNotBlank(callBackUrl)){
-                url = callBackUrl;
+            if ("inbound".equals(cdr.getCdrType())) {
+                logger.info("{} is inbound cdr.", cdr.getUuid());
+                //如果有自定义回调地址 替换回调地址为自定义回调地址 否则默认回调
+                InboundCallInfo info = getInboundCallBackUrlByUuid(cdr.getUuid());
+                if (null != info && org.apache.commons.lang3.StringUtils.isNotBlank(info.getCallBackUrl())) {
+                    String callBackUrl = info.getCallBackUrl();
+                    logger.info("呼入日志cdrUUid:{} ,getInboundCallBackUrlByUuid: {}", cdr.getUuid(), callBackUrl);
+                    if (org.apache.commons.lang3.StringUtils.isNotBlank(callBackUrl)) {
+                        url = callBackUrl;
+                    }
+                }
+            } else {
+                //如果有自定义回调地址 替换回调地址为自定义回调地址 否则默认回调
+                String callBackUrl = getCallBackUrlByUuid(cdr.getUuid());
+                logger.info("呼出日志cdrUUid:{} ,callBackUrlByUuid: {}", cdr.getUuid(), callBackUrl);
+                if (org.apache.commons.lang3.StringUtils.isNotBlank(callBackUrl)) {
+                    url = callBackUrl;
+                }
             }
             }
+
             logger.info("测试日志最后请求的url:{}",url);
             logger.info("测试日志最后请求的url:{}",url);
             if (StringUtils.isNullOrEmpty(url)) {
             if (StringUtils.isNullOrEmpty(url)) {
                 logger.error("post_cdr_url  has not been configured yet.");
                 logger.error("post_cdr_url  has not been configured yet.");
@@ -114,4 +129,17 @@ public class CdrPush implements ApplicationListener<ApplicationReadyEvent> {
         }
         }
         return null;
         return null;
     }
     }
+
+    /**
+     * 呼入回调地址替换
+     * @param uuid
+     * @return
+     */
+    private InboundCallInfo getInboundCallBackUrlByUuid(String uuid) {
+        InboundCallInfo inboundCallInfoByUuid = sysDao.getInboundCallInfoByUuid(uuid);
+        if(null != inboundCallInfoByUuid){
+            return inboundCallInfoByUuid;
+        }
+        return null;
+    }
 }
 }

+ 4 - 4
src/main/java/com/telerobot/fs/mybatis/dao/SysDao.java

@@ -1,13 +1,11 @@
 package com.telerobot.fs.mybatis.dao;
 package com.telerobot.fs.mybatis.dao;
 
 
-import com.telerobot.fs.entity.dao.BizGroup;
-import com.telerobot.fs.entity.dao.CcExtNum;
-import com.telerobot.fs.entity.dao.ExtPowerConfig;
-import com.telerobot.fs.entity.dao.LlmKb;
+import com.telerobot.fs.entity.dao.*;
 import com.telerobot.fs.entity.dto.AgentEx;
 import com.telerobot.fs.entity.dto.AgentEx;
 import com.telerobot.fs.entity.po.AgentEntity;
 import com.telerobot.fs.entity.po.AgentEntity;
 import com.telerobot.fs.entity.po.SysParams;
 import com.telerobot.fs.entity.po.SysParams;
 import com.telerobot.fs.wshandle.SessionEntity;
 import com.telerobot.fs.wshandle.SessionEntity;
+import org.apache.ibatis.annotations.Param;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -75,4 +73,6 @@ public interface SysDao {
 	int updateExtension(CcExtNum ccExtNum);
 	int updateExtension(CcExtNum ccExtNum);
 
 
 	List<CcExtNum> selectAllExtensions();
 	List<CcExtNum> selectAllExtensions();
+
+	InboundCallInfo getInboundCallInfoByUuid(String uuid);
 }
 }

+ 10 - 4
src/main/java/com/telerobot/fs/mybatis/dao/SysDaoImpl.java

@@ -1,9 +1,6 @@
 package com.telerobot.fs.mybatis.dao;
 package com.telerobot.fs.mybatis.dao;
 
 
-import com.telerobot.fs.entity.dao.BizGroup;
-import com.telerobot.fs.entity.dao.CcExtNum;
-import com.telerobot.fs.entity.dao.ExtPowerConfig;
-import com.telerobot.fs.entity.dao.LlmKb;
+import com.telerobot.fs.entity.dao.*;
 import com.telerobot.fs.entity.dto.AgentEx;
 import com.telerobot.fs.entity.dto.AgentEx;
 import com.telerobot.fs.entity.po.AgentEntity;
 import com.telerobot.fs.entity.po.AgentEntity;
 import com.telerobot.fs.entity.po.SysParams;
 import com.telerobot.fs.entity.po.SysParams;
@@ -152,4 +149,13 @@ public class SysDaoImpl implements SysDao {
 	public List<CcExtNum> selectAllExtensions() {
 	public List<CcExtNum> selectAllExtensions() {
 		return mapper.selectAllExtensions();
 		return mapper.selectAllExtensions();
 	}
 	}
+
+	/**
+	 * 获取呼入回调信息
+	 * @param uuid
+	 * @return
+	 */
+	public InboundCallInfo getInboundCallInfoByUuid(String uuid){
+		return mapper.getInboundCallInfoByUuid(uuid);
+	}
 }
 }

+ 3 - 4
src/main/java/com/telerobot/fs/mybatis/persistence/SysMapper.java

@@ -1,9 +1,6 @@
 package com.telerobot.fs.mybatis.persistence;
 package com.telerobot.fs.mybatis.persistence;
 
 
-import com.telerobot.fs.entity.dao.BizGroup;
-import com.telerobot.fs.entity.dao.CcExtNum;
-import com.telerobot.fs.entity.dao.ExtPowerConfig;
-import com.telerobot.fs.entity.dao.LlmKb;
+import com.telerobot.fs.entity.dao.*;
 import com.telerobot.fs.entity.dto.AgentEx;
 import com.telerobot.fs.entity.dto.AgentEx;
 import com.telerobot.fs.entity.po.AgentEntity;
 import com.telerobot.fs.entity.po.AgentEntity;
 import com.telerobot.fs.entity.po.SysParams;
 import com.telerobot.fs.entity.po.SysParams;
@@ -89,4 +86,6 @@ public interface SysMapper {
 	int updateExtension(CcExtNum ccExtNum);
 	int updateExtension(CcExtNum ccExtNum);
 
 
 	List<CcExtNum> selectAllExtensions();
 	List<CcExtNum> selectAllExtensions();
+
+	InboundCallInfo getInboundCallInfoByUuid(@Param("uuid") String uuid);
 }
 }

+ 12 - 0
src/main/resources/com/telerobot/fs/mybatis/persistence/SysMapper.xml

@@ -252,4 +252,16 @@
             cc_ext_num
             cc_ext_num
     </select>
     </select>
 
 
+	<select id="getInboundCallInfoByUuid" resultType="com.telerobot.fs.entity.dao.InboundCallInfo">
+		select
+			t1.uuid,
+			t2.call_back_url,
+			t2.fs_company_id,
+			t2.fs_scene_type
+		from cc_inbound_cdr t1
+				 inner join cc_inbound_llm_account t2 on t1.callee = t2.callee
+		where  t1.uuid = #{uuid}
+			limit 1
+	</select>
+
 </mapper>
 </mapper>