mirror of
https://github.com/jambonz/freeswitch-modules.git
synced 2025-12-18 22:27:43 +00:00
support variable to enable ws ping pong for jb transcribe (#101)
* support variable to enable ws ping pong for jb transcribe * update ping/pong time duration * fix review comment Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com> --------- Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com>
This commit is contained in:
@@ -229,16 +229,6 @@ int AudioPipe::lws_callback(struct lws *wsi,
|
||||
}
|
||||
|
||||
|
||||
// static members
|
||||
static const lws_retry_bo_t retry = {
|
||||
nullptr, // retry_ms_table
|
||||
0, // retry_ms_table_count
|
||||
0, // conceal_count
|
||||
UINT16_MAX, // secs_since_valid_ping
|
||||
UINT16_MAX, // secs_since_valid_hangup
|
||||
0 // jitter_percent
|
||||
};
|
||||
|
||||
struct lws_context *AudioPipe::context = nullptr;
|
||||
std::thread AudioPipe::serviceThread;
|
||||
std::mutex AudioPipe::mutex_connects;
|
||||
@@ -376,6 +366,28 @@ bool AudioPipe::lws_service_thread() {
|
||||
{ NULL, NULL, 0, 0 }
|
||||
};
|
||||
|
||||
uint16_t secs_sinceq_valid_ping = UINT16_MAX;
|
||||
uint16_t secs_since_valid_hangup = UINT16_MAX;
|
||||
|
||||
char* wsVar = std::getenv("WS_PING_INTERVAL");
|
||||
if (wsVar != nullptr) {
|
||||
secs_sinceq_valid_ping = std::atoi(wsVar);
|
||||
}
|
||||
|
||||
wsVar = std::getenv("WS_NO_PONG_HANGUP_INTERVAL");
|
||||
if (wsVar != nullptr) {
|
||||
secs_since_valid_hangup = std::atoi(wsVar);
|
||||
}
|
||||
|
||||
const lws_retry_bo_t retry = {
|
||||
nullptr, // retry_ms_table
|
||||
0, // retry_ms_table_count
|
||||
0, // conceal_count
|
||||
secs_sinceq_valid_ping, // secs_sinceq_valid_ping
|
||||
secs_since_valid_hangup, // secs_since_valid_hangup
|
||||
0 // jitter_percent
|
||||
};
|
||||
|
||||
memset(&info, 0, sizeof info);
|
||||
info.port = CONTEXT_PORT_NO_LISTEN;
|
||||
info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT;
|
||||
|
||||
Reference in New Issue
Block a user