feat: complete phase2 baseline cdr quality rbac
This commit is contained in:
@@ -47,7 +47,9 @@ class MemoryVendorGatewaysRepository implements VendorGatewaysRepository {
|
||||
cpsLimit: 20,
|
||||
concurrencyLimit: 200,
|
||||
cycleRate: '0.120000',
|
||||
billingCycleSec: 60
|
||||
billingCycleSec: 60,
|
||||
landingCalleePrefix: '86',
|
||||
callerRewritePool: [{ id: 'cr_seed', caller: '02160010001', weight: 10, status: 'ENABLED' }]
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -75,6 +77,8 @@ class MemoryVendorGatewaysRepository implements VendorGatewaysRepository {
|
||||
concurrencyLimit: input.concurrencyLimit,
|
||||
billingCycleSec: input.billingCycleSec,
|
||||
cycleRate: input.cycleRate,
|
||||
landingCalleePrefix: input.landingCalleePrefix ?? null,
|
||||
callerRewritePool: input.callerRewritePool.map((item, index) => ({ id: `caller_${index}`, ...item })),
|
||||
forbiddenPeriods: input.forbiddenPeriods.map((period, index) => ({ id: `period_${index}`, ...period })),
|
||||
codecs: input.codecs.map((codec, index) => ({ id: `codec_${index}`, ...codec })),
|
||||
prefixRules: input.prefixRules.map((rule, index) => ({ id: `rule_${index}`, ...rule }))
|
||||
@@ -100,6 +104,9 @@ class MemoryVendorGatewaysRepository implements VendorGatewaysRepository {
|
||||
concurrencyLimit: input.concurrencyLimit ?? current.concurrencyLimit,
|
||||
billingCycleSec: input.billingCycleSec ?? current.billingCycleSec,
|
||||
cycleRate: input.cycleRate ?? current.cycleRate,
|
||||
landingCalleePrefix: input.landingCalleePrefix === undefined ? current.landingCalleePrefix : input.landingCalleePrefix,
|
||||
callerRewritePool:
|
||||
input.callerRewritePool === undefined ? current.callerRewritePool : input.callerRewritePool.map((item, index) => ({ id: `caller_updated_${index}`, ...item })),
|
||||
status: input.status ?? current.status,
|
||||
forbiddenPeriods: input.forbiddenPeriods === undefined ? current.forbiddenPeriods : input.forbiddenPeriods.map((period, index) => ({ id: `period_updated_${index}`, ...period })),
|
||||
codecs: input.codecs === undefined ? current.codecs : input.codecs.map((codec, index) => ({ id: `codec_updated_${index}`, ...codec })),
|
||||
@@ -141,6 +148,8 @@ class MemoryVendorGatewaysRepository implements VendorGatewaysRepository {
|
||||
billingCycleSec,
|
||||
cycleRate,
|
||||
minuteRate: (Number(cycleRate) * 60 / billingCycleSec).toFixed(6),
|
||||
landingCalleePrefix: input.landingCalleePrefix ?? null,
|
||||
callerRewritePool: input.callerRewritePool ?? [],
|
||||
status: input.status ?? 'ENABLED',
|
||||
forbiddenPeriods: input.forbiddenPeriods ?? [],
|
||||
codecs: input.codecs ?? [],
|
||||
@@ -226,7 +235,9 @@ describe('S16 vendor gateways API', () => {
|
||||
cpsLimit: 20,
|
||||
concurrencyLimit: 200,
|
||||
cycleRate: '0.120000',
|
||||
minuteRate: '0.120000'
|
||||
minuteRate: '0.120000',
|
||||
landingCalleePrefix: '86',
|
||||
callerRewritePool: [{ id: 'cr_seed', caller: '02160010001', weight: 10, status: 'ENABLED' }]
|
||||
});
|
||||
expect(JSON.stringify(response.body)).not.toContain('sipHa1');
|
||||
});
|
||||
@@ -256,6 +267,11 @@ describe('S16 vendor gateways API', () => {
|
||||
concurrencyLimit: 300,
|
||||
billingCycleSec: 6,
|
||||
cycleRate: '0.012',
|
||||
landingCalleePrefix: '86',
|
||||
callerRewritePool: [
|
||||
{ caller: '02160010001', weight: 80 },
|
||||
{ caller: '02160010002', weight: 20 }
|
||||
],
|
||||
forbiddenPeriods: [{ weekdayMask: 62, startTime: '23:00:00', endTime: '23:59:59' }],
|
||||
codecs: [
|
||||
{ codec: 'PCMA', priority: 1 },
|
||||
@@ -272,8 +288,10 @@ describe('S16 vendor gateways API', () => {
|
||||
hasSipCredential: true,
|
||||
billingCycleSec: 6,
|
||||
cycleRate: '0.012000',
|
||||
minuteRate: '0.120000'
|
||||
minuteRate: '0.120000',
|
||||
landingCalleePrefix: '86'
|
||||
});
|
||||
expect(response.body.callerRewritePool).toHaveLength(2);
|
||||
expect(response.body.sipHa1).toBeUndefined();
|
||||
});
|
||||
|
||||
@@ -283,8 +301,10 @@ describe('S16 vendor gateways API', () => {
|
||||
.send({
|
||||
authMode: 'IP',
|
||||
host: '203.0.113.10',
|
||||
landingCalleePrefix: 'ABC',
|
||||
callerRewritePool: [{ caller: '02170020001', weight: 100 }],
|
||||
codecs: [{ codec: 'G729', priority: 1 }],
|
||||
prefixRules: [{ direction: 'CALLER', matchPrefix: '+86', replacePrefix: '0', priority: 1 }]
|
||||
prefixRules: []
|
||||
})
|
||||
.expect(200)
|
||||
.expect((response) => {
|
||||
@@ -295,7 +315,9 @@ describe('S16 vendor gateways API', () => {
|
||||
hasSipCredential: false
|
||||
});
|
||||
expect(response.body.codecs).toHaveLength(1);
|
||||
expect(response.body.prefixRules[0]).toMatchObject({ direction: 'CALLER', matchPrefix: '+86' });
|
||||
expect(response.body.prefixRules).toHaveLength(0);
|
||||
expect(response.body).toMatchObject({ landingCalleePrefix: 'ABC' });
|
||||
expect(response.body.callerRewritePool[0]).toMatchObject({ caller: '02170020001', weight: 100 });
|
||||
});
|
||||
|
||||
expect(repository.outboxEvents).toBeGreaterThanOrEqual(2);
|
||||
|
||||
Reference in New Issue
Block a user