返回列表 發帖

教程 Siptosis and Asterisk

本帖最後由 ckleea 於 2011-4-26 10:39 編輯

There are currently 2 ways to integrate skype with asterisk. The end result is to allow in and out call from other skype users to your skype account and even sip to skype (skype to sip/voip)

1. buy skype for asterisk from digium
pro: simple native support from big company; with support
cons: expensive, one channel costs US$66 (http://store.digium.com/productview.php?product_code=1SFA0001); not every asterisk platform support, in particular embedded asterisk. Therefore, IP01 cannot work with skype for asterisk

2. buy siptosis for asterisk from MHSpot.com http://www.mhspot.com/sts/siptosis_skype_trunk_howto.html
pro: inexpensive US$4.99 for siptosis, you can even get the free version to make it work
cons: require a delicate skype terminal i.e. either a PC running windows and skype or using skype for linux; knowledge of linux and software installation in linux.

本帖最後由 ckleea 於 2011-4-26 10:52 編輯

What is the SipToSis Skype Gateway?
SipToSis (Sip to Skype integration software) is Java software that allows you to make and receive Skype calls from your SIP/VOIP telephone adapter, SIP IP phone or Asterisk/SIP PBX. You can also make and receive SIP calls from Skype. It let's you integrate Skype into your SIP VOIP phone system. Basically a Skype/SIP Bridge/Gateway/Proxy/Adapter/Converter. It has a codec converter to convert SIP RTP audio to compatible Skype PCM audio and Skype PCM audio to SIP RTP audio. It performs SIP signaling and Skype call handling to connect with your SIP adapter, Asterisk Server, SIP PBX or SIP VOIP provider.

SipToSis SIP to Skype Gateway Features:

    Call Skype users using mappings/speed dial or use SkypeOut to make PSTN calls from a SIP device
    Make SIP calls from another Skype user using a SIP provider or SIP PBX (SkypeCaller-->Skype/SipToSis Host-->SIP)
    Skype callers can be directed to the SIP address of your choice
    SIP callers can be directed to the Skype user of your choice
    SIP to Skype authentication/denial mappings via SIP caller ID and IP blocks
    Skype to SIP authentication/denial mappings via incoming Skype User ID
    Automatic authorization of new contacts as of version 20110324 - feature must be enabled
    SIP DTMF touchtone decoding/encoding via RFC2833, INFO or Inband
    Skype DTMF touchtone decoding/encoding via Inband
    Connect Asterisk, FreePBX, Elastix, trixbox, PBX-in-a-Flash, 3CX or other SIP PBX to Skype Users
    Conference call as of version 20091115 - See FAQ page for compatibility
    Callback capability as of version 20091115 - See FAQ page for compatibility
    Skype voicemail retrieval via SIP as of version 20091206
    Outgoing Skype voicemail support as of version 20091206 - See FAQ page for compatibility
    Auto play pre-recorded file(s) to SIP and Skype callers
    SIP caller pin authentication and dialing
    Skype caller pin authentication and dialing
    PCMU (u-law)/PCMA (a-law)/G.711/iLBC included codecs and GSM with additional libs
    Codec interface so you can add other codecs
    SIP and Skype Hold
    SkypeOut dialing rules - customize for your location
    SIP outbound dialing rules - customize for your location
    STUN support for public IP discovery
    Call Time limiting ability
    Usage limiting abilities by used time and unique called number count
    Can be setup as a multi channel Skype to Asterisk Trunk for multiple simultaneous calls with the stsTrunkBuilder
    Multiplatform (Windows/Linux/Mac OS X)
    Run everything on a single computer if you wish
    Windows users can run it as a service - see Appicus Windows Service Wrapper

SipToSis SIP to Skype Gateway System Requirements:

    Skype client - http://www.skype.com/intl/en-us/get-skype/on-your-computer/linux
    Sun/Oracle's Java 1.5 or higher (Linux users - Do NOT use openjdk)
    SIP/VOIP adapter such as a SPA3102, SIP IP Phone, register with a SIP provider or setup an Asterisk/SIP PBX server
    Skype4Java compatible platform
    Sufficient bandwidth to support your configuration - Broadband preferred.
    Skype compatible sound device

This product uses the Skype API but is not endorsed, certified or otherwise approved in any way by Skype.

SipToSis is GNU GPL Licensed software.

TOP

本帖最後由 ckleea 於 2011-4-26 10:55 編輯

Installation

1. Basic asterisk on linux installation and skype client installation

http://www.mhspot.com/sts/sts_install_centos.html
Here is some info for setting up Linux. I don't get into PBX or ATA details here.
Modify username and folders as needed.
Most instructions are for CentOS, some also apply to other distributions.

Install CentOS 5.4 x64
If you don't choose a GUI option you will have to deal with any missing packages and start x yourself.
Create a user called stsuser
I disabled the firewall for this setup example.

update first
yum update

login as stsuser
mkdir downloads

Install Skype
Download Skype - static version 2.1.0.81 to /home/stsuser/downloads
su (use sudo for Ubuntu)
cd /opt
tar jxvf /home/stsuser/downloads/skype_static-2.1.0.81.tar.bz2
ln -s skype_static-2.1.0.81 skype
ln -s /opt/skype /usr/share/skype
ln -s /opt/skype/skype /usr/bin/skype

On a CentOS Server some additional packages are needed:
yum install libXv
yum install libXScrnSaver
yum groupinstall "X Window System"
yum install alsa-lib

On a Server twm will be used during the configuration process so some changes are needed to make it work:
vi /etc/X11/twm/system.twmrc - add RandomPlacement above NoGrabServer line.
cp /etc/X11/twm/system.twmrc /home/stsuser/.twmrc
chown stsuser:stsuser /home/stsuser/.twmrc

exit

Ubuntu 64 bit distros need 32 bit libraries (file not found error)
Install getlibs-all.deb package from here
cd /opt/skype_static-2.1.0.81
sudo getlibs skype

Setup snd-dummy - required if no sound hardware
su (or sudo)
/sbin/modprobe snd-dummy
gedit (or vi) /etc/rc.local
add /sbin/modprobe snd-dummy before exit 0:
exit

Test that skype works on it's own.
cd /home/stsuser
For a Server, first startx
skype &

Install Sun/Oracle's Java - Do NOT use openjdk
Ubuntu: sudo apt-get install sun-java6-jre
CentOS and Ubuntu can use following procedure:
Download file: jre-6u18-linux-x64.bin to /home/stsuser/downloads from Java (Linux JRE x64 version.)
su - (Don't miss the minus, use sudo on Ubuntu)
cd /opt
/bin/sh /home/stsuser/downloads/jre-6u18-linux-x64.bin

Method 1:
alternatives --install /usr/bin/java java /opt/jre1.6.0_18/bin/java 2
alternatives --config java
select correct java install if incorrect.

Method 2:
ln -s /opt/jre1.6.0_18/bin/java /usr/bin/java

java -version
confirm correct version.
exit

Install Xvfb
su
CentOS: yum install Xvfb
Ubuntu: sudo apt-get install Xvfb
exit

Add stsuser to audio group - Needed for automatic bootup.
su
usermod -a -G audio stsuser
exit

Install SipToSis
Download SipToSis to /home/stsuser/downloads
mkdir /home/stsuser/siptosis
cd /home/stsuser/siptosis
unzip /home/stsuser/downloads/tmp_SipToSis.zip (fix file name as needed)
chmod +x SipToSis_linux
skype &
login or create your skype account.
./SipToSis_linux
accept API request.
At this point you should be able to make echo test from an ATA,Softphone or PBX using the 55 shortcut and the SipToSis contact url.
PBX users should setup SipToSis to register with the PBX before going further.

Single channel users only
chmod +x stsTrunk_linux
gedit (or vi) stsTrunk_linux
runuser=stsuser
scriptpath=/home/stsuser/siptosis
displayMethod=XVFB

Single channel boot setup
su
gedit (or vi) /etc/rc.local
Add following line before exit 0:
su -l stsuser -c "/home/stsuser/siptosis/stsTrunk_linux boot"
Note: if using snd-dummy, make sure modprobe is before siptosis startup command.
exit

Pulseaudio removal
sudo apt-get remove pulseaudio then reboot.
If you didn't have a sound card when installing Ubuntu run:
sudo alsactl init

Patching snd-dummy for more streams:

Ubuntu Procedure
Alsa dummy.c modification:
Get package Driver (alsa-driver) 1.0.22.1 from Alsa Project Download
cd /usr/src
sudo tar jxvf /pathtodownload/alsa-driver-1.0.22.1.tar.bz2
cd /usr/src/alsa-driver-1.0.22.1/alsa-kernel/drivers
Change line 152:
static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8};
to:
static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};
cd /usr/src/alsa-driver-1.0.22.1
sudo ./configure
sudo make
sudo make install
reboot
more /proc/asound/version - should show Alsa Driver version 1.0.22.1
This patch also works on 1.0.23/1.0.24 driver except it's line 66 instead.

There is some good info for compiling Alsa here.

Once the new snd-dummy is in place configure all skype clients (Mic/Spkrs/Ring) - set to Dummy, Dummy PCM (hw:1,0) or whatever it ends up as.
       
2. Setup SipToSis with a SIP Phone/ATA - Configuration

http://www.mhspot.com/sts/siptosis_ata_howto.html

3. siptosis skype trunk builder

http://www.mhspot.com/sts/siptosis_skype_trunk_howto.html


4. siptosis skype bridge

5. testing

TOP

Integration with asterisk

TOP

本帖最後由 ckleea 於 2011-5-4 15:14 編輯

Fine tuning
When 9 siptosis skype trunks are idle, the utilization is like this

screenshot.9.jpg

TOP

留用帖子

TOP

留用帖子

TOP

留用帖子

TOP

留用帖子

TOP

留用帖子

TOP

When installing skype to the centos 5 server, I follow the siptosis website instruction. In case you can't find the older skype, you may need to follow this link to install

http://punkts.org/trac/wiki/Skype22ForCentOS5

TOP

I copy the page information for our users as I find the browsing speed to this site is very slow

Package, install Skype 2.2.0.25 on CentOS 5 ¶

CentOS 5 has its own GCC Standard C++ Library package, but it is relatively old:

