• Stars
    star
    218
  • Rank 181,805 (Top 4 %)
  • Language
    Go
  • License
    MIT License
  • Created about 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SMPP 3.4 Protocol for the Go programming language

SMPP 3.4

GoDoc Go Report Card Build Status

This is an implementation of SMPP 3.4 for Go, based on the original smpp34 from Kevin Patel.

The API has been refactored to idiomatic Go code with more tests and documentation. There are also quite a few new features, such as a test server (see smpptest package) and support for text transformation for LATIN-1 and UCS-2.

It is not fully compliant, there are some TODOs in the code.

Usage

Following is an SMPP client transmitter wrapped by an HTTP server that can send Short Messages (SMS):

func main() {
    // make persistent connection
    tx := &smpp.Transmitter{
        Addr:   "localhost:2775",
        User:   "foobar",
        Passwd: "secret",
    }
    conn := tx.Bind()
    // check initial connection status
    var status smpp.ConnStatus
    if status = <-conn; status.Error() != nil {
        log.Fatalln("Unable to connect, aborting:", status.Error())
    }
    log.Println("Connection completed, status:", status.Status().String())
    // example of connection checker goroutine
    go func() {
        for c := range conn {
            log.Println("SMPP connection status:", c.Status())
        }
    }()
    // example of sender handler func
    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        sm, err := tx.Submit(&smpp.ShortMessage{
            Src:      r.FormValue("src"),
            Dst:      r.FormValue("dst"),
            Text:     pdutext.Raw(r.FormValue("text")),
            Register: pdufield.NoDeliveryReceipt,
            TLVFields: pdutlv.Fields{
                pdutlv.TagReceiptedMessageID: pdutlv.CString(r.FormValue("msgId")),
            },
        })
        if err == smpp.ErrNotConnected {
            http.Error(w, "Oops.", http.StatusServiceUnavailable)
            return
        }
        if err != nil {
            http.Error(w, err.Error(), http.StatusBadRequest)
            return
        }
        io.WriteString(w, sm.RespID())
    })
    log.Fatal(http.ListenAndServe(":8080", nil))
}

You can test from the command line:

curl localhost:8080 -X GET -F src=bart -F dst=lisa -F text=hello

If you don't have an SMPP server to test, check out Selenium SMPPSim. It has been used for the development of this package.

Tools

See the tools under cmd/. There's a command line tool for sending SMS from the command line, and an HTTP server with WebSocket support.

Supported PDUs

  • bind_transmitter
  • bind_transmitter_resp
  • bind_receiver
  • bind_receiver_resp
  • bind_transceiver
  • bind_transceiver_resp
  • outbind
  • unbind
  • unbind_resp
  • submit_sm
  • submit_sm_resp
  • submit_sm_multi
  • submit_sm_multi_resp
  • data_sm
  • data_sm_resp
  • deliver_sm
  • deliver_sm_resp
  • query_sm
  • query_sm_resp
  • cancel_sm
  • cancel_sm_resp
  • replace_sm
  • replace_sm_resp
  • enquire_link
  • enquire_link_resp
  • alert_notification
  • generic_nack
  • tag-length-value (TLV)

Copyright

See LICENSE and AUTHORS files for details.

More Repositories

1

freegeoip

IP geolocation web server
Go
4,931
star
2

wsdl2go

Command line tool to generate Go code from WSDL for SOAP XML services
Go
449
star
3

go-diameter

Diameter stack and Base Protocol (RFC 6733) for the Go programming language
Go
244
star
4

protoc-gen-cobra

Cobra command line tool generator for gRPC clients
Go
189
star
5

go-daemon

Utility to "daemonize" Go programs
C
174
star
6

go-eventsocket

FreeSWITCH Event Socket library for the Go programming language.
Go
125
star
7

cat-o-licious

Cat game written in Go
Go
104
star
8

eventsocket

Twisted protocol for the FreeSWITCH's Event Socket
Python
54
star
9

go-web

Utilities for http servers written in Go
Go
52
star
10

sms-api-server

HTTP API to send SMS via SMPP
Go
47
star
11

go-redis

Redis client library for Go
Go
45
star
12

txtraceroute

An asynchronous, pure python, traceroute with geolocation information
Python
44
star
13

twisted-twitter-stream

Twitter Stream API for Twisted
Python
43
star
14

jsonschema2go

Code generator for JSON schema
Go
38
star
15

ffmpeg-arm

Docker image with ffmpeg for ARM (Raspberry Pi)
37
star
16

nitgen-bsp

Python extension for Nitgen fingerprint recognition devices
C
22
star
17

mustash

recognize people's face and put a mustache on it
Python
15
star
18

defacer

meow
Go
12
star
19

go-swagger-ui

Go HTTP handler for serving swagger-ui
Go
10
star
20

niosted

Experimental reactor on top of Java NIO
Python
8
star
21

gocp

Go Concurrency Primitives
Go
7
star
22

dotfiles

my set of configuration files
Shell
5
star
23

go-talks

A collection of my Go talks
Go
5
star
24

txdbapi

Experimental ORM for Twisted based on Twistar
Python
4
star
25

pyqrcode

QRcode encoder and decoder for python
Java
4
star
26

go-listener

TCP listener on roids
Go
3
star
27

crosstool-ng-arm

Docker image with crosstool-ng for ARM (Raspberry Pi)
Shell
3
star
28

talkinator

a talking akinator
Python
3
star
29

pyascii85

Ascii85 encoder and decoder for python
C
3
star
30

linvpn

Secure socket layer for pppd (legacy)
C
2
star
31

b3-geoip-plugin

IP Geolocation plugin for the Big Brother Bot
Python
2
star
32

fiorix.github.com

HTML
2
star
33

pbserver

pbcopy and pbpaste over the web
Python
1
star