Git Product home page Git Product logo

Comments (11)

sukhrobkhakimov avatar sukhrobkhakimov commented on August 19, 2024 1

@habaongoc Are you testing with GSM or CDMA operator? If it is GSM, then use "message_payload" instead of "short_message". If it is CDMA, you must send multiple messages. Please, refer to this link #4

from node-smpp.

notgiorgi avatar notgiorgi commented on August 19, 2024 1

@Sukhrob I tried, It didn't work. I think it's provider's problem.

I solved problem using this answer: #4 (comment)

    calculateMessageUHD(sms) {
        const info = gsm(sms)
        const cref = this.concat_ref
        return info.parts.map((part, i) => {
            
            let udh = new Buffer(6)
            udh.write(String.fromCharCode(0x5), 0) //Length of UDF
            udh.write(String.fromCharCode(0x0), 1) //Indicator for concatenated message
            udh.write(String.fromCharCode(0x3), 2) //  Subheader Length ( 3 bytes)
            udh.write(String.fromCharCode(cref), 3) //Same reference for all concatenated messages
            udh.write(String.fromCharCode(info.sms_count), 4) //Number of total messages in the concatenation
            udh.write(String.fromCharCode(i + 1), 5) //Sequence number ( used by the mobile to concatenate the split messages)

            return {
                udh: udh,
                message: part,
            }
        })
    }

then while sending submit_sm:

short_message: {
        udh: part.udh,
        message: part.message,
},

from node-smpp.

notgiorgi avatar notgiorgi commented on August 19, 2024

I'm using message_payload, also setting sm_length to 0.
Messages are delivered but they're empty, what could be a problem? I'm testing with GSM operator.

from node-smpp.

sukhrobkhakimov avatar sukhrobkhakimov commented on August 19, 2024

@notgiorgi Please, try without setting sm_length to 0. If it doesn't work, can you provide an example source code or at least the one that looks like yours?

from node-smpp.

habaongoc avatar habaongoc commented on August 19, 2024

Many thanks to @Sukhrob and @notgiorgi . I sent it successfully by changing short_message to message_payload.
Sorry for my late reply because I didn't work for this project shortly.

from node-smpp.

habaongoc avatar habaongoc commented on August 19, 2024

Besides, I cannot send message for the first time when I start service. The second time and more work well. Here is my code :

var session = smpp.connect('smpp://smppip');

session.bind_transceiver({
    system_id: 'xx',
    password: 'xx'
}, function(pdu) {
    console.log("- bind_transceiver pdu", pdu)
    if (pdu.command_status == 0) {
        // Successfully bound
        console.log("Successful bound!");
    }
    else{
        console.log("Unsucessful Bound!");
        res.send({error:pdu.command_status , success: 'Unsucessful Bound'});
    }
});
router.get('/sendSMS', function(req, res, next) {
	var number = req.query.number;
	var message = req.query.message;
	console.log("number",number,"message",message)

    session.submit_sm({
        source_addr: 'ABC',
        destination_addr: number,
        message_payload : message,
		source_addr_ton: 5,
		source_addr_npi: 1,
		dest_addr_ton: 1,
		dest_addr_npi: 1,
    }, function(pdu) {
        //console.log("- submit_sm pdu:", pdu)
        if (pdu.command_status == 0) {
            console.log("- submit_sm success",pdu.message_id);
              res.send({errorCode:pdu.command_status, errorMessage: 'Send message success'});
       }
        else{
            console.log("- submit_sm fail:", pdu);
              res.send({errorCode:pdu.command_status, errorMessage: 'Send message fail'});
        }
    });
});

Please help me, I don't know why it does not work for the very first request.

from node-smpp.

sukhrobkhakimov avatar sukhrobkhakimov commented on August 19, 2024

@habaongoc Can you put this code:

router.get('/sendSMS', function(req, res, next) {
    var number = req.query.number;
var message = req.query.message;
console.log("number",number,"message",message)

session.submit_sm({
    source_addr: 'ABC',
    destination_addr: number,
    message_payload : message,
	source_addr_ton: 5,
	source_addr_npi: 1,
	dest_addr_ton: 1,
	dest_addr_npi: 1,
}, function(pdu) {
    //console.log("- submit_sm pdu:", pdu)
    if (pdu.command_status == 0) {
        console.log("- submit_sm success",pdu.message_id);
          res.send({errorCode:pdu.command_status, errorMessage: 'Send message success'});
   }
    else{
        console.log("- submit_sm fail:", pdu);
          res.send({errorCode:pdu.command_status, errorMessage: 'Send message fail'});
    }
});

});

after this code and check it again

// Successfully bound
console.log("Successful bound!");

I think you are trying to send an SMS before connecting.

from node-smpp.

habaongoc avatar habaongoc commented on August 19, 2024

Hi @Sukhrob,
It's same as my code (I tried your suggestion) because after log : "Successful bound!" show on the console, I call api "/sendSMS". Both is not work.
My solution now is: send a SMS notify to my number (is it cheating?) after "Successful bound!" - (of course I wont receive it). But I don't think it s good idea
It's like, I need to session.send(..) once, and then everything will smooth later.

from node-smpp.

 avatar commented on August 19, 2024

Suggestion:


var session = smpp.connect('smpp://smppip');

router.get('/sendSMS', function(req, res, next) {
var number = req.query.number;
var message = req.query.message;
console.log("number", number, "message", message);

session.bind_transceiver({
    system_id: 'xx',
    password: 'xx'
}, function(pdu) {
    console.log("- bind_transceiver pdu", pdu)
    if (pdu.command_status == 0) {
        // Successfully bound
        console.log("Successful bound!");
        session.submit_sm({
            source_addr: 'ABC',
            destination_addr: number,
            message_payload: message,
            source_addr_ton: 5,
            source_addr_npi: 1,
            dest_addr_ton: 1,
            dest_addr_npi: 1,
        }, function(pdu) {
            //console.log("- submit_sm pdu:", pdu)
            if (pdu.command_status == 0) {
                console.log("- submit_sm success", pdu.message_id);
                res.send({ errorCode: pdu.command_status, errorMessage: 'Send message success' });
            } else {
                console.log("- submit_sm fail:", pdu);
                res.send({ errorCode: pdu.command_status, errorMessage: 'Send message fail' });
            }
        });
    } else {
        console.log("Unsucessful Bound!");
        res.send({ error: pdu.command_status, success: 'Unsucessful Bound' });
    }
});

});

from node-smpp.

nimitwalia89 avatar nimitwalia89 commented on August 19, 2024

My code runs without any errors. It gives response for message sent successfully. But no sms is received on device. Can i know what am i missing? Also i am getting empty message id in PDU response..

from node-smpp.

juliangut avatar juliangut commented on August 19, 2024

This issue is too broad and too old, please if help is still needed open a new issue

from node-smpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.