diff --git a/plugins/freeswitch/src/main/java/com/bytedesk/freeswitch/controller/FreeswitchController.java b/plugins/freeswitch/src/main/java/com/bytedesk/freeswitch/controller/FreeswitchController.java new file mode 100644 index 0000000000..f64b93bf68 --- /dev/null +++ b/plugins/freeswitch/src/main/java/com/bytedesk/freeswitch/controller/FreeswitchController.java @@ -0,0 +1,91 @@ +/* + * @Author: jackning 270580156@qq.com + * @Date: 2025-06-03 14:10:02 + * @LastEditors: jackning 270580156@qq.com + * @LastEditTime: 2025-06-03 14:46:13 + * @Description: bytedesk.com https://github.com/Bytedesk/bytedesk + * Please be aware of the BSL license restrictions before installing Bytedesk IM – + * selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license. + * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE + * contact: 270580156@qq.com + * 联系:270580156@qq.com + * Copyright (c) 2025 by bytedesk.com, All Rights Reserved. + */ +package com.bytedesk.freeswitch.controller; + +import com.bytedesk.freeswitch.service.CallService; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.web.PageableDefault; +import org.springframework.security.core.annotation.AuthenticationPrincipal; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +@Controller +@RequestMapping("/callcenter") +public class FreeswitchController { + + @Autowired + private CallService callService; + + // 添加用户信息到所有请求 + @ModelAttribute + public void addAttributes(@AuthenticationPrincipal UserDetails userDetails, Model model) { + if (userDetails != null) { + model.addAttribute("currentUser", userDetails); + } + } + + // 呼叫中心首页 + // http://127.0.0.1:9003/callcenter/ + @GetMapping({"", "/"}) + public String index(Model model) { + // 获取呼叫中心统计数据 + model.addAttribute("totalCalls", callService.countTotalCalls()); + model.addAttribute("activeCalls", callService.countActiveCalls()); + model.addAttribute("missedCalls", callService.countMissedCalls()); + model.addAttribute("avgDuration", callService.getAverageCallDuration()); + return "callcenter/index"; + } + + // 历史通话记录页面 + @GetMapping("/history") + public String callHistory(Model model, + @RequestParam(required = false) String keyword, + @RequestParam(required = false) String status, + @PageableDefault(size = 10, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable) { + + model.addAttribute("calls", callService.getCallHistory(keyword, status, pageable)); + model.addAttribute("keyword", keyword); + model.addAttribute("status", status); + return "callcenter/history"; + } + + // 我的通话记录 + @GetMapping("/user/calls") + public String userCalls(@AuthenticationPrincipal UserDetails userDetails, Model model, + @PageableDefault(size = 10, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable) { + + String userId = userDetails.getUsername(); + model.addAttribute("calls", callService.getUserCalls(userId, pageable)); + return "callcenter/user-calls"; + } + + // 管理员页面 - 实时监控 + @GetMapping("/admin/monitor") + public String monitorCalls(Model model) { + model.addAttribute("activeCalls", callService.getActiveCalls()); + return "callcenter/admin/monitor"; + } + + // 管理员页面 - 座席状态 + @GetMapping("/admin/agents") + public String agentStatus(Model model) { + model.addAttribute("agents", callService.getAgentStatus()); + return "callcenter/admin/agents"; + } +} diff --git a/plugins/freeswitch/src/main/resources/templates/ftl/callcenter/index.ftl b/plugins/freeswitch/src/main/resources/templates/ftl/callcenter/index.ftl new file mode 100644 index 0000000000..ec9350357a --- /dev/null +++ b/plugins/freeswitch/src/main/resources/templates/ftl/callcenter/index.ftl @@ -0,0 +1,215 @@ +<#import "layout/base.ftl" as base> + +<@base.base title="ByteDesk 呼叫中心"> + +
+
+

FreeSWITCH 呼叫中心系统

+

专业智能的企业级通信解决方案,提供高质量的语音呼叫服务

+
+
+ + +
+
+
+
+
📞
+
总通话量
+

${totalCalls!'0'}

+
+
+
+
+
+
+
🔄
+
当前活动通话
+

${activeCalls!'0'}

+
+
+
+
+
+
+
+
未接来电
+

${missedCalls!'0'}

+
+
+
+
+
+
+
⏱️
+
平均通话时长
+

${avgDuration!'0'}分钟

+
+
+
+
+ + +
+
+
+
+

ByteDesk 呼叫中心解决方案

+

我们基于FreeSWITCH打造的呼叫中心系统,为企业提供高效、稳定、灵活的通信服务

+ +
+
+
+
+
☎️
+
+
+
语音通话
+

高质量、低延迟的语音通话服务,支持多方通话和会议

+
+
+
+
+
+
+
🔄
+
+
+
智能路由
+

基于技能、状态的智能呼叫分配,提高客服效率

+
+
+
+
+
+
+
📊
+
+
+
实时监控
+

实时监控座席状态和通话质量,确保服务水平

+
+
+
+
+
+
+
📱
+
+
+
多通道接入
+

支持SIP、WebRTC、手机、固话等多种接入方式

+
+
+
+
+
+
+
🔌
+
+
+
系统集成
+

与CRM、客服系统等无缝集成,提供统一服务体验

+
+
+
+
+
+
+
🤖
+
+
+
智能语音助手
+

基于AI的语音识别和交互,提供智能服务体验

+
+
+
+
+
+
+
+
+ + +
+
+
+
+

系统架构

+ +
+
+
FreeSWITCH 核心优势
+
    +
  • 高性能处理引擎,支持上千并发通话
  • +
  • 多协议支持:SIP、WebRTC、PSTN等
  • +
  • 丰富的媒体处理能力,支持转码、录音、回声消除等
  • +
  • 灵活的路由策略,支持复杂呼叫场景
  • +
  • 开源稳定,易于扩展和定制
  • +
+
+
+
系统层级结构
+
+

+└── 呼叫中心系统
+    ├── 接入层
+    │   ├── SIP接入
+    │   ├── WebRTC接入
+    │   └── PSTN接入
+    ├── 核心层
+    │   ├── FreeSWITCH引擎
+    │   ├── 呼叫控制
+    │   └── 媒体处理
+    └── 应用层
+        ├── 座席管理
+        ├── 队列管理
+        ├── 统计报表
+        └── 系统监控
+                                
+
+
+
+
+
+
+
+ + +
+
+
+
+

应用场景

+ +
+
+
+
+
客服中心
+

为企业提供专业的呼入式客服中心解决方案,高效处理客户咨询与服务请求。

+
+
+
+
+
+
+
销售外呼
+

支持团队高效率销售外呼,提高接通率和转化率,实现销售目标。

+
+
+
+
+
+
+
远程办公
+

为远程办公团队提供统一通信平台,保持团队协作和客户服务无缝衔接。

+
+
+
+
+
+
+
+
+ diff --git a/plugins/freeswitch/src/main/resources/templates/ftl/callcenter/layout/base.ftl b/plugins/freeswitch/src/main/resources/templates/ftl/callcenter/layout/base.ftl new file mode 100644 index 0000000000..71692f790e --- /dev/null +++ b/plugins/freeswitch/src/main/resources/templates/ftl/callcenter/layout/base.ftl @@ -0,0 +1,88 @@ + + + + + + ${title!'ByteDesk 呼叫中心'} + + + + + + + + +
+ <#nested> +
+ + + + + + + +