OpenSER + Asterisk Stress Test

The following is an email report to a customer about tests performed on a OpenSER + Asterisk load-balanced solution, something we archived to put in production early in this year (one OpenSER in front of three Asterisk severs):

I have just finished performing the stress tests on the cluster, however
I’m planning to do more tests during the next days. So, this is not 100%
official.

I Used SIPP to test the cluster, from the cluster B,which is a higher
hardware configuration. Pointing directly to the SER of cluster A
(the subject of the test).

All tests were performed by streaming an audio file of ~ 20 +
seconds from the three Asterisk media servers. RTP media was
forwarded to an echo port on the machine that was running the
SIPp application.

The following command line was used:

./sipp -sn uac -d 20000 -s 6000 PPP.QQQ.YYY.ZZZ -l XXXXXX -mp 5606

Where XXXXXX was the number of concurrent calls to be generated

In parallel a softphone was registered to the cluster running the
Echo application on the Asterisk servers, in order to evaluate
delay and quality of the call while stressing the system

@ 500 concurrent calls: Quality OK. Latency: Very Low
@ 750 concurrent calls: Quality OK. Latency: Very Low
@ 1250 concurrent calls: Quality OK. Latency: Very Low
@ 1500 concurrent calls: Quality OK. Latency: Low w/ audio clips every ~30 secs.
@ 1700+ concurrent calls: The test application freezes. Before that point, audio quality was still good.

This is very important: Performance will decrease when having
UAs registered behind NAT. Cause load will increase in the load in the SER
given that we’
re using the mediaproxy module. Another very important
factor, is that the tests performed no PHP (AGI) activity on the Asterisk
servers, and thus little MySQL queries.

This is why I said before this is not official, and I that’s why I’m thinking to
perform another stress test, simulating the whole system’s behavior (including all PHP instances w/ MySQL queries). I think we’re going to be able to handle 1000- 1200 concurrent calls with ease in that scenario,

I dare to say so far, the results are beyond my expectations.

Regards,
Ariel

Ariel Mónaco - Systems Engineer - Senior IT Specialist

Potosi 4456 12th floor “D”
Ciudad Autónoma de Buenos Aires (1199)
Buenos Aires - Argentina
+54-11-4982-2689
+54-911-15-5781-8700
arielmonaco@flylabs.com

BRI/ISDN, ISDN2E, 2B+D, 2B1D

German: Integriertes Sprach- und Datennetz Basisanschluss. The English term is a backronym that was thought to be better for English-language advertisements than the original.

BRI is an ISDN configuration defined by a standard (I.430) that consists of two “Bearer” channels (64kbit/s) and one “Data” channel of 16 kbit/s. It is said that this communication standard never gained that much popularity in the US and the rest of the world, however is very common in Germany, Switzerland and less common in other European countries such as the UK.

In this article we will cover how to install and configure a Digium B410P BRI card, to interface with a service provider using this kind of signaling.

Nice things to have before we start:

a. A fresh Linux Kernel install with its sources (don’t forget to symlink /usr/src/linux)
b. ISDN4Linux and CAPI support on the kernel, built-in or as a module

Let’s start:

1. Check that the system has recognized the board as an ISDN controller.

# lspci
0000:01:0e.0 ISDN controller: Unknown device d161:b410 (rev 01)

Note:Your machine should be PCI 2.2 or higher in order to support the B410P.

2. Unpack the latest Zaptel sources, we recommend 1.4.X

# cd /usr/src/ ; tar zxvf zaptel-1.4.0.tar.gz
# wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.0.tar.gz
# tar zxvf zaptel-1.4.0.tar.gz
# cd zaptel-1.4.0
# make
# make install
# make b410p

3. Install Asterisk (not covered on this article)
4. Run /etc/init.d/misdn-init config # this will create the needed configuration files
5. Edit /etc/misdn-init.conf This file is very well documented.

6. This seems to be a service, but will only load the module with the parameters setup in /etc/misdn-init.conf

#/etc/init.d/misdn-init start

7. Repeat steps 5 and 6. Make sure the module is being loaded.

#lsmod | grep hfcmulti

8. Configure the interface to Asterisk by editing the following:

/etc/asterisk/misdn.conf

Be sure to set the MSNS properly (MSNS are like DIDs). In order to accept all incoming DIDs, set msns=*.
Be sure that echotraining=no in your misdn.conf, as this will interfere with
the hardware echo cancellation.

in misdn.conf:
; default settings
context=default
; default settings
echotraining=no
; default settings
[bri_lines]
msns=*
ports=1,2,3,4
context=incoming

Echo cancellation is enabled by setting:

echocancel=yes in misdn.conf.
Also set echotraining=no (The hardware will do the training)

Verify the Asterisk interface is properly configured by placing a phone
call. In order to call out over a port, the Dial( ) command is formatted as
follows:

Dial(misdn/1/$)
Dial(misdn/g:bri_lines/$)

Replace $ with the number you want to dial to.

MeetMe, Kernel & RTC:

