This guide outlines the fastest integration workflow for the three-stage Cascade mode (ASR → LLM → TTS), enabling a complete voice conversation in just five steps:
Issue UserSig → Integrate SDK on Client and Join Room → Create AI Conversation Task on Server → Listen for Event Webhook → End Task
Once the task is created, the AI Bot joins the TRTC room as a virtual user and subscribes to the designated user's audio stream. As soon as the user begins speaking, a real-time Recognition → Reasoning → Playback conversation starts, which can be interrupted at any moment.
Prerequisites and Quotas
Item
Requirement
TRTC Service
Service activated and real-name verification completed.
SdkAppId
TRTC Application ID, required for all server-side API calls.
Room ID
Supports both numeric (RoomIdType=0) and string (RoomIdType=1, recommended) room IDs.
If you exceed the rate or concurrency limits, the API returns FailedOperation.RestrictedConcurrency or FailedOperation.RequestLimitExceeded. Implement exponential backoff for retries.
Integration Steps
Step 1: Issue UserSig
Your backend must issue a UserSig for both the App user and the AI Bot:
Bot's UserSig: Set as AgentConfig.UserSig when creating the task; managed by your backend.
App user's UserSig: Generated by the backend and provided to the client for room entry.
"WelcomeMessage":"Hello, I am an AI assistant. How can I help you?"
}
}
Key Field Overview:
Field
Description
AgentConfig.UserId / UserSig
AI Bot's room identity and credentials for joining.
AgentConfig.TargetUserId
The user(s) whose audio stream the Bot subscribes to (currently supports one).
AgentConfig.MaxIdleTime
Idle timeout, task ends if no one speaks within this period.
STTConfig / LLMConfig / TTSConfig
Configuration for ASR, LLM, and TTS. Providers are interchangeable.
DialogConfig.WelcomeMessage
Welcome message played by the Bot after joining (used for link verification).
DialogConfig.InterruptMode
Interrupt mode: 0=Auto, 1=Manual, 2=Keyword.
A successful response with TaskId confirms the task is created, the Bot has joined the room, and subscribed to the target user's audio. If WelcomeMessage is set, the Bot automatically plays it on entry, allowing you to test the TTS pipeline immediately. Speak to the Bot to begin a full conversation cycle.
TTSPushRoomParams.UserId specifies a unique user ID for the TTS playback stream. When omitted, playback defaults to AgentConfig.UserId. Using a separate ID helps distinguish between the Bot's main logic identity and its playback identity on the client side.
Step 4: Configure Event Webhook and Verify Signature
In the console (or via support request), configure your backend callback URL and callback SecretKey, then implement Sign verification. This allows you to persist ASR/LLM results, monitor AI state changes, and manage task start/end events.
When the host leaves or the conversation concludes, your backend invokes the Delete Task API, prompting the Bot to exit the room and release resources.
Note:
You may also rely on idle timeout: if no valid audio is detected for MaxIdleTime, the task will automatically terminate.
Verifying the Conversation Pipeline
To confirm the pipeline is working, speak to the Bot and verify results using these three channels:
Verification Channel
Phenomenon
Reference
Client Audio Experience
Bot plays the welcome message automatically, then responds smoothly; you can interrupt while speaking.