Installing Go 1.3 in debian wheezy

The original script is found here: http://www.snip2code.com/Snippet/79027/How-to-install-Go-1-3-in-debian-wheezy

The original script is a bit dated, and now 1.3-1 is the latest version:


## File: go1.3-install-deb.sh
apt-get install devscripts build-essential
apt-get build-dep golang-go

wget http://ftp.de.debian.org/debian/pool/main/g/golang/golang_1.3-3.dsc
wget http://ftp.de.debian.org/debian/pool/main/g/golang/golang_1.3.orig.tar.gz
wget http://ftp.de.debian.org/debian/pool/main/g/golang/golang_1.3-3.debian.tar.xz

dpkg-source -x golang_1.3-3.dsc
cd golang-1.3/
debuild -us -uc
cd ..
dpkg -i \
golang-go_1.3-3_amd64.deb \
golang-src_1.3-3_amd64.deb \
golang-go-linux-amd64_1.3-3_amd64.deb \
vim-syntax-go_1.3-3_all.deb

echo Finished

,

Leave a comment

mSATA drives for PC Engines APU

Drives with problems:

  1. KingSpec 16GB (Model Number: KingSpec KSM-mSATA.7i-016MJ, Firmware Revision:  SVN454): quite often, the kernel times out to boot at the start.
  2. SuperSSpeed S238: with the old firmware, TRIM operation erased the boot sector. The newer firmware disables TRIM.

Drives without problems (everything works fine with TRIM)

  1. MyDigitalSSD Super Boot Drive (Model Number:  SB mSATA SSD, Firmware Revision: S9FM01.8)
  2. SanDisk X110 (Model Number: SanDisk SD6SF1M032G1022I, Firmware Revision: X231200)
  3. Kingston Now (Model Number: KINGSTON SMS200S330G, Firmware Revision: 524ABBF0)

The testing procedure is quite simple: a background process is massively creating and deleting a small file, and another process calls fstrim every few seconds. Then the health of the filesystem is checked after an hour or so.

while true; do echo xxxxxxxxxxxxxxxxxxxxxxxx >xxx; done &
while true; do fstrim -v /; sleep 10; done

 

,

Leave a comment

3G connectivity for PC Engines APU

PC Engines’ APU board has its mPCIe slot 2 wired to the SIM card socket, which allows using any standard mPCIe 3G modem. Most of modern modems are quite expensive, but there are plenty of Sierra Wireless MC8775 cards at aliexpress.com for around $20 apiece. This is a decent hardware, manufactured around 2007-2011. It doesn’t deliver the highest UMTS speeds possible, but still can be used in situations where speed is unimportant.

The cards that I bought came with firmware version 1_1_8_15, dated 2007/07/17. I didn’t test it fully, but there are some failure reports in the internet.

The firmware upgrade requires an adapter with a SIM card slot. I got mine from this eBay seller.

This page describes the firmware upgrade process. The links to istudioz.net are still valid, but you need to remove # (%23) from the URLs. The 3G watcher for the AirCard 875 is unavailable at its original place, but easy to find with Google. I got mine at this site. The upgrade requires a 32bit Windows machine, and takes about 20 minutes. I upgraded the firmware successfully with my old Vista laptop.

Also I bought the 3G antenna and the pigtail cable at aliexpress.

After inserting the 3G modem into mPCIe slot 2 and booting Debian Wheezy, the device was immediately visible as three serial USB interfaces (/dev/ttyUSB0  /dev/ttyUSB1  /dev/ttyUSB2). ttyUSB0 is used for data, and ttyUSB2 can be used for controlling the device with AT commands. The command “AT^CARDMODE” will tell if the SIM card is inserted, and “AT!GSTATUS?” displays the network status information. “AT+GMR” displays the current firmware version. Ctrl-a Ctrl-x sequence will finish the picocom session.

apt-get install -y wvdial picocom
picocom -b 115200 /dev/ttyUSB2 
AT^CARDMODE
AT!GSTATUS?
AT+GMR
Ctrl-a Ctrl-x

The following /etc/wvdial.conf works with Sunrise.ch 3G network:

[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 460800
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Phone = *99#
Username = ''
Password = ''
Ask Password = 0
Stupid Mode = 1
Compuserve = 0
Idle Seconds = 0
ISDN = 0
Auto DNS = 1 

Execute “wvdial” comand from the command line, and it should immediately connect to the internet. The rest is easy: you can place wvdial into a startup script and execute it automatically at boot time.

, ,

Leave a comment

Simple performance test for FreeSWITCH conferencing

This is a simple test that gives you an estimation of audio conferencing scalability of FreeSWITCH on your hardware.

  1. You need one or two FreeSWITCH servers, and one of them should answer to sip:moh@IPADDR:5080. The fastest way is to install this FreeSWITCH configuration: https://github.com/xlab1/voip_qos_probe
  2. Edit vars.xml and remove G722 codec (or leave or replace it, if you want to test transcoding performance at the same time).
  3. Start FreeSWITCH:
    service freeswitch start
  4. Create conference participants by calling the MOH extension on the remote or the same server. This command will add a few dozens of participants in one go:
    timeout 2 sh -c "while true; do fs_cli -x 'conference xx dial sofia/internal/moh@IPADDR:5080'; done"
  5. check the number of participants:
    fs_cli -x 'show channels'
  6. run “top” or “mpstat -P ALL 1″ to see the CPU load, and add more batches of participants.

This test differs from real world because in a real conference, one speaks and others are listening. Here everyone speaks at the same time. FreeSWITCH evaluates the energy level to find the active speaker before replicating their voice, so I guess the real conference would take less CPU power (need to look into the source code).

Some test results: PC Engines APU platform with 50 conference participants had the CPU usage about 60%. A single core VPS at digitalocean.com was busy at around 50% during a test with 200 participants.

UPD1: (thanks bob bowles) Call out to yourself and monitor the sound quality with your own ear:

fs_cli -x 'conference human dial sofia/external/user@sip.domain.com'

,

Leave a comment

End-to-end VoIP quality testing probes

This is a result of a project where we needed to measure voice QoS parameters (jitter and packet loss) in the customer network. I’ve set up small probe computers (old 10″ Intel Atom netbooks like Acer Aspire One) with FreeSWITCH and a few scripts for test automation. Each test consists of a 30-second call (producing approximately 1500 RTP packets in each direction), and tshark is measuring the received jitter and loss on each side.

Test details and the installation procedure are outlined on Github:

https://github.com/xlab1/voip_qos_probe

 

, , , ,

Leave a comment

FreeSWITCH performance test on PC Engines APU

This test is analogous to the one I described for Intel Atom CPU.This time it’s the new APU board from PC Engines, the maker of famous ALIX and WRAP boards. APU is a fanless appliance board, with a dual-core 1GHz AMD G series CPU. The overall performance is comparable to that of Intel Atom.

In these tests, FreeSWITCH was forwarding the call to itself on request by pressing *1. Each such forwarding resulted in creating four new channels in G722 and G711, thus resulting in transcoding to G711 and back. For example, if “show channels” shows 5 channels, it’s equivalent to 2 simultaneous calls with transcoding.

Test result: 57 channels were running completely fine, 65 channels had slight distortions, and with 85 channels the speech was still recognizable, but with significant distortions. With Speex instead of G722, distortions were quite annoying at 25 channels. Thus, the APU platform can easily be used as a small-to-medium business PBX for  20-30 simultaneous calls if there’s not too much transcoding.

Test details follow.

Read the rest of this entry »

, , , ,

Leave a comment

PC Engines APU board: installing Debian on mSATA drive

PC Engines started shipping its new APU board in 2014. It can boot from an SD card (slow on writes), and it can also have an mSATA drive and boot from it (fast read-write, and more write cycles). Voyage Linux is well optimized for SD card.

Here I started my scripts for building a Debian CD and installing it on APU’s mSATA drive: https://github.com/ssinyagin/pcengines-apu-debian-cd

 

, ,

1 Comment

Call forwarding/redirection in FreeSWITCH

Consider you have two different contexts in your dialplan for inbound and outbound calls: the “public” context transfers the calls into “XXX_inbound” (XXX being your organization name), and the user directory has “XXX_outbound” as “user_context” variable.

Having two contexts, you have more flexibility in defining the short dial strings and outbound destinations.

But there’s a little problem: if the SIP client redirects the ringing call, or if the user makes an attended transfer, FreeSWITCH would initiate a new outbound leg in the same context where the call was bridged toward the SIP client.

As a solution, you need to define a new extension in your XXX_inbound context which would match PSTN outbound numbers. The channel will already have all custom variables which were set before bridging toward the SIP client, so you can set an additional condition criteria to make sure that this is the redirected call. This example would be placed at the bottom of the inbound context, and “directory_ext” is the variable that was earlier in the same context before the call was bridged to the SIP client:

    <extension name="call_forward">
      <condition field="destination_number" expression="^\d+$"/>
      <condition field="${directory_ext}" expression="^70\d$">
        <action application="set" data="hangup_after_bridge=true"/>
        <action application="set" data="continue_on_fail=false"/>
        <action application="bridge" data="${outgw}/${destination_number}"/>
      </condition>        
    </extension>

, , ,

1 Comment

Reusing HTTP connections in client-server applications

I’m working on a client-server application which uses HTTP as a transport protocol for API requests, and sometimes there are occasions with a need to execute a few hundreds requests, such as data import or synchronization.

With default Apache HTTP server settings and default LWP::UserAgent options, every new request would result in a new HTTP session, and each time a DNS query is sent out. So, a synchronization process with a thousand object floods the DNS service with the same requests for the HTTP server name. This results in delays, and some public DNS servers apply rate limits which cause DNS lookup failures (had this with a domain hosted at Godaddy name servers).

HTTP 1.1 protocol supports reusing of persistent connections, but it’s not enabled by default in Apache and in the client.

In Apache HTTP server, the following options need to be configured:

  KeepAlive On
  MaxKeepAliveRequests 500

In the Perl client program, LWP::UserAgent needs the keep-alive option:

  my $ua = LWP::UserAgent->new(keep_alive => 1);

With these modifications, the DNS queries are only sent on every 500th API request, and the HTTP connection is reused between the requests, which saves CPU time on the server. This speeds up the whole process significantly, and also prevents the DNS failures caused by rate limiting.

,

Leave a comment

Minimal FreeSWITCH configuration

It’s always a bit of an effort to remove unneeded features from the default FreeSWITCH configuration. So, I made the minimal configuration which still allows to start the server, but does completely nothing. It’s now much easier to start a new server configuration for any new project.

The configuration is placed at Github. It’s very straightforward to use with FreeSWITCH Debian packages, and can also be used if you compile it from sources:

cd /etc
git clone https://github.com/xlab1/freeswitch_conf_minimal.git freeswitch

The configuration contains a number of empty “stub.xml” files in order to make the XML pre-processor happy.

It also makes sense to start using Git for your own FreeSWITCH configurations :)

, , , ,

2 Comments