send SMS via SMPP

0 votes
asked Mar 12, 2010 by olaseni

How do I send SMS directly via SMPP? My provider provides an SMPP interface to send SMS, how do I connect it to it? Are there any libraries or examples that can educate me on using SMPP to send? Perhaps using PHP? or C#?

9 Answers

0 votes
answered Mar 12, 2010 by zneak

There's the Logica SMPP project, written in Java, that could educate you on the matter. Other than that, there's a list of projects on the SMPP Wikipedia page that could fill a similar purpose.

0 votes
answered Mar 14, 2010 by paul-jenkins

I've used a client library from DevShock for a few years, but the company seems to have disappeared from view.

A quick Google turned up this one though:

http://www.inetlab.ru/Products/ALT.SMS.SmppClient.aspx.

Seems straightforward enough, and comes with both C# and VB.Net examples as well as some decent documentation.

Hope that helps.

0 votes
answered Mar 25, 2010 by phill-pafford

I would suggest Kannel for SMPP but a couple of questions.

Who is your Aggregator? They should offer some assistance for this.

I know OpenMarket does SMPP as well as HTTP with a multiple SDK languages

0 votes
answered Mar 22, 2012 by denis-rodin

I think that the best choise is jsmpp lib. It have good examples and many low level thing happen behind the scenes and you can focus on your business logic.

jsmpp home site

0 votes
answered Mar 12, 2014 by charles-okwuagwu

Devshock component was cool... they released the source i guess at some point?

I believe i still have that.

but writing your own smpp lib is not that hard...

SMPP 3.4 spec is fairly straight forward.

You are basically doing 3 things:

  • managing socket connections - .net stack makes that very easy and efficient
  • sending properly formatted PDU
  • decoding received bytes into PDU

Ola, you can drop me a mail if you still need this.

Cheers.

EDIT Some Provider, like the one i use (High Tech InfoSystems) also provide you a http gateway through which you may post your traffic

You may seek that as an alternative to SMPP.

One downside i have seen experienced with SMPP, is frequent disconnects is your Network connection is shaky.

The HTTP gateway options does not suffer from this and is just as fast too.

0 votes
answered Mar 2, 2015 by yasin-kaplan

You can use SMPPCli which is a command line SMPP SMS sender. You can download it from http://www.kaplansoft.com/download.html

0 votes
answered Mar 11, 2015 by jfergt

I use a Kannel for SMPP, connect kannel to a smpp server: link.

This is my kannel.conf:

group = core
admin-port = 13000
smsbox-port = 13001
admin-password = bar
status-password = foo
log-file = "/var/log/kannel/bearerbox.log"
log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
access-log = "/var/log/kannel/smsaccess.log"

#SMSC CONNECTION
group=smsc
smsc=smpp
smsc-id=ID1
host=130.1.1.50
port=5016
transceiver-mode = 1
source-addr-ton = 1
source-addr-autodetect = 0
dest-addr-npi = 1
dest-addr-ton = 1
smsc-username = "user"
smsc-password= "pass"
system-type= "system"

#SMSBOX SETUP
group = smsbox
bearerbox-host = 127.0.0.1
bearerbox-port = 13001
sendsms-port = 13013
log-file = "/var/log/kannel/smsbox.log"
log-level = 0
access-log = "/var/log/kannel/smsaccess.log"

#SEND-SMS USERS
group = sendsms-user
username = user
password = pass

#SERVICES
group = sms-service
keyword = default
text = "Su mensaje ha sido procesado"
concatenation = true
catch-all = true
accept-x-kannel-headers = true
get-url = "http://localhost/kannel/receivesms.php?sender=%p&text=%b"

Send SMS:

curl "http://localhost:13013/cgi-bin/sendsms?user=xxxxxx&pass=yyyyy&to=56976808016&text=tes"
0 votes
answered Mar 13, 2015 by eddy85br

You can use Net::SMPP if you are familiar with Perl or Jasmin (built in Python). Those are pretty tested and used.

0 votes
answered Sep 15, 2017 by worthyd

Here is the simple example code using smpp protocol in C#.

By the way ardan studio dll has some issue about data encoding and decoding.

TON and NPİ is given static in ardan studio dll so we changed it then we used this code otherwise it works but you can't use different char set.

using ArdanStudios.Common.SmppClient;
using ArdanStudios.Common.SmppClient.App;

public class SMPPClientService
{
    public static readonly object CounterLock = new object();
    private static bool isConnected = false;
    private ESMEManager SMPPConnectClient()
    {
        var smppServerPort = Library.GetAppSetting(SMPP_Server_Port).Split(';');
        string server = "xxx.xx.xx.xxx";
        short port = 6101;
        string shortLongCode = "MESSAGETİTLE";
        string systemId = "USername";
        string password = "password";
        DataCodings dataCoding = DataCodings.Latin1;    
        ESMEManager connectionManager = new ESMEManager("EricssonTest", shortLongCode, new ESMEManager.CONNECTION_EVENT_HANDLER(ConnectionEventHandler), null, null, null, null, new ESMEManager.LOG_EVENT_HANDLER(LogEventHandler), null);
        connectionManager.AddConnections(1, ConnectionModes.Transmitter, server, port, systemId, password, "Transmitter", dataCoding);
        return connectionManager;
    }
    private static void LogEventHandler(LogEventNotificationTypes logEventNotificationType, string logKey, string shortLongCode, string message)
    {                    
    }
    private static void ConnectionEventHandler(string logKey, ConnectionEventTypes connectionEventType, string message)
    {
        if (ConnectionEventTypes.Connected == connectionEventType)
        {
            lock (CounterLock)
            {
                isConnected = true;
            }
        }
    }
    private string Msisdn(string receiver)
    {
        var tmp = receiver.Replace("/", "")
            .Replace(" ", "")
            .Replace("-", "");

        if (tmp.Length == 10)
            return 90 + receiver;
        if (tmp.Length == 11 && tmp[0] == '0')
            return 9 + tmp;
        return tmp;
    }
    public int SMPPSendMessage(string messageText, string phoneNumber)
    {
        var result = 0;
        var pql = new PSmsSendLogs();
        try
        {
            using (var connectionManager = SMPPConnectClient())
            {
                phoneNumber = Msisdn(phoneNumber);
                DataCodings submitDataCoding = DataCodings.Latin1;
                DataCodings encodeDataCoding = DataCodings.Latin1;
                List<SubmitSm> submitSm = null;
                List<SubmitSmResp> submitSmResp = null;
                while (true)
                {
                    Thread.Sleep(1000);
                    if (isConnected)
                    {
*// put code here to wait until connection is being establish.İt works Async so it coulnt be connected when we called send method*
                        break;
                    }
                }
                result = connectionManager.SendMessageLarge(phoneNumber, null, Ton.Alphanumeric, Npi.Unknown, submitDataCoding, encodeDataCoding, messageText, out submitSm, out submitSmResp);     
            }
        }
        catch (Exception ex)
        {
            result = 0;
        }
        return result;
    }
    #endregion
}
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...