Skip to content

linxGnu/gosmpp

Folders and files

NameName
Last commit message
Last commit date
Aug 14, 2023
Jun 10, 2024
Nov 2, 2020
Jun 15, 2024
Jun 10, 2024
Jan 31, 2023
Sep 20, 2020
Oct 24, 2019
Jan 4, 2024
Jun 15, 2024
Jun 15, 2024
Mar 17, 2021
Dec 11, 2019
Apr 23, 2025
Apr 23, 2025
Jun 15, 2024
Nov 28, 2024
Jun 15, 2024
Jun 15, 2024
Jun 15, 2024
Jun 15, 2024
Sep 2, 2021
Jun 15, 2024
Nov 28, 2024
Jun 15, 2024
Jun 15, 2024
Sep 14, 2022
Jun 15, 2024

Repository files navigation

gosmpp

Go Report Card Coverage Status godoc

SMPP (3.4) Client Library in pure Go.

This library is well tested with SMSC simulators:

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:
		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+)

Old version (0.1.3 and previous)

Full example could be found: gist

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