How to send deliver_sm request add user_message_reference TLV from node.js SMPP

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

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).