From 116e316eca5b564f33ec3558dbd00201da173ed8 Mon Sep 17 00:00:00 2001 From: hectorzhao Date: Mon, 31 Aug 2026 17:26:29 +0800 Subject: [PATCH] fix: validate caller collector encoding and release engine permissions --- docs/CALLER_REALTIME_ANALYTICS_DESIGN.md | 5 +++-- infra/server-b/caller-analytics/deploy.sh | 2 ++ scripts/instrument-caller-analytics.mjs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/CALLER_REALTIME_ANALYTICS_DESIGN.md b/docs/CALLER_REALTIME_ANALYTICS_DESIGN.md index 13c3336..b75f75a 100644 --- a/docs/CALLER_REALTIME_ANALYTICS_DESIGN.md +++ b/docs/CALLER_REALTIME_ANALYTICS_DESIGN.md @@ -1,7 +1,8 @@ # 主叫号码接通率与应答率实时分析设计方案 -日期:2026-08-31 -版本:V1.1(按用户修订后的业务口径) +日期:2026-08-31 + +版本:V1.1(按用户修订后的业务口径) 状态:设计文档已完成;代码、数据库迁移、真实联调与上线均待实施。 实施更新(2026-08-31):独立分析链路、API、页面和测试脚本已编写;部署与真实验收结果以实施状态及发布报告为准,上述为方案编制时状态。 diff --git a/infra/server-b/caller-analytics/deploy.sh b/infra/server-b/caller-analytics/deploy.sh index 26ec422..e0c1cfd 100644 --- a/infra/server-b/caller-analytics/deploy.sh +++ b/infra/server-b/caller-analytics/deploy.sh @@ -50,6 +50,8 @@ source /etc/lisglosips/secrets/mysql-migrate.env set +a export DATABASE_URL DATABASE_URL=$(/usr/bin/node -e 'console.log(`mysql://${encodeURIComponent(process.env.MYSQL_USER)}:${encodeURIComponent(process.env.MYSQL_PASSWORD)}@${process.env.MYSQL_HOST}:${process.env.MYSQL_PORT}/${process.env.MYSQL_DATABASE}`)') +# Previous delta releases stripped executable bits from bundled native engines. +find "$new/node_modules/.pnpm" -path '*/@prisma/engines/schema-engine-debian-openssl-3.0.x' -type f -exec chmod 0750 {} \; /usr/bin/node "$new/node_modules/prisma/build/index.js" migrate deploy --schema "$new/prisma/schema.prisma" unset DATABASE_URL MYSQL_PASSWORD install -d -o syslog -g lisglosips -m 0750 /var/log/lisglosips diff --git a/scripts/instrument-caller-analytics.mjs b/scripts/instrument-caller-analytics.mjs index c802963..34bf874 100644 --- a/scripts/instrument-caller-analytics.mjs +++ b/scripts/instrument-caller-analytics.mjs @@ -24,7 +24,7 @@ insert('route[S28_CDR_FAILURE] {', '\n $var(cra_kind)="END"; $var(cra_code)=$ const fields = ['uid', 'callid', 'customer', 'gateway', 'vendor', 'vendorGateway', 'caller', 'landing', 'callee', 'city', 'carrier', 'attempt']; function emitter(type, prefix) { const ref = k => `$${prefix}(cra_${k})`; - const encoded = fields.map(k => `$(${prefix}(cra_${k}){s.encode.base64})`).join('|'); + const encoded = fields.map(k => `$(${prefix}(cra_${k}){s.b64encode})`).join('|'); return `\nroute[CRA_EMIT_${type}] {\n if (${ref('customer')}==NULL || ${ref('customer')}=="none") return;\n xlog("L_NOTICE", "CRA1|$var(cra_kind)|$Ts|$Tsm|${ref('startsec')}|${ref('startmicro')}|$var(cra_code)|$var(cra_source)|${encoded}\\n");\n}\n`; } cfg += emitter('AVP', 'avp') + emitter('DLG', 'dlg_val') + `