NkSIP is an Erlang SIP framework or application server, which greatly facilitates the development of robust and scalable server-side SIP applications like proxy, registrar, redirect or outbound servers and B2BUAs.
SIP is the standard protocol related to IP voice, video and remote sessions, supported by thousands of devices, softphones and network operators. It is the basic building block for most current voice or video enabled networks and it is the core protocol of the IP Multimedia Subsytem (IMS). SIP is powerful and flexible, but also very complex to work with. SIP basic concepts are easy to understand, but developing robust, scalable, highly available applications is usually quite hard and time consuming, because of the many details you have to take into account.
NkSIP takes care of much of the SIP complexity, while allowing full access to requests and responses.
NkSIP allows you to run any number of SipApps. To start a SipApp, you define a name, a set of transports to start listening on and a callback module. Currently the only way to develop NkSIP applications is using Erlang (a new, language-independent way of developing SipApps is in the works). You can now start sending SIP requests, and when your application starts receiving requests, specific functions in the callback module will be called. Each defined callback function has a sane default functionality, so you only have to implement the functions you need to customize. You don't have to deal with transports, retransmissions, authentications or dialog management. All of those aspects are managed by NkSIP in a standard way. In case you need to, you can implement the related callback functions, or even process the request by yourself using the powerful NkSIP Erlang functions.
NkSIP has a clean, written from scratch, OTP compliant and fully typed pure Erlang code. New RFCs and features can be implemented securely and quickly. The codebase includes currently more than 50 unit tests. If you want to customize the way NkSIP behaves beyond what the callback mechanism offers, it should be easy to understand the code and use it as a powerful base for your specific application server.
NkSIP is currently alpha quality. It is not yet production-ready, but it is already very robust, thanks to its OTP design. Also thanks to its Erlang roots it can perform many actions while running: starting and stopping SipApps, hot code upgrades, configuration changes and even updating your application behavior and function callbacks on the fly.
NkSIP scales automatically using all of the available cores on the machine. Using common hardware (4-core i7 MacMini), it is easy to get more than 3.000 call cycles (INVITE-ACK-BYE) or 10.000 stateless registrations per second. On the roadmap there is a fully distributed version, based on Riak Core, that will allow you to add and remove nodes while running, scale as much as needed and offer a very high availability, all of it without changing your application.
NkSIP is a pure SIP framework, so it does not support any real RTP media processing it can't record a call, host an audio conference or transcode. These type of tasks should be done with a SIP media server, like Freeswitch or Asterisk. However NkSIP can act as a standard endpoint (or a B2BUA, actually), which is very useful in many scenarios: registering with an external server, answering and redirecting a call or recovering in real time from a failed media server.
Last released version is v0.3.0. New features include:
- INFO method.
- New caching locating server with NAPTR and SRVS support.
- Outbound connection controlling process.
- SCTP transport.
- IPv6 support.
- New SIP parsers fully RFC4475 Torture Tests compliant.
- API documentation is available here.
- Change log.
- Current features.
- Roadmap.
There are currently three sample applications included with NkSIP:
- Simple PBX: Registrar server and forking proxy with endpoints monitoring.
- LoadTest: Heavy-load NkSIP testing.
- Tutorial: Code base for the included tutorial.
NkSIP has been tested on OSX and Linux, using Erlang R15B y R16B
> git clone https://github.com/kalta/nksip
> cd nksip
> make
> make tests
Now you can start a simple SipApp using the included default callback module:
> make shell
1> nksip:start(test1, nksip_sipapp, [], []).
ok
2> nksip_uac:options(test1, "sip:sip2sip.info", []).
{ok, 200, []}
From this point you can read the tutorial or start hacking with the included nksip_pbx application:
> make pbx
1> nksip_pbx:start().
You could also perform a heavy-load test using the included application nksip_loadtest:
> make loadtest
1> nksip_loadtest:full().
Please contribute with code, bug fixes, documentation fixes, testing with SIP devices or any other form. Use GitHub Issues and Pull Requests, forking this repository.