Giter Club home page Giter Club logo

fs-registrator's Introduction

fs-registrator

FreeSWITCH Sofia-SIP Registry Bridge (Sync to Key/Value Store)

Build Status Coverage Status

Summary

When run and pointed at a FreeSWITCH instance, will take note of all Sofia-SIP registrations, and propagate them to a (replicated) K/V store for lookups.

Useful for discovering which SIP registrations reside on which server/s.

We use ESL events + a semi-regular sync for reconciliation (to gracefully handle restarts and/or missed events).

Supported K/V Stores

Currently the focus is on etcd, with the intention to support others in future. Consul and redis would be the most likely next targets (both support prefix-based wildcard lookups and TTLs for the most part).

New K/V store backends can be added, see kv_etcd.go for an example implementation. As long as you satisfy the KvBackend interface and register the backend, it will be available.

Configuration

Configuration is performed via CLI arguments, and self documenting using --help:

NAME:
   fs-registrator - FreeSWITCH Sofia-SIP Registry Bridge (Sync to Key/Value Store)

USAGE:
   fs-registrator [global options] command [command options] [arguments...]

VERSION:
   0.1.0

COMMANDS:
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --fshost value           FreeSWITCH ESL Hostname/IP (default: "localhost")
   --fsport value           FreeSWITCH ESL Port (default: 8021)
   --fspassword value       FreeSWITCH ESL Password (default: "ClueCon")
   --fsprofiles value       List of Sofia Profiles to watch (comma separated list) (default: "internal")
   --fsadvertiseip value    SIP Destination IP to store in K/V Store for FreeSWITCH
   --fsadvertiseport value  SIP Destination Port to store in K/V Store for FreeSWITCH
   --kvbackend value        Key/Value Backend (one of: etcd) (default: "etcd")
   --kvhost value           Key/Value Store Hostname/IP (default: "etcd")
   --kvport value           Key/Value Store Port (default: 2379)
   --kvprefix value         Key Space Prefix in K/V Store to store Registrations (default: "fs_registrations")
   --syncinterval value     Interval (in seconds) between full sync. A full sync is performed on initial startup also. (default: 3600)
   --help, -h               show help
   --version, -v            print the version

Building

go get -d && go build should produce a single executable. Binary releases are also available here

Running Tests

You'll need to add sip.testserver.tld to your /etc/hosts file, to workaround sipsak wanting a resolveable hostname for some tests. For background, see this mailing list post. Something like the below is fine in /etc/hosts:

127.0.0.1   sip.testserver.tld

Also, some of the tests rely on Docker containers to provide a real FreeSWITCH/etcd instances. Ensure you have Docker + Docker Compose installed, then run:

docker-compose pull
go test

Tests requiring Docker use libcompose in main_test.go

fs-registrator's People

Contributors

cpuid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fs-registrator's Issues

Add support to poll for initial connections to K/V backend + FreeSWITCH

Currently if either is not responding on TCP, it just exits with non-zero immediately.

If using within Docker or something, you may want to wait until either of these resources are available before progressing to starting the goroutines.

Add support to poll for both initially, then start the goroutines after they are available.

[tests] Fix travis docker port health check

An extra long sleep (30 seconds) is being done here currently, because the TCP port test here is passing immediately instead of waiting for FreeSWITCH to come online. Not sure why, only occurs on Travis, works fine locally...

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.