.71 Dev patching asterisk for SPEEX

181 views
Skip to first unread message

HostBBB.com

unread,
Sep 21, 2010, 9:57:47 AM9/21/10
to BigBlueButton-dev
Hello, trying to get .71 dev running with asterisk. Is there
documentation on what version of asterisk is needed and how to patch
it for SPEEX to work. Only saw info in bleeding edge document on
freeswitch at this time.

Is the asterisk patch planned to be part of standard bbb release?

thanks
Stephen

Richard Alam

unread,
Sep 21, 2010, 10:25:06 AM9/21/10
to bigblueb...@googlegroups.com
HI Stephen,

Here is what I had to do to make it work. Not sure if we can get a
patched Asterisk as part of the standard release as we need to
re-package Asterisk.
Right now we just take the default Asterisk package and drop the
app_konference.so into the modules dir of Asterisk. Not sure if we
can do that
for the Speex support.

Let me know if the instructions below work for you. Or if there are
anything you can do to improve it.

Richard

===
Checkout AsteriskAudioKonf
=====================
cd
mkdir dev/app_konf/
git clone git://github.com/jthomerson/AsteriskAudioKonf.git
cd AsteriskAudioKonf/
cd asterisk-patches/
more README

Download and patch Asterisk 1.6.2.5
===========================
cd
mkdir asterisk-1.6.2.5
wget http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-1.6.2.5.tar.gz
tar zxvf asterisk-1.6.2.5.tar.gz
mv asterisk-1.6.2.5 asterisk-1.6.2.5.orig
cp ~/dev/app_konf/AsteriskAudioKonf/asterisk-patches/asterisk-1.6.2.5-speex16.patch
./
patch -p0 < asterisk-1.6.2.5-speex16.patch

Install Asterisk dependencies
======================
sudo apt-get -y install linux-headers-$(uname -r) build-essential
automake autoconf bison flex libtool libncurses5-dev libssl-dev
subversion svn-buildpackage
sudo apt-get install libspeex-dev libspeex1 libspeexdsp-dev libspeexdsp1
apt-get install libresample1 libresample1-dev

Build Asterisk
===========
cd asterisk-1.6.2.5.orig
./configure --disable-xmldoc
make
sudo make install

Build AsteriskAudioKonf
======================
cd ~/dev/app_konf/AsteriskAudioKonf/konference/

make clean
make
sudo make install
sudo /etc/init.d/asterisk stop
sudo /etc/init.d/asterisk start
sudo asterisk -vvvvvvvr

Edit bbb_sip.conf to use speex wideband
==============================
sudo vi /etc/asterisk/bbb_sip.conf
[bbbuser]
type=friend
username=bbbuser
insecure=very
qualify=no
nat=yes
host=dynamic
canreinvite=no
context=bbb-voip
disallow=all
allow=speex16,ulaw

Edit /etc/asterisk/codecs.conf to configure for speex WB
=========================================

[speex]
- Hide quoted text -
; CBR encoding quality [0..10]
; used only when vbr = false
quality => 5

; codec complexity [0..10]
; tradeoff between cpu/quality
complexity => 5

; perceptual enhancement [true / false]
; improves clarity of decoded speech
enhancement => true

; voice activity detection [true / false]
; reduces bitrate when no voice detected, used only for CBR
; (implicit in VBR/ABR)
vad => false

; variable bit rate [true / false]
; uses bit rate proportionate to voice complexity
vbr => false

; available bit rate [bps, 0 = off]
; encoding quality modulated to match this target bit rate
; not recommended with dtx or pp_vad - may cause bandwidth spikes
abr => 0

; VBR encoding quality [0-10]
; floating-point values allowed
vbr_quality => 9

; discontinuous transmission [true / false]
; stops transmitting completely when silence is detected
; pp_vad is far more effective but more CPU intensive
dtx => false

; preprocessor configuration
; these options only affect Speex v1.1.8 or newer

; enable preprocessor [true / false]
; allows dsp functionality below but incurs CPU overhead
preprocess => false

; preproc voice activity detection [true / false]
; more advanced equivalent of DTX, based on voice frequencies
pp_vad => false

; preproc automatic gain control [true / false]
pp_agc => false
pp_agc_level => 8000

; preproc denoiser [true / false]
pp_denoise => false

; preproc dereverb [true / false]
pp_dereverb => false
pp_dereverb_decay => 0.4
pp_dereverb_level => 0.3


[plc]
; for all codecs which do not support native PLC
; this determines whether to perform generic PLC
; there is a minor performance penalty for this
genericplc => true
=====

