|
| 1 | +# CallControl Widget |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +Provides call control functionality (hold, mute, transfer, consult, conference, end, wrapup) for active telephony tasks. Includes both standard and CAD (Customer Attached Data) variants. |
| 6 | + |
| 7 | +## Why This Widget? |
| 8 | + |
| 9 | +**Problem:** Agents need comprehensive call control during active conversations. |
| 10 | + |
| 11 | +**Solution:** Unified interface for all call operations with two variants: |
| 12 | +- **CallControl:** Standard call controls |
| 13 | +- **CallControlCAD:** Call controls + CAD panel for customer data |
| 14 | + |
| 15 | +## What It Does |
| 16 | + |
| 17 | +- Hold/Resume active call |
| 18 | +- Mute/Unmute microphone |
| 19 | +- Transfer call (to agent/queue/number) |
| 20 | +- Consult with agent before transfer |
| 21 | +- Conference multiple parties |
| 22 | +- Recording controls (pause/resume) |
| 23 | +- End call |
| 24 | +- Wrapup with codes |
| 25 | +- Auto-wrapup timer |
| 26 | +- CAD panel (CallControlCAD variant only) |
| 27 | + |
| 28 | +## Usage |
| 29 | + |
| 30 | +### React |
| 31 | + |
| 32 | +```tsx |
| 33 | +import { CallControl, CallControlCAD } from '@webex/cc-widgets'; |
| 34 | + |
| 35 | +function App() { |
| 36 | + return ( |
| 37 | + <> |
| 38 | + {/* Standard call controls */} |
| 39 | + <CallControl |
| 40 | + onHoldResume={(isHeld) => console.log('Hold:', isHeld)} |
| 41 | + onEnd={() => console.log('Call ended')} |
| 42 | + onWrapUp={() => console.log('Wrapup complete')} |
| 43 | + onRecordingToggle={({ isRecording }) => console.log('Recording:', isRecording)} |
| 44 | + onToggleMute={(isMuted) => console.log('Muted:', isMuted)} |
| 45 | + conferenceEnabled={true} |
| 46 | + consultTransferOptions={{ showAgents: true, showQueues: true }} |
| 47 | + /> |
| 48 | + |
| 49 | + {/* With CAD panel */} |
| 50 | + <CallControlCAD |
| 51 | + onHoldResume={(isHeld) => console.log('Hold:', isHeld)} |
| 52 | + onEnd={() => console.log('Call ended')} |
| 53 | + callControlClassName="custom-class" |
| 54 | + /> |
| 55 | + </> |
| 56 | + ); |
| 57 | +} |
| 58 | +``` |
| 59 | + |
| 60 | +### Web Component |
| 61 | + |
| 62 | +```html |
| 63 | +<widget-cc-call-control></widget-cc-call-control> |
| 64 | +<widget-cc-call-control-cad></widget-cc-call-control-cad> |
| 65 | + |
| 66 | +<script> |
| 67 | + const callControl = document.querySelector('widget-cc-call-control'); |
| 68 | + callControl.onHoldResume = (isHeld) => console.log('Hold:', isHeld); |
| 69 | + callControl.onEnd = () => console.log('Call ended'); |
| 70 | + callControl.conferenceEnabled = true; |
| 71 | +</script> |
| 72 | +``` |
| 73 | + |
| 74 | +## Props API |
| 75 | + |
| 76 | +| Prop | Type | Default | Description | |
| 77 | +|------|------|---------|-------------| |
| 78 | +| `onHoldResume` | `(isHeld: boolean) => void` | - | Callback when hold state changes | |
| 79 | +| `onEnd` | `() => void` | - | Callback when call ends | |
| 80 | +| `onWrapUp` | `() => void` | - | Callback when wrapup completes | |
| 81 | +| `onRecordingToggle` | `({ isRecording: boolean, task: ITask }) => void` | - | Callback when recording toggled | |
| 82 | +| `onToggleMute` | `(isMuted: boolean) => void` | - | Callback when mute toggled | |
| 83 | +| `conferenceEnabled` | `boolean` | `true` | Enable conference functionality | |
| 84 | +| `consultTransferOptions` | `{ showAgents?: boolean, showQueues?: boolean, showAddressBook?: boolean }` | - | Configure transfer options | |
| 85 | +| `callControlClassName` | `string` | - | Custom CSS class (CAD variant) | |
| 86 | +| `callControlConsultClassName` | `string` | - | Custom CSS class for consult (CAD variant) | |
| 87 | + |
| 88 | +## Examples |
| 89 | + |
| 90 | +### With Transfer Options |
| 91 | + |
| 92 | +```tsx |
| 93 | +<CallControl |
| 94 | + consultTransferOptions={{ |
| 95 | + showAgents: true, // Show buddy agents |
| 96 | + showQueues: true, // Show queues |
| 97 | + showAddressBook: false // Hide address book |
| 98 | + }} |
| 99 | +/> |
| 100 | +``` |
| 101 | + |
| 102 | +### With Conference Disabled |
| 103 | + |
| 104 | +```tsx |
| 105 | +<CallControl |
| 106 | + conferenceEnabled={false} |
| 107 | + onEnd={() => { |
| 108 | + console.log('Call ended without conference option'); |
| 109 | + }} |
| 110 | +/> |
| 111 | +``` |
| 112 | + |
| 113 | +### CAD Variant with Custom Styling |
| 114 | + |
| 115 | +```tsx |
| 116 | +<CallControlCAD |
| 117 | + callControlClassName="my-call-controls" |
| 118 | + callControlConsultClassName="my-consult-panel" |
| 119 | + onWrapUp={() => { |
| 120 | + console.log('Wrapup complete, CAD data saved'); |
| 121 | + }} |
| 122 | +/> |
| 123 | +``` |
| 124 | + |
| 125 | +## Differences: CallControl vs CallControlCAD |
| 126 | + |
| 127 | +| Feature | CallControl | CallControlCAD | |
| 128 | +|---------|-------------|----------------| |
| 129 | +| Call controls | ✅ | ✅ | |
| 130 | +| CAD panel | ❌ | ✅ | |
| 131 | +| Customer data display | ❌ | ✅ | |
| 132 | +| Layout | Compact | Extended with CAD sidebar | |
| 133 | +| Use case | Simple call handling | CRM integration scenarios | |
| 134 | + |
| 135 | +**Note:** Both use the same `useCallControl` hook and share 90% of logic. |
| 136 | + |
| 137 | +## Dependencies |
| 138 | + |
| 139 | +```json |
| 140 | +{ |
| 141 | + "@webex/cc-components": "workspace:*", |
| 142 | + "@webex/cc-store": "workspace:*", |
| 143 | + "@webex/cc-ui-logging": "workspace:*", |
| 144 | + "mobx-react-lite": "^4.1.0", |
| 145 | + "react-error-boundary": "^6.0.0" |
| 146 | +} |
| 147 | +``` |
| 148 | + |
| 149 | +See [package.json](../../package.json) for versions. |
| 150 | + |
| 151 | +## Additional Resources |
| 152 | + |
| 153 | +- [Architecture Details](architecture.md) - Component internals, data flows, diagrams |
| 154 | + |
0 commit comments