Git Product home page Git Product logo

Comments (10)

guicuton avatar guicuton commented on July 22, 2024 1

If your broker support 2-ways message, you will receive it on deliver_sm PDU.
I think that is something more related to your user-case/business logic then the lib feature itself.

WIth that you do whatever you want such as some auto-reply rule. A small example of how to do it:

session.on('deliver_sm', (pdu) => {
    const { short_message, destination_addr, esm_class } = pdu
    if(esm_class !== 4 && short_message.message == 'hi') {
        session.submit_sm({
            destination_addr,
            short_message: 'Welcome'
        });
    }
});

from node-smpp.

guicuton avatar guicuton commented on July 22, 2024 1

On deliver_sm PDU you will receive the further data of DLR of your provider (delivery report) from messages that you have sent by submit_sm.

The MO (message originator - the arrived messages) your provider will sent you by the same PDU, the deliver_sm.

These messages you will receive every time that one destination answer some of message that you sent or when they sent directly for your number that you have with your provider.

This is the "default" scenario but is always good ask your provider by which PDU they will sent the MO data.

from node-smpp.

guicuton avatar guicuton commented on July 22, 2024 1

Probably on both.

7929 the MO will be related to some MT that you sent (like one answer)
7233 the MO that the originator send for you regardless of a MT. (like one request)

But these are assumptions based on what i've already saw outthere.
So the best hint that i can give to you about it is check with them how it will works the flow of these shortcodes that they provide to you 😄

from node-smpp.

guicuton avatar guicuton commented on July 22, 2024 1

Have in mind that the SMPP are responsible just for send and/or receive SMS messages. Nothing else.

Any additional control like auto-reply, count users, etc, etc you will need to develop your own solution rules with caching, dabatases and so on.

would you mind adding the code snippet you shared above to Readme just incase...

As the code snippet is to particular with your user-case imho it might not be relevant made one PR with this suggestion, but Im glad that were helpfull for you 😄

from node-smpp.

elhananjair avatar elhananjair commented on July 22, 2024 1

It turned out I was using an incorrect password although the error message is misleading.

from node-smpp.

elhananjair avatar elhananjair commented on July 22, 2024

@guicuton thank you so much for the support,

Something I couldn't understand is, isn't deliver_sm PDU sent from SMSC after submit_sm request sent to SMPP Server? shouldn't my SMPP Client listen for any arrived SMS?

I am sorry am new to SMPP world.

from node-smpp.

elhananjair avatar elhananjair commented on July 22, 2024

They have already said that they will invoke the deliver_sm API to send MO SMS messages to
the App(SMPP Client), therefore I think the scenario you have specified is correct.
Can I please add something that's a little bit confusing related to MO and MT, they have already provided me e.g 7922 as MT and 7233 as MO.

when I send I will use MT code (7922) as a source address right? and use MO (7233) as a destination address for SMSC (SMPP Server) will send SMS to my app, or in which my app receives SMS?

from node-smpp.

elhananjair avatar elhananjair commented on July 22, 2024

Thanks a lot, I will do that they are not that cooperative tbh, they just sent me a document that is identical to the SMPP V5 specification 😄.

I have no idea how I get the total number of subscribers from my App, I don't think SMPP can provide such implementation.
But I will try my best. THank you so much for the support, would you mind adding the code snippet you shared above to Readme just incase...

from node-smpp.

elhananjair avatar elhananjair commented on July 22, 2024

Have in mind that the SMPP are responsible just for send and/or receive SMS messages. Nothing else.

Any additional control like auto-reply, count users, etc, etc you will need to develop your own solution rules with caching, dabatases and so on.

This is good info thank you so much, now I am getting the idea. I thought the SMSC will provide such info but I understand now.

Thanks again.

from node-smpp.

elhananjair avatar elhananjair commented on July 22, 2024

Hello @guicuton I am sorry to bother you, but I don't where else I should go, there is no great forum regarding SMPP.

I was trying to connect to a real SMSC and I keep getting command_status=14 here is my code:

var smpp = require('smpp');
var session = smpp.connect({
        url: 'smpp://HOST_NAME:PORT',
        auto_enquire_link_period: 10000,
        debug: true
}, function() {
        session.bind_transceiver({
                system_id: 'ID', //Some number
                password: 'password', //8 
                interface_version: '0x34',
                system_type: '0x00',
                addr_ton: '0x00',
                addr_npi: '0x00',
                address_range: '0x00'
        }, function(pdu) {
                if (pdu.command_status === 0) {
                        // Successfully bound
                       console.log("Successfully Created Bound");
                }else if(pdu.command_status === 14){  
                      console.log("Invalid Password");
                }
        });
});

session.on('deliver_sm', (pdu) => {
    const { short_message, destination_addr, esm_class} = pdu;
    if(esm_class !== 4 && short_message.message === 'ok') { //Indicates Message Type and enhanced network services, if it's 4 then it's a delivery receipt >
        console.log("Recieved SMS");
    }
    console.log("PDU IS : " + pdu);
})



session.on('error', (e) => {
    if(e.code === 'ETIMEOUT') {
        console.log("Connection to SMS-C Timeout");
    }else if(e.code === 'ECONNREFUSED'){
        console.log("Connection to SMS-C Refused")
    }else if(e.code === 'EAI_AGAIN'){
        console.log("Connection to internet is lost!");
    }else {
        console.log(`There is something wrong connecting to SMS-C, Error code: ${e.code}` );
    }
})
session.on('debug', function(type, msg, payload) {
        console.log({type: type, msg: msg, payload: payload});
});

I just read about command_status = 14 and it's about an invalid password but I really couldn't understand how that is possible. Can such restrictions be applied on the SMPP Server side? The password is right as far as I know.

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.