Commit 9ad3c8d304bdba60eebc63809836e5629af59966

Authored by Adhidarma Hadiwinoto
1 parent 7e9e3a6b3b
Exists in master

MSISDN db

Showing 3 changed files with 18 additions and 0 deletions Side-by-side Diff

... ... @@ -3,3 +3,5 @@
3 3 /tmp/
4 4 /logs/
5 5 pid.txt
  6 +/db-msisdn.json
  7 +/db-msisdn.js
6 8 \ No newline at end of file
... ... @@ -15,12 +15,14 @@ const common = require('./common');
15 15 const sms = require('./sms');
16 16 const dbCops = require('./db-cops');
17 17 const reportSender = require('./report-sender');
  18 +const msisdn = require('./msisdn');
18 19  
19 20 const modemInfo = {
20 21 manufacturer: null,
21 22 model: null,
22 23 imei: null,
23 24 imsi: null,
  25 + msisdn: null,
24 26 cops: null,
25 27 networkId: null,
26 28 networkName: null,
... ... @@ -169,6 +171,13 @@ function readIMSI() {
169 171 simpleCommand('AT+CIMI\r', (err, result) => {
170 172 modemInfo.imsi = result;
171 173 logger.info(`IMSI: ${result}`);
  174 +
  175 + if (result) {
  176 + modemInfo.msisdn = msisdn[result];
  177 + if (modemInfo.msisdn) {
  178 + logger.info(`MSISDN: ${modemInfo.msisdn}`);
  179 + }
  180 + }
172 181 resolve(result);
173 182 });
174 183 });
... ... @@ -0,0 +1,7 @@
  1 +'use strict';
  2 +
  3 +const fs = require('fs');
  4 +
  5 +const db = fs.existsSync('db-msisdn.json') || fs.existsSync('db-msisdn.js') ? require('../db-msisdn') : {};
  6 +
  7 +module.exports = db;