res_pjsip: Endpoint IP Access Controls

With the old SIP module we can use IP access controls per peer.
PJSIP module missing this feature.

This patch added next configuration Endpoint options:
    "acl" - list of IP ACL section names in acl.conf
    "deny" - List of IP addresses to deny access from
    "permit" - List of IP addresses to permit access from
    "contact_acl" - List of Contact ACL section names in acl.conf
    "contact_deny" - List of Contact header addresses to deny
    "contact_permit" - List of Contact header addresses to permit

This patch also better logging failed request:
    add custom message instead of "No matching endpoint found"
    add SIP method to logging

ASTERISK-25900

Change-Id: I456dea3909d929d413864fb347d28578415ebf02
This commit is contained in:
Alexei Gradinari
2016-05-13 12:46:52 -04:00
parent 7643dc44b2
commit 69a85a519f
6 changed files with 257 additions and 10 deletions

View File

@@ -0,0 +1,32 @@
"""Add PJSIP Endpoint IP Access Control options
Revision ID: d7e3c73eb2bf
Revises: 6be31516058d
Create Date: 2016-05-13 12:45:45.071871
"""
# revision identifiers, used by Alembic.
revision = 'd7e3c73eb2bf'
down_revision = '6be31516058d'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('ps_endpoints', sa.Column('deny', sa.String(95)))
op.add_column('ps_endpoints', sa.Column('permit', sa.String(95)))
op.add_column('ps_endpoints', sa.Column('acl', sa.String(40)))
op.add_column('ps_endpoints', sa.Column('contact_deny', sa.String(95)))
op.add_column('ps_endpoints', sa.Column('contact_permit', sa.String(95)))
op.add_column('ps_endpoints', sa.Column('contact_acl', sa.String(40)))
def downgrade():
op.drop_column('ps_endpoints', 'contact_acl')
op.drop_column('ps_endpoints', 'contact_permit')
op.drop_column('ps_endpoints', 'contact_deny')
op.drop_column('ps_endpoints', 'acl')
op.drop_column('ps_endpoints', 'permit')
op.drop_column('ps_endpoints', 'deny')