Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vapi.stop() doesn't work when the call is still connecting #26

Open
Ademsk1 opened this issue Apr 30, 2024 · 0 comments
Open

Vapi.stop() doesn't work when the call is still connecting #26

Ademsk1 opened this issue Apr 30, 2024 · 0 comments

Comments

@Ademsk1
Copy link

Ademsk1 commented Apr 30, 2024

I'm simulating a Skype call with the Vapi, where the user has the option to the end the call whenever they like. When the user clicks the end call button, I have a function that looks like this

onStopClicked={async () => {
          vapi.current.stop();
          playEndCallSound();
          setCallConnected(false);
          setCallConnecting(false)
          setIsFinished(true);
        }}

This works fine when the connection with vapi is already established and a call is happening. However, if I click this button before the call starts, vapi does not stop connecting. It gives me the impression that some race conditions are going on. Here you can see a screenshot of the console logs, where the Call has started text is logged when `vapi.on("call-started") event is triggered:

vapi.current.on("call-start", () => {
      console.log("Call has started");
      setCallConnected(true);
      setCallConnecting(false);
    });

The outcome of this is that the react-router I have redirects to a different page on firing that button, but vapi is still communicating with us.

Screenshot 2024-04-30 at 12 22 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant