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 呼叫中心"> + +
专业智能的企业级通信解决方案,提供高质量的语音呼叫服务
+${totalCalls!'0'}
+${activeCalls!'0'}
+${missedCalls!'0'}
+${avgDuration!'0'}分钟
+我们基于FreeSWITCH打造的呼叫中心系统,为企业提供高效、稳定、灵活的通信服务
+ +高质量、低延迟的语音通话服务,支持多方通话和会议
+基于技能、状态的智能呼叫分配,提高客服效率
+实时监控座席状态和通话质量,确保服务水平
+支持SIP、WebRTC、手机、固话等多种接入方式
+与CRM、客服系统等无缝集成,提供统一服务体验
+基于AI的语音识别和交互,提供智能服务体验
+
+└── 呼叫中心系统
+ ├── 接入层
+ │ ├── SIP接入
+ │ ├── WebRTC接入
+ │ └── PSTN接入
+ ├── 核心层
+ │ ├── FreeSWITCH引擎
+ │ ├── 呼叫控制
+ │ └── 媒体处理
+ └── 应用层
+ ├── 座席管理
+ ├── 队列管理
+ ├── 统计报表
+ └── 系统监控
+
+ 为企业提供专业的呼入式客服中心解决方案,高效处理客户咨询与服务请求。
+支持团队高效率销售外呼,提高接通率和转化率,实现销售目标。
+为远程办公团队提供统一通信平台,保持团队协作和客户服务无缝衔接。
+