FreeSWITCH - a Software Defined Telecom Stack

The intention is to have a place to ask Elixir/Erlang-related questions regarding FreeSWICH.

The thread is named FreeSWITCH and not telephony on purpose, because it is a huge topic (there is also Asterisk, for example). See also the split of Nix and Guix threads even though the main concepts are the same.

From the FreeSWITCH wiki:

What is FreeSWITCH?

FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device. Combined with our hosted cloud platform, SignalWire, FreeSWITCH can interconnect with the outside world and scale to any size. (Visit https://signalwire.com for more info)

FreeSWITCH can handle voice, video and text communications from an IP Network (VoIP) and the PSTN(Public Switched Telephone Network - regular landlines). FreeSWITCH supports all popular VoIP protocols as well as interfacing with PRIs. For a full listing of supported protocols see the Endpoints page. Some common capacities that FreeSWITCH is used for include

  • PBX (Office phone system)
  • Class 5 Softswitch (Telephone carrier)
  • Application server such as Voicemail, conferencing, IVR
  • Softphone

This list is by no means comprehensive, FreeSWITCH is extremely flexible and can be used in any way you can imagine.

Manage FreeSWITCH via events

FreeSWITCH can be controlled by events using external applications. The below FreeSWITCH modules can be used to do so:

  • mod_event_socket

    is a TCP based interface to control FreeSWITCH

  • mod_erlang_event (source)

    is a derivative of mod_event_socket that sends events and receives commands in erlang’s binary term format. This allows FreeSWITCH™ to behave like just another erlang node (albeit a hidden one).

  • mod_kazoo (source)

    is an API-based platform that lets you use your existing phones, programming languages and IT skills to build voice, video and SMS services.

Erlang/Elixir libraries building on one of the above modules:

  • fswitch
    (erlang, supports mod_erlang_event)

  • freeswitch-outboundsocket
    (elixir, supports mod_event_socket (?))

  • elixir_mod_event
    (elixir, supports mod_event_socket and mod_erlang_event)

  • kazoo
    (erlang, supports mod_kazoo)

    This is more like a platform, and using FreeSWITCH only for “‘Call Pickup’, ‘Call Hangup’ and ‘Transcoding’” (see KAZOO Overview and Architecture). Also not sure how mod_kazoo is different from the other two.

Community

3 Likes

Very interesting. I’ve recently built an IVR system based on Asterisks ARI implementation. It’s a REST and Websocket interface for controlling and reacting to Asterisk events. It’s super powerful and has been a joy to build.

Looking to open source the Elixir lib soonish.

https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=29395573

1 Like

@ryh, you mentionioned using Elixir “to send messages to mod_kazoo on FreeSWITCH (but of course this is so that we can interact with it from a web front-end)”.

Would you share why you chose mod_kazoo? Would also be interested in how it is different from the others.

mod_erlang_event is fairly well documented, but mod_kazoo is a bit of a mystery, and was only able to find the sources with some mentions in various docs:

Here’ the github for Kazoo https://github.com/2600hz/kazoo

The 2600 guys are usually at CodeBEAMSF, at least I’ve run into them there a few times.

1 Like

And docs, https://docs.2600hz.com/supported/

1 Like

Thank you @entone for the info! Unfortunately low-level things are not documented at all in Kazoo, and the FreeSWITCH docs also seem to be treated as an afterthought. (Or I’m having severe issue with my reading comprehension, which is also possible.)

It looks like Kazoo is using mod_amqp for all interactions with FreeSwitch, https://github.com/2600hz/kazoo/blob/e6e34d16363a8cfd9005e71df71047a445e9e0df/applications/crossbar/src/crossbar_freeswitch.erl

And also compiling it periodically to add numbers and dialplans… kind of crazy.

Gotta say, really glad I chose the ARI route. haha.