stop() does not seem to work with my code below. I...
# support
m
const handleCallToggle = async () => { var callIn: any; if (!isCallActive) { callIn = await vapi.start(vapiAssistant); if (callIn) { setIsCallActive(true); // Set call as active } } else { vapi.stop(); console.log("Call ended"); setIsCallActive(false); // Set call as inactive } };
v
You can continue this conversation by mentioning me in the message.
@Manish It looks like you've written a function to handle toggling the state of a call using VAPI. If you have any questions or need assistance with implementing or testing this function, feel free to ask. Remember to replace
vapiAssistant
with your actual assistant ID when calling
vapi.start()
. If you need help with anything else, please let me know!
Got it. Tagging @User for additional help.
m
vapiAssistant is the actual assistant i have created
it has model, welcomeMessage etc.
k
@Shubham Bajaj this is my colleague @Manish He and I both were trying hard with web snippet and web sdk like I had explained in the other post as well as in the direct message to you. Any help will be greatly appreciated. This is the example I was quoting that vapi.stop() wont work.
@Vapi @User please help
v
@krthkntrjn I'm here to assist you! If
vapi.stop()
isn't working as expected, it could be due to a variety of reasons. To better assist you, could you please provide more details about the issue you're facing? For instance: - Are you receiving any error messages when you try to call
vapi.stop()
? - Is the call not ending when you invoke
vapi.stop()
? - Have you confirmed that
isCallActive
is correctly set to
true
when the call is active? Also, ensure that
vapi.stop()
is being called on the correct instance of your VAPI assistant and that any asynchronous operations are being handled properly. If you could provide a bit more context or any error logs, that would be very helpful in diagnosing the problem.
s
@krthkntrjn @Manish can you check the browser console log once you try to hit the close button, the browser console logs has the simplest straightforward explanation of why it's not working. Do let me know guys what error message do you see!!
2 Views