Skip to content

Commit

Permalink
support sip_parent_callid (#12)
Browse files Browse the repository at this point in the history
* support sip_parent_callid

* fix github action
  • Loading branch information
xquanluu authored Oct 17, 2024
1 parent 639546d commit 38204c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ jobs:
- uses: actions/setup-node@v1
with:
node-version: 12
- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
- run: npm install
- run: npm run jslint
- run: npm test
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const schemas = {
from: Influx.FieldType.STRING,
to: Influx.FieldType.STRING,
sip_callid: Influx.FieldType.STRING,
sip_parent_callid: Influx.FieldType.STRING,
sip_status: Influx.FieldType.INTEGER,
duration: Influx.FieldType.INTEGER,
terminated_at: Influx.FieldType.INTEGER,
Expand Down Expand Up @@ -734,7 +735,7 @@ module.exports = (logger, opts) => {
if (typeof opts === 'string') opts = {host: opts};
assert(opts.host);

const cdrClient = new Influx.InfluxDB({database: 'cdrs', schemas: schemas.cdr, ...opts});
const cdrClient = new Influx.InfluxDB({database: 'cdrs', schemas: schemas.cdrs, ...opts});
const alertClient = new Influx.InfluxDB({database: 'alerts', schemas: schemas.alerts, ...opts});
const callCountClient = new Influx.InfluxDB({database: 'call_counts', schemas: schemas.call_counts, ...opts});
const callCountSPClient = new Influx.InfluxDB({database: 'sp_call_counts', schemas: schemas.sp_call_counts, ...opts});
Expand Down
3 changes: 3 additions & 0 deletions test/unit-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ test('write timeseries data', async(t) => {
from: 'me',
to: 'you',
sip_callid: '[email protected]',
sip_parent_callid: '[email protected]',
answered: true,
duration: 22,
attempted_at: new Date(Date.now() - (3600 * 1000)),
Expand All @@ -41,6 +42,7 @@ test('write timeseries data', async(t) => {
from: 'me2',
to: 'you2',
sip_callid: '[email protected]',
sip_parent_callid: '[email protected]',
answered: false,
duration: 20,
attempted_at: new Date(Date.now() - (7200 * 1000)),
Expand All @@ -61,6 +63,7 @@ test('write timeseries data', async(t) => {
result = await queryCdrs({account_sid: 'xxxx', page: 1, page_size:25});
//console.log(JSON.stringify(result));
t.ok(result.data.length === 1, 'queried cdrs by account sid');
t.ok(result.data[0].sip_parent_callid === '[email protected]', 'sip_parent_callid successfully added');

result = await queryCdrs({account_sid: 'xxxx', filter: 'a', page: 1, page_size:25});
t.ok(result.data.length === 0, 'queried cdrs by from');
Expand Down

0 comments on commit 38204c9

Please sign in to comment.