Code Monkey home page Code Monkey logo

sipws's Introduction

SIPWS

SIP server websocket transport

Simple all-in-one SIP server UDP, TCP, WS (websocket) transport.

SIP accounts managed by POST Json requests served by embedded HTTP server.

This is a beta.

Build

./configure
make

Building Windows

Open sipws.sln VC solution, change include and library path.

Dependencies

Libraries

Start

Start as usual (foreground) process with -f option:

./sipws -f

By default, sipws running as deamon (or Windows service). Skip -f option:

./sipws

Create service in Windows:
sc create "sipws" binPath= \sipws.exe
sc delete "sipws"

Enable SIP transports

  • UDP -u 5060
  • TCP -t 5060
  • WS -p 8080

-u, -t, -p -s port options enables UDP, TCP, WS, WSS transports.

Enable at least one transport.

Enable HTTP server

HTTP server provide account control.

  • -r 8082

Set specific network inteface

-i 192.168.43.113

By default, sipws listen 0.0.0.0 address (all interfaces).

Enable debug output

  • -vvv debug info
  • -vv more detailed log
  • -v enable logging

In deamon mode, output routes to syslog (*nix) or \sipws.log file. Please DO NOT use logging in production.

Otherwise fatal errors only.

Load options from file

sipws search sipws.cfg in the sipws binary file directory, then in the current directory, last in the /etc or windows directory.

sipws.cfg is a file with command line string. Create sipws.cfg to start daemon (service).

If file sipws.cfg exists, skip reading config with --skipconfig option.

Provision accounts

Create "database" file:

{
"data":[
{"avail":"0","cn":"Alice","description":"","domain":"192.168.43.113","expire":3600,"id":"100","image":"http://acme.com/brb/sipws/i/100.png","origin":"registry","password":"password","port":5060},
...
],
"domain":"192.168.43.113",
"ip":"192.168.43.113"
}

Assign "database" file : -b, --db=

Provision accounts at startup

In addition to -b, there is -d, --data= option loads accounts from the "request" file.

Provision accounts dynamically

When -r, --httpport= option is set, POST Json requests to add or delete SIP accounts, start or stop service, clear accounts. Key must be provided. sipws compare key with valid keys. If key is valid, operation is permitted.

Start, stop, clear

Request

{“q”:””, “domain”:””, “key”:”...”}

= start,stop,clear

Response

{“q”:, “errorcode”:”1”}

List

Request

{“q”:””, “domain”:””, “key”:”...”}

= list

Response

Success:

{“q”:”list”, “errorcode”:”1”} -invalid key

Error:

{“q”:”list”, “registry”:[

,..]}

: { "avail", "proto", "origin", "key", "cn", "description", "id", "domain", "host", "line", "tag", "rinstance", "image", "port", "expire", "registered", "updated" }

Provide user registry

Request

{“q”:””, “domain”:””, “key”:”...”, “data”:[,...], “v”:124}

= put

: {“o”:”+”, “u”:””, “k”:””, “cn”:”common name”, “description”:””, “i”:””}

o: +,- add(edit),delete

Response

{“q”:”put”, “errorcode”:”1”, “v”:123}

v: version number before update (0..)

When -r, --httpport= option is set, GET Json requests registered accounts.

Other options

./sipws -h

Usage sipws
[-fv8h] [-i ] [-r ] [-p ] [-s ] [-u ] [-t ] [-c ] [-k ] [-w ] [-d ] [-b ] [-l ] [--skipconfig] []...

simple websocket SIP service

-i, --interface= host name or IP address. Default 0.0.0.0- all interfaces
-r, --httpport= HTTP register control port number, e.g. 8082
-p, --port= SIP WS port number, e.g. 8080
-s, --tlsport= SIP WSS port number. e.g. 443
-u, --udpport= SIP UDP port number. Disable UDP transport if not specified
-t, --tcpport= SIP TCP port number. Disable TCP transport if not specified
-c, --certificate= certificate file, default server.pem
-k, --pk= private key file, default server.pem
-w, --password= certificate password, e.g. test
-d, --data= initial registry request JSON file
-b, --db= writeable database file name
-f, --foreground Do not start deamon
-v, --verbose severity: -v: error, -vv: warning, -vvv: debug. Default fatal error only.
-l, --locale= e.g. russian_russia.1251, ru_RU.UTF-8
-8, --utf8 locale use UTF-8
--skipconfig Skip reading argruments from sipws.cfg
-h, --help print this help and exit
update registry valid keys (-r)

sipws's People

Contributors

commandus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.