feat: complete phase2 baseline cdr quality rbac

This commit is contained in:
hectorzhao
2026-06-24 18:40:21 +08:00
parent 7057fd3c42
commit a86de6545f
63 changed files with 7853 additions and 3678 deletions
+19
View File
@@ -142,6 +142,12 @@ function sampleEvent(overrides: Partial<CdrStreamPublishInput> = {}): CdrStreamP
sourceIp: '100.93.185.30',
caller: 's21-ip-1001',
callee: '13800138000',
rawCallee: '67113800138000',
businessPrefixId: 'bp_1',
businessPrefix: '671',
landingCaller: '02160010001',
landingCallee: '8613800138000',
normalizedCallee: '13800138000',
calleeCityCode: '340100',
calleeCityName: '合肥市',
calleeProvinceName: '安徽省',
@@ -167,6 +173,13 @@ describe('CDR Redis Stream contract', () => {
expect(parsed.node_id).toBe('a1');
expect(parsed.opensips_instance).toBe('opensips-a1');
expect(parsed.rtpengine_node).toBe('a1');
expect(parsed.callee).toBe('13800138000');
expect(parsed.raw_callee).toBe('67113800138000');
expect(parsed.business_prefix_id).toBe('bp_1');
expect(parsed.business_prefix).toBe('671');
expect(parsed.landing_caller).toBe('02160010001');
expect(parsed.landing_callee).toBe('8613800138000');
expect(parsed.normalized_callee).toBe('13800138000');
expect(parsed.callee_city_code).toBe('340100');
expect(parsed.callee_city_name).toBe('合肥市');
expect(parsed.callee_operator).toBe('MOBILE');
@@ -202,6 +215,12 @@ describe('CDR Redis Stream contract', () => {
]);
expect(parsed.callee_city_code).toBe('');
expect(parsed.raw_callee).toBe('');
expect(parsed.business_prefix_id).toBe('');
expect(parsed.business_prefix).toBe('');
expect(parsed.landing_caller).toBe('');
expect(parsed.landing_callee).toBe('');
expect(parsed.normalized_callee).toBe('');
expect(parsed.callee_operator).toBe('UNKNOWN');
expect(parsed.callee_number_type).toBe('UNKNOWN');
});
+24
View File
@@ -36,6 +36,12 @@ export interface CdrStreamEvent {
source_ip: string;
caller: string;
callee: string;
raw_callee: string;
business_prefix_id: string;
business_prefix: string;
landing_caller: string;
landing_callee: string;
normalized_callee: string;
callee_city_code: string;
callee_city_name: string;
callee_province_name: string;
@@ -74,6 +80,12 @@ export interface CdrStreamPublishInput {
sourceIp: string;
caller?: string;
callee?: string;
rawCallee?: string;
businessPrefixId?: string;
businessPrefix?: string;
landingCaller?: string;
landingCallee?: string;
normalizedCallee?: string;
calleeCityCode?: string;
calleeCityName?: string;
calleeProvinceName?: string;
@@ -164,6 +176,12 @@ export function buildCdrStreamEvent(input: CdrStreamPublishInput): CdrStreamEven
source_ip: input.sourceIp,
caller: input.caller ?? '',
callee: input.callee ?? '',
raw_callee: input.rawCallee ?? input.callee ?? '',
business_prefix_id: input.businessPrefixId ?? '',
business_prefix: input.businessPrefix ?? '',
landing_caller: input.landingCaller ?? input.caller ?? '',
landing_callee: input.landingCallee ?? input.callee ?? '',
normalized_callee: input.normalizedCallee ?? input.callee ?? '',
callee_city_code: input.calleeCityCode ?? '',
callee_city_name: input.calleeCityName ?? '',
callee_province_name: input.calleeProvinceName ?? '',
@@ -235,6 +253,12 @@ export function parseCdrStreamEvent(fields: string[]): ParsedCdrStreamEvent {
source_ip: parsed.source_ip,
caller: parsed.caller ?? '',
callee: parsed.callee ?? '',
raw_callee: parsed.raw_callee ?? '',
business_prefix_id: parsed.business_prefix_id ?? '',
business_prefix: parsed.business_prefix ?? '',
landing_caller: parsed.landing_caller ?? '',
landing_callee: parsed.landing_callee ?? '',
normalized_callee: parsed.normalized_callee ?? '',
callee_city_code: parsed.callee_city_code ?? '',
callee_city_name: parsed.callee_city_name ?? '',
callee_province_name: parsed.callee_province_name ?? '',