$ rpm -q --provides libstdc++-4.1.2-48.el5.i386 |grep GLIBC
libstdc++.so.6(GLIBCXX_3.4)  
libstdc++.so.6(GLIBCXX_3.4.1)  
libstdc++.so.6(GLIBCXX_3.4.2)  
libstdc++.so.6(GLIBCXX_3.4.3)  
libstdc++.so.6(GLIBCXX_3.4.4)  
libstdc++.so.6(GLIBCXX_3.4.5)  
libstdc++.so.6(GLIBCXX_3.4.6)  
libstdc++.so.6(GLIBCXX_3.4.7)  
libstdc++.so.6(GLIBCXX_3.4.8)  
$

Precompiled version of Skype 2.2 Beta for Linux requires a slightly newer version, libstdc++.so.6(GLIBCXX_3.4.9). Will install the libstdc++ package from Fedora 10, and make sure that it won't overwrite the one that came with the CentOS.

   1. Download, install the GCC Standard C++ Library RPM from the Fedora 10 archive.

# rpm -i --relocate /usr/lib=/usr/local/lib \
    http://archives.fedoraproject.or ... ++-4.3.2-7.i386.rpm
#
# rpm -ql libstdc++-4.3.2-7
/usr/local/lib/libstdc++.so.6
/usr/local/lib/libstdc++.so.6.0.10
#
# ( cd /usr/local/lib ; ls -log libstdc++* )
lrwxrwxrwx 1     19 Apr  6 12:00 libstdc++.so.6 -> libstdc++.so.6.0.10
-rwxr-xr-x 1 954544 Nov  5  2008 libstdc++.so.6.0.10
#
# whereis libstdc++.so.6
libstdc++.so: /usr/lib/libstdc++.so.6 /usr/local/lib/libstdc++.so.6
#

