From 7f2cc9f7e58f864a312e879e87372e7f6f9c465b Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <me@adhisimon.org>
Date: Mon, 17 Sep 2018 21:54:58 +0700
Subject: [PATCH] IMSI dan MSISDN pada report ke core

---
 lib/partner-mkios.js | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/lib/partner-mkios.js b/lib/partner-mkios.js
index cda9b65..36f12de 100644
--- a/lib/partner-mkios.js
+++ b/lib/partner-mkios.js
@@ -262,7 +262,7 @@ function unsuspendPull() {
     if (matrix.not_ready_ts) {
         matrix.not_ready_max_age_secs = Math.max( (new Date() - matrix.not_ready_ts) / 1000, matrix.not_ready_max_age_secs );
     }
-    
+
     logger.verbose('Modem is ready');
 }
 
@@ -316,11 +316,23 @@ function buy(task) {
         });
         modem.sendUSSD(ussd_command, function() {});
     })
-
-
 }
 
 function report(data) {
+    if (data.message) {
+        if (matrix.modem.imsi) {
+            data.message = 'CHIP-IMSI: ' + matrix.modem.imsi + '; ';
+        }
+
+        let msisdn = config.partner.msisdn;
+        if (msisdn && (typeof msisdn === 'object')) {
+            msisdn = msisdn[matrix.modem.imsi];
+        }
+
+        if (msisdn) {
+            data.message = 'CHIP-MSISDN: ' + msisdn + '; ';
+        }
+    }
     pullgw.report(data);
 }
 
-- 
1.9.0