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

Creating multiple instance of Vapi object is not possible for handling multiple calls #13

Open
paraschhugani opened this issue Jan 24, 2025 · 4 comments

Comments

@paraschhugani
Copy link

paraschhugani commented Jan 24, 2025

from vapi_python import Vapi

x = Vapi(api_key='****').start(assistant_id='****')
print(x , "   : x")
y = Vapi(api_key='****').start(assistant_id='****')
print(y , "   : y")

Error :

thread '' panicked at /Users/daily/actions-runner/_work/daily-x/daily-x/daily-core/src/native/ffi/context.rs:144:5:
Execution context already exists!
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
thread '' panicked at core/src/panicking.rs:221:5:
panic in a function that cannot unwind
stack backtrace:
0: 0x1053c6268 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7adefaad4a31afc0
1: 0x1053e3440 - core::fmt::write::h381c0b0ce6ab972a
2: 0x1053c34b4 - std::io::Write::write_fmt::h75af97148630d8d3
3: 0x1053c611c - std::sys::backtrace::BacktraceLock::print::h8baf33e22611de71
4: 0x1053c7044 - std::panicking::default_hook::{{closure}}::h369c7295ef58c5b1
5: 0x1053c6e88 - std::panicking::default_hook::h50746358288a9d6a
6: 0x1053c77f8 - std::panicking::rust_panic_with_hook::h7d795911432661cb
7: 0x1053c7484 - std::panicking::begin_panic_handler::{{closure}}::h36f15310ecbde379
8: 0x1053c672c - std::sys::backtrace::_rust_end_short_backtrace::heed121414170e0c7
9: 0x1053c7164 - rust_begin_unwind
10: 0x10542cb9c - core::panicking::panic_nounwind_fmt::h5d86a478a9d7437c
11: 0x10542cc14 - core::panicking::panic_nounwind::he171ad52d328e60b
12: 0x10542cd00 - core::panicking::panic_cannot_unwind::h2dd8cd735765e065
13: 0x1047c68c8 - daily_core_context_create_with_threads
14: 0x1044633dc - daily::PyDaily::pymethod_init::h42edb4b7d1e63a58
15: 0x104462228 - pyo3::impl
::trampoline::trampoline::h5f1d25757413c76e
16: 0x104463078 - daily::<impl pyo3::impl
::pyclass::PyMethodsdaily::PyDaily for pyo3::impl
::pyclass::PyClassImplCollectordaily::PyDaily>::py_methods::ITEMS::trampoline::hb75f27c9f37646db
17: 0x102095c88 - _cfunction_call
18: 0x102027528 - __PyObject_MakeTpCall
19: 0x10216b598 - __PyEval_EvalFrameDefault
20: 0x1020272ac - __PyObject_FastCallDictTstate
21: 0x1020c3a08 - _slot_tp_init
22: 0x1020b8964 - _type_call
23: 0x102027528 - __PyObject_MakeTpCall
24: 0x10216b598 - __PyEval_EvalFrameDefault
25: 0x10202731c - __PyObject_FastCallDictTstate
26: 0x1020c3a08 - _slot_tp_init
27: 0x1020b8964 - _type_call
28: 0x102027528 - __PyObject_MakeTpCall
29: 0x10216b598 - __PyEval_EvalFrameDefault
30: 0x10215fa14 - _PyEval_EvalCode
31: 0x1021e022c - _run_mod
32: 0x1021df2b4 - _pyrun_file
33: 0x1021de210 - __PyRun_SimpleFileObject
34: 0x1021dddd4 - __PyRun_AnyFileObject
35: 0x10220c6a4 - _pymain_run_file_obj
36: 0x10220c41c - _pymain_run_file
37: 0x10220b6fc - _Py_RunMain
38: 0x10220bdc8 - _pymain_main
39: 0x10220bee4 - _Py_BytesMain
thread caused non-unwinding panic. aborting.
Abort trap: 6

@paraschhugani
Copy link
Author

Hey @nikhilro , can you help me with the problem ?

Thanks in advance...

@nitinchouhan1
Copy link

nitinchouhan1 commented Feb 20, 2025

Is there a way to know the status of the call, whether is it ongoing or has been disconnected ?

@paraschhugani
Copy link
Author

@nitinchouhan1 you can use vapi.client.app_joined and not vapi_client.app_quit:

you might need to modify the vapi-python.py file to access the daily.co client

@nitinchouhan1
Copy link

@paraschhugani created a function in daily_call.py

def has_left(self):
        return self.__app_quit

as well as a function in vapi_python.py in Vapi class :

def get_call_status(self):
        return self.__client.has_left()

But still after the call is ended it gives me the error as :-

{"timestamp":"2025-02-20T06:24:46.778297Z","level":"ERROR","fields":{"message":"failed to send message on websocket: Protocol(SendAfterClosing)"},"target":"daily_core::native::signal_channel"}
{"timestamp":"2025-02-20T06:24:46.796040Z","level":"ERROR","fields":{"message":"failed to send message on WebSocket: Protocol(SendAfterClosing)"},"target":"daily_core::native::signal_channel"}
{"timestamp":"2025-02-20T06:24:46.796069Z","level":"ERROR","fields":{"message":"Failed to send logs on disconnect: PrioritySendFailed(WebSocketSendError(\"WebSocket protocol error: Sending after closing is not allowed\"))"},"target":"daily_core::soup::signalling"}
{"timestamp":"2025-02-20T06:24:46.796084Z","level":"ERROR","fields":{"message":"failed to send message on WebSocket: Protocol(SendAfterClosing)"},"target":"daily_core::native::signal_channel"}
{"timestamp":"2025-02-20T06:24:46.796179Z","level":"ERROR","fields":{"message":"Error reconnecting recv transport: Signalling(ResponseCanceled)"},"target":"daily_core::transport"}
{"timestamp":"2025-02-20T06:24:46.796206Z","level":"ERROR","fields":{"message":"Error reconnecting send transport: Signalling(ResponseCanceled)"},"target":"daily_core::transport"}

and the has_left() still returns False

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

2 participants