Now will download a few files, build and install the RPM.

   2. Download statically compiled version of Skype (to avoid installation of Qt 4).

# cd /usr/src/redhat/SOURCES
# wget http://www.skype.com/go/getskype ... ic-2.2.0.25.tar.bz2

   3. Download a simple patch, and a .spec file.

# url=http://punkts.org/sw/el5
# wget $url/skype-2.2.0.25-shell.patch
# wget $url/skype.sh
#
# cd /usr/src/redhat/SPECS
# wget $url/skype.spec
#

   4. Build, then install the package.

# rpmbuild -bb skype.spec
[...]
#
# rpm -i /usr/src/redhat/RPMS/i386/skype-2.2.0.25-*.i386.rpm
#

What was the patch needed for?

$ rpm -ql skype |grep desktop
/usr/share/applications/skype.desktop
$
$ grep Exec /usr/share/applications/skype.desktop
Exec=skype.sh
$
$ rpm -ql skype |grep bin/skype
/usr/bin/skype
/usr/bin/skype.sh
$
$ pr -to3 /usr/bin/skype.sh
   #!/bin/sh
   LD_PRELOAD=/usr/local/lib/libstdc++.so.6 /usr/bin/skype
$

Upgrade to CentOS 5.6 ¶

If you'd followed instructions given above, and now are trying to upgrade your system to CentOS 5.6, you may encounter the following error:

# yum update
[...]
ERROR with rpm_check_debug vs depsolve:
libstdc++.so.6(GLIBCXX_3.4.9) is needed by (installed) skype-2.2.0.25-2.el5.punkts.i386
libstdc++.so.6(GLIBCXX_3.4.9) is needed by (installed) skype-2.2.0.25-2.el5.punkts.i386
libstdc++.so.6(GLIBCXX_3.4.9) is needed by (installed) skype-2.2.0.25-2.el5.punkts.i386
libstdc++.so.6(GLIBCXX_3.4.9) is needed by (installed) skype-2.2.0.25-2.el5.punkts.i386
Complete!
(1, [u'Please report this error in https://bugzilla.redhat.com/ente ... 5&component=yum])
#

To work around this problem uninstall the libstdc++-4.3.2-7 package, upgrade libstdc++ to the version that comes with CentOS 5.6, and then install the libstdc++-4.3.2-7 package back in place.

# rpm -e --nodeps libstdc++-4.3.2-7
#
# yum update libstdc++
[...]

Updated:
  libstdc++.i386 0:4.1.2-50.el5                 libstdc++.x86_64 0:4.1.2-50.el5               

Dependency Updated:
  cpp.x86_64 0:4.1.2-50.el5                    gcc.x86_64 0:4.1.2-50.el5                       
  gcc-c++.x86_64 0:4.1.2-50.el5                gcc-gfortran.x86_64 0:4.1.2-50.el5              
  libgcc.i386 0:4.1.2-50.el5                   libgcc.x86_64 0:4.1.2-50.el5                    
  libgfortran.x86_64 0:4.1.2-50.el5            libstdc++-devel.x86_64 0:4.1.2-50.el5           

Complete!
#
# rpm -i --relocate /usr/lib=/usr/local/lib libstdc++-4.3.2-7.i386.rpm

TOP

For those using siptosis, I think you should not install more than one trunk if you do not have the trunk builder. For me, even I paid for the trunk builder before, when I want to manually create more trunks, I still encounter various problems e.g. port setting.

The trunk builder can help you to create the appropriate files and settings.

In my case, I can now manage to create 11 trunks (migrating back my VM image to the real server)

TOP

返回列表