Mumble Conference With ALSA
About
How to set up a Mumble conference with ALSA.
Click here to expand Table of Contents
- 1 Prerequisites
- 2 Conference Setup
- 3 Dialplan Setup
- 4 PortAudio Endpoint
- 5 ALSA asoundrc or asound.conf
- 6 Preparing FreeSWITCH
- 7 Mumble Configuration
- 8 Connecting it together
- 9 Testing
- 10 Deploying
- 11 TODO List
- 12 Credits
Prerequisites
You'll need to verify you have a few things installed before you can get started:
* Linux 2.6+
* ALSA Loopback Module (snd-aloop or snd_aloop)
* Xorg, Xvfb, or Xvnc
* Mumble (1.2.2 used here)
For the FreeSWITCH, you'll need mod_portaudio and mod_conference.
Verify that you have these modules by looking in mod/ for their filenames (mod_portaudio.so and mod_conference.so)
Also, make sure they're enabled in autoload_configs/modules.conf.xml.
Conference Setup
Initially all you'll need to do is setup a conference, which is configured in autoload_configs/conference.conf.xml:
Mine looks like this:
<configuration name="conference.conf" description="Audio Conference">
<advertise>
<room name="\*94@$${domain}" status="FreeSWITCH"/>
</advertise>
<caller-controls>
<group name="default">
<control action="mute" digits="0"/>
<control action="deaf mute" digits="*"/>
<control action="energy up" digits="9"/>
<control action="energy equ" digits="8"/>
<control action="energy dn" digits="7"/>
<control action="vol talk up" digits="3"/>
<control action="vol talk zero" digits="2"/>
<control action="vol talk dn" digits="1"/>
<control action="vol listen up" digits="6"/>
<control action="vol listen zero" digits="5"/>
<control action="vol listen dn" digits="4"/>
<control action="hangup" digits="#"/>
</group>
</caller-controls>
<profiles>
<profile name="default">
<param name="domain" value="$${domain}"/>
<param name="rate" value="48000"/>
<param name="interval" value="20"/>
<param name="energy-level" value="300"/>
<param name="caller-controls" value="default"/>
<param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>
<param name="muted-sound" value="conference/conf-muted.wav"/>
<param name="unmuted-sound" value="conference/conf-unmuted.wav"/>
<param name="alone-sound" value="conference/conf-alone.wav"/>
<param name="enter-sound" value="tone_stream://%(200,0,500,600,700)"/>
<param name="exit-sound" value="tone_stream://%(500,0,300,200,100,50,25)"/>
<param name="kicked-sound" value="conference/conf-kicked.wav"/>
<param name="locked-sound" value="conference/conf-locked.wav"/>
<param name="is-locked-sound" value="conference/conf-is-locked.wav"/>
<param name="is-unlocked-sound" value="conference/conf-is-unlocked.wav"/>
<param name="pin-sound" value="conference/conf-pin.wav"/>
<param name="bad-pin-sound" value="conference/conf-bad-pin.wav"/>
<param name="caller-id-name" value="$${outbound_caller_name}"/>
<param name="caller-id-number" value="$${outbound_caller_id}"/>
<param name="comfort-noise" value="true"/>
</profile>
</profiles>
</configuration>
There's probably 'problems' with this, but it works perfectly for me, so pundits please update this example if you spot any errors.
As you can see, it's a basic conference, but with some key differences: the RATE is quite high (48khz), but this is because Mumble (on my system) uses this samplerate. Using the same samplerate not only avoids resampling, but also improves stability (no jitters, or crackles). Take note of this setting though for later.
Dialplan Setup
Assign an extension to this conference, and test it out. My dialplan entry looks like this:
<extension name="mumbleconference">
<condition field="destination_number" expression="^\*94$">
<action application="conference" data="hydway"/>
</condition>
</extension>
In our case, the conference is configured as 'default', and there is no conference named 'hydway', so .. it works. But I think if you have more than one conference, you should point your dialplan at it properly.
PortAudio Endpoint
The Portaudio plugin must also be setup, and the configuration is located at autoload_configs/portaudio.conf.xml. Mine looks like this:
<configuration name="portaudio.conf" description="Soundcard Endpoint">
<settings>
<param name="context" value="local"/>
<param name="indev" value="cloop"/>
<param name="outdev" value="ploop"/>
<param name="dialplan" value="XML"/>
<param name="cid-name" value="$${outbound_caller_name}"/>
<param name="cid-num" value="$${outbound_caller_id}"/>
<param name="sample-rate" value="48000"/>
<param name="codec-ms" value="20"/>
</settings>
</configuration>
Again, take note of the 'sample-rate' parameter, we want it to match both our conference and our mumble client.
ALSA asoundrc or asound.conf
Notice the 'indev' and 'outdev' values as 'cloop' and 'ploop' in the portaudio setup. These devices will be created using the snd-aloop ALSA module by adding (or creating) the following to /etc/asound.conf:
pcm.amix {
type dmix
ipc_key 219345
slave.pcm "hw:Loopback,0,0"
}
pcm.asnoop {
type dsnoop
ipc_key 219346
slave.pcm "hw:Loopback,0,1"
}
# ------------------------------------------------------
pcm.ploop {
type dmix
ipc_key 219356
slave.pcm "hw:Loopback,1,1"
}
pcm.cloop {
type dsnoop
ipc_key 219348
slave.pcm "hw:Loopback,1,0"
}
Effectively, this will connect 'asnoop' with 'ploop', and 'amix' with 'cloop'. When audio is piped into asnoop, it'll come out of ploop. The same goes for the other two. (You can name these whatever you want; mumbleAplayback/mumbleAcapture and mumbleBplayback/mumbleBcapture for example may make more sense.)
In this configuration, everything runs through dmix and dsnoop. This isn't required if your samplerates match. To freeball it, change the 'type' field to 'plug', and remove the ipc_key lines.