* 4 Dialplan, what to add to default.xml for use with Skypiax
* 5 Dialplan, how to use Skypiax
* 6 The "ANY" interface, poor man interface grouping
* 7 Multiple concurrent incoming calls on the same Skype username
* 8 Libraries needed to build Skypiax on Linux
* 9 An example of Skypiax and FreeSWITCH installation on CentOS 5.2, from scratch
* 10 An example of Skypiax and FreeSWITCH installation on Ubuntu 8.04, from scratch
* 11 How to prepare the configuration directory of Skype clients on Linux
* 12 Cloning configuration directory on Linux
* 13 Skypiax on Windows
* 14 Running Skypiax on Windows as a Service
* 15 Performance and Resource Usage
* 16 TO DO
* 17 BUGS and Feature Requests
[edit]
Breaking News!
Starting with svn 12168, Feb 19 2009, skypiax is part of the mainline FreeSWITCH trunk.
So if you have already downloaded its sources in the past, you'll have to go into the FreeSWITCH svn directory, remove the old skypiax sources, and download the new ones:
This software (Skypiax) uses the Skype API but is not endorsed, certified or otherwise approved in any way by Skype.
Skypiax is an endpoint (channel driver) that uses the Skype client as an interface to the Skype network, and allows incoming and outgoing Skype calls to/from FreeSWITCH (that can be bridged, originated, answered, etc. as in all other endpoints, e.g. sofia/SIP).
Skypiax works in FreeSWITCH (FS) on both Linux and Windows, at both 8khz and 16khz (Skype client has 16khz audio I/O). Skypiax works on Asterisk too, at 8khz, on Linux and Windows (through CygWin).
Think of Skypiax as similar to OpenZAP for analog lines. For each channel you need an interface (a Skype client). So, for example, two concurrent calls would need two channels, and therefor two Skype clients running on your FreeSWITCH server.
If your Skype client(s) have Skype credits, then Skypiax works for SkypeOut calls as well.
On Linux the Skype client uses a lot of CPU. To lower its CPU consumption, you can use the Xvfb "fake" X server and (more importantly) the snd-dummy ALSA "fake" sound driver. Scripts are provided for this, though for a low number of channels it should work just fine with normal X servers and ALSA drivers.
On a Linux machine with 3GB ram and a quad core intel6600, we had no problem with 20 concurrent calls, and plenty of head room for perhaps 100 more, (not tested).
On Windows, no need to do anything special the Skype client is lighter on the CPU.
Skypiax is now beta, usable for testing and finding bugs :-).
Skypiax has been contributed to the community by: Giovanni Maruzzelli (gmaruzz at gmail dot com)
From the FreeSWITCH mailing list:
Hello FreeSWITCHers,
mod_skypiax is available for testing, feature requests, bug hunting.
I would like to ask the help of you all to make Skypiax robust and
feature full on FreeSWITCH, and particularly of Massimo Cetra (CtRiX
on IRC), that has developed mod_airpe (another Skype endpoint).
I've written a first documentation on Skypiax installation and usage
at: http://wiki.freeswitch.org/wiki/Skypiax
and there is a Jira module at:
http://jira.freeswitch.org/browse/MODSKYPIAX
So, please, test the software, edit the wiki page both for style and
content, file bug reports and feature requests.
FreeSWITCH is now the platform of first development for me, so the
FreeSWITCH part of Skypiax is more tested (if any) and the code is
more readable compared to the Asterisk part where lot of legacy from
my other projects clutter the code.
But Skypiax strive to be available as a Skype compatible endpoint for
all the opensource telephony community, and in the near time the
Asterisk part will be cleaned much more, and documented.
As you will see, the code is made by skypiax_protocol.c (the
interaction with Skype client), mod_skypiax.c (the interaction with
FreeSWITCH), chan_skypiax.c (the interaction with Asterisk).
Skypiax automatically directs the Skype client instance to agree to a request of being added to the Contact List and to make known its "status" (online, offline, etc), and will add the requester to the Contact List of the Skype client instance.
ONLY if you have FS svn version before 12064 or before 1.0.3RC2: for having skypiax to work correctly with internal extensions (eg: calling the 1000 ext), you have to add:
to the standard default.xml dialplan, just under "set_domain_openzap" (thx BBHoss)
[edit]
Dialplan, how to use Skypiax
Like other endpoints it's easy to build up useful dialplans using Skypiax. There are a few simple examples given in the "default.xml" dialplan located in mod_skypiax/configs/
You can use the standard format with the interface name:
skypiax/skypiax1/echo123
to call "echo123" using the skypiax interface named "skypiax1"
If you modify your dialplan, you'll be able to call "skype uri"s for terminating calls via the Skype network.
A "Skype URI" is composed by the word 'skype' followed by a slash and a destination: "skype/remote_skypename" or "skype/skypeout_phonenumber"
E.g. "skype/echo123" or "skype/+18007844444".
You can use the "skype uri" of the provided dialplan directly from a SIP softphone, e.g. X-Lite.
And you can call the "2909" extension in the provided dialplan from any kind of phone to be bridged to the Skype Test Call.
Dialplan snippet:
<!-- dial echo123 via skypiax using skypiax1 interface to go out -->
Note: Currently it uses a sequential search, perhaps use round robin is more desired. Not sure if their are race conditions on concurrent calls. Anyone want to use that on high traffic?
Let's say you want to be able to serve multiple concurrent incoming calls to the Skype username "skypiax1" (as in: Alice uses Skype to call the Skype user "skypiax1", concurrently Bob uses Skype to call the Skype user "skypiax1", both Alice and Bob are concurrently served by FS).
Let's say you want to serve a max of 3 concurrent incoming calls, you'll setup three skypiax interface (100 concurrent calls, 100 skypiax interfaces). One of those three interfaces will be logged into the Skype network using the Skype username you want to use to answer all the incoming calls.
So, one interface will be logged into Skype network as "skypiax1". Let's say that the other two interfaces will be logged into the Skype network as "skypiax2" and "skypiax3", but they could be logged as any other Skype username, as long as they are all different and different from "skypiax1" (it's not possible to have more than one Skype client instance using the same Skype username on the same machine, at least on Linux).
If another call for "skypiax1" is incoming while that interface is busy into a call (incoming or outbound), the "skypiax1" interface will *transfer* the incoming call to the first other idle skypiax interface it finds (eg: skypiax2 or skypiax3). The calling user will not have to do nothing for this, and this is completely transparent for Windows and Linux users, while MacOSX users will see into their client that the called party is changed from "skypiax1" to, say, "skypiax3", but they too do not have to do nothing.
And so on until all the skypiax interfaces available are busy. At that point, further incoming calls will be rejected until one skypiax interface exit from the call it is into, and will be available to answer.
Basically, you don't have to do anything to be able to answer multiple incoming calls to the
same Skype username. Just set up enough interfaces for the maximum concurrent calls you want.
[edit]
Libraries needed to build Skypiax on Linux
If you are on Ubuntu, Debian, or derivative:
apt-get install libX11-dev
if you are on CentOS, RedHat, or derivative:
yum -y install libX11-devel
for other distros, please add here
[edit]
An example of Skypiax and FreeSWITCH installation on CentOS 5.2, from scratch
begin with CentOS-5.2-i386-netinstall.iso (or with the first installation disk)
choose language
choose keyboard
choose installation method = HTTP
default Tcp-Ip configuration
HTTP setup:
insert the name of the mirror = mi.mirror.garr.it
insert the directory name = mirrors/CentOS/5.2/os/i386
At the package selection:
select nothing from the "additional tasks", nothing for "additional repositories"
select "customize now" on the bottom
select "base system" then de-select dialup Networking support, and leave only "base" checked
After the machine installed,
from setup agent:
FIREWALL
firewall disabled
SElinux disabled
Login to the local console, and reboot it:
shutdown -r now
Login to the local console, and update the entire OS installation:
yum update -y
shutdown -r now
now login from ssh, the following is cut and paste ready
yum install -y subversion autoconf automake libtool gcc-c++ ncurses-devel make
yum install -y libX11-devel
cd /usr/src
svn co http://svn.freeswitch.org/svn/freeswitch/trunk freeswitch
cd freeswitch
./bootstrap.sh
./configure
vi modules.conf
uncomment mod_skypiax in modules.conf, then:
make && make install && make hd-sounds-install && make hd-moh-install && make samples
optionally, copy the dialplan configuration file that contains the "skypiax" modifications (eg: you can call "sip:skype/remote_skypename__OR__skypeout_phonenumber" for calling via the Skype network from a SIP softphone to remote_skypename or to a phone number via SkypeOut, or you can call the "2908" extension from any phone to be bridged to the Skype Test Call)
How to prepare the configuration directory of Skype clients on Linux
You will use configs/skypiax_auth to force the Skype client to ask you to authorize "skypiax" to connect to it.
Then you copy the .Skype configuration directory of the user that has launched Skype (eg: /home/maruzz/.Skype if you are maruzz) on the home directory of the user that will start Skype on the server (eg: root).
1) on a Linux desktop machine, rmmod all the snd* modules
2) on the desktop machine, modprobe snd-dummy
3) on the desktop machine, logout from your autologin username if any, launch the Skype client and login as the username you'll use on server
4) on the desktop machine, set the desktop client to use the "hw:dummy" audio device, to not update, to not make "events", etc etc... Make and receive a couple of test calls. Please note that you (and the remote party) will hear nothing (you're using the snd-dummy "fake" audio driver), that's ok.
3) on the desktop machine, when satisfied of the Skype client setup, use skypiax_auth (that simulates FS-skypiax connecting to the Skype client). The Skype client will ask you to be authorized to let "skypiax" connect.
4) Give the authorization and check the "not ask me again" option.
5) Close (Quit) the Skype client from the tray icon, so it saves its config.
6) Then, relaunch the Skype client and use skypiax_auth again, just to be sure it now succeed.
7) Close (Quit) the Skype client from the tray icon, so it saves its config.
Do the steps 1-7 for all Skype usernames you will want to use on the server (eg: one Skype username per channel). NB: if you use the same password for all Skype usernames, you can setup just one client and then "clone" it. See below for "Cloning configuration directory on Linux".
When finished with all the Skype usernames: Copy or targzip the .Skype directory and all its content on the home directory of the server user that will launch the Skype client(s).
After you have launched the Skype client and logged yourself into the Skype network as "skypiax1", and you have given the auth to be connected by Skypiax, and you setup all the otions in the client, exit from the client, right click on the icon and choose "Quit". The Skype client has saved its configuration.
You'll find the subdir "skypiax1" underneath the ~/.Skypiax directory in your home.
If you have registered multiple accounts with Skype ***with the same password*** as the "skypiax1" account, you can just clone the skypiax1 directory and give it the names of the other accounts, and end up as (if you just cloned them, the dates will be closer):
Inside each one of the subdirs, you'll find the file "config.xml".
After a while you'll get a grip on the format. Anyway, the most important item are:
<config>
...
...
...
<UI>
...
...
...
<CaptureDevice>4</CaptureDevice>
<RingDevice>4</RingDevice>
<SoundDevice>4</SoundDevice>
</UI>
</config>
Those values determine the audio devices used by the Skype client. You want to use the hw:snd-dummy ALSA device, because it will be really light on your CPU.
So, if you edited the startskype.sh script to rmmod all the snd-* modules from kernel, and then modprobe snd-dummy with the params in the same script, you will edit the config.xml inside the directory of the first 8 interfaces, and put the values at "2".
Next 8 interfaces, values at "4".
Next 8 interfaces, values at "6".
That's it. It works.
[edit]
Skypiax on Windows
Skypiax has been designed to work well on windows since the beginning, like FS itself.
After having downloaded the FS sources from svn or the packaged FS source release, follow the instruction on how to build FS on Windows. Using Visual C (Express or not):
* Open Freeswitch.sln
* Right click the main solution node at the top of the Solution Explorer
* Right click and select Build
Then, download and install the 16khz sounds, needed by Skypiax:
* Right click on "Download 16khzsound" and select Build
* Right click on "16khz" (just under the top) and select Build
Test if FS works at all: http://wiki.freeswitch.org/wiki/Installation_Guide#Windows_quick_start
Then, from Visual C (Express or not Express):
* Open again Freeswitch.sln
* Right click the main solution node at the top of the Solution Explorer
* Right click and select "Add" => "Existing Project" => "src\mod\endpoints\mod_skypiax" => select the mod_skypiax project
* Right click on "mod_skypiax" that you have just added to the "Solution Explorer", eg: scroll down from where you added the project
* and select "Build"
You'll probably build the "Debug" version. So, go and copy src\mod\endpoints\mod_skypiax\configs/skypiax.conf.xml to Debug\conf\autoload_configs. Edit it to reflect your configuration.
Then, go into src\mod\endpoints\mod_skypiax\configs/ and edit startskype.bat to suit your configuration. Remember that startskype.bat needs wait.bat to be in its same directory (wait.bat is in the "configs" dir too).
Eventually, launch the Skype client instances using startskype.bat, then launch FS, and from the FS command line:
load mod_skypiax
The Skype instances will ask you for permission to be connected by Skypiax. Give the auth.
The one below is another ascii screenshot, but using the current svn revision at Feb 10, 2009 (one month later than the screenshot before), taken after one hour run of 19 channels on music on hold, and 1 channel intermittent usage (for testing). 20 concurrent channels on moh.
top - 11:37:20 up 14:59, 3 users, load average: 0.04, 0.06, 0.08
Requests, suggestions, ideas (feel free to add here, but best is to add on Jira - see below 'BUGS and Feature Requests'):
* Interact with the presence system, known Skype users as subscriptions, eg: SIP
* Interact with messaging and chat, eg: SIMPLE
* Revamp and standardize configuration file structure, names, values, etc
* Audio volumes (In and Out) adjustments
* Revamp and standardize the debugging output
* Add CLI commands to list interfaces, adjust audio volumes, send commands to the Skype client, etc (coming soon on FS, works on *)
* Check for sending "early media", so to hear ringing when making outbound calls
* Check for changing the Skype Caller ID when doing SkypeOut calls
* originate skypiax/wrong_skype_name won't cause core dump
* What will happen if a skype client crash? can it automatically disable the channel and reset the channel after the skype client recovered?
* Is it possible using Skypiax and add users on the fly? Say we have a box that could support 20 channels, and we have ten active, can we configure and add the 11th channel without having to take down the other active channels?
[edit]
BUGS and Feature Requests
You can file bug reports, hints, suggestions, feature requests, improvements, patches, etc to http://jira.freeswitch.org/browse/MODSKYPIAX open an account there if you don't have it (it's free ;-) ).
You can also write to the FS users' and developers' mailing lists: http://lists.freeswitch.org/mailman/listinfo
And you can drop in the IRC channels #freeswitch and #freeswitch-dev on irc.freenode.org to ask questions and discuss issues. The original developer of Skypiax is called "gmaruzz" in the IRC channel.
As a last resort, not the preferred way, you can write email to Giovanni Maruzzelli - gmaruzz @ gmail dot com