skypiax: finishing off renaming to mod_skypopen

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16990 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Giovanni Maruzzelli 2010-03-14 23:36:14 +00:00
parent 0c1071b560
commit df18a0d499
4 changed files with 0 additions and 491 deletions

View File

@ -1,57 +0,0 @@
#######################################
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

@ -1 +0,0 @@
localhost

View File

@ -1,214 +0,0 @@
<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="interface1">
<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="5000"/>
</interface>
<interface id="2" name="interface2">
<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="interface3">
<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="interface4">
<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="interface5">
<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="interface6">
<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="interface7">
<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="interface8">
<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="interface9">
<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="interface10">
<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="interface11">
<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="interface12">
<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="interface13">
<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="interface14">
<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="interface15">
<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="interface16">
<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="interface17">
<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="interface18">
<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="interface19">
<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="interface20">
<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

@ -1,219 +0,0 @@
//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;
}