|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
const Connector = require("./Connector")
|
|
|
|
|
const config = require('../../config.json')
|
|
|
|
|
const boskrypt = require('../../boskrypt')
|
|
|
|
|
const md5 = require('md5')
|
|
|
|
|
const axios = require('axios')
|
|
|
|
|
// [ "ecityruf", "123456789" ]
|
|
|
|
@ -13,13 +14,28 @@ class eCityrufConnector extends Connector {
|
|
|
|
|
async transmitMessage(msg, params) {
|
|
|
|
|
const UUID = this.name+':'+md5(JSON.stringify([this.name,...params]))
|
|
|
|
|
if (params.length !== 1) return false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const $device = msg.routingParams.device
|
|
|
|
|
let payloadBuffer = Buffer.from(msg.payload)
|
|
|
|
|
const boskryptSupport = require("../DeviceRegistry").Devices[ $device ].supportBOSkrypt || false
|
|
|
|
|
if (boskryptSupport && !!config.pagers[ $device ] && config.pagers[ $device ].boskrypt.enabled) {
|
|
|
|
|
//payloadBuffer
|
|
|
|
|
const keyTable = config.pagers[ $device ].boskrypt.keys
|
|
|
|
|
const FunkrufNummer = "em-"+params[ 0 ]
|
|
|
|
|
if (!!keyTable[ FunkrufNummer ]) {
|
|
|
|
|
payloadBuffer = Buffer.from(boskrypt.encrypt(payloadBuffer, keyTable[ FunkrufNummer ], 0))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const cityrufRequest = require('querystring').stringify({
|
|
|
|
|
service: 1,
|
|
|
|
|
class: 7,
|
|
|
|
|
language: 'en',
|
|
|
|
|
action: 'SendMessage',
|
|
|
|
|
number: params[ 0 ],
|
|
|
|
|
message: msg.payload,
|
|
|
|
|
message: payloadBuffer.toString('ascii'),
|
|
|
|
|
lengthAlert: '',
|
|
|
|
|
})
|
|
|
|
|
console.log(cityrufRequest)
|
|
|
|
|