1

I'm using node-smpp and would like to know how to send a "deliver_sm" request and add "TLV" response to user_message_reference.

Extract of node-smpp / lib / smpp.js:

exports.addTLV = function(tag, options) {
    options.tag = tag;
    defs.tlvs[tlv] = options;
    defs.tlvsById[options.id] = options;
};

Test code:

var tlv = new Object();
tlv.tag = 0x001E; // smpp.receipted_message_id;
tlv.lenght =  msgid.lenght;
tlv.value = msgid;

smpp.addTLV(tlv,tlv);

Result:

defs.tlvs[tlv] = options;
       ^
ReferenceError: tlv is not defined
booyaa
  • 4,437
  • 2
  • 26
  • 32
user1328514
  • 11
  • 1
  • 3
  • Is SMPP the module name? Also what does TLV mean? – booyaa Apr 13 '12 at 08:46
  • TLV = Type-length-value a parameter added to PDU common with ASN.1 formatted protocols. see https://en.wikipedia.org/wiki/Type-length-value – gaoithe Sep 02 '20 at 09:38

1 Answers1

3

I'm the author of node-smpp module.

To add either a tlv parameter or a standard parameter to your PDUs you just need to add a property to the pdu with the appropriate name.

session.deliver_sm({
    source_addr: 'blahblah',
    destination_addr: 'blahblah',
    short_message: 'blahblah',
    receipted_message_id: 'blahblah',
    user_message_reference: msgid
});

This will send a deliver_sm pdu with the above parameters plus other required paramenters set to their default values.

Generally you don't need to use smpp.addTLV at all. It is for defining custom vendor specific TLVs (tags between 0x1400 and 0x3FFF).

Farhadi
  • 762
  • 6
  • 6
  • Hi, I know this answer is very older but anyway... I got ```TypeError: Cannot read property 'length' of undefined``` when trying to send a deliver_sm – Martial Anouman Jun 10 '21 at 11:36