MHSpot.com
SipToSis TM - Skype Asterisk/trixbox/Elastix Trunks on Linux or Windows - Asterisk Skype Trunk Setup
STS Home FAQ ATA Setup Skype Trunk Setup Troubleshooting Forum Downloads
You are expected to already know how to install software on your platform and how to configure Asterisk/trixbox/Elastix peers, extensions and routes. When configured correctly, you will have multiple channel inbound and outbound Skype calling abilities integrated into your Asterisk/trixbox/Elastix server. You can install everything on the same box if you desire.

These instructions are for the 20090330 and earlier versions of stsTrunkBuilder, for the lastest version click here

Install the applications
Install Asterisk, trixbox or other SIP PBX.
Install Java 1.5 JRE or higher.
Download Skype client, install and create skype accounts for as many Skype channels as you need.
SipToSis must be run on the same computer as the Skype client.
Download the latest SipToSis SIP Skype Bridge and extract into a new folder 'siptosis'.
Download the latest SipToSis Skype Trunk Builder (Requires SipToSis 20090131 or higher) and extract into a new folder 'stsTrunkConfig'.
Make sure to keep the folder/path structure contained in the archives.
For SipToSis versions prior to 20090414 copy the samples folder contents to the siptosis root.
For linux only, install Xvfb if you don't already have it installed. (Example: yum install xorg-x11-server-Xvfb) - Some sort of window manager is required.

Configure a functional test channel first.
It will be easier to correct a problem with a single channel.
Basic SipToSis setup is similiar to a SIP device - see the SipToSis ATA Setup Guide for initial setup.

Below is a simple test Asterisk peer/extension setup. You need to set the desired context and set the registration info and IP address to match your STS config.
In extensions.conf or for trixbox add to extensions_custom.conf 
exten => _7.,1,Dial(SIP/siptosisuser/${EXTEN:1})
;you would then dial 7 and the number you want to call

In sip.conf or for trixbox, add the peer via GUI
[siptosisuser]
username=siptosisuser
type=friend
context=default
secret=siptosisregpassword
host=dynamic
nat=no
dtmfmode=auto
canreinvite=no
;canrevite=yes is preferred if possible
qualify=yes
defaultip=siptosisip
incominglimit=1
outgoinglimit=1
call-limit=1
busylevel=1
Dialing Note: Normal Asterisk PBX's can strip the prefix in extensions.conf file like this:
exten => _7X.,1,Dial(SIP/siptosisuser/${EXTEN:1}) or exten => _901.,n,Dial(SIP/stsTrunk_01/${EXTEN:3})
If your PBX can't be configured this way, then you can work around the PBX limitation by adding entries to SkypeOutDialingRules.props like this:
If your PBX dialing prefix is 7 you could add the following line:
^7([1-9][0-9]{10})$:+$1
The $1 will only capture what's in the parenthesis. In the example above, the 7 will be left out when making the SkypeOut call with 11 digit dialing. If 713051234567 was sent to the gateway, SipToSis would transform it to +13051234567. For other prefixes, change the 7 to the new prefix. Tip: make sure no other rules make the same match. Read up on regular expressions if you need to get more complicated.

After you have tested your single channel test configuration completely you are ready to build the multi channel trunk.
Scroll down to the Linux section or for Windows click here.


Linux Skype Asterisk/trixbox Trunk with SipToSis.


The generated scripts were tested on Centos 5.2 and use Xvfb (X Virtual Frame Buffer) to create X sessions. Even if you don't use the scripts, the creation of the multiple siptosis configuration files and Asterisk peer setup will save you time. You can use whatever X window manager you want or change Xvfb method to vnc etc.

Create the Asterisk Skype Trunk Channel Configurations
In stsTrunkConfig do this:
Copy the samples directory contents to the stsTrunkConfig root path
Edit stsTrunkDef.cfg and set parameters. Do not use the default passwordSeed.
Add the skype user ids to use and set the target platform to linux.
Edit stsTrunkPbxSipBase.conf - Make any needed changes.
Edit stsTrunkPbxExtBase.conf - Make any needed changes.

