Skip to content

Commit 3ff41a5

Browse files
authored
fix: reregister API session after timeout (#40)
1 parent 9e124ac commit 3ff41a5

6 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"errors.user_not_found": "The user could not be located. Check entered data",
9696
"errors.webrtc_controller_error": "Unfortunately, due to a communication error, calls cannot be made.\nContact your administrator",
9797
"errors.call_declined_due_to_incompatible_codecs": "Call was automatically declined due to incompatible audio codecs",
98+
"errors.keepalive_timeout": "Connection check timeout. The connection may be unstable",
9899
"label.date_from": "Date from",
99100
"label.date_to": "Date to",
100101
"label.email": "Enter your email",

src/locales/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"errors.user_not_found": "No se pudo encontrar al usuario. Verifique los datos ingresados",
9696
"errors.webrtc_controller_error": "Lamentablemente, debido a un error de comunicación, no se pueden realizar llamadas.\nContacta a tu administrador",
9797
"errors.call_declined_due_to_incompatible_codecs": "La llamada fue rechazada automáticamente debido a códecs de audio incompatibles",
98+
"errors.keepalive_timeout": "Tiempo de espera de verificación de conexión agotado. La conexión puede ser inestable",
9899
"label.date_from": "Fecha desde",
99100
"label.date_to": "Fecha hasta",
100101
"label.email": "Introduzca su correo electrónico",

src/locales/it.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"errors.user_not_found": "L'utente non può essere individuato. Controlla i dati inseriti",
9696
"errors.webrtc_controller_error": "Purtroppo, a causa di un errore di comunicazione, le chiamate non possono essere effettuate.\nContatta il tuo amministratore",
9797
"errors.call_declined_due_to_incompatible_codecs": "La chiamata è stata rifiutata automaticamente a causa di codec audio incompatibili",
98+
"errors.keepalive_timeout": "Timeout del controllo della connessione. La connessione potrebbe essere instabile",
9899
"label.date_from": "Dalla data",
99100
"label.date_to": "Fino alla data",
100101
"label.email": "Inserisci il tuo indirizzo email",

src/locales/ru.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"errors.user_not_found": "Пользователь не найден. Проверьте введенные данные",
9696
"errors.webrtc_controller_error": "К сожалению, из-за ошибки связи звонки совершить невозможно.\nОбратитесь к вашему администратору",
9797
"errors.call_declined_due_to_incompatible_codecs": "Звонок был автоматически отклонен из-за несовместимых аудиокодеков",
98+
"errors.keepalive_timeout": "Тайм-аут проверки соединения. Соединение может быть нестабильным",
9899
"label.date_from": "Дата с",
99100
"label.date_to": "Дата по",
100101
"label.email": "Введите вашу электронную почту",

src/locales/ua.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
"errors.user_not_found": "Не вдалося знайти користувача. Перевірте введені дані",
9696
"errors.webrtc_controller_error": "На жаль, через помилку зв'язку дзвінки не здійснюються.\nЗв'яжіться з адміністратором",
9797
"errors.call_declined_due_to_incompatible_codecs": "Дзвінок був автоматично відхилений через несумісні аудіокодеки",
98+
"errors.keepalive_timeout": "Тайм-аут перевірки з'єднання. З'єднання може бути нестабільним",
9899
"label.date_from": "Дата з",
99100
"label.date_to": "Дата до",
100101
"label.email": "Введіть адресу електронної пошти",

src/store/modules/webrtc.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const WS_CLOSE_CODE_WEBRTC_CONNECTION_ERROR = 4420
2929
const WS_CLOSE_CODE_ATTACH_ERROR = 4431
3030
const WS_CLOSE_CODE_KEEPALIVE_TIMEOUT = 4502
3131
const WS_CLOSE_CODE_UNKNOWN_ERROR = 4600
32+
const WS_CLOSE_CODE_TRANSACTION_TIMEOUT = 4602
3233

3334
/**
3435
* This function takes the user registration status on a SIP server as input and
@@ -559,6 +560,11 @@ const actions = {
559560
console.log('Error handling in callback:', error)
560561
let error_message
561562
switch (error.code) {
563+
case WS_CLOSE_CODE_KEEPALIVE_TIMEOUT:
564+
case WS_CLOSE_CODE_TRANSACTION_TIMEOUT:
565+
console.warn('[WS] Keepalive timeout detected')
566+
snackbarShow(dispatch, i18n.t('errors.keepalive_timeout'))
567+
return
562568
case WS_CLOSE_CODE_UNKNOWN_ERROR:
563569
error_message = i18n.t('errors.unknown_error')
564570
break
@@ -583,11 +589,11 @@ const actions = {
583589
webtritSignalingClient.disconnect()
584590
handleCleanEvent({ commit }, getters.getCallId)
585591

586-
if (code === WS_CLOSE_CODE_KEEPALIVE_TIMEOUT) {
592+
if (code === WS_CLOSE_CODE_KEEPALIVE_TIMEOUT || code === WS_CLOSE_CODE_TRANSACTION_TIMEOUT) {
587593
setTimeout(() => {
588594
try {
589595
dispatch('connect')
590-
console.log('Reconnected successfully after keepalive timeout')
596+
console.log('Reconnected successfully after timeout')
591597
} catch (error) {
592598
console.error('Failed to reconnect after keepalive timeout:', error)
593599
commit('setSessionError', i18n.t('errors.webrtc_controller_error'))

0 commit comments

Comments
 (0)