Merge "pjsip: new endpoint's options to control Connected Line updates"

changes/67/10567/2
George Joseph 7 years ago committed by Gerrit Code Review
commit 26810197c7

@ -23,6 +23,15 @@ chan_sip
--- Functionality changes from Asterisk 16.0.0 to Asterisk 16.1.0 ------------
------------------------------------------------------------------------------
res_pjsip
------------------
* New options 'trust_connected_line' and 'send_connected_line' have been
added to the endpoint. The option 'trust_connected_line' is to control
if connected line updates are accepted from this endpoint.
The option 'send_connected_line' is to control if connected line updates
can be sent to this endpoint.
The default value is 'yes' for both options.
res_rtp_asterisk
------------------
* The existing strictrtp option in rtp.conf has a new choice availabe, called

@ -1380,7 +1380,8 @@ static int is_colp_update_allowed(struct ast_sip_session *session)
struct ast_party_id connected_id;
int update_allowed = 0;
if (!session->endpoint->id.send_pai && !session->endpoint->id.send_rpid) {
if (!session->endpoint->id.send_connected_line
|| (!session->endpoint->id.send_pai && !session->endpoint->id.send_rpid)) {
return 0;
}

@ -620,6 +620,10 @@
;direct_media_glare_mitigation=none ; Mitigation of direct media re INVITE
; glare (default: "none")
;direct_media_method=invite ; Direct Media method type (default: "invite")
;trust_connected_line=yes ; Accept Connected Line updates from this endpoint
; (default: "yes")
;send_connected_line=yes ; Send Connected Line updates to this endpoint
; (default: "yes")
;connected_line_method=invite ; Connected line method type.
; When set to "invite", check the remote's
; Allow header and if UPDATE is allowed, send

@ -0,0 +1,40 @@
"""add pjsip trust/send _connected_line
Revision ID: 1ac563b350a8
Revises: 2bb1a85135ad
Create Date: 2018-10-12 17:10:34.530282
"""
# revision identifiers, used by Alembic.
revision = '1ac563b350a8'
down_revision = '2bb1a85135ad'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import ENUM
AST_BOOL_NAME = 'ast_bool_values'
# We'll just ignore the n/y and f/t abbreviations as Asterisk does not write
# those aliases.
AST_BOOL_VALUES = [ '0', '1',
'off', 'on',
'false', 'true',
'no', 'yes' ]
def upgrade():
############################# Enums ##############################
# ast_bool_values has already been created, so use postgres enum object
# type to get around "already created" issue - works okay with mysql
ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)
op.add_column('ps_endpoints', sa.Column('trust_connected_line', ast_bool_values))
op.add_column('ps_endpoints', sa.Column('send_connected_line', ast_bool_values))
def downgrade():
if op.get_context().bind.dialect.name == 'mssql':
op.drop_constraint('ck_ps_endpoints_trust_connected_line_ast_bool_values', 'ps_endpoints')
op.drop_constraint('ck_ps_endpoints_send_connected_line_ast_bool_values', 'ps_endpoints')
op.drop_column('ps_endpoints', 'trust_connected_line')
op.drop_column('ps_endpoints', 'send_connected_line')

@ -593,6 +593,10 @@ struct ast_sip_endpoint_id_configuration {
unsigned int rpid_immediate;
/*! Do we add Diversion headers to applicable outgoing requests/responses? */
unsigned int send_diversion;
/*! Do we accept connected line updates from this endpoint? */
unsigned int trust_connected_line;
/*! Do we send connected line updates to this endpoint? */
unsigned int send_connected_line;
/*! When performing connected line update, which method should be used */
enum ast_sip_session_refresh_method refresh_method;
};

@ -189,6 +189,12 @@
</enumlist>
</description>
</configOption>
<configOption name="trust_connected_line">
<synopsis>Accept Connected Line updates from this endpoint</synopsis>
</configOption>
<configOption name="send_connected_line">
<synopsis>Send Connected Line updates to this endpoint</synopsis>
</configOption>
<configOption name="connected_line_method" default="invite">
<synopsis>Connected line method type</synopsis>
<description>
@ -2184,6 +2190,12 @@
<parameter name="DirectMediaMethod">
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='direct_media_method']/synopsis/node())"/></para>
</parameter>
<parameter name="TrustConnectedLine">
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='trust_connected_line']/synopsis/node())"/></para>
</parameter>
<parameter name="SendConnectedLine">
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='send_connected_line']/synopsis/node())"/></para>
</parameter>
<parameter name="ConnectedLineMethod">
<para><xi:include xpointer="xpointer(/docs/configInfo[@name='res_pjsip']/configFile[@name='pjsip.conf']/configObject[@name='endpoint']/configOption[@name='connected_line_method']/synopsis/node())"/></para>
</parameter>

@ -1819,6 +1819,8 @@ int ast_res_pjsip_initialize_configuration(void)
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "identify_by", "username,ip", ident_handler, ident_to_str, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "direct_media", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.direct_media.enabled));
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_method", "invite", direct_media_method_handler, direct_media_method_to_str, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "trust_connected_line", "yes", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, id.trust_connected_line));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_connected_line", "yes", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, id.send_connected_line));
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "connected_line_method", "invite", connected_line_method_handler, connected_line_method_to_str, NULL, 0, 0);
ast_sorcery_object_field_register_custom(sip_sorcery, "endpoint", "direct_media_glare_mitigation", "none", direct_media_glare_mitigation_handler, direct_media_glare_mitigation_to_str, NULL, 0, 0);
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "disable_direct_media_on_nat", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, media.direct_media.disable_on_nat));

@ -341,7 +341,8 @@ static void update_incoming_connected_line(struct ast_sip_session *session, pjsi
{
struct ast_party_id id;
if (!session->endpoint->id.trust_inbound) {
if (!session->endpoint->id.trust_connected_line
|| !session->endpoint->id.trust_inbound) {
return;
}
@ -749,7 +750,10 @@ static void caller_id_outgoing_response(struct ast_sip_session *session, pjsip_t
struct ast_party_id effective_id;
struct ast_party_id connected_id;
if (!session->channel) {
if (!session->channel
|| (!session->endpoint->id.send_connected_line
&& session->inv_session
&& session->inv_session->state >= PJSIP_INV_STATE_EARLY)) {
return;
}

Loading…
Cancel
Save