AI Agent Component Spec
AI Agent Component Spec
Overview
Call buttons provide a simple way to add voice and video calling to your chat. Pass auser for 1-on-1 calls or a group for group calls. The component handles call initiation, displays the outgoing call screen, and manages the full call lifecycle.
Time estimate: 10 minutesDifficulty: Beginner
Prerequisites
- React.js integration completed
- Voice/Video calling guide reviewed
- CometChat Calls SDK initialized
Steps
Step 1: Add call buttons for a user
Fetch a user and display call buttons:
Step 2: Add call buttons for a group
For group calls, pass agroup instead:
Step 3: Show only voice or video button
Hide one of the buttons based on your needs:Step 4: Override call initiation behavior
Handle call clicks with custom logic:Step 5: Customize the outgoing call screen
Configure how the outgoing call overlay appears:Step 6: Configure call settings
Customize the call session parameters:Complete Example
Advanced: Embed in MessageHeader
Advanced: Embed in MessageHeader
The call buttons are commonly used in the message header’s auxiliary view:
Common Issues
| Issue | Solution |
|---|---|
| Buttons disabled | Check if another call is in progress |
| Call not initiating | Verify CometChat Calls SDK is initialized |
| Outgoing screen not showing | Ensure no custom onVoiceCallClick/onVideoCallClick overrides |