> --
> You received this message because you are subscribed to the Google Groups "BigBlueButton-dev" group.
> To post to this group, send email to bigblueb...@googlegroups.com.
> To unsubscribe from this group, send email to bigbluebutton-...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/bigbluebutton-dev?hl=en.
>
>

--
---
BigBlueButton
http://www.bigbluebutton.org
http://code.google.com/p/bigbluebutton

HostBBB.com

unread,
Sep 21, 2010, 10:36:32 AM9/21/10
to BigBlueButton-dev
Richard thanks, exactly what i was looking for. i will give it a
try...

Stephen
>    wgethttp://downloads.asterisk.org/pub/telephony/asterisk/old-releases/ast...
>    tar zxvf asterisk-1.6.2.5.tar.gz
>    mv asterisk-1.6.2.5 asterisk-1.6.2.5.orig
>    cp ~/dev/app_konf/AsteriskAudioKonf/asterisk-patches/asterisk-1.6.2.5-speex16.­patch
> BigBlueButtonhttp://www.bigbluebutton.orghttp://code.google.com/p/bigbluebutton- Hide quoted text -
>
> - Show quoted text -

HostBBB.com

unread,
Sep 21, 2010, 12:03:26 PM9/21/10
to BigBlueButton-dev
Richard,

Got thru patching asterisk wirh no errors so far. This is an 10.4
ubuntu server, with no development tools...

Looks like i need to load automake and subversion commands before
continuing... I did apt-get install automake, but got

automake autoconf bison flex libtool libncurses5-dev libssl-
dev
automake: no Automake input file found for `autoconf'
automake: no Automake input file found for `bison'
automake: no Automake input file found for `flex'
automake: no Automake input file found for `libtool'
automake: no Automake input file found for `libncurses5-dev'
automake: no Automake input file found for `libssl-dev'
automake: no input file found among supplied arguments

Are there certain versions of automake an subversion needed?

thanks in advance for your help.
Stephen
> > BigBlueButtonhttp://www.bigbluebutton.orghttp://code.google.com/p/bigbluebutton-Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -

HostBBB.com

unread,
Sep 21, 2010, 12:41:27 PM9/21/10
to BigBlueButton-dev
ignore last post, found my mistake i was running

automake autoconf bison flex libtool libncurses5-dev libssl-dev
subversion svn-buildpackage

as seperate lines... the words wrapped in forum make it look like
seperate commands... these actually went with previous

on to next steps...
> > > BigBlueButtonhttp://www.bigbluebutton.orghttp://code.google.com/p/bigbluebutton-Hidequoted text -

HostBBB.com

unread,
Sep 22, 2010, 1:18:12 PM9/22/10
to BigBlueButton-dev
Richard, Getting close, have successfully patched and compiled
asterisk and konference and got BBB .71dev to connect to conference
using Konference....

But bbb client log mentions PCMu nelly moser and SPEEX..

See below, looks like speex is there but callback is PCM? I have added
allow speex16 in sip... is this running speex or pcm? Not sure,
need to look at asterisk cli closer to see if call is speex on both
legs but im 90% sure client is still 8bit with Nelly Moser.

9/22/2010 12:59:21.330 [DEBUG] Joining voice conference
9/22/2010 12:59:23.126 [DEBUG] codec=SPEEX,framesPerPacket=1,rate=16
9/22/2010 12:59:23.501 [DEBUG] Phone Module Connection Status: SUCCESS
9/22/2010 12:59:23.502 [DEBUG] Dialing....73320
9/22/2010 12:59:23.502 [DEBUG] Calling 73320
9/22/2010 12:59:23.712 [DEBUG]
successfullyJoinedVoiceConferenceCallback microphone_1285174765589 :
speaker_1285174765588 : PCMU
9/22/2010 12:59:23.713 [DEBUG] Call connected...
9/22/2010 12:59:23.715 [DEBUG] codec=NELLYMOSER,rate=8
9/22/2010 12:59:23.722 [DEBUG] Publishing stream
microphone_1285174765589
9/22/2010 12:59:26.732 [DEBUG] LISTENER-ROLE:MODERATOR

Thanks for any input on this.. Im missing something conceptually with
RED5 connecting to konference and client connecting to konference.

Stephen
> > > > BigBlueButtonhttp://www.bigbluebutton.orghttp://code.google.com/p/bigbluebutton-Hi...text -

Richard Alam

unread,
Sep 22, 2010, 1:41:50 PM9/22/10
to bigblueb...@googlegroups.com
Hi Stephen,

My answers inline....

On Wed, Sep 22, 2010 at 1:18 PM, HostBBB.com <sd...@207me.com> wrote:
> Richard, Getting close, have successfully patched and compiled
> asterisk and konference and got BBB .71dev to connect to conference
> using Konference....
>
> But bbb client log mentions PCMu nelly moser and  SPEEX..
>
> See below, looks like speex is there but callback is PCM? I have added
> allow speex16 in sip...   is this running speex or pcm?  Not sure,
> need to look at asterisk cli closer to see if call is speex on both
> legs but im 90% sure client is still 8bit with Nelly Moser.
>
> 9/22/2010 12:59:21.330 [DEBUG] Joining voice conference
> 9/22/2010 12:59:23.126 [DEBUG] codec=SPEEX,framesPerPacket=1,rate=16

The client initializes the microphone to use speex by default but
waits from the server what to really use based on codec negotiation
between Red5 and Asterisk.

> 9/22/2010 12:59:23.501 [DEBUG] Phone Module Connection Status: SUCCESS
> 9/22/2010 12:59:23.502 [DEBUG] Dialing....73320
> 9/22/2010 12:59:23.502 [DEBUG] Calling 73320
> 9/22/2010 12:59:23.712 [DEBUG]
> successfullyJoinedVoiceConferenceCallback microphone_1285174765589 :
> speaker_1285174765588 : PCMU
> 9/22/2010 12:59:23.713 [DEBUG] Call connected...
> 9/22/2010 12:59:23.715 [DEBUG] codec=NELLYMOSER,rate=8

Both Asterisk and Red5 (BBB-Voice) agree to use Ulaw. This negotiation
is really driven by what Asterisk is setup to accept. if you have the
following in bbb_sip.conf
disallow=all
allow=speex16,ulaw

and still speex doesn't work, it may mean that there are dependencies
missing in Asterisk.

There might be a step missing on the instructions I sent. When
compiling Asterisk, try doing the following:
./configure --disable-xmldoc
make menuselect

- make sure the codec_speex is selected.

make
sudo make install

After starting asterisk, in the cli console, type "core show
translation" to display the different codecs and how much time it
takes to translate between codecs. You should see speex16 there.

Richard

HostBBB.com

unread,
Sep 22, 2010, 2:10:24 PM9/22/10
to BigBlueButton-dev
thanks for your quick help.... i will look closer at this... just
showed translation in current build and i got list of codecs

- - - - -
speex - 2 2 2 2 2 1 - -
- - 2 2 - - 2
ilbc - - - - - - - - -
- - - - - - -

speex is here... not speex16?

I will go and rebuild using the menu select.

thks
Stephen
> >> > > > BigBlueButtonhttp://www.bigbluebutton.orghttp://code.google.com/p/bigbluebutton-Hi...-
>
> >> > > > - Show quoted text -- Hide quoted text -
>
> ...
>
> read more »- Hide quoted text -

HostBBB.com

unread,
Sep 22, 2010, 3:12:27 PM9/22/10
to BigBlueButton-dev
Went to rebuild asterisk..,, menuselect had speex already selected,
compiled asterisk then installed. When i compile Konference i get
quite a few warnngs, but the module builds and works in asterisk.. Not
sure if these warnings are epected... still no speex16 just speex

I'm going to go back, and try to run the patch again, then compile
asterisk, konference one more time, until i can see the speex16 in
asterisk

konference warnings.

