Move Skypiax into svn Trunk

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12167 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West 2009-02-19 20:57:36 +00:00
parent f0e6d610dd
commit 8c697d4c30
20 changed files with 7764 additions and 0 deletions

View File

@ -0,0 +1,6 @@
MODNAME=mod_skypiax
SVNDEF := -D'SKYPIAX_SVN_VERSION="$(shell svnversion -n .)"'
LOCAL_CFLAGS += $(SVNDEF)
LOCAL_LDFLAGS=-lX11
LOCAL_OBJS=skypiax_protocol.o
include ../../../../build/modmake.rules

View File

@ -0,0 +1,258 @@
#########################################################
#########################################################
#########################################################
WHAT IS SKYPIAX
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 use the Skype client as an interface to the Skype network, and allows incoming and outgoing Skype calls from/to FreeSWITCH (that can be bridged, originated, answered, etc. as in all other endpoints, eg sofia/SIP).
Think at Skypiax as similar to OpenZAP for analog lines: for each channel you need an interface (a Skype client). So, for eg, for two concurrent calls, you will need two channels, two Skype clients running on server.
If your server's Skype client(s) has got the Skype credits, Skypiax works for SkypeOut calls too.
You can use it from the dialplan, eg with the provided modified "default.xml" dialplan, you can call a "skype uri" that's the word 'skype' followed by a slash and a destination: "skype/remote_skypename__OR__skypeout_phonenumber" for calling via the Skype network. Eg "skype/echo123" or "skype/+18007844444".
You can use the "skype uri" of the provided dialplan also directly for a SIP softphone, eg X-Lite.
With the provided skypiax.conf.xml all incoming Skype calls will be routed to the "5000" extension, the IVR in default FreeSWITCH installation.
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 important) the snd-dummy ALSA "fake" sound driver. Scripts are provided for this. But for a low number of channels it would works with regular X servers and ALSA drivers.
On a Linux machine with 3GB ram and a quad core intel6600, we got no problem with 20 concurrent calls, and plenty of room for adding more Skypiax channels (100? not tested).
On Windows, no need to do anything special, the Skype client is lighter on CPU.
''Skypiax is now pre-beta, but usable for testing and finding bugs :-).''
'''You can download Skypiax source code with subversion with the command:'''
svn co http://svn.freeswitch.org/svn/freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax mod_skypiax
then, follow the README file in the mod_skypiax directory.
More info on skypiax:
http://wiki.freeswitch.org/wiki/Skypiax
http://www.celliax.org
Skypiax has been contributed to the community by:
Giovanni Maruzzelli (gmaruzz at gmail dot com)
#########################################################
#########################################################
#########################################################
An example of Skypiax installation on FreeSWITCH Linux
#########################################################
#########################################################
#########################################################
Install ubuntu 8.04 LTS server (Released April 2008 and maintained until April 2013) with *only* OpenSSH Server. (we used the 64bit edition)
Login at the real keyboard as the user you choose during install
Check the IP address with ifconfig
Logout
===============================
Login via ssh as the user you choose during install
maruzz@8-04-srv:~$
maruzz@8-04-srv:~$ sudo su
[sudo] password for maruzz:
root@8-04-srv:/home/maruzz# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@8-04-srv:/home/maruzz#
root@8-04-srv:/home/maruzz# apt-get update && apt-get -y upgrade
root@8-04-srv:/home/maruzz# apt-get update && apt-get -y dist-upgrade
root@8-04-srv:/home/maruzz# reboot
===============================
Login as root via ssh
root@8-04-srv:~# apt-get update && apt-get -y dist-upgrade
root@8-04-srv:/home/maruzz# reboot
===============================
Now, let's begin the real installation
root@8-04-srv:~# apt-get -y install build-essential subversion automake autoconf wget libtool libncurses5-dev xvfb libx11-dev libasound2-dev
root@8-04-srv:~# svn co http://svn.freeswitch.org/svn/freeswitch/branches/gmaruzz freeswitch_gmaruzz
root@8-04-srv:~# cd freeswitch_gmaruzz/
root@8-04-srv:~/freeswitch_gmaruzz# ./bootstrap.sh
root@8-04-srv:~/freeswitch_gmaruzz# ./configure
root@8-04-srv:~/freeswitch_gmaruzz# make && make install && make hd-sounds-install && make hd-moh-install && make samples
*** go to have something to drink-eat-read-whatever
*** test that FS can be started
root@8-04-srv:~/freeswitch_gmaruzz# /usr/local/freeswitch/bin/freeswitch
freeswitch@8-04-srv> ...
*** copy the skypiax configuration file
root@8-04-srv:~/freeswitch_gmaruzz# cp src/mod/endpoints/mod_skypiax/configs/skypiax.conf.xml /usr/local/freeswitch/conf/autoload_configs/
*** 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)
root@8-04-srv:~/freeswitch_gmaruzz# cp src/mod/endpoints/mod_skypiax/configs/default.xml /usr/local/freeswitch/conf/dialplan/
*** now, let's get and install the Skype client
root@8-04-srv:~/freeswitch_gmaruzz# cd ..
root@8-04-srv:~#
root@8-04-srv:~# apt-get -y install ia32-libs lib32asound2 libc6-i386 lib32gcc1 lib32stdc++6 lib32ncurses5 lib32z1 libasound2-plugins
root@8-04-srv:~# wget -c http://www.skype.com/go/getskype-linux-ubuntu-amd64
root@8-04-srv:~# dpkg -i skype_ubuntu-2.0.0.72-1_amd64.deb
*** now, let's get the skype configuration directory we prepared on another (desktop) machine
*** on "How to prepare the configuration directory of Skype clients on Linux", see configs/README.skypiax_auth
root@8-04-srv:~# cp /mnt/root/configskypenew.tgz ./
root@8-04-srv:~# tar xzf configskypenew.tgz
root@8-04-srv:~# chown root.root .Skype
root@8-04-srv:~#
**** almost ready!
**** let's edit the skypiax config
root@8-04-srv:~/freeswitch_gmaruzz# vi /usr/local/freeswitch/conf/autoload_configs/skypiax.conf.xml
**** let's edit the startskype script
**** remember to add the removing of all the installed snd-* modules
root@8-04-srv:~/freeswitch_gmaruzz# cp src/mod/endpoints/mod_skypiax/configs/startskype.sh ./
root@8-04-srv:~/freeswitch_gmaruzz# vi startskype.sh
**** let's copy the X servers' auth config file
root@8-04-srv:~/freeswitch_gmaruzz#cp src/mod/endpoints/mod_skypiax/configs/skypiax.X.conf /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf
**** start the X servers and the Skype clients
root@8-04-srv:~/freeswitch_gmaruzz# sh ./startskype.sh
**** this is the situation you want after startskype.sh
root@8-04-srv:~/freeswitch_gmaruzz# lsmod | grep snd
snd_dummy 22016 0
snd_pcm 99336 1 snd_dummy
snd_timer 35080 1 snd_pcm
snd 78024 3 snd_dummy,snd_pcm,snd_timer
snd_page_alloc 20368 1 snd_pcm
soundcore 17568 1 snd
root@8-04-srv:~/freeswitch_gmaruzz#
**** start FS and the load skypiax!
root@8-04-srv:~/freeswitch_gmaruzz# /usr/local/freeswitch/bin/freeswitch
freeswitch@8-04-srv> load mod_skypiax
=============================================
20 idle skypiax channels:
top - 18:14:26 up 2:02, 2 users, load average: 0.03, 0.08, 0.04
Tasks: 111 total, 1 running, 110 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.1%us, 0.3%sy, 0.0%ni, 99.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3096688k total, 1835100k used, 1261588k free, 137688k buffers
Swap: 248968k total, 0k used, 248968k free, 1020888k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8272 root 20 0 320m 30m 4848 S 0 1.0 0:00.56 freeswitch
7905 root 20 0 58520 27m 10m S 0 0.9 0:03.25 skype
7937 root 20 0 59356 26m 10m S 0 0.9 0:03.01 skype
8093 root 20 0 58524 26m 10m S 0 0.9 0:03.03 skype
7981 root 20 0 58376 26m 10m S 0 0.9 0:02.72 skype
8157 root 20 0 59452 26m 10m S 0 0.9 0:02.49 skype
7889 root 20 0 57888 26m 10m S 0 0.9 0:03.03 skype
8189 root 20 0 58544 26m 10m S 0 0.9 0:02.62 skype
7953 root 20 0 58400 26m 10m S 0 0.9 0:03.27 skype
7997 root 20 0 57988 26m 10m S 1 0.9 0:03.00 skype
8029 root 20 0 58456 26m 10m S 0 0.9 0:02.57 skype
8045 root 20 0 58368 26m 10m S 0 0.9 0:02.70 skype
8077 root 20 0 58444 26m 10m S 0 0.9 0:02.69 skype
8109 root 20 0 59564 26m 10m S 0 0.9 0:02.75 skype
8061 root 20 0 57984 26m 10m S 0 0.9 0:02.67 skype
7921 root 20 0 58388 26m 10m S 0 0.9 0:02.92 skype
7873 root 20 0 58492 26m 10m S 1 0.9 0:03.83 skype
8125 root 20 0 58404 26m 10m S 1 0.9 0:02.89 skype
8013 root 20 0 58460 26m 10m S 0 0.9 0:03.88 skype
8173 root 20 0 58468 26m 10m S 0 0.9 0:02.55 skype
8141 root 20 0 58232 26m 10m S 0 0.9 0:02.88 skype
7884 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.33 Xvfb
8024 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.30 Xvfb
8040 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.32 Xvfb
8072 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.29 Xvfb
7900 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.32 Xvfb
7916 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.32 Xvfb
8120 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.31 Xvfb
8152 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.29 Xvfb
8168 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.28 Xvfb
8184 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.28 Xvfb
7868 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.31 Xvfb
7932 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.32 Xvfb
7948 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.32 Xvfb
7964 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.33 Xvfb
7992 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.31 Xvfb
8008 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.31 Xvfb
8056 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.30 Xvfb
...some more Xvfb
=============================================
20 incoming concurrent skype calls listening to moh at 16khz:
top - 18:40:04 up 2:27, 2 users, load average: 0.14, 0.13, 0.06
Tasks: 111 total, 1 running, 110 sleeping, 0 stopped, 0 zombie
Cpu(s): 18.6%us, 4.5%sy, 0.0%ni, 76.4%id, 0.0%wa, 0.1%hi, 0.4%si, 0.0%st
Mem: 3096688k total, 1858460k used, 1238228k free, 137692k buffers
Swap: 248968k total, 0k used, 248968k free, 1023148k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8866 root 20 0 336m 35m 5016 S 9 1.2 0:21.23 freeswitch
8812 root 20 0 84632 28m 10m S 6 0.9 0:14.02 skype
8580 root 20 0 84252 27m 10m S 6 0.9 0:28.19 skype
8713 root 20 0 84716 27m 10m S 6 0.9 0:18.06 skype
8628 root 20 0 84268 27m 10m S 7 0.9 0:24.37 skype
8793 root 20 0 84756 27m 10m S 6 0.9 0:14.24 skype
8664 root 20 0 84140 27m 10m S 6 0.9 0:23.19 skype
8745 root 20 0 84628 27m 10m S 6 0.9 0:16.85 skype
8644 root 20 0 84588 27m 10m S 6 0.9 0:22.81 skype
8697 root 20 0 84516 27m 10m S 6 0.9 0:21.03 skype
8514 root 20 0 83164 27m 10m S 7 0.9 0:29.47 skype
8564 root 20 0 84496 27m 10m S 4 0.9 0:28.65 skype
8681 root 20 0 84632 27m 10m S 6 0.9 0:23.20 skype
8532 root 20 0 83528 27m 10m S 6 0.9 0:28.39 skype
8612 root 20 0 84460 27m 10m S 6 0.9 0:24.70 skype
8729 root 20 0 84368 27m 10m S 8 0.9 0:18.86 skype
8761 root 20 0 84644 27m 10m S 6 0.9 0:16.70 skype
8777 root 20 0 83752 27m 10m S 7 0.9 0:16.19 skype
8596 root 20 0 83692 27m 10m S 7 0.9 0:26.49 skype
8831 root 20 0 83568 27m 10m S 7 0.9 0:13.13 skype
8548 root 20 0 83336 27m 10m S 6 0.9 0:30.67 skype
8575 root 20 0 43636 9.8m 2232 S 0 0.3 0:00.63 Xvfb
8543 root 20 0 43636 9.8m 2232 S 0 0.3 0:00.64 Xvfb
8527 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.65 Xvfb
8591 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.60 Xvfb
8658 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.58 Xvfb
8724 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.64 Xvfb
8740 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.65 Xvfb
8509 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.66 Xvfb
8607 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.61 Xvfb
8623 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.57 Xvfb
8692 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.55 Xvfb
8756 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.55 Xvfb
8772 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.60 Xvfb
8788 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.56 Xvfb
8823 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.59 Xvfb
8639 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.58 Xvfb
8676 root 20 0 43624 9.8m 2232 S 0 0.3 0:00.55 Xvfb
...some more Xvfb

View File

@ -0,0 +1,93 @@
#
# Asterisk -- A telephony toolkit for Linux.
#
# Makefile for channel drivers
#
# Copyright (C) 1999-2005, Mark Spencer
#
# Mark Spencer <markster@digium.com>
#
# Edited By Belgarath <> Aug 28 2004
# Added bare bones ultrasparc-linux support.
#
# This program is free software, distributed under the terms of
# the GNU General Public License
#
#ASTERISK INCLUDE FILES
#The directory that contains the Asterisk include files (eg: /usr/include or /usr/include/asterisk or /usr/src/asterisk/include or ...)
#AST_INCLUDE_DIR=/usr/src/asterisk/include
#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_trunk/include
#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_branches_160/include
#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_branches_12/include
#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_branches_14/include
#AST_INCLUDE_DIR=/home/maruzz/devel/svn_celliax_trunk/asterisk-1.2.rev137401/include
AST_INCLUDE_DIR=/home/user/devel/asterisk-1.4.23.1/include
#ASTERISK
CFLAGS+=-DASTERISK
#ASTERISK VERSION
#Uncomment one of the following lines to match your Asterisk series
CFLAGS+=-DASTERISK_VERSION_1_4
#CFLAGS+=-DASTERISK_VERSION_1_6
#CFLAGS+=-DASTERISK_VERSION_1_2
#LINUX SKYPE SUPPORT (Celliax for Cygwin always supports Skype)
SKYPE_LIB=-L/usr/X11R6/lib -lX11
CFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
CFLAGS+=-g3
CFLAGS+=-I$(AST_INCLUDE_DIR) -I.
CFLAGS+=-D_REENTRANT -D_GNU_SOURCE
#CFLAGS+=-O6
CFLAGS+=-march=i686
CFLAGS+=-fomit-frame-pointer
ifeq ($(shell uname -m),x86_64)
CFLAGS+=-fPIC
endif
SVNDEF := -D'SKYPIAX_SVN_VERSION="$(shell svnversion -n ..)"'
CFLAGS += $(SVNDEF)
SOLINK=-shared -Xlinker -x
CHANNEL_LIBS=chan_skypiax.so
CC=gcc
OSARCH=$(shell uname -s)
ifeq ($(findstring CYGWIN,$(OSARCH)),CYGWIN)
# definition of pthread_kill as a printf (or as a noop) is required for Asterisk (and skypiax) to run on Cygwin
# without it, each time (often) pthread_kill is called (by any thread, with any signal, URG included), bad things happen
CC=gcc -D pthread_kill=cyg_no_pthreadkill
AST_DLL_DIR=/home/maruzz/devel/svn_asterisk_branches_12
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols cyg_no_pthread_kill.o
CYGSOLIB=-L/usr/lib/w32api -lrpcrt4 -L/lib/mingw -lwinmm -L$(AST_DLL_DIR) -lasterisk.dll -L$(AST_DLL_DIR)/res -lres_features.so
SKYPE_LIB=
CHANNEL_LIBS=cyg_no_pthread_kill.o chan_skypiax.so
endif
all: $(CHANNEL_LIBS)
clean:
rm -f *.so *.o *.so.a
#chan_skypiax section begins
#to debug threads and lock on 1.4 uncomment the following
#CFLAGS+=-include /usr/src/asterisk/include/asterisk/autoconfig.h
cyg_no_pthread_kill.o: cyg_no_pthread_kill.c
$(CC) $(CFLAGS) -c -o cyg_no_pthread_kill.o cyg_no_pthread_kill.c
chan_skypiax.o: chan_skypiax.c
$(CC) $(CFLAGS) -c -o chan_skypiax.o chan_skypiax.c
chan_skypiax.so: chan_skypiax.o skypiax_protocol.o
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} chan_skypiax.o skypiax_protocol.o -lm -ldl $(SKYPE_LIB) ${CYGSOLIB}
#chan_skypiax section ends

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
#include <stdio.h>
#define PRINTMSGCYG
extern int option_debug;
int cyg_no_pthreadkill(int thread, int sig);
int cyg_no_pthreadkill(int thread, int sig)
{
#ifdef PRINTMSGCYG
if (option_debug) {
printf
("\n\nHere there would have been a pthread_kill() on thread [%-7lx], with sig=%d, but it has been substituted by this printf in file cyg_no_pthread_kill.c because CYGWIN does not support sending a signal to a one only thread :-(\n\n",
(unsigned long int) thread, sig);
}
#endif // PRINTMSGCYG
return 0;
}

View File

