res_pjsip: Add global option to limit the maximum time for initial qualifies

Currently when Asterisk starts initial qualifies of contacts are spread out
randomly between 0 and qualify_timeout to prevent network and system overload.
If a contact's qualify_frequency is 5 minutes however, that contact may be
unavailable to accept calls for the entire 5 minutes after startup.  So while
staggering the initial qualifies is a good idea, basing the time on
qualify_timeout could leave contacts unavailable for too long.

This patch adds a new global parameter "max_initial_qualify_time" that sets the
maximum time for the initial qualifies.  This way you could make sure that all
your contacts are initialy, randomly qualified within say 30 seconds but still
have the contact's ongoing qualifies at a 5 minute interval.

If max_initial_qualify_time is > 0, the formula is initial_interval =
min(max_initial_interval, qualify_timeout * random().  If not set,
qualify_timeout is used.

The default is "0" (disabled).

ASTERISK-24863 #close

Change-Id: Ib80498aa1ea9923277bef51d6a9015c9c79740f4
Tested-by: George Joseph <george.joseph@fairview5.com>
This commit is contained in:
George Joseph
2015-04-11 16:04:32 -06:00
parent 51886c68dc
commit c6ed681638
7 changed files with 69 additions and 3 deletions

View File

@@ -0,0 +1,20 @@
"""add pjsip max_initial_qualify_time
Revision ID: a541e0b5e89
Revises: 461d7d691209
Create Date: 2015-04-15 14:37:36.424471
"""
# revision identifiers, used by Alembic.
revision = 'a541e0b5e89'
down_revision = '461d7d691209'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('ps_globals', sa.Column('max_initial_qualify_time', sa.Integer))
def downgrade():
op.drop_column('ps_globals', 'max_initial_qualify_time')