https://github.com/linxgnu/gosmpp
Smpp (3.4) Client Library for Go
https://github.com/linxgnu/gosmpp
client-library go golang smpp smpp-client
Last synced: about 1 year ago
JSON representation
Smpp (3.4) Client Library for Go
- Host: GitHub
- URL: https://github.com/linxgnu/gosmpp
- Owner: linxGnu
- License: apache-2.0
- Created: 2016-08-11T03:28:53.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2025-03-10T07:40:57.000Z (about 1 year ago)
- Last Synced: 2025-04-03T18:13:15.824Z (about 1 year ago)
- Topics: client-library, go, golang, smpp, smpp-client
- Language: Go
- Homepage:
- Size: 3.66 MB
- Stars: 168
- Watchers: 12
- Forks: 65
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gosmpp
[]()
[](https://goreportcard.com/report/github.com/linxGnu/gosmpp)
[](https://coveralls.io/github/linxGnu/gosmpp?branch=master)
[](https://godoc.org/github.com/linxGnu/gosmpp)
SMPP (3.4) Client Library in pure Go.
This library is well tested with SMSC simulators:
- [Melroselabs SMSC](https://melroselabs.com/services/smsc-simulator/#smsc-simulator-try)
## Installation
```
go get -u github.com/linxGnu/gosmpp
```
## Usage
### Highlight
- From `v0.1.4`, gosmpp is written in event-based style and fully-manage your smpp session, connection, error, rebinding, etc. You only need to implement some hooks:
```go
trans, err := gosmpp.NewSession(
gosmpp.TRXConnector(gosmpp.NonTLSDialer, auth),
gosmpp.Settings{
EnquireLink: 5 * time.Second,
ReadTimeout: 10 * time.Second,
OnSubmitError: func(_ pdu.PDU, err error) {
log.Fatal("SubmitPDU error:", err)
},
OnReceivingError: func(err error) {
fmt.Println("Receiving PDU/Network error:", err)
},
OnRebindingError: func(err error) {
fmt.Println("Rebinding but error:", err)
},
OnPDU: handlePDU(),
OnClosed: func(state gosmpp.State) {
fmt.Println(state)
},
}, 5*time.Second)
if err != nil {
log.Println(err)
}
defer func() {
_ = trans.Close()
}()
```
### Version (0.1.4.RC+)
- Full example could be found: [here](https://github.com/linxGnu/gosmpp/blob/master/example)
- In this example, you should run smsc first:
- Build and run SMSC Simulator:
```bash
g++ -std=c++11 example/smsc_simulator/smsc.cpp -o smsc
./smsc &
```
- Run smpp client in the example: https://github.com/linxGnu/gosmpp/blob/master/example/main.go
```bash
go run example/main.go
```
### Old version (0.1.3 and previous)
Full example could be found: [gist](https://gist.github.com/linxGnu/b488997a0e62b3f6a7060ba2af6391ea)
## Supported PDUs
- [x] bind_transmitter
- [x] bind_transmitter_resp
- [x] bind_receiver
- [x] bind_receiver_resp
- [x] bind_transceiver
- [x] bind_transceiver_resp
- [x] outbind
- [x] unbind
- [x] unbind_resp
- [x] submit_sm
- [x] submit_sm_resp
- [x] submit_sm_multi
- [x] submit_sm_multi_resp
- [x] data_sm
- [x] data_sm_resp
- [x] deliver_sm
- [x] deliver_sm_resp
- [x] query_sm
- [x] query_sm_resp
- [x] cancel_sm
- [x] cancel_sm_resp
- [x] replace_sm
- [x] replace_sm_resp
- [x] enquire_link
- [x] enquire_link_resp
- [x] alert_notification
- [x] generic_nack