diff --git a/CHANGES b/CHANGES
index 45c964e98c..b191f40dae 100644
--- a/CHANGES
+++ b/CHANGES
@@ -12,6 +12,15 @@
--- Functionality changes from Asterisk 13.23.0 to Asterisk 13.24.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
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 4da0361f1d..5bbd0257d6 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -1268,7 +1268,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->send_connected_line
+ || (!session->endpoint->id.send_pai && !session->endpoint->id.send_rpid)) {
return 0;
}
diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample
index 7f7878372d..56e7849d75 100644
--- a/configs/samples/pjsip.conf.sample
+++ b/configs/samples/pjsip.conf.sample
@@ -608,6 +608,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
diff --git a/contrib/ast-db-manage/config/versions/1ac563b350a8_add_pjsip_trust_send__connected_line.py b/contrib/ast-db-manage/config/versions/1ac563b350a8_add_pjsip_trust_send__connected_line.py
new file mode 100644
index 0000000000..6ca6d2305d
--- /dev/null
+++ b/contrib/ast-db-manage/config/versions/1ac563b350a8_add_pjsip_trust_send__connected_line.py
@@ -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')
diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h
index eb0905bf8a..902cfe88a7 100644
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -796,6 +796,10 @@ struct ast_sip_endpoint {
unsigned int accept_multiple_sdp_answers;
/*! Suppress Q.850 Reason headers on this endpoint */
unsigned int suppress_q850_reason_headers;
+ /*! 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;
};
/*! URI parameter for symmetric transport */
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 93fa6a38c9..1f34c99612 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -189,6 +189,12 @@
+
+ Accept Connected Line updates from this endpoint
+
+
+ Send Connected Line updates to this endpoint
+
Connected line method type
@@ -2120,6 +2126,12 @@
+
+
+
+
+
+
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 477b317283..3616dba3df 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -1778,6 +1778,8 @@ int ast_res_pjsip_initialize_configuration(const struct ast_module_info *ast_mod
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, trust_connected_line));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_connected_line", "yes", OPT_YESNO_T, 1, FLDSET(struct ast_sip_endpoint, 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));
diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c
index d2404965c4..24822bf426 100644
--- a/res/res_pjsip_caller_id.c
+++ b/res/res_pjsip_caller_id.c
@@ -342,7 +342,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->trust_connected_line
+ || !session->endpoint->id.trust_inbound) {
return;
}
@@ -750,7 +751,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->send_connected_line
+ && session->inv_session
+ && session->inv_session->state >= PJSIP_INV_STATE_EARLY)) {
return;
}