root@ip-10-203-7-167:/dev/app_konf/AsteriskAudioKonf/konference# make
cc -pipe -Wall -Wmissing-prototypes -Wmissing-declarations -MD -MP -g
-fPIC -I../asterisk/include -D_REENTRANT -D_GNU_SOURCE -DREVISION=
\"exported\" -DCRYPTO -DCHANNEL_TABLE_SIZE=997 -
DCONFERENCE_TABLE_SIZE=199 -DREALTIME -Ilibspeex -DSILDET=2 -c -o
app_conference.o app_conference.c
cc -pipe -Wall -Wmissing-prototypes -Wmissing-declarations -MD -MP -g
-fPIC -I../asterisk/include -D_REENTRANT -D_GNU_SOURCE -DREVISION=
\"exported\" -DCRYPTO -DCHANNEL_TABLE_SIZE=997 -
DCONFERENCE_TABLE_SIZE=199 -DREALTIME -Ilibspeex -DSILDET=2 -c -o
conference.o conference.c
conference.c: In function âshow_conference_statsâ:
conference.c:1423: warning: format â%-20ldâ expects type âlong intâ,
but argument 6 has type âintâ
cc -pipe -Wall -Wmissing-prototypes -Wmissing-declarations -MD -MP -g
-fPIC -I../asterisk/include -D_REENTRANT -D_GNU_SOURCE -DREVISION=
\"exported\" -DCRYPTO -DCHANNEL_TABLE_SIZE=997 -
DCONFERENCE_TABLE_SIZE=199 -DREALTIME -Ilibspeex -DSILDET=2 -c -o
member.o member.c
cc -pipe -Wall -Wmissing-prototypes -Wmissing-declarations -MD -MP -g
-fPIC -I../asterisk/include -D_REENTRANT -D_GNU_SOURCE -DREVISION=
\"exported\" -DCRYPTO -DCHANNEL_TABLE_SIZE=997 -
DCONFERENCE_TABLE_SIZE=199 -DREALTIME -Ilibspeex -DSILDET=2 -c -o
frame.o frame.c
cc -pipe -Wall -Wmissing-prototypes -Wmissing-declarations -MD -MP -g
-fPIC -I../asterisk/include -D_REENTRANT -D_GNU_SOURCE -DREVISION=
\"exported\" -DCRYPTO -DCHANNEL_TABLE_SIZE=997 -
DCONFERENCE_TABLE_SIZE=199 -DREALTIME -Ilibspeex -DSILDET=2 -c -o
cli.o cli.c
cli.c: In function âconference_mutechannelâ:
cli.c:541: warning: format â%dâ expects type âintâ, but argument 8 has
type âchar *â
cli.c:541: warning: too many arguments for format
cli.c: In function âconference_unmutechannelâ:
cli.c:758: warning: format â%dâ expects type âintâ, but argument 8 has
type âchar *â
cli.c:758: warning: too many arguments for format
cc -pipe -Wall -Wmissing-prototypes -Wmissing-declarations -MD -MP -g
-fPIC -I../asterisk/include -D_REENTRANT -D_GNU_SOURCE -DREVISION=
\"exported\" -DCRYPTO -DCHANNEL_TABLE_SIZE=997 -
DCONFERENCE_TABLE_SIZE=199 -DREALTIME -Ilibspeex -DSILDET=2 -c -o
libspeex/preprocess.o libspeex/preprocess.c
libspeex/preprocess.c:632: warning: no previous prototype for
âephraim_malahâ
cc -pipe -Wall -Wmissing-prototypes -Wmissing-declarations -MD -MP -g
-fPIC -I../asterisk/include -D_REENTRANT -D_GNU_SOURCE -DREVISION=
\"exported\" -DCRYPTO -DCHANNEL_TABLE_SIZE=997 -
DCONFERENCE_TABLE_SIZE=199 -DREALTIME -Ilibspeex -DSILDET=2 -c -o
libspeex/misc.o libspeex/misc.c
cc -pipe -Wall -Wmissing-prototypes -Wmissing-declarations -MD -MP -g
-fPIC -I../asterisk/include -D_REENTRANT -D_GNU_SOURCE -DREVISION=
\"exported\" -DCRYPTO -DCHANNEL_TABLE_SIZE=997 -
DCONFERENCE_TABLE_SIZE=199 -DREALTIME -Ilibspeex -DSILDET=2 -c -o
libspeex/smallft.o libspeex/smallft.c
cc -pg -shared -Xlinker -x -o app_konference.so app_conference.o
conference.o member.o frame.o cli.o libspeex/preprocess.o libspeex/
misc.o libspeex/smallft.o
root@ip-10-203-7-167:/dev/app_konf/AsteriskAudioKonf/konference#


regards,
Stephen

HostBBB.com

unread,
Sep 22, 2010, 4:00:08 PM9/22/10
to BigBlueButton-dev
Richard, SOLVED.... got speex16 running with latest .71 dev and
konference, thanks for all the tips....

I went back and reapplied the patch...and rebuilt
asterisk,konference. Not sure what i did last night, but apparently
installing bigbluebutton or running apt-get update apt-get dist-
upgrade somehow wiped my modified version of asterisk today i notice
konference missing in cli.. and rebuilt without apply the patch.

no need for menuselect.. since speex is already selected.

thanks again
Stephen

HostBBB.com

unread,
Sep 23, 2010, 2:43:41 PM9/23/10
to BigBlueButton-dev
Richard, Further testing asterisk/speex16 with konference on .71 dev
185 .... translation shows 10000+ for speex and speex16.. is this
what you see.. Also have about 2-1/2 second delay on audio conf and
the asterisk CLI is showing 40+ warnings a second like those below.

[Sep 23 18:26:33] WARNING[3097]: chan_sip.c:6215 sip_write: Asked to
transmit frame type 64, while native formats is 0x80 (speex16)(128)
read/write = 0x80 (speex16)(128)/0x80 (speex16)(128)
[Sep 23 18:26:33] WARNING[3097]: chan_sip.c:6215 sip_write: Asked to
transmit frame type 64, while native formats is 0x80 (speex16)(128)
read/write = 0x80 (speex16)(128)/0x80 (speex16)(128)


Translation times between formats (in microseconds) for one second of
data
Source Format (Rows) Destination Format (Columns)

g723 gsm ulaw alaw g726aal2 adpcm slin speex16 g729
speex ilbc g726 g722 siren7 siren14 slin16
g723 - - - - - - - -
- - - - - - - -
gsm - - 2 2 2 2 1 10002 -
10001 - 2 2 - - 2
ulaw - 2 - 1 2 2 1 10002 -
10001 - 2 2 - - 2
alaw - 2 1 - 2 2 1 10002 -
10001 - 2 2 - - 2
g726aal2 - 2 2 2 - 2 1 10002 -
10001 - 2 2 - - 2
adpcm - 2 2 2 2 - 1 10002 -
10001 - 2 2 - - 2
slin - 1 1 1 1 1 - 10001 -
10000 - 1 1 - - 1
speex16 - 3 3 3 3 3 2 - -
10002 - 3 2 - - 1
g729 - - - - - - - -
- - - - - - - -
speex - 2 2 2 2 2 1 10002
- - - 2 2 - - 2
ilbc - - - - - - - -
- - - - - - - -
g726 - 2 2 2 2 2 1 10002 -
10001 - - 2 - - 2
g722 - 2 2 2 2 2 1 10001 -
10001 - 2 - - - 1
siren7 - - - - - - - -
- - - - - - - -
siren14 - - - - - - - -
- - - - - - - -
slin16 - 2 2 2 2 2 1 10000 -
10001 - 2 1 - - -


thanks,
Stephen

Richard Alam

unread,
Sep 23, 2010, 3:01:24 PM9/23/10
to bigblueb...@googlegroups.com
Here's another step from Timo I forgot to mention to fix the warnings.

- Please recompile the module with AC_USE_SPEEX16 defined (uncomment the
corresponding line in konference/Makefile before compilation).

Don't have my Asterisk setup yet so I can't tell you what the values
for the translations are. But IIRC it was also big.

Richard

> --
> You received this message because you are subscribed to the Google Groups "BigBlueButton-dev" group.
> To post to this group, send email to bigblueb...@googlegroups.com.
> To unsubscribe from this group, send email to bigbluebutton-...@googlegroups.com.

HostBBB.com

unread,
Sep 23, 2010, 4:55:19 PM9/23/10
to BigBlueButton-dev
as always thanks for help...

Richard Alam

unread,
Sep 24, 2010, 2:59:42 PM9/24/10
to bigblueb...@googlegroups.com
Let us know how your testing goes.

We tested on EC2 with FreeSWITCH and it seems like Ulaw is better than
Speex. Speex eats up a lot of CPU.
In Speex, we get between 20-30 VOIP users and we get choppy audio. For
Ulaw, we can get up to around 100.

We're still doing more testing with different scenarios and
combinations (video, deskshare, etc.).

Richard

HostBBB.com

unread,
Sep 25, 2010, 9:49:47 AM9/25/10
to BigBlueButton-dev
Looks like latency is much improved, i have a small EC2 instance
running Asterisk Konference with Speex16 on latest ,71dev. Its at
http://bbb2.207me.com if you want to test with it.. Also enabled
breakout and deskshare. Anyone is free to play wih it.

I'm having some existing customers test it out;

With PCM 64k plus overhead so about 80k bandwidth per call, and
speex 16 Speex (16 KHz, 16 bit, 5 Qlty) 2188 bytes/sec with a lot of
computing required and very little bandwith.

Do you have some testing tools to simulate users... I have EC2
monitoring on this instance.
Would be glad to help in any way i can

I'm working on getting a freeswitch instance up now,

regards,
Stephen

Fred Dixon

unread,
Sep 25, 2010, 11:04:03 AM9/25/10
to bigblueb...@googlegroups.com
Hi Stephen,

We have internal tools to simulate N users on a BigBluebutton server,
but the *real* testing occurs when our community members try
BigBlueButton and share their results.

Thanks for sharing your findings so far ... we're still working on
0.71. When we enter our testing phase (soon!), we certainly want to
get broad feedback and do another community-wide stress test like we
did for the previous release.

http://groups.google.com/group/bigbluebutton-users/browse_thread/thread/307a9878fcf07ebe#

Regards,... Fred

Reply all
Reply to author
Forward
0 new messages