_alist_
03/27/2024, 2:52 PMretell-client-js-sdk@^1.3.2
import { RetellWebClient } from 'retell-client-js-sdk';
function WebCall() {
let retellWebClient = new RetellWebClient();
const [isCallActive, setIsCallActive] = useState(false);
retellWebClient.on(ClientEventNames.conversationEnded, ({ code, reason }) => {
console.log('Conversation ended with code "%d" and reason "%s"', code, reason);
setIsCallActive(false);
});
retellWebClient.on(ClientEventNames.error, error => {
console.error('Conversation error occurred', error);
setIsCallActive(false);
});
async function toggleCall() {
if (isCallActive) {
retellWebClient.stopConversation();
// stop doesn't work, so refresh the page instead
window.location.reload();
} else {
// ... start the call
}
}retellai
03/27/2024, 11:25 PMimpactintelligence_22533
03/28/2024, 1:00 PM_alist_
03/28/2024, 3:53 PMretellai
03/28/2024, 6:28 PMTodd - Cofounder@Retell AI
03/28/2024, 10:30 PMTodd - Cofounder@Retell AI
03/28/2024, 10:31 PM_alist_
03/29/2024, 3:57 AMarthurpex
05/07/2024, 12:13 PM_alist_
05/08/2024, 3:22 PMnext.js not sure if that makes a differencelookevink
05/09/2024, 1:51 AMarthurpex
05/09/2024, 9:20 AM_alist_
06/11/2024, 2:41 AMarthurpex
06/11/2024, 11:16 AM