Title: chan_celliax:
1- chan_celliax
- Cellphones as Asterisk GSM and SMS Channels
- (with Skype Support)?
- Astricon 2007
2Agenda
- chan_celliax Pictures
- chan_celliax Features Overview
- Asterisk Channels How Do They Work
- chan_celliax implementation
- celliax.conf configuration file
- chan_celliax CLI commands
- chan_celliax dialplan applications
- chan_celliax dialplan (extensions.conf)?
- Celliax LiveCD
- chan_celliax hard disk installation
- AudioCables and DataCables
- Celliax troubleshooting
- Celliax TODO
3One Picture....
4...a thousand words
5chan_celliax Features Overview
- Works well on Linux and Windows XP (CygWin)?
- Use Datacable to (USB) serial port and Audiocable
to soundcard, as interface to the physical
cellphone - Incoming and Outgoing call to/from most popular
(cheap) cellphones and other communication
devices - Outgoing SMSs (Incoming are TODO)
- Skype Client Incoming calls are passed through
the cellphone interface (dialing a remote
number)? - Skype and SkypeOut Outgoing calls can be
originated by the cellphone interface (via the
Skype Client)? - Cellphone phonebook and Skype Client Contacts
import into dialplan and directory - Directory export to cellphone phonebook (one
click dial from the cellphone)?
6How an Asterisk channel works
- Each channel driver implements the functions to
be used by Asterisk (call, answer, dial, etc)? - Into the driver, a loop thread monitors all its
physical interfaces, accepting interface events
(RING, DOWN, etc)? - When a call incomes or is originated, the driver
creates an instance that mediates between
Asterisk and the interested interface. That
particular interface is no more in the monitored
pool - When the call is finished, that interface go back
into the monitored pool
7Implementation 1 (monitors)?
- We need to monitor various sources of events
- serial (for datacable incoming indications)?
- skype (for Skype client incoming indications)?
- audio (for sensing a RING if we do not have
serial indications, eg Nokia 3310, or no
datacable)? - We have a loop monitor thread for each kind of
source
8Implementation 2 audio
- Audio tends to be platform specific, CygWin has
only a very rough OSS-like layer - We need an audio API that allows for sharing of
the audio interface between Skype and Celliax - ALSA Linux only, low latency, allows sharing via
plugin (default, dmix-dsnoop), the most difficult
audio API - WinMM Windows only, allows sharing, low latency
on Windows XP, unacceptable latency on Vista - OSS BSD and Linux, low latency, do not allows
sharing. Only recently the commercial version was
opensourced, it allows sharing. TODO - CoreAudio Mac OSX, low latency, allows sharing,
TODO - Incoming audio is analyzed to recognize silence
and DTMFs
9Implementation 3 serial
- Serial interfacing is fairly portable, very well
implemented by CygWin on Windows - We need various types of serial signaling
- AT standard commands, for the most part of
cellphones - FBUS2 proprietary commands, for various Nokia
models - Other serial commands/signaling protocols, eg.
for DECT modules - Each kind of signaling has its own functions,
over a common serial layer for physical I/O
10Implementation 4 skype
- Without hacks, the Skype Client can have one only
instance for computer, so one only chan_celliax
interface can be skype enabled at this moment - On Linux, the Skype Client API uses X11 messaging
- On Windows, the Skype Client API uses standard
Window Messages - For both Linux and Windows, chan_celliax creates
a fake window with its own message loop, then
dispatch messages to the skype monitor or to the
appropriate interface thread - Skype Client API is very easy, text based, but do
not allows for audio stream I/O, we need to share
the audio device - Mac OSX TODO
11celliax.conf configuration file 1
- Each section between brackets defines an
interface, eg nicephone is the
Celliax/nicephone - The first interface defined in celliax.conf sets
the defaults for all the following interfaces.
Defaults can be overridden by each interface - The most important KeyValue couple are
- skypeyesno this interface will interact with
the Skype Client, if any - control_device_protocolatfbus2no_serial...
- control_device_name/dev/ttyUSB0/dev/ttyACM0...
- alsa_capture_device_namedefault0plughw3...
- winmm_playback_device_name03...
12celliax.conf configuration file 2
- Many, many, many other keyvalue couples allows
for fine tuning of each interface - audio fragment and buffer sizes
- serial speed
- most AT commands and indications can be specified
to accommodate for cellphones non ETSI standard - need_acoustic_ring can be enabled to accommodate
for cellphones that do not give incoming RING
serial indication, or when no datacable is used
(eg. Nokia 3310 or a cellphone with autoanswer
enabled)? - dsp_silence_threshold can be set to determine how
much noise is no more silence - playback_boost scales up or down the audio signal
13CLI commands 1 interface stuff
- From the Asterisk CLI console, you can give
various commands to interact with chan_celliax - celliax give a list of chan_celliax CLI commands
and dialplan applications - console shows or sets the chan_celliax interface
on which further commands are acting upon - dial, hangup during a call, sends DTMF to the
interface (not to remote party) or hangup the
call. Useful for no_serial tests without
cellphone (only headset/mic)? - celliax_playback_boost shows or sets the audio
scaling - celliax_capture_boost shows or sets the audio
scaling - celliax_alsa_period shows or sets the ALSA
fragment and buffer size
14CLI commands 2 directory stuff
- celliax_dir_import imports entries into the
celliax_dir.conf file and adds them as extensions
to the dialplan, in the celliaxdir-default
context - addreplace appends to the existing file or
substitute it - fromskypefromcell the entries are sourced
from the Skype Client Contact list or from the
cellphone phonebook (soon also from csv files)? - celliax_dir_export exports the extensions from
the celliax_dir.conf into the cellphone
phonebook, prefixing each one with the interface
cellphonenumber and a pause, so you can one-click
dial from the remote cellphone - tocell write only to cellphone phonebook now
(soon also to csv files)? - cellphonenumber the number at which the
interface answers
15Applications 1 - celliax_directory
- Celliax_Directory(vmcontextdialcontextf)?
- it works very similar to the Asterisk standard
directory application, but it reads the specific
celliax_dir.conf that is populated by the
celliax_import CLI command with entries from the
Skype Client Contacts list and/or from the
cellphone phonebook - it asks you to digit the first three letter of
the person you want to call, tells you who it is,
and if you confirm, make the call (through Skype
or whatever) to him - vmcontext is the celliax_dir.conf section we want
to use - dialcontext is the context used to make calls
- f is for use the first name (as opposed to last
name) of the directory entry
16Applications 2 - celliax_sendsms
- Celliax_SendSMS(interfaceremote_number,text)?
- Sends an SMS to the cellphone at remote_number
with content text, using the given interface - interface is the name of the chan_celliax
interface we want to use for sending the SMS, eg.
nicephone - remote_number is the number of the cellphone to
which we want to send the SMS to - text is the content of the SMS, all standard
dialplan escaping rules apply, eg DATETIME
"This a SMS test\, we\'re testing\, yes\, we\'re
testing..."
17Applications 3 - celliax2skype
- Celliax2Skype(skypenameskypecontactskypeoutnumbe
r)? - During an incoming chan_celliax call, make a
Skype call to the given remote party and let the
chan_celliax interface share the audio path with
the Skype Client (so, the incoming chan_celliax
call is bridged to the outgoing Skype call)? - skypename is a valid skype name, eg echo123
- skypecontact is an entry in the Skype Client
Contacts list - skypeoutnumber is a valid number for SkypeOut
calls
18Applications 4 - skype2celliax
- Skype2Celliax(remotenumber)?
- When a Skype call is incoming into the PC running
Asterisk, if there is a chan_celliax interface
Skype-enabled that is not yet into a call, a call
is initiated into the skype context, where a
skype2celliax extension is lurking. - The skype2celliax extension makes a call to the
remote_number through the chan_celliax interface
and let the chan_celliax interface share the
audio path with the Skype Client (so, the
outgoing chan_celliax call is bridged to the
incoming Skype call)? - remote_number is the number to be called when a
Skype call is incoming
19Dialplan (extensions.conf)?
- Contexts
- celliaxdir-default
- is created at chan_celliax startup and with
celliax_dir_import - contains the extensions from the celliax_dir.conf
- if included in the default incoming call context,
allows one-click dial to its extensions from
cellphones which phonebooks has been populated by
celliax_dir_export - skype
- the context where incoming Skype calls arrives,
see skype2celliax - Dial
- standard Asterisk usage, eg dial(nicephone333444
5)? - celliax_directory, celliax_sendsms,
celliax2skype, skype2celliax - see before, Applications
20LiveCD 1 - contents
- Knoppix based livecd, autobooting, with Skype,
Asterisk, chan_celliax, and configuration
utilities - ISO image of AstLinux based livecd, to be burned
- USB self contained distro for Windows XP
- Asterisk with chan_celliax distro for Windows XP
- Drivers for datacables on Windows XP (Linux do
not need them)?
21LiveCD 2 - usage
- Knoppix
- setup skype first
- then setup celliax
- save configuration on USB pendrive
- reboot
- AstLinux
- burn and go
- USB Windows XP
- copy on USB pendrive and go
- Windows XP hard disk installation
- install basic Cygwin some libraries
- unpack asterisk.tgz in /usr/local and go
22Installation 1 chan_celliax only
- Linux
- If you have previously installed Asterisk from
sources, or from your distro package (with the
latter you need the asterisk-devel package too) - download the celliax_stuff.tgz
- go into the celliax_stuff/build directory
- edit the Makefile
- compile (need ALSA and libX11 devel packages)?
- copy chan_celliax.so in the Asterisk modules
directory - copy celliax.conf in the Asterisk configuration
directory - edit celliax.conf or use the celliax_config
utility
23Installation 2 Asterisk too
- Linux and Windows XP
- If you want an installation similar to the
LiveCD - you'll need all the stuff needed for Asterisk
compilation plus ALSA and libX11 development
packages - checkout from svn the tag you are interested in,
eg svn checkout http//www.celliax.org8081/svn
/celliax/tags/celliax_livecd_beta01RC1/ - go into the asterisk-1.2.XX directory
- make make install make samples
- all will be installed under /usr/local/asterisk
- copy the contents of newconfigs directory into
/usr/local/asterisk/etc/asterisk/ - copy the contents of sh directory into
/usr/local/asterisk/usr/sbin/ - configure and launch with /usr/local/asterisk/usr/
sbin/celliax
24Installation 3 on TrixBox
- TrixBox 2.2.X series is based on Centos 4, that
has very very old ALSA and whiptail versions, and
uses its own script to start Asterisk, configure
permissions, etc - We need to update the ALSA version, install ALSA
and libX11 devel packages, install a recent
dialog version as alternative to whiptail,
compile chan_celliax and modify TrixBox scripts - A very detailed and easy step by step How To
TrixBox is available on www.celliax.org
25AudioCables
- We need an audiocable between the cellphones we
use as celliax interfaces and the soundcards of
the PC running Asterisk - You can buy it or build it (little soldering
needed)? - For cellphones using standard 3pole 2.5mm
handsfree jack you can start from a cheap headset
cut it before the microphone and solder two 3pole
3.5mm jacks - For Nokias using 4pole 2.5mm handsfree jack more
work is needed - electrical schemas are availables at
www.celliax.org - Professionally manufactured audiocables are
available at www.celliax.org
26DataCables
- It's much better to have a datacable between the
cellphones we use as interfaces and the serial
ports (or USB) of the PC running Asterisk - chan_celliax can work without datacable, but it
cannot originate calls, will have no information
at all on the incoming calls (autoanswered by the
cellphone) and will rely on a period of silence
to notice a remote hangup - Most cellphones has datacables available, at
least aftermarket (notably Nokia models)? - Datacables for the cellphones most used with
chan_celliax are available from www.celliax.org
27Troubleshooting 1 - Audio
- Audio Mixer values setup
- You need working audio incoming from microphone
(capture-recording) and outgoing from
speakers-headset (playback)? - Check that the Microphone is muted for playback
(or it will loop back to you)? - Check that the Microphone is selected for capture
- Check if your microphone needs an audio boost
from the mixer - Eventually, play with scaling up or down audio
capture and playback signals in the config file
or through CLI commands
28Troubleshooting 2 - serial
- Check that the controldev_protocol for this
interface in the celliax.conf file is correct - Check that the control_device_name for this
interface in the celliax.conf config file is
correct - Check that the serial speed for this interface in
the celliax.conf config file is supported by the
cellphone (FBUS2 always uses 115200)? - Check that the device has been correctly created
by the operating system (on Linux you can use
dmesg, on Windows use controlpanel for ports
and modems)?
29Troubleshooting 3 - permissions
- Various Linux distro do not allows general
permissions to write and read the sound and
serial devices - Often those permissions are reset at each reboot
- Check that the user Asterisk is running as has
the needed permissions - Make a startup script (an rc.local, or an
Asterisk launching script) that gives to the
Asterisk user all the necessary permission, eg - chown -R asterisk.asterisk /dev/snd
- See the Trixbox How To on www.celliax.org
30Troubleshooting 4 debug logging
- Chan_celliax has very fine grained debug logging
messages, much more you can stare at - in the config file, activate the desired
debug_yes for each category you want messages
about (skype, at commands, pbx functions,
interface state, locking, etc)? - then activate debug in Asterisk itself, via CLI
command or at startup (set debug 100 or with
the -ddddd startup option)? - do not forget to allow debug messages in console
or in the logfiles, edit logger.conf for this!
31TODO
- Mac OSX
- Incoming SMS management
- CSV files import export to directory
- OSS audio
- Test, test, test
- How to contribute
- checkout the latest sources from svn trunk
- send patches to the celliax-dev mailing list
- ask for a committing svn account
32Thank you for your attention!
- for more info www.celliax.org
- Giovanni Maruzzelli
- gmaruzz_at_celliax.org