Add your custom startup commands to stsTrunkStartCmdBase_linux and stsTrunkStartBase_linux
Below is the execution sequence of the start scripts:
stsTrunkStartBase_linux is run for each trunk channel by stsTrunkStartAll_linux
stsTrunkStartBase_linux runs stsTrunkStartCmdBase_linux

The generator does replacements of certain keywords contained in these files (not case sensitive).

  • stsTrunkStartScript - replaced with the auto generated single channel start script name
  • stsTrunkStopScript - replaced with the auto generated single channel stop script name
  • stsTrunkStartCmd - replaced by script name used by the generator
  • osUserBase - replaced by osUserBase set in stsTrunkDef.cfg
  • stsTrunkNum - replaced by generated 2 digit channel number
  • stsTrunkName - replaced with trunkname set in stsTrunkDef.cfg
  • stsPath - replaced with path to siptosis set in stsTrunkDef.cfg - extracted from stsBaseConfigFile setting

Add your custom shutdown commands to stsTrunkStopCmdBase_linux and stsTrunkStopBase_linux
Below is the execution sequence of the stop scripts:
stsTrunkStopBase_linux is run for each channel by stsTrunkStopAll_linux
stsTrunkStopBase_linux runs stsTrunkStopCmdBase_linux
The generator performs the same replacements as above.

Generate the trunk scripts
chmod +x trunkConfig_linux to grant run permission.
Run ./trunkConfig_linux - This will generate configuration files for each channel.
The test channel you created earlier will be used as a configuration base for all the skype trunk channels.
The password for each channel will be generated automatically.
All the scripts will be written to directory specified by stsBaseConfigFile in stsTrunkDef.cfg.
Do chmod +x to all scripts to grant run permission.
If you used another configuration file name than the default, you can specify it as argument like this:
./trunkConfig_linux customTrunkDef.cfg
You can always rerun the trunk generator if you decide to make changes.
*** Note: A re-run will overwrite the files it already generated. ***

Add the Asterisk Skype trunk channel information to Asterisk
For standard Asterisk, Add the generated skype trunk peer information from stsTrunkPbxSipMod.conf to your Asterisk sip.conf and the stsTrunkPbxExtMod.conf entries to Asterisk extensions.conf. Also add macro-stsdialresult (located in the SipToSis project) to extensions.conf.
For trixbox: Add peer information from stsTrunkPbxSipMod.conf to sip_custom.conf and the stsTrunkPbxExtMod.conf entries to extensions_custom.conf. Assuming my default extension prefix, the outbound route dial pattern should be 901. (901 followed by period) - please correct me if this is incorrect since I do not have a trixbox installation.

Configure the Skype instances for operation
Follow these steps to perform skype configuration for a channel:
./stsTrunk_xx_start config (Change xx to the specific 2 digit trunk channel number)
Note: SipToSis will sit at 'initSkype' or display 'retrying every 5 seconds' until Skype is authorized and comes online.
Don't forget to check the 'login automatically' checkbox when logging in to skype!!!
Authorize SipToSis/skype4java to connect when that comes up.
Setup sound, turn off automatic updates and whatever else you need.
Use of snd-dummy is not recommended for the output device. You may be able to patch the snd-dummy source and make it work properly, but the version on my Centos 5.2 install is not suitable. If it works fine for you then by all means use it. Click Sample Linux Sound Setup to see a setup that works if you have a single sound card. It uses snd-dummy for the input device. This method keeps Skype happy and has good sound (at least for me). Click Alternative to snd-dummy for an alternative solution if snd-dummy gives you trouble (hardware sound device required for this solution).
./stsTrunk_xx_stop (Change xx to the channel number you just configured)
Do this procedure for every channel.

Starting the Skype Asterisk trunk.
To launch an individual channel, run ./stsTrunk_xx_start (Change xx to the specific 2 digit trunk channel number) You should not see Skype or SipToSis on the display.
To bring up all the trunk channels run ./stsTrunkStartAll_linux
This should launch the Xvfb, Skype and SipToSis instances for all channels.
You can verify SipToSis connection by looking at the SipToSis logs or use xwd to grab the screen for the desired channel.

Stopping the Asterisk Skype trunk.
To stop an individual channel, run ./stsTrunk_xx_stop (Change xx to the specific 2 digit trunk channel number) (Xvfb does not get stopped)
To stop all the skype trunk channels, run ./stsTrunkStopAll_linux
This should stop all the Xvfb, Skype and SipToSis processes.

You can see the running processes by running ./stsTrunk_show_linux

That's it. I hope you got it working, if not the SipToSis Skype Gateway Troubleshooting may offer some additional help. If you get stuck, leave a comment on the SipToSis Skype Gateway Forum and I will try to help you. I do not have the time to test every OS, Asterisk flavor or PBX. If you find an error/problem please post the correction to the Forum. Confirmation of what is working is also helpful.



Windows Skype Asterisk Trunking with SipToSis.


It was tested on Windows XP Pro. Windows 2000 forward should work. Vista probably doesn't work.

Build the Asterisk to Skype Trunk Configuration
In stsTrunkConfig do this:
Copy samples folder contents to stsTrunkConfig root
Edit stsTrunkDef.cfg and set parameters. Do not use the default passwordSeed.
Add the skype user ids you are going to use and set the target platform to windows.
Edit stsTrunkPbxSipBase.conf - Make any changes specific to your needs.
Edit stsTrunkPbxExtBase.conf - Make any changes specific to your needs.
Run trunkConfig_win.bat - This will generate the needed files for each channel.
The test configuration you created earlier will be used as a base for all the trunk channels.
The password for each channel is generated automatically.
All the scripts are written to the folder specified by stsBaseConfigFile in stsTrunkDef.cfg.
If you used a different definition file name than the default, you can specify it as argument like this:
trunkConfig_win.bat customTrunkDef.cfg
You can always rerun the generator if you decide to make changes.
*** Note: Rerunning the generator will write over the files it already created. ***

If using RunAs option, create a windows account for each channel.
After you create the account, login to each windows account and click the skype icon.
Login to the skype account you already created.
Setup all your skype preferences.
Make some test calls to make sure it works.
Exit the skype program.
Switch back to the master admin user.

Add the configuration information to Asterisk
Add the generated skype trunk information from stsTrunkPbxSipMod.conf and stsTrunkPbxExtMod.conf to your Asterisk sip.conf and extensions.conf files. Also add macro-stsdialresult (located in the SipToSis project) to extensions.conf.

Starting it all up
To start an individual channel, run stsTrunk_xx_start.bat (Change xx to the specific 2 digit trunk channel number)
To start all the channels, run stsTrunkStartAll_win.bat
This should startup all the Skype instances and also the SipToSis instances.
Note: SipToSis will wait at initSkype or display 'retrying every 5 seconds' until Skype comes online.
Note: If using RunAs option, the password for each login will be prompted for by the operating system the first time that login is used. There is a security issue with using /savecred and RunAs - if you are worried, remove the /savecred option. You will then be prompted for the passwords every time the trunk channels are started/stopped.

Shutting down the Skype to Asterisk trunk channels.
To stop an individual channel, run stsTrunk_xx_stop.bat (Change xx to the specific 2 digit trunk channel number)
To stop all the channels, run stsTrunkStopAll_win.bat
This should halt all the Skype instances and also the SipToSis instances.
Note: Shutdown will leave the skype icon on the taskbar - just hover over it to make it go away.

That's it. I hope you got it working, if not the SipToSis Skype Gateway Troubleshooting may offer some additional help. If you get stuck, leave a comment on the SipToSis Skype Gateway Forum and I will try to help you. I do not have the time to test every OS, Asterisk flavor or PBX. If you find an error/problem please post the correction to the Forum. Confirmation of what is working is also helpful.