How to create an SMPP server

490 views Asked by At

I have built am sms platform in django that connects to providers via HTTP, but now i want my application to communicate in SMPP protocol.

Please has anybody built such an application.?

I have searched through the internet, I found this repo https://github.com/dtekluva/shorty_SMPP.

But I cannot for the life of me, get it to run. I have also tried to reach out to the developer.

1

There are 1 answers

1
黄河李 On

You do not need a SMPPServer .You need a SMPPClient to connect to your SMPP providers. And provide a HTTP interface for your sms platform.

Recommend a SMS development library sms-client and sms-core to support Smpp.

Also sms-client dependent on sms-core which can provide SMPPServer easily. for example: DemoSMPPServer

Next for SMPP Client:

    <dependency>
      <groupId>com.chinamobile.cmos</groupId>
      <artifactId>sms-client</artifactId>
      <version>0.0.7</version>
    </dependency>

public void testsmpp() throws Exception {
    SmsClientBuilder builder = new SmsClientBuilder();
    SmsClient smsClient = builder.uri("smpp://127.0.0.1:18890?username=test01&password=1qaz2wsx&version=52&window=32&maxchannel=1")
    .receiver(new MessageReceiver() {

        public void receive(BaseMessage message) {
            logger.info("receive : {}",message.toString());
        }}).build();
    for (int i = 0; i < 5; i++) {
        
        SubmitSm pdu = new SubmitSm();
        pdu.setRegisteredDelivery((byte)1);
        pdu.setSourceAddress(new Address((byte)0,(byte)0,"10086"));
        pdu.setDestAddress(new Address((byte)0,(byte)0,"13800138000"));
        pdu.setSmsMsg(new SmsTextMessage("SmsTextMessage " + i,SmsDcs.getGeneralDataCodingDcs(SmsAlphabet.GSM,SmsMsgClass.CLASS_UNKNOWN)));
        try {
            smsClient.send(pdu, 1000);
        } catch (Exception e) {
            logger.info("send ", e);
        }
    }
    Thread.sleep(5000000);
}