Testing FreeSWITCH performance on Scaleway C1

The dedicated ARM hosting servers at Scaleway appear to be a decent platform for a mid-sized PBX.

In short, the platform displays the following results in performance tests:

  • OPUS<->PCMA transcoding: 16 simultaneous calls with  at about 95% total CPU load and no noticeable distortions.
  • SILK<->PCMA transcoding: 72 simultaneous calls were going without distortions, with average total CPU load at 63%. Higher number of calls resulted in noticeable distortions.
  • G722<->PCMA transcoding: 96 simultaneous calls without distortions, at 76% CPU load, and noticeable distortions for higher numbers.

Read the rest of this entry »

, , , ,

Leave a comment

Installing FreeSWITCH on Scaleway C1

Scaleway (a cloud service by online.net) offers ARM-based dedicated servers for EUR9.99/month, and the first month free. The platform is powerful enough to run a small or FreeSWITCH server, and it shows nice results in voice quality tests.

These instructions are for Debian Wheezy distribution.

By default, the server is created with Linux kernel 3.2.34, and this kernel version does not have a high-resolution timer. You need to choose 3.19.3 in server settings.

At Scaleway, you get a dedicated public IP address and 1:1 NAT to a private IP address on your server. So, FreeSWITCH SIP profiles need to be updated (“ext-rtp-ip” and “ext-sip-ip” to point to you rpublic IP address).

FreeSWITCH compiles and links “mpg123-1.13.2″ library, which fails to compile on ARM architecture.  You need to edit the corresponding files to point to “mpg123-1.19.0″ and commit back to Git, because the build scripts check if any modified and uncommitted files exist in the source tree. Also the patch forces to use gcc-4.7, as 4.6 is known with some problems on ARM architecture. Read the rest of this entry »

, , , ,

Leave a comment

Testing RTP clock precision on a virtual machine

UPD: Additional tests displayed that KVM also delivers a quite precise hardware clock. There are too many unknown and uncontrolled parameters in this test environment, and the failure  was not confirmed on another host at DigitalOcean. This all needs to be re-tested in the lab under controlled environment conditions.

It is a frequently asked question if a particular virtual hosting service is suitable to host a PBX. The following testing procedure was done with FreeSWITCH, and it should also work similarly with Asterisk. The RTP clock precision is important whenever the server has to originate an audio stream. This is needed, for example, to play an audio media source, or to send audio from a conference. In point-to-point calls, RTP is usually sent as soon as possible, and is not synchronized to the local clock. An important part of this test is that the test call goes through two independent ITSP’s, so that the audio is likely to be sent via TDM links. We also assume that the ITSP’s clocks are of good quality.

The outcome of the tests is as follows:

  • Xen, both Dom0 and VM are with Debian 7 64bit, FreeSWITCH 1.4.18: good precision
  • VmWare ESXi 5.5, Debian 7 64bit, FreeSWITCH 1.4.15: good precision
  • KVM at digitalocean.com, Debian 7 64bit, FreeSWITCH 1.4.15: at first, bad precision was indicated, but needs more testing, probably network jitter had also the influence.

Testing procedure:

Read the rest of this entry »

, , , ,

Leave a comment

Simple PBX tutorial for FreeSWITCH

Here is a short tutorial that helps building a PBX with FreeSWITCH.

, , ,

Leave a comment

3G connectivity for PC Engines APU (MU609)

HUAWEI MU609 Mini-PCIe card is available at aliexpress.com for about $40. Comparing to DW5550 card, MU609 is more expensive, but it”s a current hardware, actively supported by the manufacturer.

MU609 supports the traditional PPP interface, as well as CDC Ethernet interface for Linux.

It also has a built-in support for mobile voice calls, but its audio is only available on the physical PCM GPIO interface, which is wired to pins 45, 47, 49, and 51 on the Mini-PCIe plug. These pins are not standardized and marked as “reserved” in Mini-PCIe specification. The PC Engines APU board does not connect these pins to anything.

The card initializes 5 serial-USB devices (ttyUSB0 – ttyUSB4). ttyUSB0 can be used for modem control with AT commands. Detailed documentation for the rest of devices is available at Huawei website. The CDC Ethernet card is initialized as eth3 (because eth0-eth2 are onboard Ethernet adapters).

Setting up the card for automatic startup under Debian:

apt-get install -y picocom ppp

cat >/etc/chatscripts/sunrise.MU609 <<'EOT'
ABORT BUSY
ABORT 'NO CARRIER'
ABORT ERROR
TIMEOUT 10
'' ATZ
OK 'AT+CFUN=1'
OK 'AT+CMEE=1'
OK 'AT\^NDISDUP=1,1,"internet"'
OK
EOT

cat >/etc/chatscripts/gsm_off.MU609 <<'EOT'
ABORT ERROR
TIMEOUT 5
'' AT+CFUN=0 OK
EOT

