diff --git a/defs.js b/defs.js index a474a94..6aa9d2c 100644 --- a/defs.js +++ b/defs.js @@ -1189,7 +1189,7 @@ cmds = { replace_if_present_flag: {type: types.int8}, data_coding: {type: types.int8}, sm_default_msg_id: {type: types.int8}, - //sm_length: {type: types.int8}, + sm_length: {type: types.int8}, short_message: {type: types.buffer, filter: filters.message} } }, @@ -1259,7 +1259,7 @@ cmds = { validity_period: {type: types.cstring, filter: filters.time}, registered_delivery: {type: types.int8}, sm_default_msg_id: {type: types.int8}, - //sm_length: {type: types.int8}, + sm_length: {type: types.int8}, short_message: {type: types.buffer, filter: filters.message} } }, diff --git a/larvitsmpp.js b/larvitsmpp.js index 616ed71..bfa749c 100644 --- a/larvitsmpp.js +++ b/larvitsmpp.js @@ -48,7 +48,7 @@ function pduToObj(pdu, callback) { offset, command, param, - tlvCmdId, + //tlvCmdId, paramSize; // Returns true if this PDU is a response to another PDU @@ -128,6 +128,8 @@ function pduToObj(pdu, callback) { // If the length is greater than the current offset, there must be TLVs - resolve them! if (offset < retObj.cmdLength) { console.log('TLVs found yo! :D Implement us'); + console.log('TLV hex: ' + pdu.slice(offset, retObj.cmdLength).toString('hex')); + /* console.log(pdu.length); console.log(retObj.cmdLength); console.log(offset); @@ -138,9 +140,9 @@ function pduToObj(pdu, callback) { console.log('tlvCmdId:'); console.log(tlvCmdId); - process.exit(); offset ++; //erh... not really, do something more nice! :) + */ } // Decode the short message if it is set @@ -384,7 +386,7 @@ function session(sock) { * Always use this function to close the socket so we get it on log */ sessionEmitter.closeSocket = function() { - log.debug('larvitsmpp: session() - closeSocket() - Closing socket for ' + sock.remoteAddress + ':' + sock.remotePort); + log.verbose('larvitsmpp: session() - closeSocket() - Closing socket for ' + sock.remoteAddress + ':' + sock.remotePort); if (sessionEmitter.enqLinkTimer) { clearTimeout(sessionEmitter.enqLinkTimer); } @@ -551,6 +553,11 @@ function session(sock) { 'short_message': smsOptions.message }; + // Request DLRs! + if (smsOptions.dlr) { + pduObj.params.registered_delivery = 0x01; + } + sessionEmitter.send(pduObj, callback); };