gosms

package module
Version: v0.0.0-...-24c25ff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2015 License: GPL-2.0 Imports: 10 Imported by: 1

README

gosms

Your own local SMS gateway

What's the use ?

Can be used to send SMS, where you don't have access to internet or cannot use Web SMS gateways or want to save some money per SMS, or have minimal requirements for personal / internal use and such

  • deploy in less than 1 minute
  • supports Windows, GNU\Linux, Mac OS
  • works with GSM modems
  • provides API over HTTP to push messages to gateway, just like the internet based gateways do
  • takes care of queuing, throttling and retrying
  • supports multiple devices at once

gosms dashboard

deployment

  • Update conf.ini [DEVICES] section with your modem's COM port. for ex. COM10 or /dev/USBtty2
  • Run

API specification

  • /api/sms/ [POST]
    • param mobile
      • mobile number to send message to
      • number should have contry code prefix
      • for ex. +919890098900
    • param message
      • message text
      • max length is limited to 160 characters
    • response
{
  "status": 200,
  "message": "ok"
}
  • /api/logs/ [GET]
    • response
{
  "status": 200,
  "message": "ok",
  "summary": [ 10, 50, 2 ],
  "daycount": { "2015-01-22": 10, "2015-01-23": 25 },
  "messages": [
    {
      "uuid": "d04f17c4-a32c-11e4-827f-00ffcf62442b",
      "mobile": "+1858111222",
      "body": "Hey! Just playing around with gosms.",
      "status": 1
    },
  ]
}
- message status codes
  - 0 : Pending
  - 1 : Processed
  - 2 : Error

planned features

  • Allowing multiple mobile numbers with a single message in /api/sms/
  • CRUD support for messages, possibly support cancellation of message
  • Authentication support for API
  • Adding authentication for Dashboard
  • Send an email to admin on high failure rate

building from source

On Ubuntu

  • go get github.com/ivahaev/gosms
  • cd $GOPATH/src/github.com/ivahaev/gosms/dashboard
  • go get
  • go build

On Windows

  • go get github.com/ivahaev/gosms
  • cd $GOPATH/src/github.com/ivahaev/gosms/dashboard
  • go get
  • go build

run dashboard executable. Copy assets, templates, conf.ini, dashboard[.exe] if you want to move to another directory db.sqlite is created at first run if not present, copy that too if its there

Documentation

Index

Constants

View Source
const (
	SMSPending   = iota // 0
	SMSProcessed        // 1
	SMSError            // 2
)
View Source
const SMSRetryLimit = 3

TODO: should be configurable

Variables

This section is empty.

Functions

func EnqueueMessage

func EnqueueMessage(message *SMS, newMessage bool)

func GetConfig

func GetConfig(configFilePath string) (ini.File, error)

func GetLast7DaysMessageCount

func GetLast7DaysMessageCount() (map[string]int, error)

func GetStatusSummary

func GetStatusSummary() ([]int, error)

func InitWorker

func InitWorker(modems []*modem.GSMModem, bufferSize, bufferLow, loaderTimeout, countOut, loaderLongTimeout int)

Types

type SMS

type SMS struct {
	UUID      string    `json:"uuid"`
	Mobile    string    `json:"mobile"`
	Body      string    `json:"body"`
	Status    int       `json:"status"`
	Retries   int       `json:"retries"`
	Device    string    `json:"device"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

func GetMessages

func GetMessages(filter string) (result []SMS, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL