Mostly better logging
This commit is contained in:
+3
-1
@@ -110,7 +110,7 @@ function session(sock) {
|
||||
// Make sure the sequence number is set and is correct
|
||||
pduObj.seqNr = returnObj.ourSeqNr;
|
||||
|
||||
log.debug('larvitsmpp: lib/session.js: session() - returnObj.send() - Sending PDU to remote. cmdName: ' + pduObj.cmdName + ' seqNr: ' + pduObj.seqNr);
|
||||
log.debug('larvitsmpp: lib/session.js: session() - returnObj.send() - Sending PDU to remote. pduObj: ' + JSON.stringify(pduObj));
|
||||
|
||||
// If closeAndSend is omitted, put callback in its place
|
||||
if (typeof closeAfterSend === 'function') {
|
||||
@@ -225,6 +225,8 @@ function session(sock) {
|
||||
pduObj.params.registered_delivery = 0x01;
|
||||
}
|
||||
|
||||
log.debug('larvitsmpp: lib/session.js: returnObj.sendSms() - pduObj: ' + JSON.stringify(pduObj));
|
||||
|
||||
returnObj.send(pduObj, function(err, retPduObj) {
|
||||
if (typeof callback === 'function') {
|
||||
callback(err, retPduObj.params.message_id, retPduObj);
|
||||
|
||||
+12
-8
@@ -116,6 +116,8 @@ function writeBuffer(obj, cmdLength, callback) {
|
||||
// Write parameter value to buffer using the types method write()
|
||||
paramType.write(obj.params[param], buff, offset);
|
||||
|
||||
log.silly('larvitsmpp: lib/utils.js: writeBuffer() - Writing param "' + param + '" with content "' + obj.params[param] + '"');
|
||||
|
||||
// Increase the offset for the next param
|
||||
offset += paramType.size(obj.params[param]);
|
||||
}
|
||||
@@ -132,7 +134,7 @@ function writeBuffer(obj, cmdLength, callback) {
|
||||
|
||||
tlvSize = tlvDef.type.size(tlvValue);
|
||||
|
||||
log.silly('larvitsmpp: lib/utils.js: objToPdu() - writeBuffer() - Writing TLV "' + tlvName + '" offset: ' + offset + ' value: "' + tlvValue + '"');
|
||||
log.silly('larvitsmpp: lib/utils.js: writeBuffer() - Writing TLV "' + tlvName + '" offset: ' + offset + ' value: "' + tlvValue + '"');
|
||||
|
||||
buff.writeUInt16BE(tlvId, offset);
|
||||
buff.writeUInt16BE(tlvSize, offset + 2);
|
||||
@@ -299,6 +301,8 @@ function pduToObj(pdu, callback) {
|
||||
'tagName': defs.tlvsById[tlvCmdId].tag,
|
||||
'tagValue': tlvValue
|
||||
};
|
||||
|
||||
log.silly('larvitsmpp: lib/utils.js: pduToObj() - TLV found: "' + defs.tlvsById[tlvCmdId].tag + '" ID: "' + tlvCmdId + '" value: "' + tlvValue + '"');
|
||||
}
|
||||
|
||||
offset = offset + 4 + tlvLength;
|
||||
@@ -307,13 +311,11 @@ function pduToObj(pdu, callback) {
|
||||
// Decode the short message if it is set
|
||||
if (retObj.params.short_message !== undefined) {
|
||||
retObj.params.short_message = decodeMsg(retObj.params.short_message, retObj.params.data_coding);
|
||||
|
||||
callback(null, retObj);
|
||||
} else {
|
||||
// We need to do the standard callback in an else statement since
|
||||
// this always would be called before the above callback if we didn't
|
||||
callback(null, retObj);
|
||||
}
|
||||
|
||||
log.debug('larvitsmpp: lib/utils.js: pduToObj() - Complete decoded PDU: ' + JSON.stringify(retObj));
|
||||
|
||||
callback(null, retObj);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,7 +359,7 @@ function objToPdu(obj, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
// All params are mandatory. Set them if they are not set
|
||||
// Params must be an object
|
||||
if (obj.params === undefined) {
|
||||
obj.params = {};
|
||||
}
|
||||
@@ -379,6 +381,8 @@ function objToPdu(obj, callback) {
|
||||
log.silly('larvitsmpp: lib/utils.js: objToPdu() - encoding message "' + shortMsg + '" to "' + obj.params.short_message.toString('hex') + '"');
|
||||
}
|
||||
|
||||
log.debug('larvitsmpp: lib/utils.js: objToPdu() - Complete object to encode: ' + JSON.stringify(obj));
|
||||
|
||||
calcCmdLength(obj, function(err, cmdLength) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
|
||||
Reference in New Issue
Block a user