150 likes | 336 Views
SKYPIAX, how to add Skype capabilities to FreeSWITCH (and Asterisk) CHICAGO, USA, September 2009. AGENDA. Overview How it Works Usage How to build it How to Configure it Starting it CLI commands Performances Q&A. SKYPIAX important infos.
E N D
SKYPIAX, how to add Skype capabilities to FreeSWITCH (and Asterisk) CHICAGO, USA, September 2009
AGENDA • Overview • How it Works • Usage • How to build it • How to Configure it • Starting it • CLI commands • Performances • Q&A
SKYPIAX important infos • Skypiax uses the Skype API but is not endorsed, certified or otherwise approved in any way by Skype, Ebay, or any other company owning rights to the Skype technology • Skypiax is developed mainly on FreeSWITCH, and is then made to be compatible with Asterisk too (occasionally Asterisk version can lag behind or not compile straight from svn. Asterisk users, be patient or volunteer to maintain)
WHAT is SKYPIAX ? • 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 (calls 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 (directly, no Cygwin needed), native at 16khz (Skype client has 16khz audio I/O). • Skypiax works on Asterisk too, converting at 8khz (Asterisk cannot do 16khz), 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 therefore two Skype clients running on your FreeSWITCH server.
SKYPIAX Features Overview • Multiline (many concurrent different skypeusernames: “Alice”, “Bob”, ... “Zukowski”) • Multiline (many concurrent instances of the same skypeusername: “Alice”, “Alice”, .... “Alice”) • Multiline (a mix of the former two setups) • Can make SkypeOut calls to PSTN and cellphones • Easy integration into dialplan (like standard endpoints) • Round Robin or Linear hunt for next available outbound channel • Automatic selection of interface to answer incoming call • CLI commands for statistics, debug, prototyping, control • Easy interaction with the outside world through ESL or AMI
SKYPIAX, how it works • One Skype client instance running per each Skypiax interface (eg: 32 Skype concurrent calls, 32 Skypiax interfaces, 32 Skype clients running) • Skypiax “remote controls” its own configured Skype client via Skype API • Skypiax exchange audio to/from the Skype client via TCP/IP sockets (activated via Skype API) that “substitute” the soundcard microphone and speakers
Skype API, what it looks like • Skype API is a proprietary, text based protocol for communication between the Skype client and other external software (eg: Skypiax) • On Windows is implemented through Windows Messages, on Linux using X Events • For both Linux and Windows, Skypiax creates a “fake” window with its own message loop, then dispatch messages to the monitor or to the appropriate interface thread • Eg: Skypiax sends “PING” to Skype client, Skype client sends “PONG” back to Skypiax • Skype API is fairly complete, can manage calls, call progress, messaging, etc • Skypiax gives you different tools for interacting at the Skype API level (eg: for debugging and prototyping features)
SKYPIAX, outbound usage • Standard interface naming: skypiax/interface3 • Eg, from the FS CLI: • bgapi originate skypiax/interface3/Bob 9999 • Will originate a Skype call from interface3 to Bob, and connect Bob to extension 9999 of dialplan (Music on Hold) * Round Robin interface naming: skypiax/RR * Eg, from the FS CLI: • bgapi originate skypiax/RR/Bob 9999 • Will originate a Skype call from the first available interface (using a RR scheme for uniform utilization) to Bob, and connect Bob to extension 9999 of dialplan (Music on Hold)
SKYPIAX, inbound usage • Each interface will answer inbound calls directed to its own configured Skype client (eg: to “Alice” or to “Bob”, as per how the Skype client identified itself with the Skype network) • If you have different interfaces configured with different skypenames (eg: you have two channels, one with Skype client “Alice” and one with Skype client “Bob”), if the incoming call to Alice find the client “Alice” busy and the client “Bob” is idle, the call will be transferred to “Bob”. Transparently for the caller (caller still thinks is Alice to answer). • If you have multiple instances of client “Alice”, one such idle interface will be automatically chosen to answer an incoming call to Alice
SKYPIAX, HOW to BUILD it • On Linux and BSD, you need to install the Xvfb (fake) Xserver – needed by the Skype client – and the libX11 development package • Edit the modules.conf in the root of FS sources, and uncomment the mod_skypiax line • Make install • On Windows, Skypiax is build by default, no need for special actions • Both Linux and Windows: You want to download and install the 16khz sounds and music (Skypiax is 16khz native)
SKYPIAX Configuration • Edit the file startskype.sh from src/mod/endpoints/mod_skypiax/config to reflect the number of Skype clients you want to start and which Skype username each one client will use to register with the Skype network • REMEMBER: one interface – one Skype client running. Each interface has its own Skype client to “remote control” • Copy the configuration file skypiax.conf.xml from src/mod/endpoints/mod_skypiax/configs to the configuration directory of FreeSWITCH • Edit the skypiax.conf.xml to reflect how many interfaces you will use, specify for each interface the same Skype username the configured Skype client will register to the Skype network
SKYPIAX, starting it • BEFORE TO START FreeSWITCH • Execute the script startskype.sh (or startskype.bat on Windoz) • Wait until all the Skype clients have been started • Start FreeSWITCH • Since 1.0.4 it is now possible to add/remove Skypiax interfaces on the fly, eg as in starting a Skype client instance connected as “Bob” and then add an interface to it to a running FreeSWITCH/Skypiax
SKYPIAX CLI commands • Two kinds of commands: “sk” and “skypiax” gives you complete and full control of Skypiax and the Skype API • “sk” is meant to be used from the command line, interactively, to send API command to the Skype client “remote controlled” by a Skypiax interface • “sk” is also used to list interfaces' status, and to add/remove interfaces on the fly • “skypiax” is meant to be used by external programs, eg: via ESL, to send Skype API command to a Skype client “remote controlled” by a particular interface
SKYPIAX performances • Easily 30 concurrent Skype calls per machine • The load on the server is generated by the Skype clients • On Windows you cannot do anything to lower the load generated by Skype clients, but they are highly optimized for Windoz, so not big problem • To minimize the load generated by the Skype client instances on Linux (scripts provided for): • Use the “fake” Xserver Xvfb • Use the “fake” snd-dummy ALSA driver * To “really” optimize performances on Linux: - follow the instructions on wiki for custom kernel and custom ALSA driver
for more info: http://wiki.freeswitch.org/wiki/Skypiax Giovanni Maruzzelli gmaruzz@celliax.org Thank you for your attention, please, any questions?