gsm

package module
v0.0.0-...-17ca8fb Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2016 License: GPL-3.0 Imports: 5 Imported by: 0

README

GSMGo

Introduction

GSMGo is SMS HTTP server with REST API, written in Go language.

Server enables you to send SMS messages with simple HTTP POST request:

# curl -X POST -d '{"text": "Message Example", "number": "+38164182xxxx"}' http://localhost:38164
{
"message": "success",
"status": "OK"
}

GSMGo uses libGammu so it has support for many different phones. Check Gammu Phone Database for details.

Download

Binaries are compiled with static build of libGammu, so gammu/libgammu is not required to be installed.

Usage

Usage of gsmgo:
  -bind string
        Bind address (default ":38164")
  -config string
        Config file
  -debug
	    Enable debugging
  -password string
        Password
  -username string
        Username

If you start server with username and password, it will be protected with HTTP Basic Auth.

Config file is required. Example config is shown below, it will be searched for in /etc/gsmgo.conf then ~/.gsmgo.conf and finally in directory where binary is located. You can also point it with -config option.

[gammu]
device = /dev/ttyACM0
name = Ericsson Ericsson_F3507g_Mobile_Broadband_Minicard_Composite_Device
connection = at

You can try to detect your device with gammu-detect from gammu package and then just copy /etc/gammurc file to /etc/gsmgo.conf.

Compile

Install libgammu library and devel package:

apt-get install libgammu-dev libgammu

Install server to $GOPATH/bin:

go get github.com/gen2brain/gsmgo
go install github.com/gen2brain/gsmgo/server/gsmgo

Documentation

Index

Constants

View Source
const (
	ERR_NONE    = C.ERR_NONE
	ERR_UNKNOWN = C.ERR_UNKNOWN
	ERR_TIMEOUT = C.ERR_TIMEOUT
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GSM

type GSM struct {
	// contains filtered or unexported fields
}

Gammu GSM struct

func NewGSM

func NewGSM() (g *GSM, err error)

Returns new GSM

func (*GSM) Connect

func (g *GSM) Connect() (err error)

Connects to phone

func (*GSM) EnableDebug

func (g *GSM) EnableDebug()

Enables global debugging to stderr

func (*GSM) IsConnected

func (g *GSM) IsConnected() bool

Checks if phone is connected

func (*GSM) SendSMS

func (g *GSM) SendSMS(text, number string) (err error)

Sends message

func (*GSM) SetConfig

func (g *GSM) SetConfig(config string) (err error)

Reads configuration file

func (*GSM) Terminate

func (g *GSM) Terminate() (err error)

Terminates connection and free memory

Directories

Path Synopsis
server
gsmgo command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL