# SmartCall **Repository Path**: gdzWork/SmartCall ## Basic Information - **Project Name**: SmartCall - **Description**: 融合传统呼叫中心与大模型能力,打造新一代 AI 客服呼叫中心。 项目基于 Java 17、Spring Boot 3+ 开发。 🔝🔝如果本项目对你有帮助,欢迎点个 Star,并关注后续更新。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: https://qidiangk.com - **GVP Project**: No ## Statistics - **Stars**: 609 - **Forks**: 190 - **Created**: 2026-06-30 - **Last Updated**: 2026-11-27 ## Categories & Tags **Categories**: erp **Tags**: 呼叫中心, AI客服, Java, 人工智能, 大模型 ## README

SmartCall Logo

SmartCall · AI-Powered Contact Center

An AI-powered customer service contact center — bringing intelligence to every call

Add a dependency and declare one Bean to bring AI voice calling to your Spring Boot application.
Embed it in a monolith or a microservice.

Website · Documentation · Live Demo · 中文

Java 21 Spring Boot 3.5.8 Asterisk 22 LiveKit Agents Apache 2.0 Author mr.g

--- ## Introduction **SmartCall** is an easy-to-integrate, open-source AI voice calling framework. Add the dependency, configure telephony and model services, and declare one Bean to bring AI conversations to your Spring Boot application. Use it for customer service, phone inquiries, and follow-up calls. Embed it in an existing monolith or microservice and keep your business systems. The framework handles telephony, sessions, and model interaction so you can focus on conversation design and business logic. ## Capabilities - **Simple integration**: Spring Boot auto-configuration and one session configuration Bean for incoming calls. - **Natural conversations**: Streaming ASR → LLM → TTS, interruptions, false interruption recovery, and idle prompts, with optional echo cancellation and LLM / TTS pre-generation. - **Per-call customization**: Configure models, voices, instructions, and greetings independently for each call to suit customer service, inquiries, and follow-ups. - **Flexible models**: Combine Model Studio, DeepSeek, Alibaba Cloud NLS, Doubao TTS, and OpenAI-compatible LLM adapters across providers; add custom adapters or connect self-hosted services using compatible protocols. - **Inbound and outbound**: Answer, dial, and hang up calls; transfer to a queue or a specific destination, with optional AI conversation resumption afterward. - **Business extensions**: Connect orders, tickets, knowledge bases, and other business APIs through tools and turn interceptors so conversations can take action. - **Conversation records**: Receive turn text, audio, and interruption status through the recording interface for storage and further analysis. - **Flexible deployment**: Docker Compose scripts start the example and its dependencies with one command after setup; embed the framework in monoliths, microservices, or multiple instances. ## Architecture ```mermaid flowchart TB subgraph App["Your Spring Boot application · monolith / microservice"] Config["One session configuration Bean"] --> SmartCall["SmartCall · sessions and call control"] Business["Business APIs / tools / turn records"] <--> SmartCall end Phone["Phone / SIP extension"] <-->|"SIP / RTP"| Asterisk["Asterisk"] Asterisk <-->|"FastAGI / AMI · call control"| SmartCall Asterisk <-->|"SIP / RTP · audio"| SIP["LiveKit SIP"] SIP <--> LiveKit["LiveKit Server"] LiveKit <-->|"Realtime audio"| Agent["Python Agent"] SmartCall -->|"Rooms / dispatch"| LiveKit SmartCall <-->|"WebSocket · configuration / events / tools"| Agent Agent <--> Models["ASR → LLM → TTS · combine or extend"] SmartCall -.->|"Optional"| Redis["Redis · session directory / remote commands"] ``` This shows the built-in Python Agent pipeline: Spring Boot handles call control and business orchestration, while audio travels through Asterisk, LiveKit SIP, and LiveKit to the Agent. Redis is optional for the framework's cross-instance routing. ## Quick start ### Start the example with one command The [`script`](script) directory provides Docker Compose configuration. Prepare **Java 21, Maven, Docker, and Docker Compose**, then follow these steps to build, start, and verify the example. **1. Configure models and connections** Copy the environment template from the repository root: ```bash cp script/.env.example script/.env ``` - Fill in the ASR, LLM, and TTS endpoints and credentials in [`DemoConfig.java`](smart-demo/src/main/java/com/smart/demo/config/DemoConfig.java), using models and voices enabled for your account. - Set `external_signaling_address` and `external_media_address` in [`pjsip.conf`](script/config/asterisk/pjsip.conf) to the deployment machine's IP reachable by your softphone. - For an all-container deployment, set the AGI address in [`extensions.conf`](script/config/asterisk/extensions.conf) to `agi://smart-call:4573/realtime.agi`. Keep the template defaults for addresses and credentials in `script/.env`; see the [documentation](https://qidiangk.com/docs) for custom settings. **2. Build the application images** Run from the repository root. The project's Jib plugin builds the Java image, and the Dockerfile builds the Python Agent image. Image tags match the Compose configuration. ```bash mvn -pl smart-demo -am clean package jib:dockerBuild -DskipTests docker build -t smart/smart-agent:2.0.0 ./smart-voice-agent ``` **3. Start services** ```bash cd script docker compose up -d docker compose ps ``` **4. Verify inbound and outbound calls** **Inbound**: Register a SIP softphone with the deployment machine on `5060/UDP`, using username `1001`, password `1001@123`, and `ulaw` / `alaw`. Once registered, dial any numeric destination with at least two digits, such as `1000` or `12345`, to start an AI conversation. No matching destination extension needs to be created. **Outbound**: End the inbound test and keep extension `1001` registered and idle. Request the example outbound endpoint from the deployment machine: ```bash curl -X POST http://127.0.0.1:9999/api/calls/outbound -H "Content-Type: application/json" -d '{"number":"1001"}' ``` A normal response is HTTP `202`, containing `callId` and `submission`; `ACCEPTED` means the call was submitted. Answer the softphone when it rings to talk to the AI. For remote requests, replace `127.0.0.1` with the deployment machine's IP. The current [`OutboundCallController`](smart-demo/src/main/java/com/smart/demo/controller/OutboundCallController.java) builds `PJSIP/{number}@1001`, so this request calls back the test extension. To call real external numbers, replace the trailing `1001` with a configured SIP trunk name, rebuild the example image, and pass the destination as `number`. **Logs**: Read `smart-call` logs in the host's bind-mounted `script/logs/aicc/` directory (container path `/smart/boot/logs/`). For `smart-agent` console logs, run from `script`: ```bash docker compose logs -f smart-agent ``` See the [documentation](https://qidiangk.com/docs) for further usage and configuration. ### Integrate into an existing application Requirements: **Java 21 and Spring Boot 3.5.8**. Add the dependency, configure services, and declare one Bean. **1. Add the dependency** Run `mvn -pl smart-voice-realtime -am install -DskipTests` from the repository root, then add the dependency to your Spring Boot project: ```xml com.qidiangk.smart smart-voice-realtime 2.0.0 ``` **2. Prepare services** Reuse the infrastructure above, replace the example application with your own, and follow the [documentation](https://qidiangk.com/docs) to configure telephony and Agent connections. The example uses Model Studio models. Set `DASHSCOPE_API_KEY` before starting the application, using a Beijing-region key with access to the selected models. **3. Declare one Bean** Once services are configured, place `VoiceConfiguration` inside your application's component scan. Models, voice, and endpoints are configured; adjust the instructions and greeting for your use case.
Expand the single-Bean integration example ```java import com.qidiangk.smart.voice.realtime.api.RealtimeSessionConfigProvider; import com.qidiangk.smart.voice.realtime.model.*; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.List; @Configuration(proxyBeanMethods = false) public class VoiceConfiguration { @Bean RealtimeSessionConfigProvider conversationConfig(@Value("${DASHSCOPE_API_KEY}") String apiKey) { var auth = new ModelAuthConfig().setApiKey(apiKey); var endpoint = "wss://dashscope.aliyuncs.com/api-ws/v1/inference"; var asr = new BoundModel() .setSlot(ModelSlot.ASR).setProvider(ModelProvider.DASHSCOPE) .setAdapter(ModelAdapter.FUN_ASR_REALTIME).setModel("paraformer-realtime-8k-v2") .setEndpoint(endpoint).setAuthConfig(auth); var llm = new BoundModel() .setSlot(ModelSlot.LLM).setProvider(ModelProvider.DASHSCOPE) .setAdapter(ModelAdapter.CHAT_COMPLETIONS).setModel("qwen-plus") .setEndpoint("https://dashscope.aliyuncs.com/compatible-mode/v1") .setAuthConfig(auth); var tts = new BoundModel() .setSlot(ModelSlot.TTS).setProvider(ModelProvider.DASHSCOPE) .setAdapter(ModelAdapter.COSYVOICE).setModel("cosyvoice-v3-flash") .setEndpoint(endpoint).setVoice("longanyang").setAuthConfig(auth); return call -> new RealtimeSessionConfig() .setExecutionMode(ExecutionMode.PYTHON_AGENT) .setGreeting("Hello, I am your SmartCall voice assistant. How can I help?") .setInstructions("You are a telephone voice assistant. Answer briefly and naturally in Chinese.") .setModels(List.of(asr, llm, tts)); } } ```
[`smart-demo`](smart-demo) provides [session configuration](smart-demo/src/main/java/com/smart/demo/config/DemoConfig.java) and [outbound API](smart-demo/src/main/java/com/smart/demo/controller/OutboundCallController.java) examples. Combine models, add custom adapters, and connect business services through tools and interceptors. See the [documentation](https://qidiangk.com/docs) for configuration, usage, model extensions, and cluster deployment. ## Documentation and community - Website: [qidiangk.com](https://qidiangk.com/) - Documentation: [qidiangk.com/docs](https://qidiangk.com/docs) - Source: [GitHub](https://github.com/g-mr/SmartCall) · [Gitee](https://gitee.com/gdzWork/SmartCall) · [AtomGit](https://gitcode.com/ding1254646/SmartCall) - Articles: [Source code and integration practices](https://blog.csdn.net/ding1254646) - Email: [ding931226@yeah.net](mailto:ding931226@yeah.net) Stars, issues, and pull requests are welcome. ## Support the project If SmartCall has been helpful, consider buying the author a coffee to support ongoing maintenance and improvements. Thank you for your support!

Donate via WeChat Pay
Scan with WeChat · Click the image to view the original

## License Licensed under [Apache License 2.0](LICENSE), which permits commercial use. Follow its terms and retain applicable copyright and license notices. ## SmartCall Commercial Edition **Bring AI customer service into your business.** SmartCall Commercial Edition serves businesses seeking a complete AI contact center, with product delivery, deployment assistance, and technical support. Visit the website, try the live demo, or contact us to discuss purchasing the commercial edition and your business needs. **[Explore SmartCall](https://qidiangk.com/) · [Try the live demo](https://smartcall.qidiangk.com)** ---

SmartCall — Empowering every call with AI