Fix missing first line of in-progress call and wrong state (#7948)

When the dashboard widget is first called, the first line of the active call response was ignored due to a promise dropped in the client. This fixes the dropped event.
The status is hard-coded to 'ringing' on the server-side to allow the client to pick up the event as a 'new' call. This patches the client to correct this and put the correct 'answered' status for an already in-progress call.
This commit is contained in:
frytimo
2026-05-04 16:58:43 +00:00
committed by GitHub
parent 494664f598
commit 097af5d836
3 changed files with 53 additions and 2 deletions
@@ -48,6 +48,22 @@ class ws_client {
if (status === 'ok' && code >= 200 && code < 300) {
resolve({service, topic, payload, code, message});
// Some services stream event payloads while also echoing the request_id.
// Dispatch to event handlers so the first streamed event is not swallowed.
if (topic && this._eventHandlers.has(topic)) {
let event_message = message;
if (payload !== null && typeof payload === 'object' && !Array.isArray(payload)) {
event_message = {
...message,
payload: {
...payload,
__from_request: true
}
};
}
this._dispatchEvent(event_message);
}
} else {
const err = new Error(message || `Error ${code}`);
err.code = code;