vi /etc/network/interfaces
allow-hotplug eth3
iface eth3 inet dhcp
    pre-up /usr/sbin/chat -v -f /etc/chatscripts/sunrise.MU609 >/dev/ttyUSB0 </dev/ttyUSB0
    post-down /usr/sbin/chat -v -f /etc/chatscripts/gsm_off.MU609 >/dev/ttyUSB0 </dev/ttyUSB0


, , , ,

Leave a comment

Call generator for performance tests

Here I wrote a simple call generator for FreeSWITCH, and it can be used for performance tests:

https://github.com/voxserv/freeswitch-perf-dialer

, , ,

Leave a comment

3G connectivity for PC Engines APU (DW5550)

In addition to Sierra Wireless MC8775 3G modem, there’s now a new offering for Dell DW5550 (or Ericsson F5521gw, which is the same hardware) mini-PCIe 3G cards at Aliexpress.com, in the price range of $20. This is a newer hardware (the ones I received were manufactured in mid-2012), and it supports higher UMTS speeds and an CDC Ethernet interface in Linux.

This page refers to Ericsson F3507g card, but all instructions are relevant for DW5550. The device identifies itself as Dell DW5550, firmware version R3B01 (Command for retrieving the version: AT+CGMR).

Default Linux kernel 3.2.0 in Debian Wheezy names the CDC Ethernet interface as usb0, and 3.16.0 from Wheezy backports names it as wwan0. Other than that, everything else works the same.

Out of 3 ordered cards, two worked immediately, and one was broken. The seller has kindly offered a replacement for additional $10.

for n in `ls /sys/class/*/*{ACM,wdm,usb0}*/device/interface`;do echo $(echo $n|awk -F '/' '{print $5}') : $(cat $n);done

usb0 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card Network Adapter
ttyACM0 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card Modem
ttyACM1 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card Data Modem
ttyACM2 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card GPS Port
cdc-wdm0 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card Device Management
cdc-wdm1 : Dell Wireless 5550 HSPA+ Mobile Broadband Mini-Card USIM Port

The following commands initiate a 3G connection for a sunrise.ch SIM card:

apt-get install -y picocom ppp
picocom -b 115200 /dev/ttyACM1

AT+CFUN=1
AT+CGDCONT=1,"IP","internet"
AT*ENAP=1,1

Ctrl-a Ctrl-x
dhclient usb0

This Debian wiki page explains how to bring up the connection automatically at Linux startup:

cat >/etc/chatscripts/sunrise.DW5550 <<'EOT'
ABORT BUSY
ABORT 'NO CARRIER'
ABORT ERROR
TIMEOUT 10
'' AT+CFUN=1 OK
\dAT+CGDCONT=1,"IP","internet" OK
\d\d\dAT*ENAP=1,1 OK
EOT

cat >/etc/chatscripts/gsm_off.DW5550 <<'EOT'
ABORT ERROR
TIMEOUT 5
'' AT+CFUN=4 OK
EOT

vi /etc/network/interfaces

allow-hotplug usb0
iface usb0 inet dhcp
    pre-up /usr/sbin/chat -v -f /etc/chatscripts/sunrise.DW5550 >/dev/ttyACM0 </dev/ttyACM0
    post-down /usr/sbin/chat -v -f /etc/chatscripts/gsm_off.DW5550 >/dev/ttyACM0 </dev/ttyACM0

, , , ,

Leave a comment

Connecting Yeastar TG200 GSM gateway to FreeSWITCH

I needed to connect a GSM gateway to my FreeSWITCH PBX, in order to receive SMS and mobile calls and emulate a normal mobile phone. I’ve got the Yeastar Neogate TG200 V2 for this purpose (Firmware Version: 53.18.0.39, running Asterisk 1.6.2.6 on an ARM processor).

This blog entry has helped a lot and saved a bunch of time.

The box supports OpenVPN, so you can place it in some remote location behind NAT, and manage it via the VPN connection. The client version is rather old (2.0.5), so it does not support embedded certificates in the client config, and also “topology subnet” option is not supported. You need to pack your vpn.conf and the certificates and pivate key into a TAR archive and upload to Neogate via its web interface.

It’s sufficient to configure one SIP trunk to your PBX, and manipulate the To: header in order to distinguish between SIM cards on incoming calls.

When the SIP trunk was configured (FreeSWITCH as a registrar), I started receiving the following warnings on FreeSWITCH, and the registration status was quickly removed after neogate’s REGISTER message:

2014-12-22 12:29:42.208567 [WARNING] sofia.c:5721 Sip user 'gsm01@xxxxx.net' is now Unreachable
2014-12-22 12:29:42.208567 [WARNING] sofia.c:5732 Expire sip user 'gsm01@xxxxx.net' due to options failure

