Implement Configurable TCP Keepalive Settings in PJSIP Transports

This commit introduces configurable TCP keepalive settings for both TCP and TLS transports. The changes allow for finer control over TCP connection keepalives, enhancing stability and reliability in environments prone to connection timeouts or where intermediate devices may prematurely close idle connections. This has proven necessary and has already been tested in production in several specialized environments where access to the underlying transport is unreliable in ways invisible to the operating system directly, so these keepalive and timeout mechanisms are necessary.

Fixes #657
This commit is contained in:
Joshua Elson
2024-03-18 15:14:36 -04:00
committed by George Joseph
parent 2de1a68339
commit c8ab570c6f
6 changed files with 184 additions and 10 deletions

View File

@@ -0,0 +1,28 @@
"""Add TCP keepalive settings to ps_transports
Revision ID: 8fce8496f03e
Revises: 74dc751dfe8e
Create Date: 2024-03-18 17:00:17.148018
"""
# revision identifiers, used by Alembic.
revision = '8fce8496f03e'
down_revision = '74dc751dfe8e'
from alembic import op
import sqlalchemy as sa
def upgrade():
with op.batch_alter_table('ps_transports') as batch_op:
batch_op.add_column(sa.Column('tcp_keepalive_enable', sa.Boolean(), nullable=True))
batch_op.add_column(sa.Column('tcp_keepalive_idle_time', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('tcp_keepalive_interval_time', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('tcp_keepalive_probe_count', sa.Integer(), nullable=True))
def downgrade():
with op.batch_alter_table('ps_transports') as batch_op:
batch_op.drop_column('tcp_keepalive_enable')
batch_op.drop_column('tcp_keepalive_idle_time')
batch_op.drop_column('tcp_keepalive_interval_time')
batch_op.drop_column('tcp_keepalive_probe_count')