[Freeswitch-branches] [commit] r10940 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax
FreeSWITCH SVN
gmaruzz at freeswitch.org
Wed Dec 24 08:45:31 PST 2008
Author: gmaruzz
Date: Wed Dec 24 11:45:31 2008
New Revision: 10940
Log:
skypiax: beginning multiline on windows
Modified:
freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Wed Dec 24 11:45:31 2008
@@ -522,9 +522,70 @@
}
}
+int LaunchSkype2(void)
+{
+ PROCESS_INFORMATION pi;
+ STARTUPINFO si = {0};
+ struct skypiax_interface *p = NULL;
+ int ret=1;
+ int times=0;
+ LPTSTR pszMessage;
+ DWORD dwLastError;
+ ZeroMemory( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi) );
+
+ ShellExecute(NULL, "open", "C:\\Program Files\\Skype\\Phone\\Skype.exe", "/secondary /username:skypiax3 /password:xxx", ".", SW_SHOWNORMAL);
+ switch_sleep(1000000);
+ ShellExecute(NULL, "open", "C:\\Program Files\\Skype\\Phone\\Skype.exe", "/secondary /username:skypiax4 /password:xxx", ".", SW_SHOWNORMAL);
+
+#if 0
+
+ CreateProcess( "C:\\Program Files\\Skype\\Phone\\Skype.exe",
+ "/secondary /username:skypiax4 /password:xxx", // Command line.
+ NULL, // Process handle not inheritable.
+ NULL, // Thread handle not inheritable.
+ FALSE, // Set handle inheritance to FALSE.
+ NORMAL_PRIORITY_CLASS, // No creation flags.
+ NULL, // Use parent's environment block.
+ NULL, // Use parent's starting directory.
+ &si, // Pointer to STARTUPINFO structure.
+ &pi // Pointer to PROCESS_INFORMATION structure.
+ );
+#endif
+
+ dwLastError = GetLastError();
+
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ dwLastError,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR)&pszMessage,
+ 0, NULL );
+
+ NOTICA("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA %s\n", SKYPIAX_P_LOG,pszMessage);
+ LocalFree(pszMessage);
+#if 0
+ switch_sleep(10000000);
+
+ while(ret){
+ ret = EnumWindows(&EnumWindowsProc, pi.dwThreadId);
+ switch_sleep(10000);
+ times++;
+ if (times == 1000)
+ break;
+ }
+ NOTICA("HWND=%p\n", SKYPIAX_P_LOG, win32_hGlobal_SkypeAPIWindowHandle);
+#endif
+ return 1;
+
+}
int LaunchSkype(void)
{
@@ -533,22 +594,50 @@
struct skypiax_interface *p = NULL;
int ret=1;
int times=0;
+ LPTSTR pszMessage;
+ DWORD dwLastError;
-
+ ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi) );
+
+ ShellExecute(NULL, "open", "C:\\Program Files\\Skype\\Phone\\Skype.exe", "/secondary /username:skypiax5 /password:xxx", ".", SW_SHOWNORMAL);
+
+#if 0
CreateProcess( "C:\\Program Files\\Skype\\Phone\\Skype.exe",
- "/secondary /username:skypiax4 /password:", // Command line.
+ "/secondary /username:skypiax5 /password:xxx", // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
- NORMAL_PRIORITY_CLASS, // No creation flags.
+ 0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi // Pointer to PROCESS_INFORMATION structure.
);
+#endif
+
+ dwLastError = GetLastError();
+
+ FormatMessage(
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ dwLastError,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR)&pszMessage,
+ 0, NULL );
+
+ // Display the error message and exit the process
+
+
+ NOTICA("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA %s\n", SKYPIAX_P_LOG,pszMessage);
+ LocalFree(pszMessage);
+#if 0
+ switch_sleep(10000000);
while(ret){
ret = EnumWindows(&EnumWindowsProc, pi.dwThreadId);
@@ -558,6 +647,7 @@
break;
}
NOTICA("HWND=%p\n", SKYPIAX_P_LOG, win32_hGlobal_SkypeAPIWindowHandle);
+#endif
return 1;
}
@@ -643,16 +733,13 @@
if (uiMessage == win32_uiGlobal_MsgID_SkypeControlAPIAttach) {
switch (ulParam) {
case SKYPECONTROLAPI_ATTACH_SUCCESS:
- NOTICA(" OK, we have to find the subwindow, or something like HWND=%p\n", SKYPIAX_P_LOG, win32_hGlobal_SkypeAPIWindowHandle);
NOTICA("\n\n\tConnected to Skype API!\n", SKYPIAX_P_LOG);
win32_hGlobal_SkypeAPIWindowHandle = (HWND) uiParam;
- NOTICA(" OK, we have to find the subwindow, or something like HWND=%p\n", SKYPIAX_P_LOG, win32_hGlobal_SkypeAPIWindowHandle);
switch_sleep(5000);
win32_AsteriskHandlesSkype->win32_hGlobal_SkypeAPIWindowHandle =
win32_hGlobal_SkypeAPIWindowHandle;
break;
case SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION:
- NOTICA("HWND=%u\n", SKYPIAX_P_LOG, win32_hGlobal_SkypeAPIWindowHandle);
WARNINGA
("\n\n\tIf I do not immediately connect to Skype API,\n\tplease give the Skype client authorization to be connected \n\tby Asterisk and to not ask you again.\n\n",
SKYPIAX_P_LOG);
@@ -666,11 +753,9 @@
case SKYPECONTROLAPI_ATTACH_API_AVAILABLE:
DEBUGA_SKYPE("Skype API available\n", SKYPIAX_P_LOG);
- NOTICA("HWND=%u\n", SKYPIAX_P_LOG, win32_hGlobal_SkypeAPIWindowHandle);
SendMessage
(HWND_BROADCAST, win32_uiGlobal_MsgID_SkypeControlAPIDiscover,
(WPARAM) win32_hInit_MainWindowHandle, 0);
- NOTICA("HWND=%u\n", SKYPIAX_P_LOG, win32_hGlobal_SkypeAPIWindowHandle);
break;
default:
WARNINGA("GOT AN UNKNOWN SKYPE WINDOWS MSG\n", SKYPIAX_P_LOG);
@@ -765,9 +850,7 @@
//DWORD MsgWaitResult;
p = obj;
- LaunchSkype();
- NOTICA("HWND=%u\n", SKYPIAX_P_LOG, win32_hGlobal_SkypeAPIWindowHandle);
switch_file_pipe_create(&p->AsteriskHandlesAst.fdesc[0], &p->AsteriskHandlesAst.fdesc[1], skypiax_module_pool);
//switch_file_pipe_timeout_set(p->AsteriskHandlesAst.fdesc[0], 100);
@@ -779,13 +862,23 @@
win32_uiGlobal_MsgID_SkypeControlAPIDiscover =
RegisterWindowMessage("SkypeControlAPIDiscover");
+ LaunchSkype();
+ switch_sleep(1000000);
+ LaunchSkype2();
+ switch_sleep(1000000);
+
if (win32_uiGlobal_MsgID_SkypeControlAPIAttach != 0
&& win32_uiGlobal_MsgID_SkypeControlAPIDiscover != 0) {
if (win32_Initialize_CreateWindowClass()) {
if (win32_Initialize_CreateMainWindow()) {
+#if 1
if (SendMessage
(HWND_BROADCAST, win32_uiGlobal_MsgID_SkypeControlAPIDiscover,
(WPARAM) win32_hInit_MainWindowHandle, 0) != 0) {
+#else
+
+ if (1) {
+#endif
win32_AsteriskHandlesSkype->win32_hInit_MainWindowHandle =
win32_hInit_MainWindowHandle;
while (1) {
@@ -1158,7 +1251,8 @@
memset(messaggio_2, 0, 4096);
rt = 1;
- if (rt > 0) {
+ //if (rt > 0) {
+ if (p->AsteriskHandlesAst.fdesc[0]) {
howmany = sizeof(read_from_pipe);
switch_file_read(p->AsteriskHandlesAst.fdesc[0], read_from_pipe, &howmany);
More information about the Freeswitch-branches
mailing list