Git Product home page Git Product logo

spring-boot-starter-smpp's People

Contributors

dependabot-preview[bot] avatar mikesafonov avatar mikhailepatko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

spring-boot-starter-smpp's Issues

Flash Message Feature

Hi Mike,

Hope you are doing well. I have been using your project from last 2 months in my production system. It fulfilled many of my business requirements. A great work. Really appreciated. My question is can you please add new feature to send a flash message.

Regards,
Haseeb Majeed

toReport method should not check missing fields

Hi @MikeSafonov

Current when trying to receive an inbound mo I get the following exception. Sometimes an smsc doesn't return a message with an id therefore it fails here

com.cloudhopper.smpp.util.DeliveryReceiptException: Unable to find [id] field or empty value in delivery receipt message
	at com.cloudhopper.smpp.util.DeliveryReceipt.parseShortMessage(DeliveryReceipt.java:510) ~[ch-smpp-5.1.0-113.jar!/:5.1.0-113]
	at com.cloudhopper.smpp.util.DeliveryReceipt.parseShortMessage(DeliveryReceipt.java:365) ~[ch-smpp-5.1.0-113.jar!/:5.1.0-113]
	at com.cloudhopper.smpp.util.DeliveryReceipt.parseShortMessage(DeliveryReceipt.java:349) ~[ch-smpp-5.1.0-113.jar!/:5.1.0-113]
	at com.github.mikesafonov.smpp.core.reciever.ResponseSmppSessionHandler.toReport(ResponseSmppSessionHandler.java:65) ~[spring-boot-starter-smpp-1.4.0.jar!/:na]

Could you kindly change it to this.

private DeliveryReport toReport(DeliverSm deliverSm) throws DeliveryReceiptException {
        byte[] shortMessage = deliverSm.getShortMessage();
        String sms = new String(shortMessage);
        DeliveryReceipt deliveryReceipt = DeliveryReceipt.parseShortMessage(sms, DateTimeZone.UTC, false);
        return DeliveryReport.of(deliveryReceipt, clientId);
    }

Edit:

Finally found the issue is related to an MO message. When it is parsed the body doesn't contain delivery receipt but instead contains an actual message.

Was able to add the following to ResponseSmppSessionHandler

public class ResponseSmppSessionHandler extends DefaultSmppSessionHandler {

    private final String clientId;
    private final List<DeliveryReportConsumer> deliveryReportConsumers;
    private final List<ReceivedMessageConsumer> receivedMessageConsumers;

    public ResponseSmppSessionHandler(String clientId, List<DeliveryReportConsumer> deliveryReportConsumers, List<ReceivedMessageConsumer> receivedMessageConsumers) {
        this.clientId = requireNonNull(clientId);
        this.deliveryReportConsumers = requireNonNull(deliveryReportConsumers);
        this.receivedMessageConsumers = requireNonNull(receivedMessageConsumers);
    }

    @Override
    public PduResponse firePduRequestReceived(PduRequest pduRequest) {
        log.debug(pduRequest.toString());
        if (isDelivery(pduRequest)) {
            processReport(pduRequest);
        }

        return pduRequest.createResponse();
    }

    private boolean isDelivery(PduRequest pduRequest) {
        return pduRequest.isRequest() && pduRequest.getClass() == DeliverSm.class;
    }

    private void processReport(PduRequest pduRequest) {
        DeliverSm dlr = (DeliverSm) pduRequest;
        try {
            if(dlr.getEsmClass() == 0x04){
                DeliveryReport report = toReport(dlr);
                for (DeliveryReportConsumer deliveryReportConsumer : deliveryReportConsumers) {
                    deliveryReportConsumer.accept(report);
                }
            }
            else{
                ReceivedMessage receivedMessage = toReceivedMessage(dlr);
                for (ReceivedMessageConsumer consumer: receivedMessageConsumers){
                    consumer.accept(receivedMessage);
                }
            }

        } catch (DeliveryReceiptException e) {
            log.error(e.getMessage(), e);
        }
    }

    private ReceivedMessage toReceivedMessage(DeliverSm deliverSm){
        ReceivedMessage receivedMessage = new ReceivedMessage();
        receivedMessage.setText(new String(deliverSm.getShortMessage()));
        receivedMessage.setSource(deliverSm.getSourceAddress().getAddress());
        receivedMessage.setMsisdn(deliverSm.getDestAddress().getAddress());
        receivedMessage.setMessageId(Integer.toString(deliverSm.getSequenceNumber()));
        return receivedMessage;
    }

    private DeliveryReport toReport(DeliverSm deliverSm) throws DeliveryReceiptException {
        byte[] shortMessage = deliverSm.getShortMessage();
        String sms = new String(shortMessage);
        DeliveryReceipt deliveryReceipt = DeliveryReceipt.parseShortMessage(sms, DateTimeZone.UTC, false);
        return DeliveryReport.of(deliveryReceipt, clientId);
    }
}

failed message in bind request with reason “ESME has maxed out its allowed sessions”

I found that there are a lot of failed message in bind request with reason “ESME has maxed out its allowed sessions”. Currently, we set the maximum sessions as 10 in each site. But it seems your application will bind more than 20 sessions to submit SMS. For the submissions, you can use the same sessions to submit 200 messages/second (your production accounts are using this logic) instead to bind X sessions to submit 200 messages/second.

how can i setting for : maximum sessions as 10 in each site.

Want to contribute

Would like to contribute to this library. Send me your email Id. Sorry for adding this message as an issue.

Message validity period

Hi,
firstly I'd like to thank you for your great library :)

I've got a question if it's possible to set validity period (smsc expiration time) for the message?

Greetings,
cholo

Is this project still active?

I see the last (real) commit is from over a year ago. Is this still a relevant/wanted project?
If so I can contribute, I have Java and SMPP knowledge.

recieve issue

If the user send message to shortcode, like order something, then how to get this message by host,port,systemId,password etc

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.