diff options
author | Richard Mudgett <rmudgett@digium.com> | 2017-07-31 14:21:06 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2017-08-10 12:18:58 -0500 |
commit | 82f4ade959ef3ab7abb5deb4bc06882850dcde90 (patch) | |
tree | b5ab08fe752a2e13c809fb9340b0713fc06e91fa /contrib | |
parent | 1dcb92bba89440fff3454670ed5f892da157bf27 (diff) |
res_pjsip: Remove ephemeral registered contacts on transport shutdown.
The fix for the issue is broken up into three parts.
This is part two which handles the server side of REGISTER requests when
rewrite_contact is enabled. Any registered reliable transport contact
becomes invalid when the transport connection becomes disconnected.
* Monitor the rewrite_contact's reliable transport REGISTER contact for
shutdown. If it is shutdown then the contact must be removed because it
is no longer valid. Otherwise, when the client attempts to re-REGISTER it
may be blocked because the invalid contact is there. Also if we try to
send a call to the endpoint using the invalid contact then the endpoint is
not likely to see the request. The endpoint either won't be listening on
that port for new connections or a NAT/firewall will block it.
* Prune any rewrite_contact's registered reliable transport contacts on
boot. The reliable transport no longer exists so the contact is invalid.
* Websockets always rewrite the REGISTER contact address and the transport
needs to be monitored for shutdown.
* Made the websocket transport set a unique name since that is what we use
as the ao2 container key. Otherwise, we would not know which transport we
find when one of them shuts down. The names are also used for PJPROJECT
debug logging.
* Made the websocket transport post the PJSIP_TP_STATE_CONNECTED state
event. Now the global keep_alive_interval option, initially idle shutdown
timer, and the server REGISTER contact monitor can work on wetsocket
transports.
* Made the websocket transport set the PJSIP_TP_DIR_INCOMING direction.
Now initially idle websockets will automatically shutdown.
ASTERISK-27147
Change-Id: I397a5e7d18476830f7ffe1726adf9ee6c15964f4
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ast-db-manage/config/versions/f3d1c5d38b56_add_prune_on_boot.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/ast-db-manage/config/versions/f3d1c5d38b56_add_prune_on_boot.py b/contrib/ast-db-manage/config/versions/f3d1c5d38b56_add_prune_on_boot.py new file mode 100644 index 000000000..fe9c35ed1 --- /dev/null +++ b/contrib/ast-db-manage/config/versions/f3d1c5d38b56_add_prune_on_boot.py @@ -0,0 +1,28 @@ +"""add_prune_on_boot + +Revision ID: f3d1c5d38b56 +Revises: 44ccced114ce +Create Date: 2017-08-04 17:31:23.124767 + +""" + +# revision identifiers, used by Alembic. +revision = 'f3d1c5d38b56' +down_revision = '44ccced114ce' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ############################# Enums ############################## + + # yesno_values have already been created, so use postgres enum object + # type to get around "already created" issue - works okay with mysql + yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False) + + op.add_column('ps_contacts', sa.Column('prune_on_boot', yesno_values)) + + +def downgrade(): + op.drop_column('ps_contacts', 'prune_on_boot') |