Skip to main content

Posts

Showing posts with the label freeswitch

Monitoring FreeSWITCH with Homer - adding non-SIP events with hepipe.js

FreeSWITCH (from now on FS) provides a very powerful tool to interact with it: the Event Socket (ESL), made available via the mod_event_socket module ( https://freeswitch.org/confluence/display/FREESWITCH/mod_event_socket ). ESL is a TCP socket where applications can connect to, and perform two types of action: 1. Send commands. 2. Subscribe to events. The applications subscribing to events will receive the expected notifications through the same TCP connection. A simple protocol and transport made it possible for various libraries in various languages to be written. Events from FS can serve multiple purposes. In this article I'm interested in monitoring and event correlation. Homer ( http://sipcapture.org/ ) is a widely used, open source tool to monitor RTC infrastructures. It has a multitude of features, but the core is the ability to collect SIP signalling and other events from RTC applications, and perform a form of correlation. In particular, it's ab...

Opus/G.711 Transcoding For The Practical Man

Following my earlier post on "Opus SDP negotiation" in the series "For The Practical Man", I'm presenting today a related topic: Opus audio codec when transcoding is involved. Most of the providers of PSTN connectivity require the simplest possible VoIP codec: G.711 (which comes in two flavours, u-law and a-law). G.711 is a sort of PCM encoding at 8000 samples per second: 8000 times per second an audio sample is encoded with 8 bit. Sometimes Comfort Noise can be used, reducing the bitrate when silence is detected, but otherwise the typical working principle is a continuous flow of digitally-encoded packets of voice. u-law and a-law just use a different way to encode the data. (If you're curious about what does silence look like in G.711, I wrote a post about it some time ago ). G.729 is another widely adopted codec, but I'll leave it for another day. With 8000 samples per second and 8 bit dedicated for each sample G.711 requires a net...

FreeSWITCH - Check what configuration directories are in use

There is a little trick to see what directories FreeSWITCH is using as paths for the configuration files: /opt/freeswitch/bin/fs_cli -x 'global_getvar'| grep _dir For example, the output can be: base_dir=/usr/local/freeswitch recordings_dir=/usr/local/freeswitch/recordings sounds_dir=/usr/local/freeswitch/sounds conf_dir=/opt/freeswitch/etc/freeswitch/ log_dir=/usr/local/freeswitch/log run_dir=/usr/local/freeswitch/log db_dir=/usr/local/freeswitch/db mod_dir=/usr/local/freeswitch/mod htdocs_dir=/usr/local/freeswitch/htdocs script_dir=/usr/local/freeswitch/scripts temp_dir=/tmp grammar_dir=/usr/local/freeswitch/grammar fonts_dir=/usr/local/freeswitch/fonts images_dir=/usr/local/freeswitch/images certs_dir=/usr/local/freeswitch/certs storage_dir=/usr/local/freeswitch/storage cache_dir=/usr/local/freeswitch/cache data_dir=/usr/local/freeswitch localstate_dir=/usr/local/freeswitch internal_ssl_dir=/usr/local/freeswitch/conf/ssl external_ssl_dir=/usr/loca...

Bridging WebRTC and SIP with verto

Verto is a newly designed signalling protocol for WebRTC clients interacting with FreeSWITCH . It has an intuitive, JSON-based RPC which allows clients to exchange SDP offers and answers with FreeSWITCH over a WebSocket (and Secure WebSockets are supported). It’s available right now with the 1.4 stable version (1.4.14 at the moment of writing). The feature I like the most is “ verto.attach ”: when a client has an active bridge on FreeSWITCH and, for any reason (e.g. a tab refresh) it disconnects, upon reconnection FreeSWITCH automatically re-offers the session SDP and allows the client to immediately reattach to the existing session. I have not seen this implemented in other places and find it extremely useful. I’ve noticed recently that this does not fully work yet when the media is bypassed (e.g. on a verto-verto call), but Anthony Minnesale, on the FreeSWITCH dev mailing list said this feature is still a work in progress, so I’m keeping an eye on it. Initially I was ex...

Accessing the full P-Asserted-Identity header from FreeSWITCH

I hope this can save the reader some time. If you need to read the entire content of the P-Asserted-Identity header of an incoming INVITE, be aware that you should change the sofia profile by adding a param like: param name="p-asserted-id-parse" value="verbatim" FreeSWITCH will populate the variable accordingly and make it available with commands like (e.g. with lua): PAID = session:getVariable("sip_P-Asserted-Identity") If you don't add this parameter, you'll get the default behaviour, which is just filling the variable with the P-Asserted-Identity URI username part. Possible value are: "default", "user-only", "user-domain", "verbatim" , which I think are self-explanatory. A recent reference here .

Build a test bed with FreeSWITCH and PJSUA (with SILK)

Build and run FreeSWITCH This is based on debian wheezy, and uses master FreeSWITCH . You can switch to stable when cloning. In my experience this is the quickest way to get to a working, vanilla setup that you can use to automate tests with PJSUA (the PJSIP command-line client). mkdir git cd git # To get master git clone https://stash.freeswitch.org/scm/fs/freeswitch.git cd git/freeswitch ./bootstrap.sh -j # If changes are needed to the list of modules to be compiled vi modules.conf ./configure --enable-core-pgsql-support make sudo make install # Launch FS (in foreground) sudo /usr/bin/freeswitch You can find here the process for building it from source recommended by the FreeSWITCH team. In /etc/freeswitch/vars.xml you may want to change the default password in: cmd="set" data="default_password=XXXXXXXX" If you're enabling SILK , add it to the list in modules.conf.xml : load module="mod_silk" and add it to global_codec_prefs ...