app_queue: Add option to not log Restricted Caller ID to queue_log

Add a queue option log-restricted-caller-id to strip the Caller ID when storing the ENTERQUEUE event
in the queue log if the Caller ID is restricted.

Resolves: #765

UpgradeNote: Add a new column to the queues table:
queue_log_option_log_restricted ENUM('0','1','off','on','false','true','no','yes')
to control whether the Restricted Caller ID will be stored in the queue log.

UserNote: Add a Queue option log-restricted-caller-id to control whether the Restricted Caller ID
will be stored in the queue log.
If log-restricted-caller-id=no then the Caller ID will be stripped if the Caller ID is restricted.
pull/712/head
Alexei Gradinari 11 months ago committed by asterisk-org-access-app[bot]
parent 4280d7cd77
commit 07aa0ffe6a

@ -1882,6 +1882,8 @@ struct call_queue {
int memberdelay; /*!< Seconds to delay connecting member to caller */
int autofill; /*!< Ignore the head call status and ring an available agent */
int log_restricted_caller_id:1; /*!< Whether log Restricted Caller ID */
struct ao2_container *members; /*!< Head of the list of members */
struct queue_ent *head; /*!< Head of the list of callers */
AST_LIST_ENTRY(call_queue) list; /*!< Next call queue */
@ -2992,6 +2994,7 @@ static void init_queue(struct call_queue *q)
q->autopauseunavail = 0;
q->timeoutpriority = TIMEOUT_PRIORITY_APP;
q->autopausedelay = 0;
q->log_restricted_caller_id = 1;
if (!q->members) {
if (q->strategy == QUEUE_STRATEGY_LINEAR || q->strategy == QUEUE_STRATEGY_RRORDERED) {
/* linear strategy depends on order, so we have to place all members in a list */
@ -3517,6 +3520,8 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
} else {
q->timeoutpriority = TIMEOUT_PRIORITY_APP;
}
} else if (!strcasecmp(param, "log-restricted-caller-id")) {
q->log_restricted_caller_id = ast_true(val);
} else if (failunknown) {
if (linenum >= 0) {
ast_log(LOG_WARNING, "Unknown keyword in queue '%s': %s at line %d of queues.conf\n",
@ -8538,6 +8543,7 @@ static int queue_exec(struct ast_channel *chan, const char *data)
struct ast_flags opts = { 0, };
char *opt_args[OPT_ARG_ARRAY_SIZE];
int max_forwards;
int cid_allow;
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Queue requires an argument: queuename[,options[,URL[,announceoverride[,timeout[,agi[,gosub[,rule[,position]]]]]]]]\n");
@ -8683,9 +8689,11 @@ static int queue_exec(struct ast_channel *chan, const char *data)
qe.last_periodic_announce_time -= qe.parent->periodicannouncefrequency;
}
cid_allow = qe.parent->log_restricted_caller_id || ((ast_party_id_presentation(&ast_channel_caller(chan)->id) & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED);
ast_queue_log(args.queuename, ast_channel_uniqueid(chan), "NONE", "ENTERQUEUE", "%s|%s|%d",
S_OR(args.url, ""),
S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""),
S_COR(cid_allow && ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, ""),
qe.opos);
/* PREDIAL: Preprocess any callee gosub arguments. */

@ -51,6 +51,13 @@ monitor-type = MixMonitor
;
;log_membername_as_agent = no
;
; log-restricted-caller-id controls whether the Restricted Caller ID will be stored
; in the queue log.
; If log-restricted-caller-id=no then the Caller ID will be stripped if the Caller ID
; is restricted.
; Default is 'yes', which means the Caller ID is always stored.
;log-restricted-caller-id = yes
;
; force_longest_waiting_caller will cause app_queue to make sure callers are offered
; in order (longest waiting first), even for callers across multiple queues.
; Before a call is offered to an agent, an additional check is made to see if the agent

@ -0,0 +1,34 @@
"""add queue_log option log-restricted-caller-id
Revision ID: 2b7c507d7d12
Revises: bd9c5159c7ea
Create Date: 2024-06-12 17:00:16.841343
"""
# revision identifiers, used by Alembic.
revision = '2b7c507d7d12'
down_revision = 'bd9c5159c7ea'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import ENUM
AST_BOOL_NAME = 'ast_bool_values'
AST_BOOL_VALUES = [ '0', '1',
'off', 'on',
'false', 'true',
'no', 'yes' ]
def upgrade():
# Create the new enum
ast_bool_values = ENUM(*AST_BOOL_VALUES, name=AST_BOOL_NAME, create_type=False)
if op.get_context().bind.dialect.name == 'postgresql':
ast_bool_values.create(op.get_bind(), checkfirst=False)
op.add_column('queues', sa.Column('log_restricted_caller_id', ast_bool_values))
def downgrade():
op.drop_column('queues', 'log_restricted_caller_id')
Loading…
Cancel
Save