@ -0,0 +1,207 @@
;;;;;;;;
;;;;;;;;
;;;;;;; Skypiax Asterisk Driver
;;;;;;;
;;;;;;; Configuration file
;;;;;;; lines beginning with semicolon (" are ignored (commented out)
;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;
;;;;;;; The first interface (named skypeclient)
;;;;;;[skypeclient]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;; general settings, valid on all platforms
;;;;;;;
;;;;;;;
;;;;;;; Default language
;;;;;;;
;;;;;;language=en
;;;;;;;
;;;;;;; Default context (in extensions.conf, can be overridden with @context syntax)
;;;;;;;
;;;;;;context=default
;;;;;;;
;;;;;;; Default extension (in extensions.conf) where incoming calls land
;;;;;;;
;;;;;;extension=s
;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;; Debugging settings, valid globally for all interfaces on all platforms
;;;;;;;
;;;;;;; the debug values are global for all the interfaces.
;;;;;;;
;;;;;;; default is no skypiax debugging output, you **have** to activate debugging here to obtain debugging from skypiax
;;;;;;;
;;;;;;; To see the debugging output you have to "set debug 100" from the Asterisk CLI or launch
;;;;;;; Asterisk with -ddddddddddd option, and have the logger.conf file activating debug info for console and messages
;;;;;;;
;;;;;;; You can activate each of the following separately, but you can't disactivate. Eg: debug_at=no does not subtract debug_at from debug_all
;;;;;;; debug_all activate all possible debugging info
;;;;;;;
;;;;;;;debug_all=yes
;;;;;;debug_skype=yes
;;;;;;debug_pbx=yes
;;;;;;;debug_sound=yes
;;;;;;;debug_locks=yes
;;;;;;;debug_monitorlocks=yes
;;;;;;
;;;;;;skype=yes ; legacy setting, leave it to yes
;;;;;;X11_display=:101
;;;;;;tcp_cli_port=11234
;;;;;;tcp_srv_port=11235
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;; audio boost settings, valid for all platforms, to compensate for different input/output audio signal levels
;;;;;;; tweak it if you get horrible (or not hearable) sound
;;;;;;;
;;;;;;;boost can be positive or negative (-40 to +40) in db
;;;;;;;experiment to find which values are best for your computer
;;;;;;playback_boost=0 ;
;;;;;;capture_boost=0 ;
;;;;;;
;;; [skypiax1]
;;; language=en
;;; context=default
;;; extension=s
;;; debug_skype=yes
;;; debug_pbx=yes
;;; skype=yes ; legacy setting, leave it to yes
;;; playback_boost=0 ;
;;; capture_boost=0 ;
;;; X11_display=:101
;;; tcp_cli_port=15576
;;; tcp_srv_port=15577
;;; skype_user=skypiax1
;;;
;;; [skypiax2]
;;; language=en
;;; context=default
;;; extension=s
;;; debug_skype=yes
;;; debug_pbx=yes
;;; skype=yes ; legacy setting, leave it to yes
;;; playback_boost=0 ;
;;; capture_boost=0 ;
;;; X11_display=:102
;;; tcp_cli_port=15578
;;; tcp_srv_port=15579
;;; skype_user=skypiax2
;;;
;;; [skypiax3]
;;; language=en
;;; context=default
;;; extension=s
;;; debug_skype=yes
;;; debug_pbx=yes
;;; skype=yes ; legacy setting, leave it to yes
;;; playback_boost=0 ;
;;; capture_boost=0 ;
;;; X11_display=:103
;;; tcp_cli_port=15580
;;; tcp_srv_port=15581
;;; skype_user=skypiax3
;;;
[skypiax4]
language=en
context=default
extension=s
debug_skype=yes
debug_pbx=yes
skype=yes ; legacy setting, leave it to yes
playback_boost=0 ;
capture_boost=0 ;
X11_display=:104
tcp_cli_port=15582
tcp_srv_port=15583
skype_user=skypiax4
[skypiax5]
language=en
context=default
extension=s
debug_skype=yes
debug_pbx=yes
skype=yes ; legacy setting, leave it to yes
playback_boost=0 ;
capture_boost=0 ;
X11_display=:105
tcp_cli_port=15584
tcp_srv_port=15585
skype_user=skypiax5
[skypiax6]
language=en
context=default
extension=s
debug_skype=yes
debug_pbx=yes
skype=yes ; legacy setting, leave it to yes
playback_boost=0 ;
capture_boost=0 ;
X11_display=:106
tcp_cli_port=15586
tcp_srv_port=16586
skype_user=skypiax6
;;; [skypiax17]
;;; language=en
;;; context=default
;;; extension=s
;;; debug_skype=yes
;;; debug_pbx=yes
;;; skype=yes ; legacy setting, leave it to yes
;;; playback_boost=0 ;
;;; capture_boost=0 ;
;;; X11_display=:117
;;; tcp_cli_port=15587
;;; tcp_srv_port=15588
;;; skype_user=skypiax17
;;;
;;; [skypiax18]
;;; language=en
;;; context=default
;;; extension=s
;;; debug_skype=yes
;;; debug_pbx=yes
;;; skype=yes ; legacy setting, leave it to yes
;;; playback_boost=0 ;
;;; capture_boost=0 ;
;;; X11_display=:118
;;; tcp_cli_port=15589
;;; tcp_srv_port=15590
;;; skype_user=skypiax18
;;;
;;; [skypiax19]
;;; language=en
;;; context=default
;;; extension=s
;;; debug_skype=yes
;;; debug_pbx=yes
;;; skype=yes ; legacy setting, leave it to yes
;;; playback_boost=0 ;
;;; capture_boost=0 ;
;;; X11_display=:119
;;; tcp_cli_port=15591
;;; tcp_srv_port=15592
;;; skype_user=skypiax19
;;;
;;; [skypiax20]
;;; language=en
;;; context=default
;;; extension=s
;;; debug_skype=yes
;;; debug_pbx=yes
;;; skype=yes ; legacy setting, leave it to yes
;;; playback_boost=0 ;
;;; capture_boost=0 ;
;;; X11_display=:120
;;; tcp_cli_port=15593
;;; tcp_srv_port=15594
;;; skype_user=skypiax20
;;;
;;;
;;;

View File

@ -0,0 +1,426 @@
//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90
#ifndef _SKYPIAX_H_
#define _SKYPIAX_H_
#ifndef SKYPIAX_SVN_VERSION
#define SKYPIAX_SVN_VERSION "????NO_REVISION???"
#endif
#include <asterisk/version.h> /* needed here for conditional compilation on version.h */
/* the following #defs are for LINUX */
#ifndef __CYGWIN__
#ifndef ASTERISK_VERSION_1_6
#ifndef ASTERISK_VERSION_1_4
#ifndef ASTERISK_VERSION_1_2
#define ASTERISK_VERSION_1_4
#if(ASTERISK_VERSION_NUM == 999999)
#undef ASTERISK_VERSION_1_4
#elif(ASTERISK_VERSION_NUM < 10400)
#undef ASTERISK_VERSION_1_4
#endif /* ASTERISK_VERSION_NUM == 999999 || ASTERISK_VERSION_NUM < 10400 */
#endif /* ASTERISK_VERSION_1_2 */
#endif /* ASTERISK_VERSION_1_4 */
#endif /* ASTERISK_VERSION_1_6 */
#ifdef ASTERISK_VERSION_1_2
#undef ASTERISK_VERSION_1_4
#endif /* ASTERISK_VERSION_1_2 */
#ifdef ASTERISK_VERSION_1_6
#define ASTERISK_VERSION_1_4
#endif /* ASTERISK_VERSION_1_6 */
#define SKYPIAX_SKYPE
#define WANT_SKYPE_X11
#endif /* NOT __CYGWIN__ */
/* the following #defs are for WINDOWS */
#ifdef __CYGWIN__
#undef ASTERISK_VERSION_1_4
#undef ASTERISK_VERSION_1_6
#define SKYPIAX_SKYPE
#undef WANT_SKYPE_X11
#endif /* __CYGWIN__ */
/* INCLUDES */
#ifdef ASTERISK_VERSION_1_6
#include <asterisk.h> /* some asterisk-devel package do not contains asterisk.h, but seems that is needed for the 1.6 series, at least from trunk */
#endif /* ASTERISK_VERSION_1_6 */
#include <unistd.h>
#include <termios.h>
#include <fcntl.h>
#include <errno.h>
#include <math.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
#include <ctype.h>
#ifndef ASTERISK_VERSION_1_4
#include <stdlib.h>
#include <stdio.h>
#endif /* ASTERISK_VERSION_1_4 */
#include <asterisk/frame.h>
#include <asterisk/channel.h>
#include <asterisk/module.h>
#include <asterisk/options.h>
#include <asterisk/pbx.h>
#include <asterisk/config.h>
#include <asterisk/cli.h>
#include <asterisk/causes.h>
#include <asterisk/endian.h>
#include <asterisk/lock.h>
#include <asterisk/devicestate.h>
#include <asterisk/file.h>
#include <asterisk/say.h>
#ifdef ASTERISK_VERSION_1_6
#include <asterisk/astobj2.h>
#include <asterisk/paths.h>
#endif /* ASTERISK_VERSION_1_6 */
#ifdef ASTERISK_VERSION_1_4
#include <asterisk/stringfields.h>
#include <asterisk/abstract_jb.h>
#include <asterisk/logger.h>
#include <asterisk/utils.h>
#endif /* ASTERISK_VERSION_1_4 */
#ifdef ASTERISK_VERSION_1_2
#include <asterisk/utils.h>
#include <asterisk/logger.h>
#endif /* ASTERISK_VERSION_1_2 */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
//#include "skypiax_spandsp.h"
#ifdef __CYGWIN__
#include <windows.h>
#endif /* __CYGWIN__ */
#ifdef WANT_SKYPE_X11
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xatom.h>
#endif /* WANT_SKYPE_X11 */
#ifndef AST_DIGIT_ANYDIG
#define AST_DIGIT_ANYDIG "0123456789*#"
#else
#warning Please review Skypiax AST_DIGIT_ANYDIG
#endif
#ifndef _ASTERISK_H
#define AST_CONFIG_MAX_PATH 255 /* defined in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
extern char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH];
int ast_register_atexit(void (*func) (void)); /* in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
void ast_unregister_atexit(void (*func) (void)); /* in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
#endif
/* DEFINITIONS */
#define SAMPLERATE_SKYPIAX 8000
#define SAMPLES_PER_FRAME SAMPLERATE_SKYPIAX/50
#define SKYPIAX_DIR_CONFIG "directoriax.conf"
/* LUIGI RIZZO's magic */
/* boost support. BOOST_SCALE * 10 ^(BOOST_MAX/20) must
* be representable in 16 bits to avoid overflows.
*/
#define BOOST_SCALE (1<<9)
#define BOOST_MAX 40 /* slightly less than 7 bits */
/* call flow from the device */
#define CALLFLOW_CALL_IDLE AST_STATE_DOWN
#define CALLFLOW_INCOMING_RING AST_STATE_RING
#define CALLFLOW_CALL_DIALING AST_STATE_DIALING
#define CALLFLOW_CALL_LINEBUSY AST_STATE_BUSY
#define CALLFLOW_CALL_ACTIVE 300
#define CALLFLOW_INCOMING_HANGUP 100
#define CALLFLOW_CALL_RELEASED 101
#define CALLFLOW_CALL_NOCARRIER 102
#define CALLFLOW_CALL_INFLUX 103
#define CALLFLOW_CALL_INCOMING 104
#define CALLFLOW_CALL_FAILED 105
#define CALLFLOW_CALL_NOSERVICE 106
#define CALLFLOW_CALL_OUTGOINGRESTRICTED 107
#define CALLFLOW_CALL_SECURITYFAIL 108
#define CALLFLOW_CALL_NOANSWER 109
#define CALLFLOW_STATUS_FINISHED 110
#define CALLFLOW_STATUS_CANCELLED 111
#define CALLFLOW_STATUS_FAILED 112
#define CALLFLOW_STATUS_REFUSED 113
#define CALLFLOW_STATUS_RINGING 114
#define CALLFLOW_STATUS_INPROGRESS 115
#define CALLFLOW_STATUS_UNPLACED 116
#define CALLFLOW_STATUS_ROUTING 117
#define CALLFLOW_STATUS_EARLYMEDIA 118
#define AST_STATE_HANGUP_REQUESTED 200
//FIXME CALLFLOW_INCOMING_CALLID to be removed
#define CALLFLOW_INCOMING_CALLID 1019
/* debugging bitmask */
#define DEBUG_SOUND 1
#define DEBUG_SERIAL 2
#define DEBUG_SKYPE 4
#define DEBUG_AT 8
#define DEBUG_FBUS2 16
#define DEBUG_CALL 32
#define DEBUG_LOCKS 64
#define DEBUG_PBX 128
#define DEBUG_MONITORLOCKS 256
#define DEBUG_ALL DEBUG_SOUND|DEBUG_SERIAL|DEBUG_SKYPE|DEBUG_AT|DEBUG_FBUS2|DEBUG_CALL|DEBUG_PBX|DEBUG_LOCKS|DEBUG_MONITORLOCKS
/* wrappers for ast_log */
#define DEBUGA_SOUND(...) if (skypiax_debug & DEBUG_SOUND) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SOUND %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define DEBUGA_SERIAL(...) if (skypiax_debug & DEBUG_SERIAL) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SERIAL %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define DEBUGA_SKYPE(...) if (skypiax_debug & DEBUG_SKYPE) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SKYPE %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define DEBUGA_AT(...) if (skypiax_debug & DEBUG_AT) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_AT %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define DEBUGA_FBUS2(...) if (skypiax_debug & DEBUG_FBUS2) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_FBUS2 %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define DEBUGA_CALL(...) if (skypiax_debug & DEBUG_CALL) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_CALL %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define DEBUGA_PBX(...) if (skypiax_debug & DEBUG_PBX) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_PBX %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define ERRORA(...) ast_log(LOG_ERROR, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][ERROR %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define NOTICA(...) ast_log(LOG_NOTICE, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][NOTICE %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define WARNINGA(...) ast_log(LOG_WARNING, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][WARNING %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
/* macros for logging */
#define SKYPIAX_P_LOG p ? p->owner : NULL, (unsigned long)pthread_self(), __LINE__, p ? p->name ? p->name : "none" : "none", p ? p->owner ? p->owner->_state : -1 : -1, p ? p->interface_state : -1, p ? p->skype_callflow : -1
#define SKYPIAX_TMP_LOG tmp ? tmp->owner : NULL, (unsigned long)pthread_self(), __LINE__, tmp ? tmp->name ? tmp->name : "none" : "none", tmp ? tmp->owner ? tmp->owner->_state : -1 : -1, tmp ? tmp->interface_state : -1, tmp ? tmp->skype_callflow : -1
/* logging wrappers for ast_mutex_lock and ast_mutex_unlock */
#define LOKKA(x) if (skypiax_debug & DEBUG_LOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS %-5d][%-10s][%2d,%2d,%2d] going to lock %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????"); if (ast_mutex_lock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n"); if (skypiax_debug & DEBUG_LOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS %-5d][%-10s][%2d,%2d,%2d] locked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
#define UNLOCKA(x) if (skypiax_debug & DEBUG_LOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS %-5d][%-10s][%2d,%2d,%2d] going to unlock %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????"); if (ast_mutex_unlock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n"); if (skypiax_debug & DEBUG_LOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS %-5d][%-10s][%2d,%2d,%2d] unlocked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
#define PUSHA_UNLOCKA(x) pthread_cleanup_push(skypiax_unlocka_log, (void *) x);
#define POPPA_UNLOCKA(x) pthread_cleanup_pop(0);
#define MONITORLOKKA(x) if (skypiax_debug & DEBUG_MONITORLOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS %-5d][%-10s][%2d,%2d,%2d] going to lock %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????"); if (ast_mutex_lock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n"); if (skypiax_debug & DEBUG_MONITORLOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS %-5d][%-10s][%2d,%2d,%2d] locked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
#define MONITORUNLOCKA(x) if (skypiax_debug & DEBUG_MONITORLOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS %-5d][%-10s][%2d,%2d,%2d] going to unlock %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????"); if (ast_mutex_unlock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n"); if (skypiax_debug & DEBUG_MONITORLOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS %-5d][%-10s][%2d,%2d,%2d] unlocked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
/* macros used for config file parsing (luigi rizzo)*/
#define M_BOOL(tag, dst) M_F(tag, (dst) = ast_true(__val) )
#define M_END(x) x;
#define M_F(tag, f) if (!strcasecmp((__s), tag)) { f; } else
#ifdef ASTERISK_VERSION_1_6
#define M_START(var, val) const char *__s = var; const char *__val = val;
#else
#define M_START(var, val) char *__s = var; char *__val = val;
#endif /* ASTERISK_VERSION_1_6 */
#define M_STR(tag, dst) M_F(tag, ast_copy_string(dst, __val, sizeof(dst)))
#define M_UINT(tag, dst) M_F(tag, (dst) = strtoul(__val, NULL, 0) )
#define SKYPIAX_FRAME_SIZE 160
/* SKYPIAX INTERNAL STRUCTS */
/*!
* \brief structure for exchanging messages with the skype client
*/
#ifdef WANT_SKYPE_X11
struct AsteriskHandles {
Window skype_win;
Display *disp;
Window win;
int fdesc[2];
};
#else /* WANT_SKYPE_X11 */
struct AsteriskHandles {
HWND win32_hInit_MainWindowHandle;
HWND win32_hGlobal_SkypeAPIWindowHandle;
int fdesc[2];
};
#endif /* WANT_SKYPE_X11 */
#ifndef WIN32
struct SkypiaxHandles {
Window skype_win;
Display *disp;
Window win;
int api_connected;
int fdesc[2];
};
#else //WIN32
struct SkypiaxHandles {
HWND win32_hInit_MainWindowHandle;
HWND win32_hGlobal_SkypeAPIWindowHandle;
HINSTANCE win32_hInit_ProcessHandle;
char win32_acInit_WindowClassName[128];
UINT win32_uiGlobal_MsgID_SkypeControlAPIAttach;
UINT win32_uiGlobal_MsgID_SkypeControlAPIDiscover;
int api_connected;
int fdesc[2];
};
#endif //WIN32
/*!
* \brief PVT structure for a skypiax interface (channel), created by skypiax_mkif
*/
struct skypiax_pvt {
char *name; /*!< \brief 'name' of the interface (channel) */
int interface_state; /*!< \brief 'state' of the interface (channel) */
struct ast_channel *owner; /*!< \brief channel we belong to, possibly NULL */
struct skypiax_pvt *next; /*!< \brief Next interface (channel) in list */
char context[AST_MAX_EXTENSION]; /*!< \brief default Asterisk dialplan context for this interface */
char language[MAX_LANGUAGE]; /*!< \brief default Asterisk dialplan language for this interface */
char exten[AST_MAX_EXTENSION]; /*!< \brief default Asterisk dialplan extension for this interface */
int skypiax_sound_rate; /*!< \brief rate of the sound device, in Hz, eg: 8000 */
int skypiax_sound_capt_fd; /*!< \brief file descriptor for sound capture dev */
char callid_name[50];
char callid_number[50];
pthread_t controldev_thread; /*!< \brief serial control thread for this interface, running during the call */
double playback_boost;
double capture_boost;
int stripmsd;
pthread_t skype_thread;
struct AsteriskHandles AsteriskHandlesAst;
struct SkypiaxHandles SkypiaxHandles;
char skype_call_id[512];
int skype_call_ongoing;
char skype_friends[4096];
char skype_fullname[512];
char skype_displayname[512];
int skype_callflow; /*!< \brief 'callflow' of the skype interface (as opposed to phone interface) */
int skype; /*!< \brief config flag, bool, Skype support on this interface (0 if false, -1 if true) */
int control_to_send;
int audiopipe[2];
int audioskypepipe[2];
pthread_t tcp_srv_thread;
pthread_t tcp_cli_thread;
short audiobuf[160];
int audiobuf_is_loaded;
//int phonebook_listing;
//int phonebook_querying;
//int phonebook_listing_received_calls;
//int phonebook_first_entry;
//int phonebook_last_entry;
//int phonebook_number_lenght;
//int phonebook_text_lenght;
FILE *phonebook_writing_fp;
int skypiax_dir_entry_extension_prefix;
#ifdef WIN32
unsigned short tcp_cli_port;
unsigned short tcp_srv_port;
#else
int tcp_cli_port;
int tcp_srv_port;
#endif
char X11_display[256];
struct ast_frame read_frame;
char skype_user[256];
char skype_password[256];
char destination[256];
char session_uuid_str[512 + 1];
pthread_t signaling_thread;
};
typedef struct skypiax_pvt private_t;
/* FUNCTIONS */
/* module helpers functions */
int load_module(void);
int unload_module(void);
int usecount(void);
char *description(void);
char *key(void);
/* chan_skypiax internal functions */
void skypiax_unlocka_log(void *x);
void *do_skypeapi_thread(void *data);
//int skypiax2skype(struct ast_channel *c, void *data);
//int skype2skypiax(struct ast_channel *c, void *data);
//void skypiax_disconnect(void);
int skypiax_signaling_write(struct skypiax_pvt *p, char *msg_to_skype);
int skypiax_signaling_read(struct skypiax_pvt *p);
int skypiax_console_skype(int fd, int argc, char *argv[]);
#ifdef WANT_SKYPE_X11
int X11_errors_handler(Display * dpy, XErrorEvent * err);
int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P);
int skypiax_present(struct SkypiaxHandles *SkypiaxHandles);
void skypiax_clean_disp(void *data);
#endif /* WANT_SKYPE_X11 */
#ifdef __CYGWIN__
int win32_Initialize_CreateWindowClass(private_t * tech_pvt);
void win32_DeInitialize_DestroyWindowClass(private_t * tech_pvt);
int win32_Initialize_CreateMainWindow(private_t * tech_pvt);
void win32_DeInitialize_DestroyMainWindow(private_t * tech_pvt);
#endif /* __CYGWIN__ */
/* CHAN_SKYPIAX.C */
int skypiax_queue_control(struct ast_channel *chan, int control);
struct skypiax_pvt *skypiax_console_find_desc(char *dev);
int skypiax_serial_call(struct skypiax_pvt *p, char *dstr);
/* FUNCTIONS */
/* PBX interface functions */
struct ast_channel *skypiax_request(const char *type, int format, void *data, int *cause);
int skypiax_answer(struct ast_channel *c);
int skypiax_hangup(struct ast_channel *c);
int skypiax_originate_call(struct ast_channel *c, char *idest, int timeout);
struct ast_frame *skypiax_read(struct ast_channel *chan);
int skypiax_write(struct ast_channel *c, struct ast_frame *f);
int skypiax_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
#ifndef ASTERISK_VERSION_1_4
int skypiax_indicate(struct ast_channel *c, int cond);
#else
int skypiax_indicate(struct ast_channel *c, int cond, const void *data, size_t datalen);
#endif
int skypiax_devicestate(void *data);
#ifdef ASTERISK_VERSION_1_4
int skypiax_digitsend_begin(struct ast_channel *ast, char digit);
int skypiax_digitsend_end(struct ast_channel *ast, char digit, unsigned int duration);
#else /* ASTERISK_VERSION_1_4 */
int skypiax_digitsend(struct ast_channel *ast, char digit);
#endif /* ASTERISK_VERSION_1_4 */
/* chan_skypiax internal functions */
struct skypiax_pvt *skypiax_mkif(struct ast_config *cfg, char *ctg,
int is_first_category);
struct ast_channel *skypiax_new(struct skypiax_pvt *p, int state, char *context);
int skypiax_restart_monitor(void);
void *skypiax_do_monitor(void *data);
int skypiax_sound_boost(struct ast_frame *f, double boost);
int skypiax_sound_init(struct skypiax_pvt *p);
int skypiax_sound_shutdown(struct skypiax_pvt *p);
struct ast_frame *skypiax_sound_read(struct skypiax_pvt *p);
int skypiax_sound_write(struct skypiax_pvt *p, struct ast_frame *f);
void *skypiax_do_controldev_thread(void *data);
#ifdef ASTERISK_VERSION_1_6
void skypiax_store_boost(const char *s, double *boost);
#else
void skypiax_store_boost(char *s, double *boost);
#endif /* ASTERISK_VERSION_1_6 */
int skypiax_console_set_active(int fd, int argc, char *argv[]);
int skypiax_console_hangup(int fd, int argc, char *argv[]);
int skypiax_console_playback_boost(int fd, int argc, char *argv[]);
int skypiax_console_capture_boost(int fd, int argc, char *argv[]);
int skypiax_console_skypiax(int fd, int argc, char *argv[]);
int skypiax_console_dial(int fd, int argc, char *argv[]);
int skypiax_audio_init(struct skypiax_pvt *p);
//struct ast_frame *skypiax_audio_read(struct skypiax_pvt *p);
int skypiax_audio_read(struct skypiax_pvt *p);
void *skypiax_do_tcp_srv_thread(void *data);
int skypiax_audio_write(struct skypiax_pvt *p, struct ast_frame *f);
void *skypiax_do_tcp_cli_thread(void *data);
int skypiax_call(struct skypiax_pvt *p, char *idest, int timeout);
int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[]);
void *skypiax_do_tcp_srv_thread_func(void *obj);
void *skypiax_do_tcp_cli_thread_func(void *obj);
void *skypiax_do_skypeapi_thread_func(void *obj);
int dtmf_received(private_t * tech_pvt, char *value);
int start_audio_threads(private_t * tech_pvt);
int new_inbound_channel(private_t * tech_pvt);
int outbound_channel_answered(private_t * tech_pvt);
int skypiax_senddigit(struct skypiax_pvt *p, char digit);
int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype);
#if defined(WIN32) && !defined(__CYGWIN__)
int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany);
int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany);
/* Visual C do not have strsep ? */
char *strsep(char **stringp, const char *delim);
#else
int skypiax_pipe_read(int pipe, short *buf, int howmany);
int skypiax_pipe_write(int pipe, short *buf, int howmany);
#endif /* WIN32 */
int skypiax_close_socket(unsigned int fd);
private_t *find_available_skypiax_interface(void);
#define SKYPIAX_STATE_DOWN AST_STATE_DOWN
#define SKYPIAX_STATE_RING AST_STATE_RING
#define SKYPIAX_STATE_DIALING AST_STATE_DIALING
#define SKYPIAX_STATE_BUSY AST_STATE_BUSY
#define SKYPIAX_STATE_UP AST_STATE_UP
#define SKYPIAX_STATE_RINGING AST_STATE_RINGING
#define SKYPIAX_STATE_PRERING AST_STATE_PRERING
#define SKYPIAX_STATE_RESERVED AST_STATE_RESERVED
#define SKYPIAX_STATE_HANGUP_REQUESTED 200
#endif /* _SKYPIAX_H_ */

View File

@ -0,0 +1 @@
../skypiax_protocol.c

View File

@ -0,0 +1,57 @@
#######################################
HOW TO USE SKYPIAX_AUTH
#######################################
You will use skypiax_auth only at the setup moment, 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).
Compile skypiax_auth:
$ gcc -Wall -ggdb skypiax_auth.c -o skypiax_auth -lX11
Then:
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)
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).
############################
first time you use skypiax_auth
############################
$ ./skypiax_auth
Skype instance found with id #27263062
RECEIVED==> ERROR 68
RECEIVED==> OK
############################
Give the auth to the Skype client, and tell him not to ask again
Then Ctrl-C to exit from skypiax_auth
############################
Close (Quit) the Skype client from the tray icon, so it saves its config.
Then, relaunch the Skype client
############################
you use skypiax_auth again
############################
$ ./skypiax_auth
Skype instance found with id #27263062
RECEIVED==> OK
RECEIVED==> PROTOCOL 6
RECEIVED==> CONNSTATUS ONLINE
RECEIVED==> CURRENTUSERHANDLE gmaruzz3
RECEIVED==> USERSTATUS INVISIBLE

View File

@ -0,0 +1,624 @@
<!--
NOTICE:
This context is usually accessed via authenticated callers on the sip profile on port 5060
or transfered callers from the public context which arrived via the sip profile on port 5080.
Authenticated users will use the user_context variable on the user to determine what context
they can access. You can also add a user in the directory with the cidr= attribute acl.conf.xml
will build the domains acl using this value.
-->
<?xml version="1.0" encoding="utf-8"?>
<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
<include>
<context name="default">
<extension name="unloop">
<condition field="$${unroll_loops}" expression="^true$"/>
<condition field="${sip_looped_call}" expression="^true$">
<action application="deflect" data="${destination_number}"/>
</condition>
</extension>
<!--
Try to get the domain from the sip_auth_realm otherwise it will
default domain in vars.xml for cases it can't figure it out.
-->
<extension name="set_domain" continue="true">
<condition field="${domain_name}" expression="^$"/>
<condition field="source" expression="mod_sofia"/>
<condition field="${sip_auth_realm}" expression="^$">
<action application="set" data="domain_name=$${domain}"/>
<anti-action application="set" data="domain_name=${sip_auth_realm}"/>
</condition>
</extension>
<!-- Set the domain -->
<extension name="set_domain_openzap" continue="true">
<condition field="${domain_name}" expression="^$"/>
<condition field="source" expression="mod_openzap">
<action application="set" data="domain_name=$${domain}"/>
</condition>
</extension>
<!-- Example of doing things based on time of day. -->
<extension name="tod_example" continue="true">
<!-- man strftime - M-F, 9AM to 6PM -->
<condition field="${strftime(%w)}" expression="^([1-5])$"/>
<condition field="${strftime(%H%M)}" expression="^((09|1[0-7])[0-5][0-9]|1800)$">
<action application="set" data="open=true"/>
</condition>
</extension>
<extension name="global-intercept">
<condition field="destination_number" expression="^886$">
<action application="answer"/>
<action application="intercept" data="${db(select/${domain_name}-last_dial/global)}"/>
<action application="sleep" data="2000"/>
</condition>
</extension>
<extension name="group-intercept">
<condition field="destination_number" expression="^\*8$">
<action application="answer"/>
<action application="intercept" data="${db(select/${domain_name}-last_dial/${callgroup})}"/>
<action application="sleep" data="2000"/>
</condition>
</extension>
<extension name="intercept-ext">
<condition field="destination_number" expression="^\*\*(\d+)$">
<action application="answer"/>
<action application="intercept" data="${db(select/${domain_name}-last_dial_ext/$1)}"/>
<action application="sleep" data="2000"/>
</condition>
</extension>
<extension name="redial">
<condition field="destination_number" expression="^870$">
<action application="transfer" data="${db(select/${domain_name}-last_dial/${caller_id_number})}"/>
</condition>
</extension>
<extension name="global" continue="true">
<condition field="${network_addr}" expression="^$" break="never">
<action application="set" data="use_profile=${cond(${acl($${local_ip_v4} rfc1918)} == true ? nat : default)}"/>
<anti-action application="set" data="use_profile=${cond(${acl(${network_addr} rfc1918)} == true ? nat : default)}"/>
</condition>
<!-- This will setup some variables if the user isn't authenticated. -->
<condition field="${numbering_plan}" expression="^$" break="never">
<action application="set_user" data="default@${domain_name}"/>
</condition>
<condition field="${call_debug}" expression="^true$" break="never">
<action application="info"/>
</condition>
<condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$" break="never">
<action application="set" data="sip_secure_media=true"/>
<!-- Offer SRTP on outbound legs if we have it on inbound. -->
<!-- <action application="export" data="sip_secure_media=true"/> -->
</condition>
<condition>
<action application="db" data="insert/${domain_name}-spymap/${caller_id_number}/${uuid}"/>
<action application="db" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/>
<action application="db" data="insert/${domain_name}-last_dial/global/${uuid}"/>
</condition>
</extension>
<!-- If sip_req_host is not a local domain then this has to be an external sip uri -->
<!--
<extension name="external_sip_uri" continue="true">
<condition field="source" expression="mod_sofia"/>
<condition field="${outside_call}" expression="^$"/>
<condition field="${domain_exists(${sip_req_host})}" expression="true">
<anti-action application="bridge" data="sofia/${use_profile}/${sip_to_uri}"/>
</condition>
</extension>
-->
<!--
snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
-->
<extension name="snom-demo-2">
<condition field="destination_number" expression="^9001$">
<action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
<action application="transfer" data="3000"/>
</condition>
</extension>
<extension name="snom-demo-1">
<condition field="destination_number" expression="^9000$">
<!--<key> <light> <label> <user> <host> <profile> <action_name> <action>-->
<action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
<action application="playback" data="$${hold_music}"/>
</condition>
</extension>
<extension name="eavesdrop">
<condition field="destination_number" expression="^88(.*)$|^\*0(.*)$">
<action application="answer"/>
<action application="eavesdrop" data="${db(select/${domain_name}-spymap/$1)}"/>
</condition>
</extension>
<extension name="eavesdrop">
<condition field="destination_number" expression="^779$">
<action application="answer"/>
<action application="set" data="eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)"/>
<action application="set" data="eavesdrop_indicate_new=tone_stream://%(500, 0, 620)"/>
<action application="set" data="eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)"/>
<action application="eavesdrop" data="all"/>
</condition>
</extension>
<extension name="call_return">
<condition field="destination_number" expression="^\*69$|^869$|^lcr$">
<action application="transfer" data="${db(select/${domain_name}-call_return/${caller_id_number})}"/>
</condition>
</extension>
<extension name="del-group">
<condition field="destination_number" expression="^80(\d{2})$">
<action application="answer"/>
<action application="group" data="delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}"/>
<action application="gentones" data="%(1000, 0, 320)"/>
</condition>
</extension>
<extension name="add-group">
<condition field="destination_number" expression="^81(\d{2})$">
<action application="answer"/>
<action application="group" data="insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}"/>
<action application="gentones" data="%(1000, 0, 640)"/>
</condition>
</extension>
<extension name="call-group-simo">
<condition field="destination_number" expression="^82(\d{2})$">
<action application="bridge" data="{ignore_early_media=true}${group(call:$1@${domain_name})}"/>
</condition>
</extension>
<extension name="call-group-order">
<condition field="destination_number" expression="^83(\d{2})$">
<action application="set" data="call_timeout=10"/>
<action application="bridge" data="{ignore_early_media=true}${group(call:$1@${domain_name}:order)}"/>
</condition>
</extension>
<extension name="extension-intercom">
<!-- <condition field="${sip_to_params}" expression="intercom\=true"/> -->
<condition field="destination_number" expression="^8(10[01][0-9])$">
<action application="set" data="dialed_extension=$1"/>
<!-- This Alert-Info seems to be a case for Intercom for Polycom which sip_auto_answer=true covers already. -->
<!--<action application="export"><![CDATA[alert_info=<sip:${domain_name}>;Ring;Answer]]></action>-->
<action application="export"><![CDATA[sip_h_Call-Info=<sip:${domain_name}>;answer-after=0]]></action>
<action application="export" data="sip_invite_params=intercom=true"/>
<action application="export" data="sip_auto_answer=true"/>
<action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
</condition>
</extension>
<!--
if the calling party is the called party, go to their VM
if the calling party is NOT the called party dial the extension
(1000-1019) for 30 seconds and go to voicemail if the
call fails (continue_on_fail=true), otherwise hang up after a
successful bridge (hangup_after-bridge=true)
-->
<extension name="Local_Extension">
<condition field="destination_number" expression="^(10[01][0-9])$">
<action application="set" data="dialed_extension=$1"/>
<action application="export" data="dialed_extension=$1"/>
</condition>
<condition field="destination_number" expression="^${caller_id_number}$">
<action application="set" data="voicemail_authorized=${sip_authorized}"/>
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="voicemail" data="check default ${domain_name} ${dialed_extension}"/>
<!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
<anti-action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
<anti-action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
<anti-action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
<anti-action application="set" data="ringback=${us-ring}"/>
<anti-action application="set" data="transfer_ringback=$${hold_music}"/>
<anti-action application="set" data="call_timeout=30"/>
<!-- <anti-action application="set" data="sip_exclude_contact=${network_addr}"/> -->
<anti-action application="set" data="hangup_after_bridge=true"/>
<!--<anti-action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
<anti-action application="set" data="continue_on_fail=true"/>
<anti-action application="db" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
<anti-action application="db" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
<anti-action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>
<!--<anti-action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>-->
<anti-action application="db" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
<anti-action application="bridge" data="user/${dialed_extension}@${domain_name}"/>
<anti-action application="answer"/>
<anti-action application="sleep" data="1000"/>
<anti-action application="voicemail" data="default ${domain_name} ${dialed_extension}"/>
</condition>
</extension>
<!-- voicemail operator extension -->
<extension name="operator">
<condition field="destination_number" expression="^operator$|^0$">
<action application="set" data="transfer_ringback=$${hold_music}"/>
<action application="transfer" data="1000 XML features"/>
</condition>
</extension>
<!-- voicemail main extension -->
<extension name="vmain">
<condition field="destination_number" expression="^vmain|4000$">
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="voicemail" data="check default ${domain_name}"/>
</condition>
</extension>
<!-- dial via SIP uri -->
<extension name="sip_uri">
<condition field="destination_number" expression="^sip:(.*)$">
<action application="bridge" data="sofia/${use_profile}/$1"/>
</condition>
</extension>
<!-- dial via skypiax -->
<extension name="skypiax">
<condition field="destination_number" expression="^2909$">
<action application="bridge" data="skypiax/skypiax1/echo123"/>
</condition>
</extension>
<!-- dial via skypiax ANY interface -->
<extension name="skypiax">
<condition field="destination_number" expression="^2908$">
<action application="bridge" data="skypiax/ANY/echo123"/>
</condition>
</extension>
<!-- dial via SKYPE uri with skypiax ANY interface-->
<extension name="skype_uri">
<condition field="destination_number" expression="^skype/(.*)$">
<action application="bridge" data="skypiax/ANY/$1"/>
</condition>
</extension>
<!--
start a dynamic conference with the settings of the "default" conference profile in conference.conf.xml
-->
<extension name="nb_conferences">
<condition field="destination_number" expression="^(30\d{2})$">
<action application="answer"/>
<action application="conference" data="$1-${domain_name}@default"/>
</condition>
</extension>
<extension name="wb_conferences">
<condition field="destination_number" expression="^(31\d{2})$">
<action application="answer"/>
<action application="conference" data="$1-${domain_name}@wideband"/>
</condition>
</extension>
<extension name="uwb_conferences">
<condition field="destination_number" expression="^(32\d{2})$">
<action application="answer"/>
<action application="conference" data="$1-${domain_name}@ultrawideband"/>
</condition>
</extension>
<!-- dial the freeswitch conference via SIP-->
<extension name="freeswitch_public_conf_via_sip">
<condition field="destination_number" expression="^9(888|1616)$">
<action application="bridge" data="sofia/${use_profile}/$1@conference.freeswitch.org"/>
</condition>
</extension>
<!--This extension will start a conference and invite several people upon entering -->
<extension name="mad_boss">
<condition field="destination_number" expression="^0911$">
<!--These params effect the outcalls made once you join-->
<action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss"/>
<action application="set" data="conference_auto_outcall_caller_id_number=0911"/>
<action application="set" data="conference_auto_outcall_timeout=60"/>
<action application="set" data="conference_auto_outcall_flags=none"/>
<!--<action application="set" data="conference_auto_outcall_announce=say:You have been called into an emergency conference"/>-->
<!--Add as many of these as you need, These are the people you are going to call-->
<action application="conference_set_auto_outcall" data="sofia/gateway/$${default_provider}/19184238080"/>
<action application="conference_set_auto_outcall" data="sofia/default/888@conference.freeswitch.org"/>
<action application="conference" data="cool@default"/>
</condition>
</extension>
<!-- a sample IVR -->
<extension name="ivr_demo">
<condition field="destination_number" expression="^5000$">
<action application="answer"/>
<action application="sleep" data="2000"/>
<action application="ivr" data="demo_ivr"/>
</condition>
</extension>
<!-- Create a conference on the fly and pull someone in at the same time. -->
<extension name="dyanmic conference">
<condition field="destination_number" expression="^5001$">
<action application="conference" data="bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org"/>
</condition>
</extension>
<extension name="rtp_multicast_page">
<condition field="destination_number" expression="^pagegroup$|^7243">
<action application="answer"/>
<action application="esf_page_group"/>
</condition>
</extension>
<!--
Parking extensions... transferring calls to 5900 will park them in a queue.
-->
<extension name="park">
<condition field="destination_number" expression="^5900$">
<action application="set" data="fifo_music=$${hold_music}"/>
<action application="fifo" data="5900@${domain_name} in"/>
</condition>
</extension>
<!--
Parking pickup extension. Calling 5901 will pickup the call.
-->
<extension name="unpark">
<condition field="destination_number" expression="^5901$">
<action application="answer"/>
<action application="fifo" data="5900@${domain_name} out nowait"/>
</condition>
</extension>
<!--
This extension is used with snom phones.
Set a function key to park+lot (lot being a number or name.)
Set type to Park+Orbit. You can then park and pickup using
the softkey on the phone. Should work with other phones.
-->
<extension name="park">
<condition field="source" expression="mod_sofia"/>
<condition field="destination_number" expression="park\+(\d+)">
<action application="fifo" data="$1@${domain_name} in undef $${hold_music}"/>
</condition>
</extension>
<!--
The extension is parking pickup with a to param of the fifo we are calling
Some phones send things like orbit= and you can extract that info.
-->
<extension name="unpark">
<condition field="source" expression="mod_sofia"/>
<condition field="destination_number" expression="^parking$"/>
<condition field="${sip_to_params}" expression="fifo\=(\d+)">
<action application="answer"/>
<action application="fifo" data="$1@${domain_name} out nowait"/>
</condition>
</extension>
<!--
This extension is used with linksys phones.
Set a Phone tab option Call Park Serv to yes. You can park and
pickup using soft keys "park" and "unpark" found during
active call when moving navigation button. The other option
is to use phone's star codes (defaults to *38 and *39).
-->
<extension name="park">
<condition field="source" expression="mod_sofia"/>
<condition field="destination_number" expression="callpark"/>
<condition field="${sip_refer_to}">
<expression><![CDATA[<sip:callpark@${domain_name};orbit=(\d+)>]]></expression>
<action application="fifo" data="$1@${domain_name} in undef $${hold_music}"/>
</condition>
</extension>
<!--
This extension is used with linksys phones.
The extension is parking pickup with a to param of the fifo
we are calling. Linksys sends orbit=<parkingslotnumber>
and we extract that info.
-->
<extension name="unpark">
<condition field="source" expression="mod_sofia"/>
<condition field="destination_number" expression="pickup"/>
<condition field="${sip_to_params}" expression="orbit\=(\d+)">
<action application="answer"/>
<action application="fifo" data="$1@${domain_name} out nowait"/>
</condition>
</extension>
<!--
Here are some examples of how to override the ringback heard by the
far end. You have two variables that you can use to override this.
ringback - used when a call isn't answered. (early media)
transfer_ringback - used when the call is already answered. (post answer)
-->
<!-- Demonstration of how to override the ringback in various situations -->
<extension name="wait">
<condition field="destination_number" expression="^wait$">
<action application="pre_answer"/>
<action application="sleep" data="20000"/>
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="playback" data="voicemail/vm-goodbye.wav"/>
<action application="hangup"/>
</condition>
</extension>
<!-- Send a 180 and let the far end generate ringback. -->
<extension name="ringback_180">
<condition field="destination_number" expression="^9980$">
<action application="ring_ready"/>
<action application="sleep" data="20000"/>
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="playback" data="voicemail/vm-goodbye.wav"/>
<action application="hangup"/>
</condition>
</extension>
<!-- Send a 183 and send uk-ring as the ringtone. (early media) -->
<extension name="ringback_183_uk_ring">
<condition field="destination_number" expression="^9981$">
<action application="set" data="ringback=$${uk-ring}"/>
<action application="bridge" data="loopback/wait"/>
</condition>
</extension>
<!-- Send a 183 and use music as the ringtone. (early media) -->
<extension name="ringback_183_music_ring">
<condition field="destination_number" expression="^9982$">
<action application="set" data="ringback=$${hold_music}"/>
<action application="bridge" data="loopback/wait"/>
</condition>
</extension>
<!-- Answer the call and use music as the ringtone. (post answer) -->
<extension name="ringback_post_answer_uk_ring">
<condition field="destination_number" expression="^9983$">
<action application="set" data="transfer_ringback=$${uk-ring}"/>
<action application="answer"/>
<action application="bridge" data="loopback/wait"/>
</condition>
</extension>
<!-- Answer the call and use music as the ringtone. (post answer) -->
<extension name="ringback_post_answer_music">
<condition field="destination_number" expression="^9984$">
<action application="set" data="transfer_ringback=$${hold_music}"/>
<action application="answer"/>
<action application="bridge" data="loopback/wait"/>
</condition>
</extension>
<extension name="show_info">
<condition field="destination_number" expression="^9992$">
<action application="answer"/>
<action application="info"/>
<action application="sleep" data="250"/>
<action application="hangup"/>
</condition>
</extension>
<extension name="video_record">
<condition field="destination_number" expression="^9993$">
<action application="answer"/>
<action application="record_fsv" data="/tmp/testrecord.fsv"/>
</condition>
</extension>
<extension name="video_playback">
<condition field="destination_number" expression="^9994$">
<action application="answer"/>
<action application="play_fsv" data="/tmp/testrecord.fsv"/>
</condition>
</extension>
<extension name="delay_echo">
<condition field="destination_number" expression="^9995$">
<action application="answer"/>
<action application="delay_echo" data="5000"/>
</condition>
</extension>
<extension name="echo">
<condition field="destination_number" expression="^9996$">
<action application="answer"/>
<action application="echo"/>
</condition>
</extension>
<extension name="milliwatt">
<condition field="destination_number" expression="^9997$">
<action application="answer"/>
<action application="playback" data="tone_stream://%(10000,0,1004);loops=-1"/>
</condition>
</extension>
<extension name="tone_stream">
<condition field="destination_number" expression="^9998$">
<action application="answer"/>
<action application="playback" data="tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10"/>
</condition>
</extension>
<!--
You will no longer hear the bong tone. The wav file is playing stating the call is secure.
The file will not play unless you have both TLS and SRTP active.
-->
<extension name="hold_music">
<condition field="destination_number" expression="^9999$"/>
<condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$">
<action application="answer"/>
<action application="execute_extension" data="is_secure XML features"/>
<action application="playback" data="$${hold_music}"/>
<anti-action application="answer"/>
<anti-action application="playback" data="$${hold_music}"/>
</condition>
</extension>
<!--
You can place files in the default directory to get included.
-->
<X-PRE-PROCESS cmd="include" data="default/*.xml"/>
<!--
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
Anything you put below this line will usually get ignored due to the file in
default/99999_enum.xml as it will transfer the call to the enum dialplan.
WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-->
<!--
This is an example of how to override the RURI on an outgoing invite to a registered contact.
-->
<!--
<extension name="refer">
<condition field="${sip_refer_to}">
<expression><![CDATA[<sip:${destination_number}@${domain_name}>]]></expression>
</condition>
<condition field="${sip_refer_to}">
<expression><![CDATA[<sip:(.*)@(.*)>]]></expression>
<action application="set" data="refer_user=$1"/>
<action application="set" data="refer_domain=$2"/>
<action application="info"/>
<action application="bridge" data="sofia/${use_profile}/${refer_user}@${refer_domain}"/>
</condition>
</extension>
<extension name="ruri">
<condition field="destination_number" expression="^ruri$">
<action application="bridge" data="sofia/${ruri_profile}/${ruri_user}${regex(${sofia_contact(${ruri_contact})}|^[^\@]+(.*)|%1)}"/>
</condition>
</extension>
<extension name="7004">
<condition field="destination_number" expression="^7004$">
<action application="set" data="ruri_profile=default"/>
<action application="set" data="ruri_user=2000"/>
<action application="set" data="ruri_contact=1001@${domain_name}"/>
<action application="execute_extension" data="ruri"/>
</condition>
</extension>
-->
<!-- SEE WARNING ABOVE IF YOU ARE TRYING TO ADD EXTENSIONS HERE! -->
</context>
</include>

View File

@ -0,0 +1 @@
localhost

View File

@ -0,0 +1,214 @@
<configuration name="skypiax.conf" description="Skypiax Configuration">
<global_settings>
<param name="debug" value="8"/>
<param name="codec-master" value="us"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="codec-prefs" value="gsm,ulaw"/>
<param name="codec-rates" value="8000,16000"/>
<param name="hold-music" value="$${moh_uri}"/>
<param name="destination" value="5000"/>
</global_settings>
<!-- one entry here per skypiax interface -->
<per_interface_settings>
<interface id="1" name="skypiax1">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":101"/>
<param name="tcp_cli_port" value="15556"/>
<param name="tcp_srv_port" value="15557"/>
<param name="skype_user" value="skypiax1"/>
<param name="destination" value="3101"/>
</interface>
<interface id="2" name="skypiax2">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":102"/>
<param name="tcp_cli_port" value="15558"/>
<param name="tcp_srv_port" value="15559"/>
<param name="skype_user" value="skypiax2"/>
<param name="destination" value="5000"/>
</interface>
<!-- following interfaces are commented out!
<interface id="3" name="skypiax3">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":103"/>
<param name="tcp_cli_port" value="15560"/>
<param name="tcp_srv_port" value="15561"/>
<param name="skype_user" value="skypiax3"/>
</interface>
<interface id="4" name="skypiax4">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":104"/>
<param name="tcp_cli_port" value="15562"/>
<param name="tcp_srv_port" value="15563"/>
<param name="skype_user" value="skypiax4"/>
</interface>
<interface id="5" name="skypiax5">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":105"/>
<param name="tcp_cli_port" value="15564"/>
<param name="tcp_srv_port" value="15565"/>
<param name="skype_user" value="skypiax5"/>
</interface>
<interface id="6" name="skypiax6">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":106"/>
<param name="tcp_cli_port" value="15566"/>
<param name="tcp_srv_port" value="15567"/>
<param name="skype_user" value="skypiax6"/>
</interface>
<interface id="7" name="skypiax7">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":107"/>
<param name="tcp_cli_port" value="15568"/>
<param name="tcp_srv_port" value="15569"/>
<param name="skype_user" value="skypiax7"/>
</interface>
<interface id="8" name="skypiax8">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":108"/>
<param name="tcp_cli_port" value="15570"/>
<param name="tcp_srv_port" value="15571"/>
<param name="skype_user" value="skypiax8"/>
</interface>
<interface id="9" name="skypiax9">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":109"/>
<param name="tcp_cli_port" value="15572"/>
<param name="tcp_srv_port" value="15573"/>
<param name="skype_user" value="skypiax9"/>
</interface>
<interface id="10" name="skypiax10">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":110"/>
<param name="tcp_cli_port" value="15574"/>
<param name="tcp_srv_port" value="15575"/>
<param name="skype_user" value="skypiax10"/>
</interface>
<interface id="11" name="skypiax11">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":111"/>
<param name="tcp_cli_port" value="15576"/>
<param name="tcp_srv_port" value="15577"/>
<param name="skype_user" value="skypiax11"/>
</interface>
<interface id="12" name="skypiax12">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":112"/>
<param name="tcp_cli_port" value="15578"/>
<param name="tcp_srv_port" value="15579"/>
<param name="skype_user" value="skypiax12"/>
</interface>
<interface id="13" name="skypiax13">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":113"/>
<param name="tcp_cli_port" value="15580"/>
<param name="tcp_srv_port" value="15581"/>
<param name="skype_user" value="skypiax13"/>
</interface>
<interface id="14" name="skypiax14">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":114"/>
<param name="tcp_cli_port" value="15582"/>
<param name="tcp_srv_port" value="15583"/>
<param name="skype_user" value="skypiax14"/>
</interface>
<interface id="15" name="skypiax15">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":115"/>
<param name="tcp_cli_port" value="15584"/>
<param name="tcp_srv_port" value="15585"/>
<param name="skype_user" value="skypiax15"/>
</interface>
<interface id="16" name="skypiax16">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":116"/>
<param name="tcp_cli_port" value="15586"/>
<param name="tcp_srv_port" value="15587"/>
<param name="skype_user" value="skypiax16"/>
</interface>
<interface id="17" name="skypiax17">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":117"/>
<param name="tcp_cli_port" value="15588"/>
<param name="tcp_srv_port" value="15589"/>
<param name="skype_user" value="skypiax17"/>
</interface>
<interface id="18" name="skypiax18">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":118"/>
<param name="tcp_cli_port" value="15590"/>
<param name="tcp_srv_port" value="15591"/>
<param name="skype_user" value="skypiax18"/>
</interface>
<interface id="19" name="skypiax19">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":119"/>
<param name="tcp_cli_port" value="15592"/>
<param name="tcp_srv_port" value="15593"/>
<param name="skype_user" value="skypiax19"/>
</interface>
<interface id="20" name="skypiax20">
<param name="hold-music" value="$${moh_uri}"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<param name="X11-display" value=":120"/>
<param name="tcp_cli_port" value="15594"/>
<param name="tcp_srv_port" value="15595"/>
<param name="skype_user" value="skypiax20"/>
</interface>
-->
</per_interface_settings>
</configuration>

View File

@ -0,0 +1,230 @@
//gcc -Wall -ggdb skypiax_auth.c -o skypiax_auth -lX11
#include <stdio.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xatom.h>
struct SkypiaxHandles {
Window skype_win;
Display *disp;
Window win;
int api_connected;
int fdesc[2];
};
XErrorHandler old_handler = 0;
int xerror = 0;
char *dispname;
int X11_errors_handler(Display * dpy, XErrorEvent * err)
{
(void) dpy;
xerror = err->error_code;
printf("\n\nReceived error code %d from X Server on display '%s'\n\n", xerror,
dispname);
return 0; /* ignore the error */
}
static void X11_errors_trap(void)
{
xerror = 0;
old_handler = XSetErrorHandler(X11_errors_handler);
}
static int X11_errors_untrap(void)
{
XSetErrorHandler(old_handler);
return (xerror != BadValue) && (xerror != BadWindow);
}
int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P)
{
Window w_P;
Display *disp;
Window handle_P;
int ok;
w_P = SkypiaxHandles->skype_win;
disp = SkypiaxHandles->disp;
handle_P = SkypiaxHandles->win;
Atom atom1 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
Atom atom2 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
unsigned int pos = 0;
unsigned int len = strlen(message_P);
XEvent e;
memset(&e, 0, sizeof(e));
e.xclient.type = ClientMessage;
e.xclient.message_type = atom1; /* leading message */
e.xclient.display = disp;
e.xclient.window = handle_P;
e.xclient.format = 8;
X11_errors_trap();
do {
unsigned int i;
for (i = 0; i < 20 && i + pos <= len; ++i)
e.xclient.data.b[i] = message_P[i + pos];
XSendEvent(disp, w_P, False, 0, &e);
e.xclient.message_type = atom2; /* following messages */
pos += i;
} while (pos <= len);
XSync(disp, False);
ok = X11_errors_untrap();
if (!ok)
printf("Sending message failed with status %d\n", xerror);
return 1;
}
int skypiax_present(struct SkypiaxHandles *SkypiaxHandles)
{
Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
Atom type_ret;
int format_ret;
unsigned long nitems_ret;
unsigned long bytes_after_ret;
unsigned char *prop;
int status;
X11_errors_trap();
status =
XGetWindowProperty(SkypiaxHandles->disp, DefaultRootWindow(SkypiaxHandles->disp),
skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret,
&nitems_ret, &bytes_after_ret, &prop);
X11_errors_untrap();
/* sanity check */
if (status != Success || format_ret != 32 || nitems_ret != 1) {
SkypiaxHandles->skype_win = (Window) - 1;
printf("Skype instance not found on display '%s'\n", dispname);
return 0;
}
SkypiaxHandles->skype_win = *(const unsigned long *) prop & 0xffffffff;
printf("Skype instance found on display '%s', with id #%d\n", dispname,
(unsigned int) SkypiaxHandles->skype_win);
return 1;
}
void skypiax_clean_disp(void *data)
{
int *dispptr;
int disp;
dispptr = data;
disp = *dispptr;
if (disp) {
close(disp);
} else {
}
usleep(1000);
}
int main(int argc, char *argv[])
{
struct SkypiaxHandles SkypiaxHandles;
char buf[512];
Display *disp = NULL;
Window root = -1;
Window win = -1;
if (argc == 2)
dispname = argv[1];
else
dispname = ":0.0";
disp = XOpenDisplay(dispname);
if (!disp) {
printf("Cannot open X Display '%s', exiting\n", dispname);
return -1;
}
int xfd;
xfd = XConnectionNumber(disp);
SkypiaxHandles.disp = disp;
if (skypiax_present(&SkypiaxHandles)) {
root = DefaultRootWindow(disp);
win =
XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0,
BlackPixel(disp, DefaultScreen(disp)), BlackPixel(disp,
DefaultScreen
(disp)));
SkypiaxHandles.win = win;
snprintf(buf, 512, "NAME skypiax");
if (!skypiax_send_message(&SkypiaxHandles, buf)) {
printf
("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
return -1;
}
snprintf(buf, 512, "PROTOCOL 6");
if (!skypiax_send_message(&SkypiaxHandles, buf)) {
printf
("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
return -1;
}
/* perform an events loop */
XEvent an_event;
char buf[21]; /* can't be longer */
char buffer[17000];
char *b;
int i;
b = buffer;
while (1) {
XNextEvent(disp, &an_event);
switch (an_event.type) {
case ClientMessage:
if (an_event.xclient.format != 8)
break;
for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i)
buf[i] = an_event.xclient.data.b[i];
buf[i] = '\0';
strcat(buffer, buf);
if (i < 20) { /* last fragment */
unsigned int howmany;
howmany = strlen(b) + 1;
printf("RECEIVED==> %s\n", b);
memset(buffer, '\0', 17000);
}
break;
default:
break;
}
}
} else {
printf
("Skype client not found on display '%s'. Please run/restart Skype manually and launch skypiax_auth again\n\n\n",
dispname);
return -1;
}
return 0;
}

View File

@ -0,0 +1,52 @@
echo off
REM
REM you MUST use the new Skype BETA (4.x) for Windows, older versions (3.x) cannot be started this way
REM
REM you have to adjust PATH to where the Skype executable is
set PATH=%PATH%;C:\Program Files\Skype\Phone\
echo %PATH%
REM start a Skype client instance that will login to the Skype network using the "username password" you give to it. Here xxx would be the password and skypiax1 the username
start Skype.exe /secondary /username:skypiax1 /password:xxx
call wait 7
start Skype.exe /secondary /username:skypiax2 /password:xxx
call wait 7
REM
REM Following Skype client instances are commented out
REM
REM start Skype.exe /secondary /username:skypiax3 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax4 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax5 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax6 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax7 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax8 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax9 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax10 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax11 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax12 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax13 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax14 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax15 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax16 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax17 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax18 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax19 /password:xxx
REM call wait 7
REM start Skype.exe /secondary /username:skypiax20 /password:xxx

View File

@ -0,0 +1,136 @@
# remember to add here the removing of all the installed snd-* modules, so you're sure only the snd-dummy driver will be around
rmmod snd_hda_intel
# you need three dummy soundcard for 20 Skype client instances, because each dummy soundcard can handle a max of 8 Skype instances
# the enable= module parameter tells how many cards to start. For each additional card, add a comma and a 1
# manually configure the first 8 Skype client instances to use the hw:Dummy_0, the next 8 instances to use hw:Dummy_1, etc for all three devices (Play, Capture, Ring)
modprobe snd-dummy enable=1,1,1
sleep 3
#start the fake X server on a given port
/usr/bin/Xvfb :101 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
sleep 3
# start a Skype client instance that will connect to the X server above, and will login to the Skype network using the "username password" you send to it on stdin. Here xxx would be the password and skypiax1 the username
echo "skypiax1 xxx"| DISPLAY=:101 /usr/bin/skype --pipelogin &
sleep 7
/usr/bin/Xvfb :102 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
sleep 3
echo "skypiax2 xxx"| DISPLAY=:102 /usr/bin/skype --pipelogin &
sleep 7
#################################################################
# Following X server Skype client instances are commented out
#################################################################
###/usr/bin/Xvfb :103 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax3 xxx"| DISPLAY=:103 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :104 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax4 xxx"| DISPLAY=:104 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :105 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax5 xxx"| DISPLAY=:105 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :106 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax6 xxx"| DISPLAY=:106 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :107 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax7 xxx"| DISPLAY=:107 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :108 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax8 xxx"| DISPLAY=:108 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :109 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax9 xxx"| DISPLAY=:109 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :110 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax10 xxx"| DISPLAY=:110 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :111 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax11 xxx"| DISPLAY=:111 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :112 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax12 xxx"| DISPLAY=:112 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :113 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax13 xxx"| DISPLAY=:113 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :114 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax14 xxx"| DISPLAY=:114 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :115 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax15 xxx"| DISPLAY=:115 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :116 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax16 xxx"| DISPLAY=:116 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :117 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax17 xxx"| DISPLAY=:117 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :118 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax18 xxx"| DISPLAY=:118 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :119 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax19 xxx"| DISPLAY=:119 /usr/bin/skype --pipelogin &
###
###sleep 7
###/usr/bin/Xvfb :120 -auth /usr/local/freeswitch/conf/autoload_configs/skypiax.X.conf &
###sleep 3
###
###echo "skypiax20 xxx"| DISPLAY=:120 /usr/bin/skype --pipelogin &
###
###sleep 7
###

View File

@ -0,0 +1,4 @@
REM would you believe there is no sleep() in standard windows batchfiles?
@ping 127.0.0.1 -n 2 -w 1000 > nul
@ping 127.0.0.1 -n %1% -w 1000> nul

View File

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="mod_skypiax"
ProjectGUID="{C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}"
RootNamespace="mod_skypiax"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
WarningLevel="4"
WarnAsError="false"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="rpcrt4.lib &quot;..\..\..\..\libs\win32\pthread\pthreadvc2.lib&quot; &quot;..\..\..\..\libs\win32\apr\debug\libapr-1.lib&quot; &quot;..\..\..\..\w32\library\debug\freeswitchcore.lib&quot;"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
ConfigurationType="2"
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="..\mod_skypiax\mod_skypiax.c"
>
</File>
<File
RelativePath=".\skypiax.h"
>
</File>
<File
RelativePath=".\skypiax_protocol.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,270 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthmct@yahoo.com>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* This module (mod_skypiax) has been contributed by:
*
* Giovanni Maruzzelli (gmaruzz@gmail.com)
*
*
* Further Contributors:
*
*
*
* mod_skypiax.c -- Skype compatible Endpoint Module
*
*/
#include <switch.h>
#include <switch_version.h>
#ifndef WIN32
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xatom.h>
#endif //WIN32
#ifdef _MSC_VER
//Windows macro for FD_SET includes a warning C4127: conditional expression is constant
#pragma warning(push)
#pragma warning(disable:4127)
#endif
#define SAMPLERATE_SKYPIAX 16000
#define SAMPLES_PER_FRAME SAMPLERATE_SKYPIAX/50
#ifndef SKYPIAX_SVN_VERSION
#define SKYPIAX_SVN_VERSION SWITCH_VERSION_REVISION
#endif /* SKYPIAX_SVN_VERSION */
typedef enum {
TFLAG_IO = (1 << 0),
TFLAG_INBOUND = (1 << 1),
TFLAG_OUTBOUND = (1 << 2),
TFLAG_DTMF = (1 << 3),
TFLAG_VOICE = (1 << 4),
TFLAG_HANGUP = (1 << 5),
TFLAG_LINEAR = (1 << 6),
TFLAG_CODEC = (1 << 7),
TFLAG_BREAK = (1 << 8)
} TFLAGS;
typedef enum {
GFLAG_MY_CODEC_PREFS = (1 << 0)
} GFLAGS;
#define DEBUGA_SKYPE(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SKYPE %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define DEBUGA_CALL(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_CALL %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define DEBUGA_PBX(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_PBX %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define ERRORA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][ERRORA %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define WARNINGA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][WARNINGA %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define NOTICA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][NOTICA %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
#define SKYPIAX_P_LOG NULL, (unsigned long)55, __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", -1, tech_pvt ? tech_pvt->interface_state : -1, tech_pvt ? tech_pvt->skype_callflow : -1
/*********************************/
#define SKYPIAX_CAUSE_NORMAL 1
/*********************************/
#define SKYPIAX_FRAME_DTMF 1
/*********************************/
#define SKYPIAX_CONTROL_RINGING 1
#define SKYPIAX_CONTROL_ANSWER 2
/*********************************/
#define SKYPIAX_STATE_DOWN 1
#define SKYPIAX_STATE_RING 2
#define SKYPIAX_STATE_DIALING 3
#define SKYPIAX_STATE_BUSY 4
#define SKYPIAX_STATE_UP 5
#define SKYPIAX_STATE_RINGING 6
#define SKYPIAX_STATE_PRERING 7
/*********************************/
/* call flow from the device */
#define CALLFLOW_CALL_IDLE SKYPIAX_STATE_DOWN
#define CALLFLOW_INCOMING_RING SKYPIAX_STATE_RING
#define CALLFLOW_CALL_DIALING SKYPIAX_STATE_DIALING
#define CALLFLOW_CALL_LINEBUSY SKYPIAX_STATE_BUSY
#define CALLFLOW_CALL_ACTIVE 300
#define CALLFLOW_INCOMING_HANGUP 100
#define CALLFLOW_CALL_RELEASED 101
#define CALLFLOW_CALL_NOCARRIER 102
#define CALLFLOW_CALL_INFLUX 103
#define CALLFLOW_CALL_INCOMING 104
#define CALLFLOW_CALL_FAILED 105
#define CALLFLOW_CALL_NOSERVICE 106
#define CALLFLOW_CALL_OUTGOINGRESTRICTED 107
#define CALLFLOW_CALL_SECURITYFAIL 108
#define CALLFLOW_CALL_NOANSWER 109
#define CALLFLOW_STATUS_FINISHED 110
#define CALLFLOW_STATUS_CANCELLED 111
#define CALLFLOW_STATUS_FAILED 112
#define CALLFLOW_STATUS_REFUSED 113
#define CALLFLOW_STATUS_RINGING 114
#define CALLFLOW_STATUS_INPROGRESS 115
#define CALLFLOW_STATUS_UNPLACED 116
#define CALLFLOW_STATUS_ROUTING 117
#define CALLFLOW_STATUS_EARLYMEDIA 118
#define SKYPIAX_STATE_HANGUP_REQUESTED 200
//FIXME CALLFLOW_INCOMING_CALLID to be removed
#define CALLFLOW_INCOMING_CALLID 1019
/*********************************/
#define SKYPIAX_MAX_INTERFACES 64
#ifndef WIN32
struct SkypiaxHandles {
Window skype_win;
Display *disp;
Window win;
int api_connected;
int fdesc[2];
};
#else //WIN32
struct SkypiaxHandles {
HWND win32_hInit_MainWindowHandle;
HWND win32_hGlobal_SkypeAPIWindowHandle;
HINSTANCE win32_hInit_ProcessHandle;
char win32_acInit_WindowClassName[128];
UINT win32_uiGlobal_MsgID_SkypeControlAPIAttach;
UINT win32_uiGlobal_MsgID_SkypeControlAPIDiscover;
int api_connected;
switch_file_t *fdesc[2];
};
#endif //WIN32
struct private_object {
unsigned int flags;
switch_codec_t read_codec;
switch_codec_t write_codec;
switch_frame_t read_frame;
unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
char session_uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
switch_caller_profile_t *caller_profile;
switch_mutex_t *mutex;
switch_mutex_t *flag_mutex;
char interface_id[80];
char name[80];
char dialplan[80];
char context[80];
char dial_regex[256];
char fail_dial_regex[256];
char hold_music[256];
char type[256];
char X11_display[256];
#ifdef WIN32
unsigned short tcp_cli_port;
unsigned short tcp_srv_port;
#else
int tcp_cli_port;
int tcp_srv_port;
#endif
struct SkypiaxHandles SkypiaxHandles;
int interface_state; /*!< \brief 'state' of the interface (channel) */
char language[80]; /*!< \brief default Asterisk dialplan language for this interface */
char exten[80]; /*!< \brief default Asterisk dialplan extension for this interface */
int skypiax_sound_rate; /*!< \brief rate of the sound device, in Hz, eg: 8000 */
char callid_name[50];
char callid_number[50];
double playback_boost;
double capture_boost;
int stripmsd;
char skype_call_id[512];
int skype_call_ongoing;
char skype_friends[4096];
char skype_fullname[512];
char skype_displayname[512];
int skype_callflow; /*!< \brief 'callflow' of the skype interface (as opposed to phone interface) */
int skype; /*!< \brief config flag, bool, Skype support on this interface (0 if false, -1 if true) */
int control_to_send;
#ifdef WIN32
switch_file_t *audiopipe[2];
switch_file_t *audioskypepipe[2];
switch_file_t *skypiax_sound_capt_fd; /*!< \brief file descriptor for sound capture dev */
#else /* WIN32 */
int audiopipe[2];
int audioskypepipe[2];
int skypiax_sound_capt_fd; /*!< \brief file descriptor for sound capture dev */
#endif /* WIN32 */
switch_thread_t *tcp_srv_thread;
switch_thread_t *tcp_cli_thread;
switch_thread_t *skypiax_signaling_thread;
switch_thread_t *skypiax_api_thread;
short audiobuf[SAMPLES_PER_FRAME];
int audiobuf_is_loaded;
//int phonebook_listing;
//int phonebook_querying;
//int phonebook_listing_received_calls;
//int phonebook_first_entry;
//int phonebook_last_entry;
//int phonebook_number_lenght;
//int phonebook_text_lenght;
FILE *phonebook_writing_fp;
int skypiax_dir_entry_extension_prefix;
char skype_user[256];
char skype_password[256];
char destination[256];
};
typedef struct private_object private_t;
void *SWITCH_THREAD_FUNC skypiax_api_thread_func(switch_thread_t * thread, void *obj);
void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t * session);
int skypiax_audio_read(private_t * tech_pvt);
int skypiax_audio_init(private_t * tech_pvt);
int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype);
int skypiax_signaling_read(private_t * tech_pvt);
int skypiax_call(private_t * tech_pvt, char *idest, int timeout);
int skypiax_senddigit(private_t * tech_pvt, char digit);
void *skypiax_do_tcp_srv_thread_func(void *obj);
void *SWITCH_THREAD_FUNC skypiax_do_tcp_srv_thread(switch_thread_t * thread, void *obj);
void *skypiax_do_tcp_cli_thread_func(void *obj);
void *SWITCH_THREAD_FUNC skypiax_do_tcp_cli_thread(switch_thread_t * thread, void *obj);
void *skypiax_do_skypeapi_thread_func(void *obj);
void *SWITCH_THREAD_FUNC skypiax_do_skypeapi_thread(switch_thread_t * thread, void *obj);
int dtmf_received(private_t * tech_pvt, char *value);
int start_audio_threads(private_t * tech_pvt);
int new_inbound_channel(private_t * tech_pvt);
int outbound_channel_answered(private_t * tech_pvt);
int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype);
#if defined(WIN32) && !defined(__CYGWIN__)
int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany);
int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany);
/* Visual C do not have strsep ? */
char *strsep(char **stringp, const char *delim);
#else
int skypiax_pipe_read(int pipe, short *buf, int howmany);
int skypiax_pipe_write(int pipe, short *buf, int howmany);
#endif /* WIN32 */
int skypiax_close_socket(unsigned int fd);
private_t *find_available_skypiax_interface(void);

File diff suppressed because it is too large Load Diff