When using mISDN and Ztdummy together, you may experience a very choppy audio in conferences and similar applications that use a timing interface. Since we’re not fully using Zaptel or ztdummy, we advice to turn on Real Time Clock support on the Linux kernel. That should address the problem.

Sipura SPA 3000, taking advantage

Sipura/Linksys SPA3000 - 1xFXS 1xFXO. This little and useful device is not as simple as it seems, its configuration it’s a little bit tricky when it comes to make it work with Asterisk. Before we continue. Firmware update is a good idea.

1) After setting up the network in the System tab. You need to create two SIP users for each line, let’s say 1000 for the PSTN line and 2000 for the phone line. Register both lines to the Asterisk box, just as any other SIP ATA.

2) Under the tab “PSTN Line” you need to set the following values:

VoIP-To-PSTN Gateway Enable: yes
Dial Plan 8: (S0<:2000>)
VoIP Caller Default DP: 1
PSTN Caller Default DP: 8

The tricky thing is that the two lines should not use the same Sipura internal dialplan rule. That’s why we use a “Default DP” for the PSTN Callers (PSTN line), and another one for VoIP Callers (SIP user).

This will pass any PSTN call to Asterisk extension 2000 on the configured context. In that incoming context for the extension #2000 we’ll set up some dialplan rules to call the FXS (which is registered as SIP/2000 line) so we’ll get something similar to this:

SPA3000 FXO <-> Asterisk <-> SPA3000 FXS

Incoming

; answer the extension, planning to monitor the channel
exten => 2000,1,Answer()
exten => 2000,n,MixMonitor(${EXTEN}-${UNIQUEID}.wav|a)
exten => 2000,n,Dial(SIP/2000,25,wWt)
; switch using the ${DIALSTATUS} variable, you should know this one
exten => 2000,n,Goto(2000-${DIALSTATUS},1)
exten => 2000-NOANSWER,1,Voicemail(2000|u)
exten => 2000-BUSY,1,Voicemail(2000|b)
exten => 2000-CONGESTION,1,Voicemail(2000|b)

Tip: Remember, if you’re planning to monitor the SPA 3000 channels, you will have to make Asterisk to treat the ATA in a special way, forcing the RTP traffic to pass trough Asterisk, and thus becoming available for recording/monitoring on the established channel:

canreinvite=no ; allow RTP voice traffic to bypass Asterisk

Outgoing

The SIP line is going to listen on the UDP port 5061, for incoming SIP signaling, so when a call is made from Asterisk to use the external Sipura line, the Dial command arguments should look something like this. Note I’m trimming the first character since I use this matching rule _9X. as an outgoing pattern:

exten => _9X.,1,MixMonitor(${EXTEN}-${UNIQUEID}.wav|a)
exten => _9X.,n,Dial(SIP/${EXTEN:1}@192.168.0.128:5061)

; my SPA3000 IP is 192.168.0.128

Once you achieve this basic setup, you’ll see how versatile is this small ATA. That’s it.
Have fun.

Snom 300, 320, 360 with Asterisk

Snom is a well known Germany-based IP-phones manufacturer, their products work very well with Asterisk and also with proprietary IP-PBX systems. There are though, some things to be done in the Asterisk side to be able to get the most out of these devices.

Firmware

It’s recommended to update the firmware: Snom has three kind of firmwares 1) the SIP firmware, 2) Ramfs firmware 3) Linux OS firmware, there is a given order to follow to perform a software update:

1. snom320-3.25-l.bin: This linux is needed to make the ethernet switch properties control work. The link for this is: http://www.snom.com/download/snom320-3.25-l.bin.

2. snom320-5.5a-SIP-j.bin: Application part of release 5 which introduces the new image formats, everything except the ethernet switch properties control is working. Downgrading manually via TFTP is still possible. The link for this is: http://www.snom.com/download/snom320-5.5a-SIP-j.bin.

3. snom320-ramdiskToJffs2-3.36-br.bin: New bootloader and rootfs with new image format each, which can be updated by application part release 5 or above only. This saves 2MB of RAM and brings a TFTP update application which is able to update application images with version 5 or above only. The link for this file is: http://www.snom.com/download/snom320-ramdiskToJffs2-3.36-br.bin

4. snom320-6.2-SIP-j.bin: Application part of release 5 which introduces the new image formats, everything except the ethernet switch properties control is working. Downgrading manually via TFTP is still possible. The link for this is: http://www.snom.com/download/snom320-6.2-SIP-j.bin

Note: The phone is making sure, that you cannot destroy your phone by using a wrong order of those updates. If the order is wrong it will show Wrong Image at the display!

MWI

Notifications from Asterisk are sent to the device like this -> asterisk@yourdomain.com, yourdomain.com can be set in sip.conf under the variable name “fromdomain=”, this can also be an IP address. You will need an extension called ‘asterisk’ in your box which could be reached from the phone on the same context the corresponding SIP user is registered in.

exten => asterisk,1,VoiceMailMain(${CALLERIDNUM})

In case you don’t like to have an extension called ‘asterisk’ you can use vmexten=<voicemail extension> in sip.conf, and in extensions.conf something like this:

exten => <voicemail extension>,1,VoiceMailMain(${CALLERIDNUM})

You will also want to enable SIP SIMPLE to allow the MW key to work on the Snom phones, again in the beginning of sip.conf replace:

notifymimetype=text/plain
with
notifymimetype=application/simple-message-summary

Provisioning

You should have Apache installed with DocumentRoot pointing somewhere. For us it will be /var/www/localhost/htdocs/snom (hey you guessed! Gentoo ;)

We need the phones to boot using DHCP, which is default on these (and most) phones, giving them a URL from where to download the settings file from. This could be a good example:

http://10.0.0.1/snom/snom_000413230000

For a large deployment, you can use the QUERY_STRING to pass the MAC as a variable, the URL will have to be setup individually for each device or using a wildcard.

http://10.0.0.1/snom/snom_provisioning.php?mac=000413230000

Then you’ll have to code the snom_provisioning.php, should not be hard, a tip: $_GET[’mac’] and some includes.
The content of the file is well documented on Snom’s Mass Deployment page. However I am going to give you an example of how the file should look like:

active_line&: 1
language&: Deutsch
setting_server&: http://10.0.0.5/snom/snom.php?mac={mac}
ntp_server&: 10.0.0.10
ring_sound&: Ringer1
timezone&: GER+1
contrast&: 22
user_phone!: on
active_line&: 1
outgoing_identity&: 1
sip_proxy&: 10.0.0.5
tone_scheme&: GER
vol_speaker&: 4
vol_ringer&: 5
vol_handset&: 11
vol_speaker_mic&: 3
vol_handset_mic&: 3
log_level&: 5
mwi_notification&: silent
user_host1&: 10.0.0.5
user_ringer1&: Ringer3
call_waiting&: on
user_active1&: on
user_realname1&: Empfang
user_name1&: 1013
user_pass1&: 1364092
user_idle_text1&: Empfang
phone_name&: SIP1013
user_pname1&: 1013
message_led_other&: off

# firmware stuff snom320
firmware_status: http://10.0.0.5/snom/firmware/snom360-firmware.html

This file can be either plain/text or HTML, since Snom uses an embedded version of Mozilla on it. It will make no difference.
BTW, if you ask me why is an ampersand before the colon on each variable, this my give you a idea:

! : writable by the user, but will not overwrite existing
$ : writable by the user, but will overwrite existing (available since version 4.2)
& (or no flag) : read only, but will overwrite existing

We strongly advice to use the ampersand or no-flag at all for an initial provisioning.
Note that the last line of the previous configuration file, has a URL pointing to a firmware settings file, if this option is setup, then the phone is going to ask for a firmware upgrade. The file looks like this, and has some options on it:

# the firmware file:
firmware_status: http://10.0.0.5/snom/firmware/snom360-firmware.html
# how to update
update_policy: auto_update
# update interval here, amount in minutes, default is 1440 = 1 day
firmware_interval: 2880

System and application firmware files for different phone versions of this manufacturer can be found here

Good luck with the setup (you’re gonna need it ;)

H323 Media Gateway Setup

There are many Asterisk channels that can talk to H323 devices. To keep ourselves working with Open Source technologies, and in order to use existing standard supported packages, we decide to implement ooh323 channel drivers for our H323 / Asterisk implementations.

In order to install this channel driver, you need to have a fresh Asterisk 1.2 / 1.4 installation, Glibc, Gnu/Linux compiler, and development tools. In other words, you should be familiar building an Asterisk system from scratch, from the sources.

You will need to download the asterisk-addons package corresponding to your Asterisk version, and untar it. Then build:

# make clean ; make ; make install

in a PWD similar to this one:
/usr/local/src/asterisk-addons-1.4.0/asterisk-ooh323c

This will copy the channel driver to /usr/lib/asterisk/modules/ which is the default location for modules, resources, applications and codecs.


You will need now to setup now the newly created file /etc/asterisk/ooh323.conf First, in the general section:
;This parameter indicates whether channel driver should register with
;gatekeeper as a gateway or an endpoint.
gateway=no
dtmfmode=rfc2833

There are many features you should research about, these are only the basics to connect the *box to an H323 media gateway.

[voiptalk]
type=friend
context=voiptalk_test
ip=192.168.0.3
allow=gsm
allow=alaw
allow=ulaw
dtmfmode=rfc2833

Now, extensions.conf should look like this (I’m using a VP604 FXS which has 4 FXS ports):

[voiptalk_test]
exten => 3001,1,Dial(OOH323/3001@192.168.0.3)
exten => 3002,1,Dial(OOH323/3002@192.168.0.3)
exten => 3003,1,Dial(OOH323/3003@192.168.0.3)
exten => 3004,1,Dial(OOH323/3004@192.168.0.3)

Hey, don’t forget to set up the device :D

Note: H323 does not count with authentication that’s the important thing about ip=192.168.0.3 in the configuration file.

Finally load the module and reload extensions, in Asterisk’s CLI:
*CLI> module load chan_ooh323.so
*CLI> extensions reload