My FreeSWITCH was sending SIP OPTIONS requests to all registered users and removed the registrations unless the clients responded with status 200 or 468. Neogate responds with 404 Not Found on such requests toward the trunk SIP user. I had to disable “unregister-on-options-fail” option in FreeSWITCH internal SIP profile.

In SIP trunk configuration, “Advanced->Caller ID” was automatically set to my trunk’s registration user name. Because of this, all incoming calls had this name as the caller ID, and the original caller number was lost. After setting this field to blank, the problem was resolved.

In “Mobile to IP” rules, you can set a different rule for each SIM card. The “Hotline” field should not be blank, and should contain some distinguishing number. It will be used in To field in the SIP INVITE on incoming calls. If you leave “Hotline” empty, the Neogate will respond with dial tone and collect DTMF digits before placing the call to your SIP trunk. So far I could not find any documentation that describes this.

Also in trunk configuration, sometimes I had to reboot the box in order for my changes to take effect.

The box uses the standard Asterisk management interface for sending and receiving SMS, and I’m planning to use this Perl module through the VPN connection.

, , ,

Leave a comment

Inspiration projects for next-generation Torrus

It’s not yet clear when I can start working on a new-generation Torrus, but here are some nice software projects which would probably inspire the new design, or probably be part of the new design. I haven’t looked into them in depth though.

  • Bosun is a distributed monitoring system produced by StackExchange. It uses distributed collector agents which write data into OpenTSDB. Bosun and its collector are written in Go, and OpenTSDB is written in Java.
  • InfluxDB is a time-series database written in Go.

and yes, the new project will most probably have its core in Go. But the SNMP discovery engine will most probably remain in Perl because of a big list of supported vendors.

, , ,

Leave a comment

Using Voxbeam for outbound calls with FreeSWITCH

Voxbeam is providing worldwide PSTN connectivity at competitive rates, and it allows you to use any Caller ID, which is very convenient for call forwarding. The Voxbeam gateway authenticates the clients by their IP addresses only, so you need a static IP address, and no username or password are required. The FreeSWITCH configuration shown below allows you to control which destinations should be routed to Voxbeam. With a bit of further extension, you can also control which destinations would use different tariff plans at Voxbeam. This configuration covers only their Standard pricing plan. Here INTERNALDOMAIN is a name of the SIP realm that is used for registered users. We assume that the variable “outbound_caller_id_number” is set elsewhere above in the dialplan.

--- File: ip_profiles/external/voxbeam.xml ---
<include>
  <gateway name="voxbeam_outbound">
    <param name="realm" value="sbc.voxbeam.com" />
    <param name="register" value="false" />
    <!-- important, so that your caller ID is transmitted properly -->
    <param name="caller-id-in-from" value="true"/> 
  </gateway>
</include> 

--- File: dialplan/INTERNALDOMAIN/05_pstn_outbound.xml ---
<include>
  <!-- Express destination and caller numbers in E.164 notation without leading plus sign.
       Note that we treat numbers with one leading zero as local Swiss numbers -->
  <extension name="pstn_normalize" continue="true">
    <condition field="destination_number" expression="^00([1-9]\d+)$" break="never">
      <action inline="true" application="set" data="e164_dest=$1"/>
    </condition>
    <condition field="destination_number" expression="^0([1-9]\d+)$" break="never">
      <action inline="true" application="set" data="e164_dest=41$1"/>
    </condition>
    <condition field="${outbound_caller_id_number}" expression="^00([1-9]\d+)$" break="never">
      <action inline="true" application="set" data="e164_cid=$1"/>
    </condition>
    <condition field="${outbound_caller_id_number}" expression="^0([1-9]\d+)$" break="never">
      <action inline="true" application="set" data="e164_cid=41$1"/>
    </condition>
  </extension>

  <!-- Here we define that calls to Russia and Ukraine should go through Voxbeam -->
  <extension name="pstn_select_itsp" continue="true">
    <condition field="${e164_dest}" expression="^(7|38)" break="on-true">
      <action inline="true" application="set" data="outbound_itsp=voxbeam"/>
    </condition>
  </extension>

  <!-- send matched calls to Voxbeam -->
  <extension name="pstn_voxbeam">
    <condition field="${outbound_itsp}" expression="^voxbeam$" break="on-false">
      <action application="set" data="effective_caller_id_number=${e164_cid}"/>
      <action application="bridge" data="sofia/gateway/voxbeam_outbound/0011103${e164_dest}"/>
    </condition>
  </extension>

  <!-- send everything else to Sipcall.ch -->
  <extension name="pstn_sipcall">
    <condition field="destination_number" expression="^(0\d+)$">
      <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
      <action application="bridge" data="sofia/gateway/sipcall/$1"/>
    </condition>
  </extension>
</include>

This is a very simple example, and a bit more logic can be introduced, such as looking up in some kind of a database for least cost routing, and so on.

 

, , ,

2 Comments