freeswitch-branches
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- 1655 discussions
[Freeswitch-branches] [commit] r12015 - freeswitch/branches/gmaruzz/mod_skypiax/asterisk
by FreeSWITCH SVN 14 Feb '09
by FreeSWITCH SVN 14 Feb '09
14 Feb '09
Author: gmaruzz
Date: Sat Feb 14 15:46:57 2009
New Revision: 12015
Log:
skypiax: * 1.6 changed CLI mechanism, so disable compilation of our CLIs for 1.6 until our CLIs updated. Works for 1.4 and 1.2
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/Makefile
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/Makefile
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/Makefile (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/Makefile Sat Feb 14 15:46:57 2009
@@ -21,7 +21,8 @@
#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/maruzz/devel/svn_celliax_trunk/asterisk-1.2.rev137401/include
+AST_INCLUDE_DIR=/home/user/devel/asterisk-1.6.0.5/include
#ASTERISK
CFLAGS+=-DASTERISK
@@ -29,8 +30,8 @@
#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
+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
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c Sat Feb 14 15:46:57 2009
@@ -130,6 +130,23 @@
*/
struct skypiax_pvt *skypiax_iflist = NULL;
+#ifdef ASTERISK_VERSION_1_6
+struct ast_cli_entry myclis[] = {
+/*
+ * CLI do not works since some time on 1.6, they changed the CLI mechanism
+ */
+#if 0
+ AST_CLI_DEFINE(skypiax_console_hangup, "Hangup a call on the console"),
+ AST_CLI_DEFINE(skypiax_console_dial, "Dial an extension on the console"),
+ AST_CLI_DEFINE(skypiax_console_playback_boost, "Sets/displays spk boost in dB"),
+ AST_CLI_DEFINE(skypiax_console_capture_boost, "Sets/displays mic boost in dB"),
+ AST_CLI_DEFINE(skypiax_console_set_active, "Sets/displays active console"),
+ AST_CLI_DEFINE(skypiax_console_skype, "Sends a Skype command"),
+ AST_CLI_DEFINE(skypiax_console_skypiax_dir_import, "imports entries from cellphone"),
+ AST_CLI_DEFINE(skypiax_console_skypiax, "all things skypiax"),
+ #endif
+};
+#else
struct ast_cli_entry myclis[] = {
{{"skypiax_hangup", NULL}, skypiax_console_hangup,
"Hangup a call on the skypiax_console",
@@ -152,6 +169,7 @@
"Write the directoriax.conf file, used by directoriax app",
skypiax_console_skypiax_dir_import_usage},
};
+#endif
/* IMPLEMENTATION */
1
0
[Freeswitch-branches] [commit] r11927 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk configs
by FreeSWITCH SVN 12 Feb '09
by FreeSWITCH SVN 12 Feb '09
12 Feb '09
Author: gmaruzz
Date: Thu Feb 12 09:17:24 2009
New Revision: 11927
Log:
skypiax: indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/cyg_no_pthread_kill.c
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax_auth.c
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c Thu Feb 12 09:17:24 2009
@@ -300,22 +300,21 @@
/* make a pointer to the first interface in the interfaces list */
p = skypiax_iflist;
-
if (strncmp("ANY", name, 3) == 0) {
- /* we've been asked for the "ANY" interface, let's find the first idle interface */
- DEBUGA_SKYPE("Finding one available skype interface\n", SKYPIAX_P_LOG);
- p = find_available_skypiax_interface();
- if (p){
- found = 1;
-
- /* create a new channel owning this interface */
- tmp = skypiax_new(p, SKYPIAX_STATE_DOWN, p->context);
- if (!tmp) {
- /* the channel was not created, probable memory allocation error */
- *cause = AST_CAUSE_SWITCH_CONGESTION;
- }
+ /* we've been asked for the "ANY" interface, let's find the first idle interface */
+ DEBUGA_SKYPE("Finding one available skype interface\n", SKYPIAX_P_LOG);
+ p = find_available_skypiax_interface();
+ if (p) {
+ found = 1;
+
+ /* create a new channel owning this interface */
+ tmp = skypiax_new(p, SKYPIAX_STATE_DOWN, p->context);
+ if (!tmp) {
+ /* the channel was not created, probable memory allocation error */
+ *cause = AST_CAUSE_SWITCH_CONGESTION;
+ }
- }
+ }
}
@@ -586,13 +585,13 @@
if ((c->_state != SKYPIAX_STATE_DOWN)
&& (c->_state != SKYPIAX_STATE_RESERVED)) {
- ERRORA("skypiax_originate_call called on %s, neither down nor reserved\n", SKYPIAX_P_LOG,
- c->name);
+ ERRORA("skypiax_originate_call called on %s, neither down nor reserved\n",
+ SKYPIAX_P_LOG, c->name);
return -1;
}
- DEBUGA_PBX("skypiax_originate_call to call idest: %s, timeout: %d!\n", SKYPIAX_P_LOG, idest,
- timeout);
+ DEBUGA_PBX("skypiax_originate_call to call idest: %s, timeout: %d!\n", SKYPIAX_P_LOG,
+ idest, timeout);
strncpy(rdest, idest, sizeof(rdest) - 1);
stringp = rdest;
@@ -605,8 +604,8 @@
}
strncpy(dstr, where + p->stripmsd, sizeof(dstr) - 1);
- DEBUGA_PBX("skypiax_originate_call dialing idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
- idest, timeout, dstr);
+ DEBUGA_PBX("skypiax_originate_call dialing idest: %s, timeout: %d, dstr: %s!\n",
+ SKYPIAX_P_LOG, idest, timeout, dstr);
strcpy(p->session_uuid_str, "dialing");
status = skypiax_call(p, dstr, timeout);
@@ -615,8 +614,8 @@
return -1;
}
- DEBUGA_PBX("skypiax_originate_call dialed idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
- idest, timeout, dstr);
+ DEBUGA_PBX("skypiax_originate_call dialed idest: %s, timeout: %d, dstr: %s!\n",
+ SKYPIAX_P_LOG, idest, timeout, dstr);
ast_setstate(p->owner, SKYPIAX_STATE_DIALING);
return 0;
@@ -1926,8 +1925,7 @@
return RESULT_SHOWUSAGE;
}
if (!p) {
- ast_cli(fd,
- "No \"current\" console for skypiax_, please enter 'help console'\n");
+ ast_cli(fd, "No \"current\" console for skypiax_, please enter 'help console'\n");
return RESULT_SUCCESS;
}
if (!p->skype) {
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/cyg_no_pthread_kill.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/cyg_no_pthread_kill.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/cyg_no_pthread_kill.c Thu Feb 12 09:17:24 2009
@@ -4,11 +4,14 @@
extern int option_debug;
int cyg_no_pthreadkill(int thread, int sig);
-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;
- }
+ 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;
+}
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h Thu Feb 12 09:17:24 2009
@@ -322,8 +322,7 @@
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_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 */
Modified: freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax_auth.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax_auth.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax_auth.c Thu Feb 12 09:17:24 2009
@@ -15,14 +15,15 @@
XErrorHandler old_handler = 0;
int xerror = 0;
- char *dispname;
+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);
+ printf("\n\nReceived error code %d from X Server on display '%s'\n\n", xerror,
+ dispname);
return 0; /* ignore the error */
}
@@ -38,9 +39,7 @@
return (xerror != BadValue) && (xerror != BadWindow);
}
-
-int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles,
- const char *message_P)
+int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P)
{
Window w_P;
@@ -58,7 +57,6 @@
unsigned int len = strlen(message_P);
XEvent e;
-
memset(&e, 0, sizeof(e));
e.xclient.type = ClientMessage;
e.xclient.message_type = atom1; /* leading message */
@@ -83,7 +81,6 @@
if (!ok)
printf("Sending message failed with status %d\n", xerror);
-
return 1;
}
@@ -114,7 +111,7 @@
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);
+ (unsigned int) SkypiaxHandles->skype_win);
return 1;
}
@@ -143,10 +140,10 @@
Window root = -1;
Window win = -1;
- if(argc==2)
- dispname=argv[1];
+ if (argc == 2)
+ dispname = argv[1];
else
- dispname=":0.0";
+ dispname = ":0.0";
disp = XOpenDisplay(dispname);
if (!disp) {
@@ -172,13 +169,15 @@
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");
+ 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");
+ printf
+ ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
return -1;
}
@@ -221,9 +220,11 @@
}
}
} 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;
+ 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;
+ return 0;
}
Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Thu Feb 12 09:17:24 2009
@@ -883,11 +883,9 @@
NOTICA("STARTING interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
switch_threadattr_create(&skypiax_api_thread_attr, skypiax_module_pool);
- switch_threadattr_stacksize_set(skypiax_api_thread_attr,
- SWITCH_THREAD_STACKSIZE);
- switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id].
- skypiax_api_thread, skypiax_api_thread_attr,
- skypiax_do_skypeapi_thread,
+ switch_threadattr_stacksize_set(skypiax_api_thread_attr, SWITCH_THREAD_STACKSIZE);
+ switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread,
+ skypiax_api_thread_attr, skypiax_do_skypeapi_thread,
&globals.SKYPIAX_INTERFACES[interface_id],
skypiax_module_pool);
@@ -1002,7 +1000,9 @@
if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
#ifdef WIN32
if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) { // let's the skypiax_api_thread_func die
- DEBUGA_SKYPE("got FALSE here, thread probably was already dead. GetLastError returned: %d\n", SKYPIAX_P_LOG, GetLastError());
+ DEBUGA_SKYPE
+ ("got FALSE here, thread probably was already dead. GetLastError returned: %d\n",
+ SKYPIAX_P_LOG, GetLastError());
}
#else
XEvent e;
@@ -1032,8 +1032,7 @@
}
if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
switch_thread_join(&status,
- globals.SKYPIAX_INTERFACES[interface_id].
- skypiax_api_thread);
+ globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread);
}
}
return SWITCH_STATUS_SUCCESS;
@@ -1164,7 +1163,7 @@
private_t *find_available_skypiax_interface(void)
{
- private_t *tech_pvt=NULL;
+ private_t *tech_pvt = NULL;
int found = 0;
int i;
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h Thu Feb 12 09:17:24 2009
@@ -234,8 +234,7 @@
typedef struct private_object private_t;
-void *SWITCH_THREAD_FUNC skypiax_api_thread_func(switch_thread_t * thread,
- void *obj);
+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);
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Thu Feb 12 09:17:24 2009
@@ -898,7 +898,7 @@
}
LRESULT APIENTRY skypiax_present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
- LPARAM ulParam)
+ LPARAM ulParam)
{
LRESULT lReturnCode;
int fIssueDefProc;
@@ -1141,8 +1141,7 @@
return (xerror != BadValue) && (xerror != BadWindow);
}
-int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles,
- const char *message_P)
+int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P)
{
Window w_P;
1
0
[Freeswitch-branches] [commit] r11926 - freeswitch/branches/gmaruzz/mod_skypiax/configs
by FreeSWITCH SVN 12 Feb '09
by FreeSWITCH SVN 12 Feb '09
12 Feb '09
Author: gmaruzz
Date: Thu Feb 12 09:10:40 2009
New Revision: 11926
Log:
skypiax: cleaning
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax_auth.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax_auth.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax_auth.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax_auth.c Thu Feb 12 09:10:40 2009
@@ -39,7 +39,7 @@
}
-int skypiax_skype_send_message(struct SkypiaxHandles *SkypiaxHandles,
+int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles,
const char *message_P)
{
@@ -87,7 +87,7 @@
return 1;
}
-int skypiax_skype_present(struct SkypiaxHandles *SkypiaxHandles)
+int skypiax_present(struct SkypiaxHandles *SkypiaxHandles)
{
Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
@@ -118,7 +118,7 @@
return 1;
}
-void skypiax_skype_clean_disp(void *data)
+void skypiax_clean_disp(void *data)
{
int *dispptr;
@@ -159,7 +159,7 @@
SkypiaxHandles.disp = disp;
- if (skypiax_skype_present(&SkypiaxHandles)) {
+ if (skypiax_present(&SkypiaxHandles)) {
root = DefaultRootWindow(disp);
win =
XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0,
@@ -171,13 +171,13 @@
snprintf(buf, 512, "NAME skypiax");
- if (!skypiax_skype_send_message(&SkypiaxHandles, buf)) {
+ 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_skype_send_message(&SkypiaxHandles, buf)) {
+ 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;
}
1
0
[Freeswitch-branches] [commit] r11924 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk
by FreeSWITCH SVN 12 Feb '09
by FreeSWITCH SVN 12 Feb '09
12 Feb '09
Author: gmaruzz
Date: Thu Feb 12 09:03:56 2009
New Revision: 11924
Log:
skypiax: cleaning
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c Thu Feb 12 09:03:56 2009
@@ -86,16 +86,16 @@
.hangup = skypiax_hangup,
.answer = skypiax_answer,
.read = skypiax_read,
- .call = skypiax_call,
+ .call = skypiax_originate_call,
.write = skypiax_write,
.indicate = skypiax_indicate,
.fixup = skypiax_fixup,
.devicestate = skypiax_devicestate,
#ifdef ASTERISK_VERSION_1_4
- .send_digit_begin = skypiax_senddigit_begin,
- .send_digit_end = skypiax_senddigit_end,
+ .send_digit_begin = skypiax_digitsend_begin,
+ .send_digit_end = skypiax_digitsend_end,
#else /* ASTERISK_VERSION_1_4 */
- .send_digit = skypiax_senddigit,
+ .send_digit = skypiax_digitsend,
#endif /* ASTERISK_VERSION_1_4 */
};
@@ -472,7 +472,7 @@
}
#ifdef ASTERISK_VERSION_1_4
-int skypiax_senddigit_begin(struct ast_channel *c, char digit)
+int skypiax_digitsend_begin(struct ast_channel *c, char digit)
{
struct skypiax_pvt *p = c->tech_pvt;
@@ -481,7 +481,7 @@
return 0;
}
-int skypiax_senddigit_end(struct ast_channel *c, char digit, unsigned int duration)
+int skypiax_digitsend_end(struct ast_channel *c, char digit, unsigned int duration)
{
struct skypiax_pvt *p = c->tech_pvt;
char msg_to_skype[1024];
@@ -495,7 +495,7 @@
return 0;
}
#else /* ASTERISK_VERSION_1_4 */
-int skypiax_senddigit(struct ast_channel *c, char digit)
+int skypiax_digitsend(struct ast_channel *c, char digit)
{
struct skypiax_pvt *p = c->tech_pvt;
char msg_to_skype[1024];
@@ -576,7 +576,7 @@
/*! \brief Initiate skypiax call from PBX
* used from the dial() application
*/
-int skypiax_call(struct ast_channel *c, char *idest, int timeout)
+int skypiax_originate_call(struct ast_channel *c, char *idest, int timeout)
{
struct skypiax_pvt *p = NULL;
p = c->tech_pvt;
@@ -586,12 +586,12 @@
if ((c->_state != SKYPIAX_STATE_DOWN)
&& (c->_state != SKYPIAX_STATE_RESERVED)) {
- ERRORA("skypiax_call called on %s, neither down nor reserved\n", SKYPIAX_P_LOG,
+ ERRORA("skypiax_originate_call called on %s, neither down nor reserved\n", SKYPIAX_P_LOG,
c->name);
return -1;
}
- DEBUGA_PBX("skypiax_call to call idest: %s, timeout: %d!\n", SKYPIAX_P_LOG, idest,
+ DEBUGA_PBX("skypiax_originate_call to call idest: %s, timeout: %d!\n", SKYPIAX_P_LOG, idest,
timeout);
strncpy(rdest, idest, sizeof(rdest) - 1);
@@ -605,17 +605,17 @@
}
strncpy(dstr, where + p->stripmsd, sizeof(dstr) - 1);
- DEBUGA_PBX("skypiax_call dialing idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
+ DEBUGA_PBX("skypiax_originate_call dialing idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
idest, timeout, dstr);
strcpy(p->session_uuid_str, "dialing");
- status = skypiax__call(p, dstr, timeout);
+ status = skypiax_call(p, dstr, timeout);
if (status) {
- WARNINGA("skypiax_call dialing failed: %d!\n", SKYPIAX_P_LOG, status);
+ WARNINGA("skypiax_originate_call dialing failed: %d!\n", SKYPIAX_P_LOG, status);
return -1;
}
- DEBUGA_PBX("skypiax_call dialed idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
+ DEBUGA_PBX("skypiax_originate_call dialed idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
idest, timeout, dstr);
ast_setstate(p->owner, SKYPIAX_STATE_DIALING);
@@ -813,7 +813,7 @@
ast_log(LOG_ERROR, "Not initialized XInitThreads!\n");
#endif /* __CYGWIN__ */
#if 0
- ast_register_atexit(skypiax__disconnect);
+ ast_register_atexit(skypiax_disconnect);
ast_register_application(skype2skypiaxapp, skype2skypiax, skype2skypiaxsynopsis,
skype2skypiaxdescrip);
ast_register_application(skypiax2skypeapp, skypiax2skype, skypiax2skypesynopsis,
@@ -927,7 +927,7 @@
//FIXME what to do? ast_log(LOG_ERROR, "Not initialized XInitThreads!\n");
#endif /* __CYGWIN__ */
#if 0
- ast_unregister_atexit(skypiax__disconnect);
+ ast_unregister_atexit(skypiax_disconnect);
ast_unregister_application(skype2skypiaxapp);
ast_unregister_application(skypiax2skypeapp);
#endif
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h Thu Feb 12 09:03:56 2009
@@ -316,16 +316,16 @@
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);
+//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,
+int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles,
const char *message_P);
-int skypiax__present(struct SkypiaxHandles *SkypiaxHandles);
-void skypiax__clean_disp(void *data);
+int skypiax_present(struct SkypiaxHandles *SkypiaxHandles);
+void skypiax_clean_disp(void *data);
#endif /* WANT_SKYPE_X11 */
#ifdef __CYGWIN__
@@ -345,7 +345,7 @@
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_call(struct ast_channel *c, char *idest, int timeout);
+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);
@@ -356,10 +356,10 @@
#endif
int skypiax_devicestate(void *data);
#ifdef ASTERISK_VERSION_1_4
-int skypiax_senddigit_begin(struct ast_channel *ast, char digit);
-int skypiax_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration);
+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_senddigit(struct ast_channel *ast, char digit);
+int skypiax_digitsend(struct ast_channel *ast, char digit);
#endif /* ASTERISK_VERSION_1_4 */
/* chan_skypiax internal functions */
@@ -392,7 +392,7 @@
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_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);
@@ -402,7 +402,7 @@
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_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);
Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Thu Feb 12 09:03:56 2009
@@ -270,7 +270,7 @@
DEBUGA_SKYPE("DTMF: %c\n", SKYPIAX_P_LOG, dtmf->digit);
- skypiax__senddigit(tech_pvt, dtmf->digit);
+ skypiax_senddigit(tech_pvt, dtmf->digit);
return SWITCH_STATUS_SUCCESS;
}
@@ -562,7 +562,7 @@
rdest = strchr(caller_profile->destination_number, '/');
*rdest++ = '\0';
- skypiax__call(tech_pvt, rdest, 30);
+ skypiax_call(tech_pvt, rdest, 30);
switch_copy_string(tech_pvt->session_uuid_str,
switch_core_session_get_uuid(*new_session),
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h Thu Feb 12 09:03:56 2009
@@ -242,8 +242,8 @@
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);
+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);
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Thu Feb 12 09:03:56 2009
@@ -707,7 +707,7 @@
return 1;
}
-int skypiax__senddigit(private_t * tech_pvt, char digit)
+int skypiax_senddigit(private_t * tech_pvt, char digit)
{
char msg_to_skype[1024];
@@ -718,7 +718,7 @@
return 0;
}
-int skypiax__call(private_t * tech_pvt, char *rdest, int timeout)
+int skypiax_call(private_t * tech_pvt, char *rdest, int timeout)
{
char msg_to_skype[1024];
@@ -897,7 +897,7 @@
}
-LRESULT APIENTRY skypiax__present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
+LRESULT APIENTRY skypiax_present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
LPARAM ulParam)
{
LRESULT lReturnCode;
@@ -1016,7 +1016,7 @@
(char *) paucUUIDString);
oWindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
- oWindowClass.lpfnWndProc = (WNDPROC) & skypiax__present;
+ oWindowClass.lpfnWndProc = (WNDPROC) & skypiax_present;
oWindowClass.cbClsExtra = 0;
oWindowClass.cbWndExtra = 0;
oWindowClass.hInstance = tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle;
@@ -1141,7 +1141,7 @@
return (xerror != BadValue) && (xerror != BadWindow);
}
-int skypiax__send_message(struct SkypiaxHandles *SkypiaxHandles,
+int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles,
const char *message_P)
{
@@ -1197,7 +1197,7 @@
SkypiaxHandles = &tech_pvt->SkypiaxHandles;
- if (!skypiax__send_message(SkypiaxHandles, msg_to_skype)) {
+ if (!skypiax_send_message(SkypiaxHandles, msg_to_skype)) {
ERRORA
("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then restart Skype, then launch Skypiax and try again.\n",
SKYPIAX_P_LOG);
@@ -1208,7 +1208,7 @@
}
-int skypiax__present(struct SkypiaxHandles *SkypiaxHandles)
+int skypiax_present(struct SkypiaxHandles *SkypiaxHandles)
{
Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
@@ -1242,7 +1242,7 @@
return 1;
}
-void skypiax__clean_disp(void *data)
+void skypiax_clean_disp(void *data)
{
int *dispptr;
@@ -1303,7 +1303,7 @@
SkypiaxHandles->disp = disp;
- if (skypiax__present(SkypiaxHandles)) {
+ if (skypiax_present(SkypiaxHandles)) {
root = DefaultRootWindow(disp);
win =
XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0,
@@ -1315,7 +1315,7 @@
snprintf(buf, 512, "NAME skypiax");
- if (!skypiax__send_message(SkypiaxHandles, buf)) {
+ if (!skypiax_send_message(SkypiaxHandles, buf)) {
ERRORA
("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n",
SKYPIAX_P_LOG);
@@ -1324,7 +1324,7 @@
}
snprintf(buf, 512, "PROTOCOL 7");
- if (!skypiax__send_message(SkypiaxHandles, buf)) {
+ if (!skypiax_send_message(SkypiaxHandles, buf)) {
ERRORA
("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n",
SKYPIAX_P_LOG);
1
0
[Freeswitch-branches] [commit] r11923 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk
by FreeSWITCH SVN 12 Feb '09
by FreeSWITCH SVN 12 Feb '09
12 Feb '09
Author: gmaruzz
Date: Thu Feb 12 08:49:13 2009
New Revision: 11923
Log:
skypiax: cleaning
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c Thu Feb 12 08:49:13 2009
@@ -36,7 +36,7 @@
" chan_skypiax adds to Asterisk the following CLI commands:\n" " \n"
" CLI COMMANDS:\n" " skypiax_hangup\n" " skypiax_dial\n"
" skypiax_console\n" " skypiax_playback_boost\n"
- " skypiax_capture_boost\n" " skypiax_skype\n"
+ " skypiax_capture_boost\n" " skypiax_\n"
" skypiax_dir_import\n" "\n"
" You can type 'help [command]' to obtain more specific info on usage.\n"
" \n";
@@ -67,7 +67,7 @@
" If the parameter is \"show\", the available interfaces are listed\n";
char skypiax_console_skype_usage[] =
- "Usage: skypiax_skype [command string]\n"
+ "Usage: skypiax_ [command string]\n"
" Send the 'command string' skype_msg to the Skype client connected to the \"current\" skypiax_console (Skypiax) channel.\n"
" Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
@@ -140,7 +140,7 @@
skypiax_console_capture_boost_usage},
{{"skypiax_usage", NULL}, skypiax_console_skypiax, "chan_skypiax commands info",
skypiax_console_skypiax_usage},
- {{"skypiax_skype", NULL}, skypiax_console_skype, "Skype msg",
+ {{"skypiax_", NULL}, skypiax_console_skype, "Skype msg",
skypiax_console_skype_usage},
{{"skypiax_dial", NULL}, skypiax_console_dial,
"Dial an extension on the skypiax_console",
@@ -510,7 +510,7 @@
}
#endif /* ASTERISK_VERSION_1_4 */
-//struct ast_frame *skypiax_skypeaudio_read(struct skypiax_pvt *p)
+//struct ast_frame *skypiax_audio_read(struct skypiax_pvt *p)
//#define SAMPLES_PER_FRAME 160
/*! \brief Read audio frames from channel */
struct ast_frame *skypiax_read(struct ast_channel *c)
@@ -609,7 +609,7 @@
idest, timeout, dstr);
strcpy(p->session_uuid_str, "dialing");
- status = skypiax_skype_call(p, dstr, timeout);
+ status = skypiax__call(p, dstr, timeout);
if (status) {
WARNINGA("skypiax_call dialing failed: %d!\n", SKYPIAX_P_LOG, status);
return -1;
@@ -813,7 +813,7 @@
ast_log(LOG_ERROR, "Not initialized XInitThreads!\n");
#endif /* __CYGWIN__ */
#if 0
- ast_register_atexit(skypiax_skype_disconnect);
+ ast_register_atexit(skypiax__disconnect);
ast_register_application(skype2skypiaxapp, skype2skypiax, skype2skypiaxsynopsis,
skype2skypiaxdescrip);
ast_register_application(skypiax2skypeapp, skypiax2skype, skypiax2skypesynopsis,
@@ -927,7 +927,7 @@
//FIXME what to do? ast_log(LOG_ERROR, "Not initialized XInitThreads!\n");
#endif /* __CYGWIN__ */
#if 0
- ast_unregister_atexit(skypiax_skype_disconnect);
+ ast_unregister_atexit(skypiax__disconnect);
ast_unregister_application(skype2skypiaxapp);
ast_unregister_application(skypiax2skypeapp);
#endif
@@ -1509,7 +1509,7 @@
int skypiax_sound_init(struct skypiax_pvt *p)
{
- return skypiax_skypeaudio_init(p);
+ return skypiax_audio_init(p);
}
/*!
@@ -1535,7 +1535,7 @@
struct ast_frame *f = NULL;
int res;
- res = skypiax_skypeaudio_read(p);
+ res = skypiax_audio_read(p);
f = &p->read_frame;
return f;
}
@@ -1545,7 +1545,7 @@
{
int ret = -1;
- ret = skypiax_skypeaudio_write(p, f);
+ ret = skypiax_audio_write(p, f);
return ret;
}
@@ -1908,7 +1908,7 @@
return skypiax_do_tcp_cli_thread_func(obj);
}
-int skypiax_skypeaudio_write(struct skypiax_pvt *p, struct ast_frame *f)
+int skypiax_audio_write(struct skypiax_pvt *p, struct ast_frame *f)
{
int sent;
@@ -1927,7 +1927,7 @@
}
if (!p) {
ast_cli(fd,
- "No \"current\" console for skypiax_skype, please enter 'help console'\n");
+ "No \"current\" console for skypiax_, please enter 'help console'\n");
return RESULT_SUCCESS;
}
if (!p->skype) {
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h Thu Feb 12 08:49:13 2009
@@ -316,16 +316,16 @@
void *do_skypeapi_thread(void *data);
//int skypiax2skype(struct ast_channel *c, void *data);
//int skype2skypiax(struct ast_channel *c, void *data);
-//void skypiax_skype_disconnect(void);
+//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_skype_send_message(struct SkypiaxHandles *SkypiaxHandles,
+int skypiax__send_message(struct SkypiaxHandles *SkypiaxHandles,
const char *message_P);
-int skypiax_skype_present(struct SkypiaxHandles *SkypiaxHandles);
-void skypiax_skype_clean_disp(void *data);
+int skypiax__present(struct SkypiaxHandles *SkypiaxHandles);
+void skypiax__clean_disp(void *data);
#endif /* WANT_SKYPE_X11 */
#ifdef __CYGWIN__
@@ -386,13 +386,13 @@
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_skypeaudio_init(struct skypiax_pvt *p);
-//struct ast_frame *skypiax_skypeaudio_read(struct skypiax_pvt *p);
-int skypiax_skypeaudio_read(struct skypiax_pvt *p);
+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_skypeaudio_write(struct skypiax_pvt *p, struct ast_frame *f);
+int skypiax_audio_write(struct skypiax_pvt *p, struct ast_frame *f);
void *skypiax_do_tcp_cli_thread(void *data);
-int skypiax_skype_call(struct skypiax_pvt *p, char *idest, int timeout);
+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);
@@ -402,7 +402,7 @@
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_skype_senddigit(struct skypiax_pvt *p, char digit);
+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);
Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Thu Feb 12 08:49:13 2009
@@ -270,7 +270,7 @@
DEBUGA_SKYPE("DTMF: %c\n", SKYPIAX_P_LOG, dtmf->digit);
- skypiax_skype_senddigit(tech_pvt, dtmf->digit);
+ skypiax__senddigit(tech_pvt, dtmf->digit);
return SWITCH_STATUS_SUCCESS;
}
@@ -291,9 +291,9 @@
tech_pvt->read_frame.flags = SFF_NONE;
*frame = NULL;
- if (!skypiax_skypeaudio_read(tech_pvt)) {
+ if (!skypiax_audio_read(tech_pvt)) {
- ERRORA("skypiax_skypeaudio_read ERROR\n", SKYPIAX_P_LOG);
+ ERRORA("skypiax_audio_read ERROR\n", SKYPIAX_P_LOG);
} else {
switch_set_flag_locked(tech_pvt, TFLAG_VOICE);
@@ -562,7 +562,7 @@
rdest = strchr(caller_profile->destination_number, '/');
*rdest++ = '\0';
- skypiax_skype_call(tech_pvt, rdest, 30);
+ skypiax__call(tech_pvt, rdest, 30);
switch_copy_string(tech_pvt->session_uuid_str,
switch_core_session_get_uuid(*new_session),
@@ -813,7 +813,7 @@
if (interface_id && interface_id < SKYPIAX_MAX_INTERFACES) {
private_t newconf;
- switch_threadattr_t *skypiax_skypeapi_thread_attr = NULL;
+ switch_threadattr_t *skypiax_api_thread_attr = NULL;
switch_threadattr_t *skypiax_signaling_thread_attr = NULL;
memset(&newconf, '\0', sizeof(newconf));
@@ -882,11 +882,11 @@
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].context);
NOTICA("STARTING interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
- switch_threadattr_create(&skypiax_skypeapi_thread_attr, skypiax_module_pool);
- switch_threadattr_stacksize_set(skypiax_skypeapi_thread_attr,
+ switch_threadattr_create(&skypiax_api_thread_attr, skypiax_module_pool);
+ switch_threadattr_stacksize_set(skypiax_api_thread_attr,
SWITCH_THREAD_STACKSIZE);
switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id].
- skypiax_skypeapi_thread, skypiax_skypeapi_thread_attr,
+ skypiax_api_thread, skypiax_api_thread_attr,
skypiax_do_skypeapi_thread,
&globals.SKYPIAX_INTERFACES[interface_id],
skypiax_module_pool);
@@ -904,7 +904,7 @@
switch_sleep(100000);
- skypiax_skypeaudio_init(&globals.SKYPIAX_INTERFACES[interface_id]);
+ skypiax_audio_init(&globals.SKYPIAX_INTERFACES[interface_id]);
i = 0;
while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected == 0 && running && i < 60000) { // 60sec FIXME
@@ -999,9 +999,9 @@
#endif /* WIN32 */
}
- if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_skypeapi_thread) {
+ if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
#ifdef WIN32
- if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) { // let's the skypiax_skypeapi_thread_func die
+ if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) { // let's the skypiax_api_thread_func die
DEBUGA_SKYPE("got FALSE here, thread probably was already dead. GetLastError returned: %d\n", SKYPIAX_P_LOG, GetLastError());
}
#else
@@ -1030,10 +1030,10 @@
globals.SKYPIAX_INTERFACES[interface_id].
skypiax_signaling_thread);
}
- if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_skypeapi_thread) {
+ if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
switch_thread_join(&status,
globals.SKYPIAX_INTERFACES[interface_id].
- skypiax_skypeapi_thread);
+ skypiax_api_thread);
}
}
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h Thu Feb 12 08:49:13 2009
@@ -212,7 +212,7 @@
switch_thread_t *tcp_srv_thread;
switch_thread_t *tcp_cli_thread;
switch_thread_t *skypiax_signaling_thread;
- switch_thread_t *skypiax_skypeapi_thread;
+ switch_thread_t *skypiax_api_thread;
short audiobuf[SAMPLES_PER_FRAME];
int audiobuf_is_loaded;
@@ -234,16 +234,16 @@
typedef struct private_object private_t;
-void *SWITCH_THREAD_FUNC skypiax_skypeapi_thread_func(switch_thread_t * thread,
+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_skypeaudio_read(private_t * tech_pvt);
-int skypiax_skypeaudio_init(private_t * tech_pvt);
+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_skype_call(private_t * tech_pvt, char *idest, int timeout);
-int skypiax_skype_senddigit(private_t * tech_pvt, char digit);
+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);
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Thu Feb 12 08:49:13 2009
@@ -687,7 +687,7 @@
return NULL;
}
-int skypiax_skypeaudio_read(private_t * tech_pvt)
+int skypiax_audio_read(private_t * tech_pvt)
{
unsigned int samples;
@@ -707,7 +707,7 @@
return 1;
}
-int skypiax_skype_senddigit(private_t * tech_pvt, char digit)
+int skypiax__senddigit(private_t * tech_pvt, char digit)
{
char msg_to_skype[1024];
@@ -718,7 +718,7 @@
return 0;
}
-int skypiax_skype_call(private_t * tech_pvt, char *rdest, int timeout)
+int skypiax__call(private_t * tech_pvt, char *rdest, int timeout)
{
char msg_to_skype[1024];
@@ -774,7 +774,7 @@
return res;
}
-int skypiax_skypeaudio_init(private_t * tech_pvt)
+int skypiax_audio_init(private_t * tech_pvt)
{
switch_status_t rv;
rv =
@@ -805,7 +805,7 @@
return res;
}
-int skypiax_skypeaudio_init(private_t * tech_pvt)
+int skypiax_audio_init(private_t * tech_pvt)
{
if (pipe(tech_pvt->audiopipe)) {
fcntl(tech_pvt->audiopipe[0], F_SETFL, O_NONBLOCK);
@@ -897,7 +897,7 @@
}
-LRESULT APIENTRY skypiax_skype_present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
+LRESULT APIENTRY skypiax__present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
LPARAM ulParam)
{
LRESULT lReturnCode;
@@ -1016,7 +1016,7 @@
(char *) paucUUIDString);
oWindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
- oWindowClass.lpfnWndProc = (WNDPROC) & skypiax_skype_present;
+ oWindowClass.lpfnWndProc = (WNDPROC) & skypiax__present;
oWindowClass.cbClsExtra = 0;
oWindowClass.cbWndExtra = 0;
oWindowClass.hInstance = tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle;
@@ -1141,7 +1141,7 @@
return (xerror != BadValue) && (xerror != BadWindow);
}
-int skypiax_skype_send_message(struct SkypiaxHandles *SkypiaxHandles,
+int skypiax__send_message(struct SkypiaxHandles *SkypiaxHandles,
const char *message_P)
{
@@ -1197,7 +1197,7 @@
SkypiaxHandles = &tech_pvt->SkypiaxHandles;
- if (!skypiax_skype_send_message(SkypiaxHandles, msg_to_skype)) {
+ if (!skypiax__send_message(SkypiaxHandles, msg_to_skype)) {
ERRORA
("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then restart Skype, then launch Skypiax and try again.\n",
SKYPIAX_P_LOG);
@@ -1208,7 +1208,7 @@
}
-int skypiax_skype_present(struct SkypiaxHandles *SkypiaxHandles)
+int skypiax__present(struct SkypiaxHandles *SkypiaxHandles)
{
Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
@@ -1242,7 +1242,7 @@
return 1;
}
-void skypiax_skype_clean_disp(void *data)
+void skypiax__clean_disp(void *data)
{
int *dispptr;
@@ -1303,7 +1303,7 @@
SkypiaxHandles->disp = disp;
- if (skypiax_skype_present(SkypiaxHandles)) {
+ if (skypiax__present(SkypiaxHandles)) {
root = DefaultRootWindow(disp);
win =
XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0,
@@ -1315,7 +1315,7 @@
snprintf(buf, 512, "NAME skypiax");
- if (!skypiax_skype_send_message(SkypiaxHandles, buf)) {
+ if (!skypiax__send_message(SkypiaxHandles, buf)) {
ERRORA
("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n",
SKYPIAX_P_LOG);
@@ -1324,7 +1324,7 @@
}
snprintf(buf, 512, "PROTOCOL 7");
- if (!skypiax_skype_send_message(SkypiaxHandles, buf)) {
+ if (!skypiax__send_message(SkypiaxHandles, buf)) {
ERRORA
("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n",
SKYPIAX_P_LOG);
1
0
[Freeswitch-branches] [commit] r11922 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk configs
by FreeSWITCH SVN 12 Feb '09
by FreeSWITCH SVN 12 Feb '09
12 Feb '09
Author: gmaruzz
Date: Thu Feb 12 08:46:51 2009
New Revision: 11922
Log:
skypiax: cleaning
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax.conf.xml
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c Thu Feb 12 08:46:51 2009
@@ -385,7 +385,7 @@
DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPIAX_P_LOG, p->skype_call_id);
//sprintf(msg_to_skype, "SET CALL %s STATUS FINISHED", p->skype_call_id);
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", p->skype_call_id);
- skypiax_skype_write(p, msg_to_skype);
+ skypiax_signaling_write(p, msg_to_skype);
}
while (p->interface_state != SKYPIAX_STATE_DOWN) {
@@ -490,7 +490,7 @@
sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
- skypiax_skype_write(p, msg_to_skype);
+ skypiax_signaling_write(p, msg_to_skype);
return 0;
}
@@ -504,7 +504,7 @@
sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
- skypiax_skype_write(p, msg_to_skype);
+ skypiax_signaling_write(p, msg_to_skype);
return 0;
}
@@ -1477,7 +1477,7 @@
if (p->skype) {
if (FD_ISSET(p->SkypiaxHandles.fdesc[0], &rfds)) {
- res = skypiax_skype_read(p);
+ res = skypiax_signaling_read(p);
if (res == CALLFLOW_INCOMING_CALLID || res == CALLFLOW_INCOMING_RING) {
//ast_log(LOG_NOTICE, "CALLFLOW_INCOMING_RING SKYPE\n");
DEBUGA_SKYPE("CALLFLOW_INCOMING_RING\n", SKYPIAX_P_LOG);
@@ -1569,7 +1569,7 @@
usleep(1000);
pthread_testcancel();
if (p->skype) {
- res = skypiax_skype_read(p);
+ res = skypiax_signaling_read(p);
if (res == CALLFLOW_INCOMING_HANGUP) {
DEBUGA_SKYPE("skype call ended\n", SKYPIAX_P_LOG);
if (p->owner) {
@@ -1951,7 +1951,7 @@
if (c == 1023)
break;
}
- skypiax_skype_write(p, skype_msg);
+ skypiax_signaling_write(p, skype_msg);
return RESULT_SUCCESS;
}
@@ -2074,7 +2074,7 @@
p->skype_friends[0] = '\0';
sprintf(msg_to_skype, "#333 SEARCH FRIENDS");
- if (skypiax_skype_write(p, msg_to_skype) < 0) {
+ if (skypiax_signaling_write(p, msg_to_skype) < 0) {
return -1;
}
@@ -2116,7 +2116,7 @@
p->skype_displayname[0] = '\0';
sprintf(msg_to_skype, "#765 GET USER %s DISPLAYNAME", where);
- skypiax_skype_write(p, msg_to_skype);
+ skypiax_signaling_write(p, msg_to_skype);
int displayname_count = 0;
while (p->skype_displayname[0] == '\0') {
/* FIXME needs a timeout, can't wait forever!
@@ -2198,7 +2198,7 @@
p->skype_fullname[0] = '\0';
sprintf(msg_to_skype, "#222 GET USER %s FULLNAME", where);
- skypiax_skype_write(p, msg_to_skype);
+ skypiax_signaling_write(p, msg_to_skype);
int fullname_count = 0;
while (p->skype_fullname[0] == '\0') {
/* FIXME needs a timeout, can't wait forever!
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h Thu Feb 12 08:46:51 2009
@@ -317,8 +317,8 @@
//int skypiax2skype(struct ast_channel *c, void *data);
//int skype2skypiax(struct ast_channel *c, void *data);
//void skypiax_skype_disconnect(void);
-int skypiax_skype_write(struct skypiax_pvt *p, char *msg_to_skype);
-int skypiax_skype_read(struct skypiax_pvt *p);
+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);
@@ -403,7 +403,7 @@
int new_inbound_channel(private_t * tech_pvt);
int outbound_channel_answered(private_t * tech_pvt);
int skypiax_skype_senddigit(struct skypiax_pvt *p, char digit);
-int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype);
+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);
Modified: freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax.conf.xml
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax.conf.xml (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax.conf.xml Thu Feb 12 08:46:51 2009
@@ -4,7 +4,6 @@
<param name="codec-master" value="us"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
- <param name="destination" value="5000"/>
<param name="codec-prefs" value="gsm,ulaw"/>
<param name="codec-rates" value="8000,16000"/>
<param name="hold-music" value="$${moh_uri}"/>
@@ -19,6 +18,7 @@
<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}"/>
@@ -28,6 +28,7 @@
<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">
Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Thu Feb 12 08:46:51 2009
@@ -161,7 +161,7 @@
//switch_thread_cond_signal(tech_pvt->cond);
DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id);
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
}
if (tech_pvt->read_codec.implementation) {
@@ -580,7 +580,7 @@
}
/*!
- * \brief This thread runs during a call, and monitor the interface serial port for signaling, like hangup, caller id, etc
+ * \brief This thread runs during a call, and monitor the interface for signaling, like hangup, caller id, etc most of signaling is handled inside the skypiax_signaling_read function
*
*/
static void *SWITCH_THREAD_FUNC skypiax_signaling_thread_func(switch_thread_t * thread,
@@ -596,7 +596,7 @@
while (forever) {
if (!running)
break;
- res = skypiax_skype_read(tech_pvt);
+ res = skypiax_signaling_read(tech_pvt);
if (res == CALLFLOW_INCOMING_HANGUP) {
switch_core_session_t *session = NULL;
//private_t *tech_pvt = NULL;
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h Thu Feb 12 08:46:51 2009
@@ -164,7 +164,6 @@
switch_caller_profile_t *caller_profile;
switch_mutex_t *mutex;
switch_mutex_t *flag_mutex;
- //switch_thread_cond_t *cond;
char interface_id[80];
char name[80];
@@ -240,8 +239,8 @@
void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t * session);
int skypiax_skypeaudio_read(private_t * tech_pvt);
int skypiax_skypeaudio_init(private_t * tech_pvt);
-int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype);
-int skypiax_skype_read(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_skype_call(private_t * tech_pvt, char *idest, int timeout);
int skypiax_skype_senddigit(private_t * tech_pvt, char digit);
@@ -258,7 +257,7 @@
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_skype_write(private_t * tech_pvt, char *msg_to_skype);
+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);
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Thu Feb 12 08:46:51 2009
@@ -23,7 +23,7 @@
#endif /* WIN32 */
/*************************************/
-int skypiax_skype_read(private_t * tech_pvt)
+int skypiax_signaling_read(private_t * tech_pvt)
{
char read_from_pipe[4096];
char message[4096];
@@ -56,7 +56,7 @@
("If I don't connect immediately, please give the Skype client authorization to be connected by Skypiax (and to not ask you again)\n",
SKYPIAX_P_LOG);
skypiax_sleep(1000000);
- skypiax_skype_write(tech_pvt, "PROTOCOL 7");
+ skypiax_signaling_write(tech_pvt, "PROTOCOL 7");
skypiax_sleep(10000);
return 0;
}
@@ -118,7 +118,7 @@
SKYPIAX_P_LOG, message, obj, id, prop);
//TODO: allow authorization based on config param
sprintf(msg_to_skype, "SET USER %s ISAUTHORIZED TRUE", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
}
}
if (!strcasecmp(message, "MESSAGE")) {
@@ -136,7 +136,7 @@
SKYPIAX_P_LOG, message, obj, id, prop, value);
//TODO: authomatically flag messages as read based on config param
sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
}
} else if (!strcasecmp(prop, "BODY")) {
char msg_to_skype[256];
@@ -144,7 +144,7 @@
SKYPIAX_P_LOG, message, obj, id, prop);
//TODO: authomatically flag messages as read based on config param
sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
}
}
if (!strcasecmp(message, "CALL")) {
@@ -213,18 +213,18 @@
tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
tech_pvt->interface_state = SKYPIAX_STATE_RING;
/* no owner, no active call, let's answer */
- skypiax_skype_write(tech_pvt, "SET AGC OFF");
+ skypiax_signaling_write(tech_pvt, "SET AGC OFF");
skypiax_sleep(10000);
- skypiax_skype_write(tech_pvt, "SET AEC OFF");
+ skypiax_signaling_write(tech_pvt, "SET AEC OFF");
skypiax_sleep(10000);
sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
skypiax_sleep(10000);
sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
skypiax_sleep(10000);
sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG,
id);
strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
@@ -254,7 +254,7 @@
SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
}
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
skypiax_sleep(10000);
DEBUGA_SKYPE
("We (%s) have NOT answered a Skype RING on skype_call %s, because we are already in a skypiax call\n",
@@ -348,11 +348,11 @@
DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
tech_pvt->tcp_cli_port);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
start_audio_threads(tech_pvt);
sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
tech_pvt->tcp_srv_port);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
if (!strlen(tech_pvt->session_uuid_str)) {
DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
@@ -713,7 +713,7 @@
DEBUGA_SKYPE("DIGIT received: %c\n", SKYPIAX_P_LOG, digit);
sprintf(msg_to_skype, "SET CALL %s DTMF %c", tech_pvt->skype_call_id, digit);
- skypiax_skype_write(tech_pvt, msg_to_skype);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
return 0;
}
@@ -724,13 +724,13 @@
skypiax_sleep(5000);
DEBUGA_SKYPE("Calling Skype, rdest is: %s\n", SKYPIAX_P_LOG, rdest);
- skypiax_skype_write(tech_pvt, "SET AGC OFF");
+ skypiax_signaling_write(tech_pvt, "SET AGC OFF");
skypiax_sleep(10000);
- skypiax_skype_write(tech_pvt, "SET AEC OFF");
+ skypiax_signaling_write(tech_pvt, "SET AEC OFF");
skypiax_sleep(10000);
sprintf(msg_to_skype, "CALL %s", rdest);
- if (skypiax_skype_write(tech_pvt, msg_to_skype) < 0) {
+ if (skypiax_signaling_write(tech_pvt, msg_to_skype) < 0) {
ERRORA("failed to communicate with Skype client, now exit\n", SKYPIAX_P_LOG);
return -1;
}
@@ -868,7 +868,7 @@
return res;
}
-int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype)
+int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype)
{
static char acInputRow[1024];
COPYDATASTRUCT oCopyData;
@@ -1189,7 +1189,7 @@
return 1;
}
-int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype)
+int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype)
{
struct SkypiaxHandles *SkypiaxHandles;
1
0
[Freeswitch-branches] [commit] r11920 - freeswitch/branches/gmaruzz/mod_skypiax
by FreeSWITCH SVN 12 Feb '09
by FreeSWITCH SVN 12 Feb '09
12 Feb '09
Author: gmaruzz
Date: Thu Feb 12 05:33:25 2009
New Revision: 11920
Log:
skypiax: cleaning on Visual C
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Thu Feb 12 05:33:25 2009
@@ -1002,7 +1002,7 @@
if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_skypeapi_thread) {
#ifdef WIN32
if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) { // let's the skypiax_skypeapi_thread_func die
- ERRORA("WHY FALSE HERE? %d\n", SKYPIAX_P_LOG, GetLastError());
+ DEBUGA_SKYPE("got FALSE here, thread probably was already dead. GetLastError returned: %d\n", SKYPIAX_P_LOG, GetLastError());
}
#else
XEvent e;
1
0
[Freeswitch-branches] [commit] r11919 - freeswitch/branches/gmaruzz/mod_skypiax/asterisk
by FreeSWITCH SVN 12 Feb '09
by FreeSWITCH SVN 12 Feb '09
12 Feb '09
Author: gmaruzz
Date: Thu Feb 12 05:32:11 2009
New Revision: 11919
Log:
skypiax: outbound interface automatic selection for * too: you can call skypiax/ANY/another_skypename, it will automatically chose first available channel.
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c Thu Feb 12 05:32:11 2009
@@ -285,6 +285,7 @@
struct skypiax_pvt *p = NULL;
struct ast_channel *tmp = NULL;
char *name = data;
+ int found = 0;
DEBUGA_PBX("Try to request type: %s, name: %s, cause: %d," " format: %d\n",
SKYPIAX_P_LOG, type, name, *cause, format);
@@ -298,9 +299,28 @@
LOKKA(&skypiax_iflock);
/* make a pointer to the first interface in the interfaces list */
p = skypiax_iflist;
+
+
+ if (strncmp("ANY", name, 3) == 0) {
+ /* we've been asked for the "ANY" interface, let's find the first idle interface */
+ DEBUGA_SKYPE("Finding one available skype interface\n", SKYPIAX_P_LOG);
+ p = find_available_skypiax_interface();
+ if (p){
+ found = 1;
+
+ /* create a new channel owning this interface */
+ tmp = skypiax_new(p, SKYPIAX_STATE_DOWN, p->context);
+ if (!tmp) {
+ /* the channel was not created, probable memory allocation error */
+ *cause = AST_CAUSE_SWITCH_CONGESTION;
+ }
+
+ }
+
+ }
+
/* Search for the requested interface and verify if is unowned and format compatible */
- //TODO implement groups a la chan_zap
- while (p) {
+ while (p && !found) {
size_t length = strlen(p->name);
/* is this the requested interface? */
if (strncmp(name, p->name, length) == 0) {
@@ -870,7 +890,7 @@
i++;
}
if (p->SkypiaxHandles.api_connected) {
- NOTICA("Interface %s is now STARTED\n", SKYPIAX_P_LOG, p->name);
+ NOTICA("STARTED interface %s\n", SKYPIAX_P_LOG, p->name);
} else {
ERRORA("Interface %s FAILED to start\n", SKYPIAX_P_LOG, p->name);
running = 0;
1
0
[Freeswitch-branches] [commit] r11918 - freeswitch/branches/gmaruzz/mod_skypiax
by FreeSWITCH SVN 12 Feb '09
by FreeSWITCH SVN 12 Feb '09
12 Feb '09
Author: gmaruzz
Date: Thu Feb 12 03:09:29 2009
New Revision: 11918
Log:
skypiax: cleaning on Visual C
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Thu Feb 12 03:09:29 2009
@@ -1164,7 +1164,7 @@
private_t *find_available_skypiax_interface(void)
{
- private_t *tech_pvt;
+ private_t *tech_pvt=NULL;
int found = 0;
int i;
1
0
[Freeswitch-branches] [commit] r11917 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk
by FreeSWITCH SVN 12 Feb '09
by FreeSWITCH SVN 12 Feb '09
12 Feb '09
Author: gmaruzz
Date: Thu Feb 12 03:04:35 2009
New Revision: 11917
Log:
skypiax: indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90
Modified:
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c Thu Feb 12 03:04:35 2009
@@ -12,7 +12,7 @@
/* GLOBAL VARIABLES */
int running = 1;
-int skypiax_dir_entry_extension=1; //FIXME one var for each interface!
+int skypiax_dir_entry_extension = 1; //FIXME one var for each interface!
char skypiax_console_active_array[50] = "";
char *skypiax_console_active = skypiax_console_active_array;
/*! \brief Count of active channels for this module */
@@ -286,7 +286,6 @@
struct ast_channel *tmp = NULL;
char *name = data;
-
DEBUGA_PBX("Try to request type: %s, name: %s, cause: %d," " format: %d\n",
SKYPIAX_P_LOG, type, name, *cause, format);
@@ -442,10 +441,11 @@
usleep(10000); //10msec
}
if (p->interface_state != SKYPIAX_STATE_UP) {
- ERRORA("call answering failed, we want it to be into interface_state=%d, got %d\n", SKYPIAX_P_LOG, SKYPIAX_STATE_UP, p->interface_state);
+ ERRORA("call answering failed, we want it to be into interface_state=%d, got %d\n",
+ SKYPIAX_P_LOG, SKYPIAX_STATE_UP, p->interface_state);
res = -1;
} else {
- DEBUGA_PBX("call answered\n", SKYPIAX_P_LOG);
+ DEBUGA_PBX("call answered\n", SKYPIAX_P_LOG);
res = 0;
}
return res;
@@ -501,7 +501,6 @@
short *buf;
int samples;
-
/* if there are control frames queued to be sent by skypiax_queue_control, send it the first */
//TODO maybe better a real queue?
if (p && p->owner && p->control_to_send) {
@@ -572,8 +571,8 @@
return -1;
}
- DEBUGA_PBX("skypiax_call to call idest: %s, timeout: %d!\n", SKYPIAX_P_LOG, idest,
- timeout);
+ DEBUGA_PBX("skypiax_call to call idest: %s, timeout: %d!\n", SKYPIAX_P_LOG, idest,
+ timeout);
strncpy(rdest, idest, sizeof(rdest) - 1);
stringp = rdest;
@@ -586,8 +585,8 @@
}
strncpy(dstr, where + p->stripmsd, sizeof(dstr) - 1);
- DEBUGA_PBX("skypiax_call dialing idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
- idest, timeout, dstr);
+ DEBUGA_PBX("skypiax_call dialing idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
+ idest, timeout, dstr);
strcpy(p->session_uuid_str, "dialing");
status = skypiax_skype_call(p, dstr, timeout);
@@ -596,8 +595,8 @@
return -1;
}
- DEBUGA_PBX("skypiax_call dialed idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
- idest, timeout, dstr);
+ DEBUGA_PBX("skypiax_call dialed idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG,
+ idest, timeout, dstr);
ast_setstate(p->owner, SKYPIAX_STATE_DIALING);
return 0;
@@ -861,24 +860,24 @@
/* go through the interfaces list (skypiax_iflist) WITHOUT locking */
p = skypiax_iflist;
while (p) {
- int i;
- /* for each interface in list */
- p2 = p->next;
- NOTICA("STARTING interface %s, please be patient\n", SKYPIAX_P_LOG, p->name);
- i=0;
- while (p->SkypiaxHandles.api_connected == 0 && running && i < 60000) { // 60sec FIXME
- usleep(1000);
- i++;
- }
- if (p->SkypiaxHandles.api_connected){
- NOTICA("Interface %s is now STARTED\n", SKYPIAX_P_LOG, p->name);
- } else {
- ERRORA("Interface %s FAILED to start\n", SKYPIAX_P_LOG, p->name);
- running = 0;
- return -1;
- }
- /* next one, please */
- p = p2;
+ int i;
+ /* for each interface in list */
+ p2 = p->next;
+ NOTICA("STARTING interface %s, please be patient\n", SKYPIAX_P_LOG, p->name);
+ i = 0;
+ while (p->SkypiaxHandles.api_connected == 0 && running && i < 60000) { // 60sec FIXME
+ usleep(1000);
+ i++;
+ }
+ if (p->SkypiaxHandles.api_connected) {
+ NOTICA("Interface %s is now STARTED\n", SKYPIAX_P_LOG, p->name);
+ } else {
+ ERRORA("Interface %s FAILED to start\n", SKYPIAX_P_LOG, p->name);
+ running = 0;
+ return -1;
+ }
+ /* next one, please */
+ p = p2;
}
return 0;
}
@@ -898,7 +897,6 @@
struct skypiax_pvt *p = NULL, *p2 = NULL;
int res;
-
/* unregister our channel type with Asterisk */
ast_channel_unregister(&skypiax_tech);
ast_cli_unregister_multiple(myclis, sizeof(myclis) / sizeof(struct ast_cli_entry));
@@ -1024,7 +1022,7 @@
{
struct skypiax_pvt *p = NULL;
- NOTICA("Returning Key\n", SKYPIAX_P_LOG);
+ NOTICA("Returning Key\n", SKYPIAX_P_LOG);
return ASTERISK_GPL_KEY;
}
@@ -1080,7 +1078,8 @@
skypiax_store_boost(v->value, &skypiax_default.capture_boost))
M_UINT("skypiax_dir_entry_extension_prefix",
skypiax_default.skypiax_dir_entry_extension_prefix)
- M_END(;);
+ M_END(;
+ );
}
}
@@ -1116,7 +1115,8 @@
M_STR("skype_user", tmp->skype_user)
M_UINT("skypiax_dir_entry_extension_prefix",
tmp->skypiax_dir_entry_extension_prefix)
- M_END(;);
+ M_END(;
+ );
}
if (debug_all) {
@@ -1231,34 +1231,33 @@
return NULL;
}
/*
- res = pipe(tmp->SkypiaxHandles.fdesc);
- if (res) {
- ast_log(LOG_ERROR, "Unable to create skype pipe\n");
- if (option_debug > 10) {
- DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
- }
- free(tmp);
- return NULL;
- }
- fcntl(tmp->SkypiaxHandles.fdesc[0], F_SETFL, O_NONBLOCK);
- fcntl(tmp->SkypiaxHandles.fdesc[1], F_SETFL, O_NONBLOCK);
- */
+ res = pipe(tmp->SkypiaxHandles.fdesc);
+ if (res) {
+ ast_log(LOG_ERROR, "Unable to create skype pipe\n");
+ if (option_debug > 10) {
+ DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
+ }
+ free(tmp);
+ return NULL;
+ }
+ fcntl(tmp->SkypiaxHandles.fdesc[0], F_SETFL, O_NONBLOCK);
+ fcntl(tmp->SkypiaxHandles.fdesc[1], F_SETFL, O_NONBLOCK);
+ */
tmp->skype_thread = AST_PTHREADT_NULL;
if (tmp->skype) {
- ast_log(LOG_DEBUG, "TO BE started skype_thread=%lu STOP=%lu NULL=%lu\n",
- (unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
- (unsigned long) AST_PTHREADT_NULL);
+ ast_log(LOG_DEBUG, "TO BE started skype_thread=%lu STOP=%lu NULL=%lu\n",
+ (unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
+ (unsigned long) AST_PTHREADT_NULL);
#ifdef __CYGWIN__
- if (ast_pthread_create
- (&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) {
+ if (ast_pthread_create(&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) {
ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
free(tmp);
return NULL;
}
#else /* __CYGWIN__ */
#ifdef WANT_SKYPE_X11
- ast_log(LOG_DEBUG, "AsteriskHandlesfd: %d\n", tmp->SkypiaxHandles.fdesc[1]);
+ ast_log(LOG_DEBUG, "AsteriskHandlesfd: %d\n", tmp->SkypiaxHandles.fdesc[1]);
if (ast_pthread_create(&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) {
ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
free(tmp);
@@ -1266,18 +1265,16 @@
}
#endif /* WANT_SKYPE_X11 */
#endif /* __CYGWIN__ */
- usleep(100000); //0.1 sec
- if( tmp->skype_thread == AST_PTHREADT_NULL){
+ usleep(100000); //0.1 sec
+ if (tmp->skype_thread == AST_PTHREADT_NULL) {
ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
free(tmp);
return NULL;
}
- ast_log(LOG_DEBUG, "STARTED skype_thread=%lu STOP=%lu NULL=%lu\n",
- (unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
- (unsigned long) AST_PTHREADT_NULL);
+ ast_log(LOG_DEBUG, "STARTED skype_thread=%lu STOP=%lu NULL=%lu\n",
+ (unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
+ (unsigned long) AST_PTHREADT_NULL);
}
-
-
#if 0
if (tmp->skype) {
#if 0
@@ -1298,7 +1295,8 @@
}
#else /* __CYGWIN__ */
#ifdef WANT_SKYPE_X11
- if (ast_pthread_create(&tmp->signaling_thread, NULL, do_signaling_thread_fnc, tmp) < 0) {
+ if (ast_pthread_create(&tmp->signaling_thread, NULL, do_signaling_thread_fnc, tmp) <
+ 0) {
ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
if (option_debug > 10) {
DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
@@ -1308,8 +1306,8 @@
}
#endif /* WANT_SKYPE_X11 */
#endif /* __CYGWIN__ */
- usleep(100000); //0.1 sec
- if( tmp->skype_thread == AST_PTHREADT_NULL){
+ usleep(100000); //0.1 sec
+ if (tmp->skype_thread == AST_PTHREADT_NULL) {
ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
if (option_debug > 10) {
DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
@@ -1322,12 +1320,8 @@
(unsigned long) tmp->signaling_thread, (unsigned long) AST_PTHREADT_STOP,
(unsigned long) AST_PTHREADT_NULL);
}
-
#endif
-
-
-
/* return the newly created skypiax_pvt */
return tmp;
}
@@ -1522,7 +1516,7 @@
int res;
res = skypiax_skypeaudio_read(p);
- f = &p->read_frame;
+ f = &p->read_frame;
return f;
}
@@ -1557,7 +1551,7 @@
if (p->skype) {
res = skypiax_skype_read(p);
if (res == CALLFLOW_INCOMING_HANGUP) {
- DEBUGA_SKYPE("skype call ended\n", SKYPIAX_P_LOG);
+ DEBUGA_SKYPE("skype call ended\n", SKYPIAX_P_LOG);
if (p->owner) {
pthread_testcancel();
ast_queue_control(p->owner, AST_CONTROL_HANGUP);
@@ -1596,7 +1590,7 @@
*boost = BOOST_MAX;
}
*boost = exp(log(10) * *boost / 20) * BOOST_SCALE;
- DEBUGA_SOUND("setting boost %s to %f\n", SKYPIAX_P_LOG, s, *boost);
+ DEBUGA_SOUND("setting boost %s to %f\n", SKYPIAX_P_LOG, s, *boost);
}
/*
@@ -1758,147 +1752,140 @@
void *do_skypeapi_thread(void *obj)
{
- return skypiax_do_skypeapi_thread_func(obj);
+ return skypiax_do_skypeapi_thread_func(obj);
}
-int dtmf_received(private_t *p, char *value){
+int dtmf_received(private_t * p, char *value)
+{
- struct ast_frame f2 = { AST_FRAME_DTMF, value[0], };
- DEBUGA_SKYPE("Received DTMF: %s\n", SKYPIAX_P_LOG, value);
- ast_queue_frame(p->owner, &f2);
+ struct ast_frame f2 = { AST_FRAME_DTMF, value[0], };
+ DEBUGA_SKYPE("Received DTMF: %s\n", SKYPIAX_P_LOG, value);
+ ast_queue_frame(p->owner, &f2);
- return 0;
+ return 0;
}
-int start_audio_threads(private_t *p) {
- //if (!p->tcp_srv_thread) {
- if (ast_pthread_create
- (&p->tcp_srv_thread, NULL, skypiax_do_tcp_srv_thread, p) < 0) {
- ERRORA("Unable to start tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
- return -1;
- } else {
- DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
- }
- //}
- //if (!p->tcp_cli_thread) {
- if (ast_pthread_create
- (&p->tcp_cli_thread, NULL, skypiax_do_tcp_cli_thread, p) < 0) {
- ERRORA("Unable to start tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
- return -1;
- } else {
- DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
- }
- //}
+int start_audio_threads(private_t * p)
+{
+ //if (!p->tcp_srv_thread) {
+ if (ast_pthread_create(&p->tcp_srv_thread, NULL, skypiax_do_tcp_srv_thread, p) < 0) {
+ ERRORA("Unable to start tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+ return -1;
+ } else {
+ DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+ }
+ //}
+ //if (!p->tcp_cli_thread) {
+ if (ast_pthread_create(&p->tcp_cli_thread, NULL, skypiax_do_tcp_cli_thread, p) < 0) {
+ ERRORA("Unable to start tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+ return -1;
+ } else {
+ DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+ }
+ //}
#ifdef NOTDEF
- switch_threadattr_t *thd_attr = NULL;
+ switch_threadattr_t *thd_attr = NULL;
+
+ switch_threadattr_create(&thd_attr, skypiax_module_pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypiax_do_tcp_srv_thread,
+ tech_pvt, skypiax_module_pool);
+ DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+
+ switch_threadattr_create(&thd_attr, skypiax_module_pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypiax_do_tcp_cli_thread,
+ tech_pvt, skypiax_module_pool);
+ DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+ switch_sleep(100000);
- switch_threadattr_create(&thd_attr, skypiax_module_pool);
- switch_threadattr_detach_set(thd_attr, 1);
- switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr,
- skypiax_do_tcp_srv_thread, tech_pvt,
- skypiax_module_pool);
- DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
-
- switch_threadattr_create(&thd_attr, skypiax_module_pool);
- switch_threadattr_detach_set(thd_attr, 1);
- switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr,
- skypiax_do_tcp_cli_thread, tech_pvt,
- skypiax_module_pool);
- DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
- switch_sleep(100000);
-
#endif
- return 0;
+ return 0;
}
-int new_inbound_channel(private_t *p) {
+int new_inbound_channel(private_t * p)
+{
#ifdef NOTDEF
- switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
-
- if ((session =
- switch_core_session_request(skypiax_endpoint_interface,
- NULL)) != 0) {
- switch_core_session_add_stream(session, NULL);
- channel = switch_core_session_get_channel(session);
- skypiax_tech_init(tech_pvt, session);
-
- if ((tech_pvt->caller_profile =
- switch_caller_profile_new(switch_core_session_get_pool(session),
- "skypiax", tech_pvt->dialplan,
- tech_pvt->callid_name,
- tech_pvt->callid_number, NULL, NULL,
- NULL, NULL, "mod_skypiax",
- tech_pvt->context,
- tech_pvt->destination)) != 0) {
- char name[128];
- //switch_snprintf(name, sizeof(name), "skypiax/%s/%s", tech_pvt->name, tech_pvt->caller_profile->destination_number);
- switch_snprintf(name, sizeof(name), "skypiax/%s", tech_pvt->name);
- switch_channel_set_name(channel, name);
- switch_channel_set_caller_profile(channel,
- tech_pvt->caller_profile);
- }
- switch_channel_set_state(channel, CS_INIT);
- if (switch_core_session_thread_launch(session) !=
- SWITCH_STATUS_SUCCESS) {
- ERRORA("Error spawning thread\n", SKYPIAX_P_LOG);
- switch_core_session_destroy(&session);
- }
- }
- switch_channel_mark_answered(channel);
+ switch_core_session_t *session = NULL;
+ switch_channel_t *channel = NULL;
+ if ((session = switch_core_session_request(skypiax_endpoint_interface, NULL)) != 0) {
+ switch_core_session_add_stream(session, NULL);
+ channel = switch_core_session_get_channel(session);
+ skypiax_tech_init(tech_pvt, session);
+
+ if ((tech_pvt->caller_profile =
+ switch_caller_profile_new(switch_core_session_get_pool(session), "skypiax",
+ tech_pvt->dialplan, tech_pvt->callid_name,
+ tech_pvt->callid_number, NULL, NULL, NULL, NULL,
+ "mod_skypiax", tech_pvt->context,
+ tech_pvt->destination)) != 0) {
+ char name[128];
+ //switch_snprintf(name, sizeof(name), "skypiax/%s/%s", tech_pvt->name, tech_pvt->caller_profile->destination_number);
+ switch_snprintf(name, sizeof(name), "skypiax/%s", tech_pvt->name);
+ switch_channel_set_name(channel, name);
+ switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
+ }
+ switch_channel_set_state(channel, CS_INIT);
+ if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
+ ERRORA("Error spawning thread\n", SKYPIAX_P_LOG);
+ switch_core_session_destroy(&session);
+ }
+ }
+ switch_channel_mark_answered(channel);
#endif
- return 0;
+ return 0;
}
-int outbound_channel_answered(private_t *p) {
-#ifdef NOTDEF
- switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
+int outbound_channel_answered(private_t * p)
+{
+#ifdef NOTDEF
+ switch_core_session_t *session = NULL;
+ switch_channel_t *channel = NULL;
- if (strlen(tech_pvt->session_uuid_str)) {
- session = switch_core_session_locate(tech_pvt->session_uuid_str);
- } else {
- ERRORA("No session???\n", SKYPIAX_P_LOG);
- }
- if (session) {
- channel = switch_core_session_get_channel(session);
- } else {
- ERRORA("No session???\n", SKYPIAX_P_LOG);
- }
- if (channel) {
- switch_channel_mark_answered(channel);
- //DEBUGA_SKYPE("skype_call: %s, answered\n", SKYPIAX_P_LOG, id);
- } else {
- ERRORA("No channel???\n", SKYPIAX_P_LOG);
- }
+ if (strlen(tech_pvt->session_uuid_str)) {
+ session = switch_core_session_locate(tech_pvt->session_uuid_str);
+ } else {
+ ERRORA("No session???\n", SKYPIAX_P_LOG);
+ }
+ if (session) {
+ channel = switch_core_session_get_channel(session);
+ } else {
+ ERRORA("No session???\n", SKYPIAX_P_LOG);
+ }
+ if (channel) {
+ switch_channel_mark_answered(channel);
+ //DEBUGA_SKYPE("skype_call: %s, answered\n", SKYPIAX_P_LOG, id);
+ } else {
+ ERRORA("No channel???\n", SKYPIAX_P_LOG);
+ }
- switch_core_session_rwunlock(session);
+ switch_core_session_rwunlock(session);
#endif
- if (p->owner) {
- ast_queue_control(p->owner, AST_CONTROL_ANSWER);
- }
+ if (p->owner) {
+ ast_queue_control(p->owner, AST_CONTROL_ANSWER);
+ }
- NOTICA("HERE!\n", SKYPIAX_P_LOG);
+ NOTICA("HERE!\n", SKYPIAX_P_LOG);
- return 0;
+ return 0;
}
-void * skypiax_do_tcp_srv_thread(void *obj)
+void *skypiax_do_tcp_srv_thread(void *obj)
{
- return skypiax_do_tcp_srv_thread_func(obj);
+ return skypiax_do_tcp_srv_thread_func(obj);
}
-void * skypiax_do_tcp_cli_thread(void *obj)
+void *skypiax_do_tcp_cli_thread(void *obj)
{
- return skypiax_do_tcp_cli_thread_func(obj);
+ return skypiax_do_tcp_cli_thread_func(obj);
}
int skypiax_skypeaudio_write(struct skypiax_pvt *p, struct ast_frame *f)
@@ -1962,10 +1949,11 @@
//int fromcell = 0;
#if 0
- if(directoriax_entry_extension){
- skypiax_dir_entry_extension=directoriax_entry_extension;
- }else{
- ast_cli(fd, "No 'directoriax_entry_extension', you MUST have loaded directoriax.so\n");
+ if (directoriax_entry_extension) {
+ skypiax_dir_entry_extension = directoriax_entry_extension;
+ } else {
+ ast_cli(fd,
+ "No 'directoriax_entry_extension', you MUST have loaded directoriax.so\n");
return RESULT_SUCCESS;
}
#endif
@@ -2027,7 +2015,7 @@
} else {
snprintf(fn, sizeof(fn), "%s/%s", ast_config_AST_CONFIG_DIR, configfile);
}
- NOTICA("Opening '%s'\n", SKYPIAX_P_LOG, fn);
+ NOTICA("Opening '%s'\n", SKYPIAX_P_LOG, fn);
time(&t);
ast_copy_string(date, ctime(&t), sizeof(date));
@@ -2038,13 +2026,13 @@
if (p->phonebook_writing_fp) {
if (add_to_skypiax_dir_conf) {
- NOTICA("Opened '%s' for appending \n", SKYPIAX_P_LOG, fn);
+ NOTICA("Opened '%s' for appending \n", SKYPIAX_P_LOG, fn);
fprintf(p->phonebook_writing_fp, ";!\n");
fprintf(p->phonebook_writing_fp, ";! Update Date: %s", date);
fprintf(p->phonebook_writing_fp, ";! Updated by: %s, %d\n", __FILE__, __LINE__);
fprintf(p->phonebook_writing_fp, ";!\n");
} else {
- NOTICA("Opened '%s' for writing \n", SKYPIAX_P_LOG, fn);
+ NOTICA("Opened '%s' for writing \n", SKYPIAX_P_LOG, fn);
fprintf(p->phonebook_writing_fp, ";!\n");
fprintf(p->phonebook_writing_fp, ";! Automatically generated configuration file\n");
fprintf(p->phonebook_writing_fp, ";! Filename: %s (%s)\n", configfile, fn);
@@ -2057,117 +2045,198 @@
/*******************************************************************************************/
//if (fromskype) {
- if (p->skype) {
- WARNINGA
- ("About to querying the Skype client 'Contacts', it may take some moments... Don't worry.\n",
- SKYPIAX_P_LOG);
- if (p->skype_thread != AST_PTHREADT_NULL) {
- char msg_to_skype[1024];
+ if (p->skype) {
+ WARNINGA
+ ("About to querying the Skype client 'Contacts', it may take some moments... Don't worry.\n",
+ SKYPIAX_P_LOG);
+ if (p->skype_thread != AST_PTHREADT_NULL) {
+ char msg_to_skype[1024];
+
+ p->skype_friends[0] = '\0';
+ sprintf(msg_to_skype, "#333 SEARCH FRIENDS");
+ if (skypiax_skype_write(p, msg_to_skype) < 0) {
+ return -1;
+ }
- p->skype_friends[0] = '\0';
- sprintf(msg_to_skype, "#333 SEARCH FRIENDS");
- if (skypiax_skype_write(p, msg_to_skype) < 0) {
- return -1;
+ int friends_count = 0;
+ while (p->skype_friends[0] == '\0') {
+ /* FIXME needs a timeout, can't wait forever!
+ * eg. when skype is running but not connected! */
+ usleep(100);
+ friends_count++;
+ if (friends_count > 20000) {
+ return -1; /* FIXME */
}
+ }
- int friends_count = 0;
- while (p->skype_friends[0] == '\0') {
- /* FIXME needs a timeout, can't wait forever!
- * eg. when skype is running but not connected! */
- usleep(100);
- friends_count++;
- if (friends_count > 20000) {
- return -1; /* FIXME */
- }
- }
+ }
- }
+ if (p->skype_thread != AST_PTHREADT_NULL) {
+ char msg_to_skype[1024];
- if (p->skype_thread != AST_PTHREADT_NULL) {
- char msg_to_skype[1024];
+ if (p->skype_friends[0] != '\0') {
+ char *buf, *where;
+ char **stringp;
+ int skype_dir_file_written = 0;
+
+ buf = p->skype_friends;
+ stringp = &buf;
+ where = strsep(stringp, ", ");
+ while (where) {
+ if (where[0] != '\0') {
+ /*
+ * So, we have the Skype username (the HANDLE, I think is called).
+ * But we want to call the names we see in the Skype contact list
+ * So, let's check the DISPLAYNAME (the end user modified contact name)
+ * Then, we check the FULLNAME (that appears as it was the DISPLAYNAME
+ * if the end user has not modify it)
+ * If we still have neither DISPLAYNAME nor FULLNAME, we'll use the
+ * Skipe username (the HANDLE)
+ */
+
+ p->skype_displayname[0] = '\0';
+ sprintf(msg_to_skype, "#765 GET USER %s DISPLAYNAME", where);
+ skypiax_skype_write(p, msg_to_skype);
+ int displayname_count = 0;
+ while (p->skype_displayname[0] == '\0') {
+ /* FIXME needs a timeout, can't wait forever!
+ * eg. when skype is running but not connected! */
+ usleep(100);
+ displayname_count++;
+ if (displayname_count > 20000)
+ return -1; /* FIXME */
+ }
+ if (p->skype_displayname[0] != '\0') {
+ char *where2;
+ char sanitized[300];
+
+ sanitized[0] = '\0';
+
+ where2 = strstr(p->skype_displayname, "DISPLAYNAME ");
+ if (where2) {
+
+ /* there can be some *smart* that makes a displayname
+ * that is different than first<space>last, */
+ /* maybe initials, simbols, slashes,
+ * something smartish... let's check */
+
+ if (where2[12] != '\0') {
+ int i = 12;
+ int x = 0;
+ int spaces = 0;
+ int last_char_was_space = 0;
+
+ for (i = 12; i < strlen(where2) && x < 299; i++) {
+ if (!isalnum(where2[i])) {
+ if (!isblank(where2[i])) {
+ /* bad char */
+ continue;
+ }
+ /* is a space */
+ if (last_char_was_space == 1) /* do not write 2 consecutive spaces */
+ continue;
+ last_char_was_space = 1;
+ sanitized[x] = ' ';
+ x++;
+ continue;
+ }
+ /* is alphanum */
+ last_char_was_space = 0;
+ sanitized[x] = where2[i];
+ x++;
+ continue;
+ }
- if (p->skype_friends[0] != '\0') {
- char *buf, *where;
- char **stringp;
- int skype_dir_file_written = 0;
+ sanitized[x] = '\0';
+ if (spaces == 0) {
+ }
+ DEBUGA_SKYPE("sanitized=|%s|, where=|%s|, where2=|%s|\n",
+ SKYPIAX_P_LOG, sanitized, where, &where2[12]);
+ }
- buf = p->skype_friends;
- stringp = &buf;
- where = strsep(stringp, ", ");
- while (where) {
- if (where[0] != '\0') {
- /*
- * So, we have the Skype username (the HANDLE, I think is called).
- * But we want to call the names we see in the Skype contact list
- * So, let's check the DISPLAYNAME (the end user modified contact name)
- * Then, we check the FULLNAME (that appears as it was the DISPLAYNAME
- * if the end user has not modify it)
- * If we still have neither DISPLAYNAME nor FULLNAME, we'll use the
- * Skipe username (the HANDLE)
- */
-
- p->skype_displayname[0] = '\0';
- sprintf(msg_to_skype, "#765 GET USER %s DISPLAYNAME", where);
- skypiax_skype_write(p, msg_to_skype);
- int displayname_count = 0;
- while (p->skype_displayname[0] == '\0') {
- /* FIXME needs a timeout, can't wait forever!
- * eg. when skype is running but not connected! */
- usleep(100);
- displayname_count++;
- if (displayname_count > 20000)
- return -1; /* FIXME */
+ if (where2[12] != '\0') {
+ skypiax_dir_entry_extension++;
+ if (where[0] == '+' || isdigit(where[0])) { /* is a skypeout number */
+ fprintf(p->phonebook_writing_fp,
+ "%s => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+ where, sanitized, "no",
+ p->skypiax_dir_entry_extension_prefix, "2",
+ skypiax_dir_entry_extension, "yes", "not_specified");
+ } else { /* is a skype name */
+ fprintf(p->phonebook_writing_fp,
+ "%s => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+ where, sanitized, "no",
+ p->skypiax_dir_entry_extension_prefix, "1",
+ skypiax_dir_entry_extension, "yes", "not_specified");
+ }
+ skype_dir_file_written = 1;
+
+ }
}
- if (p->skype_displayname[0] != '\0') {
- char *where2;
- char sanitized[300];
-
- sanitized[0] = '\0';
-
- where2 = strstr(p->skype_displayname, "DISPLAYNAME ");
- if (where2) {
-
- /* there can be some *smart* that makes a displayname
- * that is different than first<space>last, */
- /* maybe initials, simbols, slashes,
- * something smartish... let's check */
-
- if (where2[12] != '\0') {
- int i = 12;
- int x = 0;
- int spaces = 0;
- int last_char_was_space = 0;
-
- for (i = 12; i < strlen(where2) && x < 299; i++) {
- if (!isalnum(where2[i])) {
- if (!isblank(where2[i])) {
- /* bad char */
- continue;
- }
- /* is a space */
- if (last_char_was_space == 1) /* do not write 2 consecutive spaces */
- continue;
- last_char_was_space = 1;
- sanitized[x] = ' ';
- x++;
+ }
+ p->skype_displayname[0] = '\0';
+
+ p->skype_fullname[0] = '\0';
+ sprintf(msg_to_skype, "#222 GET USER %s FULLNAME", where);
+ skypiax_skype_write(p, msg_to_skype);
+ int fullname_count = 0;
+ while (p->skype_fullname[0] == '\0') {
+ /* FIXME needs a timeout, can't wait forever!
+ * eg. when skype is running but not connected! */
+ usleep(100);
+ fullname_count++;
+ if (fullname_count > 20000)
+ return -1; /* FIXME */
+ }
+ if (p->skype_fullname[0] != '\0') {
+ char *where2;
+ char sanitized[300];
+
+ where2 = strstr(p->skype_fullname, "FULLNAME ");
+ if (where2) {
+
+ /* there can be some *smart* that makes a fullname
+ * that is different than first<space>last, */
+ /* maybe initials, simbols, slashes,
+ * something smartish... let's check */
+
+ if (where2[9] != '\0') {
+ int i = 9;
+ int x = 0;
+ int spaces = 0;
+ int last_char_was_space = 0;
+
+ for (i = 9; i < strlen(where2) && x < 299; i++) {
+ if (!isalnum(where2[i])) {
+ if (!isblank(where2[i])) {
+ /* bad char */
continue;
}
- /* is alphanum */
- last_char_was_space = 0;
- sanitized[x] = where2[i];
+ /* is a space */
+ if (last_char_was_space == 1) /* do not write 2 consecutive spaces */
+ continue;
+ last_char_was_space = 1;
+ sanitized[x] = ' ';
x++;
continue;
}
+ /* alphanum */
+ last_char_was_space = 0;
+ sanitized[x] = where2[i];
+ x++;
+ continue;
+ }
- sanitized[x] = '\0';
- if (spaces == 0) {
- }
- DEBUGA_SKYPE("sanitized=|%s|, where=|%s|, where2=|%s|\n",
- SKYPIAX_P_LOG, sanitized, where, &where2[12]);
+ sanitized[x] = '\0';
+ if (spaces == 0) {
}
+ DEBUGA_SKYPE("sanitized=|%s|, where=|%s|, where2=|%s|\n",
+ SKYPIAX_P_LOG, sanitized, where, &where2[9]);
+ }
- if (where2[12] != '\0') {
- skypiax_dir_entry_extension++;
+ if (skype_dir_file_written == 0) {
+ skypiax_dir_entry_extension++;
+ if (where2[9] != '\0') {
if (where[0] == '+' || isdigit(where[0])) { /* is a skypeout number */
fprintf(p->phonebook_writing_fp,
"%s => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
@@ -2180,127 +2249,44 @@
where, sanitized, "no",
p->skypiax_dir_entry_extension_prefix, "1",
skypiax_dir_entry_extension, "yes", "not_specified");
- }
- skype_dir_file_written = 1;
-
- }
- }
- }
- p->skype_displayname[0] = '\0';
-
- p->skype_fullname[0] = '\0';
- sprintf(msg_to_skype, "#222 GET USER %s FULLNAME", where);
- skypiax_skype_write(p, msg_to_skype);
- int fullname_count = 0;
- while (p->skype_fullname[0] == '\0') {
- /* FIXME needs a timeout, can't wait forever!
- * eg. when skype is running but not connected! */
- usleep(100);
- fullname_count++;
- if (fullname_count > 20000)
- return -1; /* FIXME */
- }
- if (p->skype_fullname[0] != '\0') {
- char *where2;
- char sanitized[300];
-
- where2 = strstr(p->skype_fullname, "FULLNAME ");
- if (where2) {
-
- /* there can be some *smart* that makes a fullname
- * that is different than first<space>last, */
- /* maybe initials, simbols, slashes,
- * something smartish... let's check */
-
- if (where2[9] != '\0') {
- int i = 9;
- int x = 0;
- int spaces = 0;
- int last_char_was_space = 0;
-
- for (i = 9; i < strlen(where2) && x < 299; i++) {
- if (!isalnum(where2[i])) {
- if (!isblank(where2[i])) {
- /* bad char */
- continue;
- }
- /* is a space */
- if (last_char_was_space == 1) /* do not write 2 consecutive spaces */
- continue;
- last_char_was_space = 1;
- sanitized[x] = ' ';
- x++;
- continue;
- }
- /* alphanum */
- last_char_was_space = 0;
- sanitized[x] = where2[i];
- x++;
- continue;
- }
- sanitized[x] = '\0';
- if (spaces == 0) {
}
- DEBUGA_SKYPE("sanitized=|%s|, where=|%s|, where2=|%s|\n",
- SKYPIAX_P_LOG, sanitized, where, &where2[9]);
- }
-
- if (skype_dir_file_written == 0) {
- skypiax_dir_entry_extension++;
- if (where2[9] != '\0') {
- if (where[0] == '+' || isdigit(where[0])) { /* is a skypeout number */
- fprintf(p->phonebook_writing_fp,
- "%s => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
- where, sanitized, "no",
- p->skypiax_dir_entry_extension_prefix, "2",
- skypiax_dir_entry_extension, "yes", "not_specified");
- } else { /* is a skype name */
- fprintf(p->phonebook_writing_fp,
- "%s => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
- where, sanitized, "no",
- p->skypiax_dir_entry_extension_prefix, "1",
- skypiax_dir_entry_extension, "yes", "not_specified");
- }
-
- } else {
- if (where[0] == '+' || isdigit(where[0])) { /* is a skypeout number */
- fprintf(p->phonebook_writing_fp,
- "%s => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
- where, where, "no",
- p->skypiax_dir_entry_extension_prefix, "2",
- skypiax_dir_entry_extension, "yes", "not_specified");
- } else { /* is a skype name */
- fprintf(p->phonebook_writing_fp,
- "%s => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
- where, where, "no",
- p->skypiax_dir_entry_extension_prefix, "1",
- skypiax_dir_entry_extension, "yes", "not_specified");
+ } else {
+ if (where[0] == '+' || isdigit(where[0])) { /* is a skypeout number */
+ fprintf(p->phonebook_writing_fp,
+ "%s => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+ where, where, "no", p->skypiax_dir_entry_extension_prefix,
+ "2", skypiax_dir_entry_extension, "yes", "not_specified");
+ } else { /* is a skype name */
+ fprintf(p->phonebook_writing_fp,
+ "%s => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+ where, where, "no", p->skypiax_dir_entry_extension_prefix,
+ "1", skypiax_dir_entry_extension, "yes", "not_specified");
- }
}
}
-
- skype_dir_file_written = 0;
-
}
+ skype_dir_file_written = 0;
+
}
- p->skype_fullname[0] = '\0';
}
- where = strsep(stringp, ", ");
- }
+ p->skype_fullname[0] = '\0';
- p->skype_friends[0] = '\0';
+ }
+ where = strsep(stringp, ", ");
}
- }
- } else {
- ast_cli(fd,
- "Skype not configured on the 'current' console, not importing from Skype client!\n");
+ p->skype_friends[0] = '\0';
+ }
}
+ } else {
+
+ ast_cli(fd,
+ "Skype not configured on the 'current' console, not importing from Skype client!\n");
+ }
//}
/*******************************************************************************************/
/*******************************************************************************************/
@@ -2317,9 +2303,10 @@
return RESULT_SUCCESS;
}
-private_t *find_available_skypiax_interface(void) {
- private_t *p;
- int found = 0;
+private_t *find_available_skypiax_interface(void)
+{
+ private_t *p;
+ int found = 0;
/* lock the interfaces' list */
LOKKA(&skypiax_iflock);
@@ -2327,15 +2314,15 @@
p = skypiax_iflist;
/* Search for the requested interface and verify if is unowned */
while (p) {
- if (!p->owner) {
- DEBUGA_PBX("Interface is NOT OWNED by a channel\n", SKYPIAX_P_LOG);
- found = 1;
+ if (!p->owner) {
+ DEBUGA_PBX("Interface is NOT OWNED by a channel\n", SKYPIAX_P_LOG);
+ found = 1;
/* we found the requested interface, bail out from the while loop */
- break;
- } else {
- /* interface owned by a channel */
- DEBUGA_PBX("Interface is OWNED by a channel\n", SKYPIAX_P_LOG);
- }
+ break;
+ } else {
+ /* interface owned by a channel */
+ DEBUGA_PBX("Interface is OWNED by a channel\n", SKYPIAX_P_LOG);
+ }
/* not yet found, next please */
p = p->next;
}
@@ -2343,14 +2330,12 @@
/* lock the interfaces' list */
UNLOCKA(&skypiax_iflock);
-
- if(found)
- return p;
+ if (found)
+ return p;
else
- return NULL;
+ return NULL;
}
-
/************************************************/
#ifdef ASTERISK_VERSION_1_4
#ifndef AST_MODULE
Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h Thu Feb 12 03:04:35 2009
@@ -235,7 +235,6 @@
#endif //WIN32
-
/*!
* \brief PVT structure for a skypiax interface (channel), created by skypiax_mkif
*/
@@ -396,13 +395,13 @@
int skypiax_skype_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);
+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_skype_senddigit(struct skypiax_pvt *p, char digit);
int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype);
#if defined(WIN32) && !defined(__CYGWIN__)
Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c Thu Feb 12 03:04:35 2009
@@ -474,7 +474,7 @@
private_t *tech_pvt;
switch_channel_t *channel;
switch_caller_profile_t *caller_profile;
- char *rdest;
+ char *rdest;
switch_core_session_add_stream(*new_session, NULL);
@@ -491,30 +491,32 @@
slash = strrchr(interface_name, '/');
*slash = '\0';
- if (strncmp("ANY", interface_name, strlen(interface_name)) == 0) {
- /* we've been asked for the "ANY" interface, let's find the first idle interface */
- DEBUGA_SKYPE("Finding one available skype interface\n",
- SKYPIAX_P_LOG);
- tech_pvt = find_available_skypiax_interface();
- if(tech_pvt)
- found=1;
- }
+ if (strncmp("ANY", interface_name, strlen(interface_name)) == 0) {
+ /* we've been asked for the "ANY" interface, let's find the first idle interface */
+ DEBUGA_SKYPE("Finding one available skype interface\n", SKYPIAX_P_LOG);
+ tech_pvt = find_available_skypiax_interface();
+ if (tech_pvt)
+ found = 1;
+ }
for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
- /* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the "ANY" interface */
+ /* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the "ANY" interface */
if (strlen(globals.SKYPIAX_INTERFACES[i].name)
&&
(strncmp
(globals.SKYPIAX_INTERFACES[i].name, interface_name,
strlen(interface_name)) == 0)) {
- if (strlen(globals.SKYPIAX_INTERFACES[i].session_uuid_str)){
- DEBUGA_SKYPE("globals.SKYPIAX_INTERFACES[%d].name=|||%s||| session_uuid_str=|||%s||| is BUSY\n", SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name, globals.SKYPIAX_INTERFACES[i].session_uuid_str);
- switch_core_session_destroy(new_session);
- return SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE ;
- }
+ if (strlen(globals.SKYPIAX_INTERFACES[i].session_uuid_str)) {
+ DEBUGA_SKYPE
+ ("globals.SKYPIAX_INTERFACES[%d].name=|||%s||| session_uuid_str=|||%s||| is BUSY\n",
+ SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name,
+ globals.SKYPIAX_INTERFACES[i].session_uuid_str);
+ switch_core_session_destroy(new_session);
+ return SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE;
+ }
DEBUGA_SKYPE("globals.SKYPIAX_INTERFACES[%d].name=|||%s|||?\n", SKYPIAX_P_LOG,
i, globals.SKYPIAX_INTERFACES[i].name);
- tech_pvt = &globals.SKYPIAX_INTERFACES[i];
+ tech_pvt = &globals.SKYPIAX_INTERFACES[i];
found = 1;
break;
}
@@ -557,18 +559,16 @@
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
-
- rdest = strchr(caller_profile->destination_number, '/');
- *rdest++ = '\0';
-
+ rdest = strchr(caller_profile->destination_number, '/');
+ *rdest++ = '\0';
skypiax_skype_call(tech_pvt, rdest, 30);
- switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(*new_session),
- sizeof(tech_pvt->session_uuid_str));
- caller_profile = tech_pvt->caller_profile;
- caller_profile->destination_number = rdest;
-
+ switch_copy_string(tech_pvt->session_uuid_str,
+ switch_core_session_get_uuid(*new_session),
+ sizeof(tech_pvt->session_uuid_str));
+ caller_profile = tech_pvt->caller_profile;
+ caller_profile->destination_number = rdest;
switch_channel_set_flag(channel, CF_OUTBOUND);
switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
@@ -590,7 +590,6 @@
int res;
int forever = 1;
-
DEBUGA_SKYPE("In skypiax_signaling_thread_func: started, p=%p\n", SKYPIAX_P_LOG,
(void *) tech_pvt);
@@ -639,7 +638,7 @@
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, skypiax_module_pool);
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
ERRORA("open of %s failed\n", SKYPIAX_P_LOG, cf);
- running=0;
+ running = 0;
return SWITCH_STATUS_TERM;
}
@@ -820,7 +819,7 @@
memset(&newconf, '\0', sizeof(newconf));
globals.SKYPIAX_INTERFACES[interface_id] = newconf;
- tech_pvt=&globals.SKYPIAX_INTERFACES[interface_id];
+ tech_pvt = &globals.SKYPIAX_INTERFACES[interface_id];
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].interface_id, id);
if (name) {
@@ -907,17 +906,17 @@
skypiax_skypeaudio_init(&globals.SKYPIAX_INTERFACES[interface_id]);
- i=0;
- while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected == 0 && running && i < 60000) { // 60sec FIXME
+ i = 0;
+ while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected == 0 && running && i < 60000) { // 60sec FIXME
switch_sleep(1000);
- i++;
+ i++;
+ }
+ if (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected) {
+ NOTICA("STARTED interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
+ } else {
+ ERRORA("FAILED to start interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
+ return SWITCH_STATUS_FALSE;
}
- if(globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected){
- NOTICA("STARTED interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
- } else {
- ERRORA("FAILED to start interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
- return SWITCH_STATUS_FALSE;
- }
} else {
ERRORA("interface id %d is higher than SKYPIAX_MAX_INTERFACES (%d)\n",
@@ -929,7 +928,7 @@
for (i = 0; i < SKYPIAX_MAX_INTERFACES; i++) {
if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
- tech_pvt = &globals.SKYPIAX_INTERFACES[i];
+ tech_pvt = &globals.SKYPIAX_INTERFACES[i];
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].interface_id=%s\n",
SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].interface_id);
@@ -963,7 +962,7 @@
running = 1;
if (load_config() != SWITCH_STATUS_SUCCESS)
- return SWITCH_STATUS_FALSE;
+ return SWITCH_STATUS_FALSE;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
skypiax_endpoint_interface =
@@ -972,11 +971,11 @@
skypiax_endpoint_interface->io_routines = &skypiax_io_routines;
skypiax_endpoint_interface->state_handler = &skypiax_state_handlers;
- if(running)
- /* indicate that the module should continue to be loaded */
- return SWITCH_STATUS_SUCCESS;
+ if (running)
+ /* indicate that the module should continue to be loaded */
+ return SWITCH_STATUS_SUCCESS;
else
- return SWITCH_STATUS_FALSE;
+ return SWITCH_STATUS_FALSE;
}
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown)
@@ -1040,165 +1039,156 @@
return SWITCH_STATUS_SUCCESS;
}
-void *SWITCH_THREAD_FUNC skypiax_do_tcp_srv_thread(switch_thread_t * thread,
- void *obj)
+void *SWITCH_THREAD_FUNC skypiax_do_tcp_srv_thread(switch_thread_t * thread, void *obj)
+{
+ return skypiax_do_tcp_srv_thread_func(obj);
+}
+void *SWITCH_THREAD_FUNC skypiax_do_tcp_cli_thread(switch_thread_t * thread, void *obj)
{
- return skypiax_do_tcp_srv_thread_func(obj);
+ return skypiax_do_tcp_cli_thread_func(obj);
}
-void *SWITCH_THREAD_FUNC skypiax_do_tcp_cli_thread(switch_thread_t * thread,
- void *obj)
+void *SWITCH_THREAD_FUNC skypiax_do_skypeapi_thread(switch_thread_t * thread, void *obj)
{
- return skypiax_do_tcp_cli_thread_func(obj);
-}
-void *SWITCH_THREAD_FUNC skypiax_do_skypeapi_thread(switch_thread_t * thread,
- void *obj)
-{
- return skypiax_do_skypeapi_thread_func(obj);
-}
-
-int dtmf_received(private_t *tech_pvt, char *value){
- switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
-
- session = switch_core_session_locate(tech_pvt->session_uuid_str);
- channel = switch_core_session_get_channel(session);
-
- if (channel) {
- switch_dtmf_t dtmf =
- { (char) value[0], switch_core_default_dtmf_duration(0) };
- DEBUGA_SKYPE("received DTMF %c on channel %s\n", SKYPIAX_P_LOG, dtmf.digit,
- switch_channel_get_name(channel));
- switch_mutex_lock(tech_pvt->flag_mutex);
- //FIXME: why sometimes DTMFs from here do not seems to be get by FS?
- switch_channel_queue_dtmf(channel, &dtmf);
- switch_set_flag(tech_pvt, TFLAG_DTMF);
- switch_mutex_unlock(tech_pvt->flag_mutex);
- } else {
- WARNINGA("received %c DTMF, but no channel?\n", SKYPIAX_P_LOG, value[0]);
- }
- switch_core_session_rwunlock(session);
-
- return 0;
-}
-
-int start_audio_threads(private_t *tech_pvt) {
- switch_threadattr_t *thd_attr = NULL;
-
- switch_threadattr_create(&thd_attr, skypiax_module_pool);
- switch_threadattr_detach_set(thd_attr, 1);
- switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr,
- skypiax_do_tcp_srv_thread, tech_pvt,
- skypiax_module_pool);
- DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
-
- switch_threadattr_create(&thd_attr, skypiax_module_pool);
- switch_threadattr_detach_set(thd_attr, 1);
- switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr,
- skypiax_do_tcp_cli_thread, tech_pvt,
- skypiax_module_pool);
- DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
- switch_sleep(100000);
-
-
- return 0;
-}
-
-int new_inbound_channel(private_t *tech_pvt) {
- switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
-
- if ((session =
- switch_core_session_request(skypiax_endpoint_interface,
- NULL)) != 0) {
- switch_core_session_add_stream(session, NULL);
- channel = switch_core_session_get_channel(session);
- skypiax_tech_init(tech_pvt, session);
-
- if ((tech_pvt->caller_profile =
- switch_caller_profile_new(switch_core_session_get_pool(session),
- "skypiax", tech_pvt->dialplan,
- tech_pvt->callid_name,
- tech_pvt->callid_number, NULL, NULL,
- NULL, NULL, "mod_skypiax",
- tech_pvt->context,
- tech_pvt->destination)) != 0) {
- char name[128];
- //switch_snprintf(name, sizeof(name), "skypiax/%s/%s", tech_pvt->name, tech_pvt->caller_profile->destination_number);
- switch_snprintf(name, sizeof(name), "skypiax/%s", tech_pvt->name);
- switch_channel_set_name(channel, name);
- switch_channel_set_caller_profile(channel,
- tech_pvt->caller_profile);
- }
- switch_channel_set_state(channel, CS_INIT);
- if (switch_core_session_thread_launch(session) !=
- SWITCH_STATUS_SUCCESS) {
- ERRORA("Error spawning thread\n", SKYPIAX_P_LOG);
- switch_core_session_destroy(&session);
- }
- }
- switch_channel_mark_answered(channel);
-
- DEBUGA_SKYPE("Here\n", SKYPIAX_P_LOG);
-
- return 0;
-}
-int outbound_channel_answered(private_t *tech_pvt) {
- switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
-
-
- if (strlen(tech_pvt->session_uuid_str)) {
- session = switch_core_session_locate(tech_pvt->session_uuid_str);
- } else {
- ERRORA("No session???\n", SKYPIAX_P_LOG);
- }
- if (session) {
- channel = switch_core_session_get_channel(session);
- } else {
- ERRORA("No session???\n", SKYPIAX_P_LOG);
- }
- if (channel) {
- switch_channel_mark_answered(channel);
- //DEBUGA_SKYPE("skype_call: %s, answered\n", SKYPIAX_P_LOG, id);
- } else {
- ERRORA("No channel???\n", SKYPIAX_P_LOG);
- }
-
- switch_core_session_rwunlock(session);
- DEBUGA_SKYPE("HERE!\n", SKYPIAX_P_LOG);
-
-
- return 0;
-}
-
-private_t *find_available_skypiax_interface(void) {
- private_t *tech_pvt;
- int found = 0;
- int i;
-
- for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
- if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
- int skype_state = 0;
-
- tech_pvt = &globals.SKYPIAX_INTERFACES[i];
- skype_state = tech_pvt->interface_state;
- DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n",
- SKYPIAX_P_LOG,
- i, globals.SKYPIAX_INTERFACES[i].name, skype_state);
- if (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) {
- found=1;
- break;
- }
- }
- }
-
- if(found)
- return tech_pvt;
- else
- return NULL;
+ return skypiax_do_skypeapi_thread_func(obj);
}
+
+int dtmf_received(private_t * tech_pvt, char *value)
+{
+ switch_core_session_t *session = NULL;
+ switch_channel_t *channel = NULL;
+
+ session = switch_core_session_locate(tech_pvt->session_uuid_str);
+ channel = switch_core_session_get_channel(session);
+
+ if (channel) {
+ switch_dtmf_t dtmf = { (char) value[0], switch_core_default_dtmf_duration(0) };
+ DEBUGA_SKYPE("received DTMF %c on channel %s\n", SKYPIAX_P_LOG, dtmf.digit,
+ switch_channel_get_name(channel));
+ switch_mutex_lock(tech_pvt->flag_mutex);
+ //FIXME: why sometimes DTMFs from here do not seems to be get by FS?
+ switch_channel_queue_dtmf(channel, &dtmf);
+ switch_set_flag(tech_pvt, TFLAG_DTMF);
+ switch_mutex_unlock(tech_pvt->flag_mutex);
+ } else {
+ WARNINGA("received %c DTMF, but no channel?\n", SKYPIAX_P_LOG, value[0]);
+ }
+ switch_core_session_rwunlock(session);
+
+ return 0;
+}
+
+int start_audio_threads(private_t * tech_pvt)
+{
+ switch_threadattr_t *thd_attr = NULL;
+
+ switch_threadattr_create(&thd_attr, skypiax_module_pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypiax_do_tcp_srv_thread,
+ tech_pvt, skypiax_module_pool);
+ DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+
+ switch_threadattr_create(&thd_attr, skypiax_module_pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypiax_do_tcp_cli_thread,
+ tech_pvt, skypiax_module_pool);
+ DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+ switch_sleep(100000);
+
+ return 0;
+}
+
+int new_inbound_channel(private_t * tech_pvt)
+{
+ switch_core_session_t *session = NULL;
+ switch_channel_t *channel = NULL;
+
+ if ((session = switch_core_session_request(skypiax_endpoint_interface, NULL)) != 0) {
+ switch_core_session_add_stream(session, NULL);
+ channel = switch_core_session_get_channel(session);
+ skypiax_tech_init(tech_pvt, session);
+
+ if ((tech_pvt->caller_profile =
+ switch_caller_profile_new(switch_core_session_get_pool(session), "skypiax",
+ tech_pvt->dialplan, tech_pvt->callid_name,
+ tech_pvt->callid_number, NULL, NULL, NULL, NULL,
+ "mod_skypiax", tech_pvt->context,
+ tech_pvt->destination)) != 0) {
+ char name[128];
+ //switch_snprintf(name, sizeof(name), "skypiax/%s/%s", tech_pvt->name, tech_pvt->caller_profile->destination_number);
+ switch_snprintf(name, sizeof(name), "skypiax/%s", tech_pvt->name);
+ switch_channel_set_name(channel, name);
+ switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
+ }
+ switch_channel_set_state(channel, CS_INIT);
+ if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
+ ERRORA("Error spawning thread\n", SKYPIAX_P_LOG);
+ switch_core_session_destroy(&session);
+ }
+ }
+ switch_channel_mark_answered(channel);
+
+ DEBUGA_SKYPE("Here\n", SKYPIAX_P_LOG);
+
+ return 0;
+}
+
+int outbound_channel_answered(private_t * tech_pvt)
+{
+ switch_core_session_t *session = NULL;
+ switch_channel_t *channel = NULL;
+
+ if (strlen(tech_pvt->session_uuid_str)) {
+ session = switch_core_session_locate(tech_pvt->session_uuid_str);
+ } else {
+ ERRORA("No session???\n", SKYPIAX_P_LOG);
+ }
+ if (session) {
+ channel = switch_core_session_get_channel(session);
+ } else {
+ ERRORA("No session???\n", SKYPIAX_P_LOG);
+ }
+ if (channel) {
+ switch_channel_mark_answered(channel);
+ //DEBUGA_SKYPE("skype_call: %s, answered\n", SKYPIAX_P_LOG, id);
+ } else {
+ ERRORA("No channel???\n", SKYPIAX_P_LOG);
+ }
+
+ switch_core_session_rwunlock(session);
+ DEBUGA_SKYPE("HERE!\n", SKYPIAX_P_LOG);
+
+ return 0;
+}
+
+private_t *find_available_skypiax_interface(void)
+{
+ private_t *tech_pvt;
+ int found = 0;
+ int i;
+
+ for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+ if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
+ int skype_state = 0;
+
+ tech_pvt = &globals.SKYPIAX_INTERFACES[i];
+ skype_state = tech_pvt->interface_state;
+ DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n", SKYPIAX_P_LOG, i,
+ globals.SKYPIAX_INTERFACES[i].name, skype_state);
+ if (SKYPIAX_STATE_DOWN == skype_state || 0 == skype_state) {
+ found = 1;
+ break;
+ }
+ }
+ }
+
+ if (found)
+ return tech_pvt;
+ else
+ return NULL;
+}
+
/* For Emacs:
* Local Variables:
* mode:c
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h Thu Feb 12 03:04:35 2009
@@ -208,7 +208,7 @@
#else /* WIN32 */
int audiopipe[2];
int audioskypepipe[2];
- int skypiax_sound_capt_fd; /*!< \brief file descriptor for sound capture dev */
+ 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;
@@ -246,18 +246,18 @@
int skypiax_skype_call(private_t * tech_pvt, char *idest, int timeout);
int skypiax_skype_senddigit(private_t * tech_pvt, char digit);
-void * skypiax_do_tcp_srv_thread_func(void *obj);
+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 *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 *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 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_skype_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);
Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c Thu Feb 12 03:04:35 2009
@@ -61,8 +61,9 @@
return 0;
}
if (!strncasecmp(message, "ERROR 92 CALL", 12)) {
- ERRORA("Skype got ERROR: |||%s|||, the (skypeout) number we called was not recognized as valid\n",
- SKYPIAX_P_LOG, message);
+ ERRORA
+ ("Skype got ERROR: |||%s|||, the (skypeout) number we called was not recognized as valid\n",
+ SKYPIAX_P_LOG, message);
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
tech_pvt->skype_call_id[0] = '\0';
@@ -141,7 +142,7 @@
char msg_to_skype[256];
DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
SKYPIAX_P_LOG, message, obj, id, prop);
- //TODO: authomatically flag messages as read based on config param
+ //TODO: authomatically flag messages as read based on config param
sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
skypiax_skype_write(tech_pvt, msg_to_skype);
}
@@ -207,7 +208,7 @@
char msg_to_skype[1024];
if (tech_pvt->interface_state != SKYPIAX_STATE_DIALING) {
/* we are not calling out */
- if (!strlen(tech_pvt->skype_call_id)) {
+ if (!strlen(tech_pvt->skype_call_id)) {
/* we are not inside an active call */
tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
tech_pvt->interface_state = SKYPIAX_STATE_RING;
@@ -229,24 +230,30 @@
strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
} else {
/* we're owned, we're in a call, let's try to transfer */
- /************************** TODO
+ /************************** TODO
Checking here if it is possible to transfer this call to Test2
-> GET CALL 288 CAN_TRANSFER Test2
<- CALL 288 CAN_TRANSFER test2 TRUE
**********************************/
- private_t *available_skypiax_interface;
+ private_t *available_skypiax_interface;
- available_skypiax_interface = find_available_skypiax_interface();
- if(available_skypiax_interface){
- /* there is a skypiax interface idle, let's transfer the call to it */
- DEBUGA_SKYPE ("Let's transfer the skype_call %s to %s interface, because we are already in a skypiax call(%s)\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, available_skypiax_interface->name, id);
- sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id, available_skypiax_interface->name);
- } else{
- /* no skypiax interfaces idle, let's refuse the call */
- DEBUGA_SKYPE ("Let's refuse the skype_call %s, because we are already in a skypiax call(%s) and no other skypiax interfaces are available\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
- sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
- }
+ available_skypiax_interface = find_available_skypiax_interface();
+ if (available_skypiax_interface) {
+ /* there is a skypiax interface idle, let's transfer the call to it */
+ DEBUGA_SKYPE
+ ("Let's transfer the skype_call %s to %s interface, because we are already in a skypiax call(%s)\n",
+ SKYPIAX_P_LOG, tech_pvt->skype_call_id,
+ available_skypiax_interface->name, id);
+ sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id,
+ available_skypiax_interface->name);
+ } else {
+ /* no skypiax interfaces idle, let's refuse the call */
+ DEBUGA_SKYPE
+ ("Let's refuse the skype_call %s, because we are already in a skypiax call(%s) and no other skypiax interfaces are available\n",
+ SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
+ sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
+ }
skypiax_skype_write(tech_pvt, msg_to_skype);
skypiax_sleep(10000);
DEBUGA_SKYPE
@@ -268,22 +275,23 @@
SKYPIAX_P_LOG, id);
} else if (!strcasecmp(value, "MISSED")) {
DEBUGA_SKYPE("We missed skype_call %s\n", SKYPIAX_P_LOG, id);
- } else if (!strcasecmp(value, "FINISHED")) {
- DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
- if(!strcasecmp(tech_pvt->skype_call_id, id)){
- DEBUGA_SKYPE("skype_call %s is MY call, now I'm going DOWN\n", SKYPIAX_P_LOG, id);
- tech_pvt->skype_call_id[0] = '\0';
- if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
- //tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- return CALLFLOW_INCOMING_HANGUP;
- } else {
- tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
- }
- }else {
- DEBUGA_SKYPE("skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, id);
- }
+ } else if (!strcasecmp(value, "FINISHED")) {
+ DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
+ if (!strcasecmp(tech_pvt->skype_call_id, id)) {
+ DEBUGA_SKYPE("skype_call %s is MY call, now I'm going DOWN\n",
+ SKYPIAX_P_LOG, id);
+ tech_pvt->skype_call_id[0] = '\0';
+ if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
+ //tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ return CALLFLOW_INCOMING_HANGUP;
+ } else {
+ tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
+ }
+ } else {
+ DEBUGA_SKYPE("skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, id);
+ }
- } else if (!strcasecmp(value, "CANCELLED")) {
+ } else if (!strcasecmp(value, "CANCELLED")) {
tech_pvt->skype_callflow = CALLFLOW_STATUS_CANCELLED;
DEBUGA_SKYPE
("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n",
@@ -329,33 +337,35 @@
tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
DEBUGA_SKYPE("skype_call: %s is now UNPLACED\n", SKYPIAX_P_LOG, id);
- } else if (!strcasecmp(value, "INPROGRESS")) {
- char msg_to_skype[1024];
+ } else if (!strcasecmp(value, "INPROGRESS")) {
+ char msg_to_skype[1024];
- if(!strlen(tech_pvt->session_uuid_str) || !strlen(tech_pvt->skype_call_id) || !strcasecmp(tech_pvt->skype_call_id, id)){
- tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
- strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
- tech_pvt->interface_state = SKYPIAX_STATE_UP;
- DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
- sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
- tech_pvt->tcp_cli_port);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- start_audio_threads(tech_pvt);
- sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
- tech_pvt->tcp_srv_port);
- skypiax_skype_write(tech_pvt, msg_to_skype);
- tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
- if (!strlen(tech_pvt->session_uuid_str)) {
- DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
- new_inbound_channel(tech_pvt);
- } else {
- DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG);
- outbound_channel_answered(tech_pvt);
- }
- }else {
- DEBUGA_SKYPE("I'm on %s, skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
- }
- } else {
+ if (!strlen(tech_pvt->session_uuid_str) || !strlen(tech_pvt->skype_call_id)
+ || !strcasecmp(tech_pvt->skype_call_id, id)) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
+ strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
+ tech_pvt->interface_state = SKYPIAX_STATE_UP;
+ DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
+ sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_cli_port);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ start_audio_threads(tech_pvt);
+ sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_srv_port);
+ skypiax_skype_write(tech_pvt, msg_to_skype);
+ tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
+ if (!strlen(tech_pvt->session_uuid_str)) {
+ DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
+ new_inbound_channel(tech_pvt);
+ } else {
+ DEBUGA_SKYPE("Outbound Channel Answered!\n", SKYPIAX_P_LOG);
+ outbound_channel_answered(tech_pvt);
+ }
+ } else {
+ DEBUGA_SKYPE("I'm on %s, skype_call %s is NOT MY call, ignoring\n",
+ SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
+ }
+ } else {
WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG, id,
value);
}
@@ -495,7 +505,7 @@
SAMPLES_PER_FRAME * sizeof(short));
if (howmany != SAMPLES_PER_FRAME * sizeof(short)) {
ERRORA("howmany is %d, but was expected to be %d\n", SKYPIAX_P_LOG, howmany,
- (int)(SAMPLES_PER_FRAME * sizeof(short)));
+ (int) (SAMPLES_PER_FRAME * sizeof(short)));
}
/* done with the stored half frame */
tech_pvt->audiobuf_is_loaded = 0;
@@ -593,7 +603,7 @@
if (!running)
break;
FD_ZERO(&fs);
- to.tv_usec = 60000; //60msec
+ to.tv_usec = 60000; //60msec
to.tv_sec = 0;
#if defined(WIN32) && !defined(__CYGWIN__)
/* on win32 we cannot select from the apr "pipe", so we select on socket writability */
@@ -609,7 +619,6 @@
rt = select(fdselect + 1, &fs, NULL, NULL, &to);
#endif
-
if (rt > 0) {
/* read from the pipe the audio frame we are supposed to send out */
got =
@@ -617,7 +626,7 @@
SAMPLES_PER_FRAME * sizeof(short));
if (got != SAMPLES_PER_FRAME * sizeof(short)) {
WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
- (int)(SAMPLES_PER_FRAME * sizeof(short)));
+ (int) (SAMPLES_PER_FRAME * sizeof(short)));
}
if (got == SAMPLES_PER_FRAME * sizeof(short)) {
@@ -641,9 +650,9 @@
ERRORA("SAMPLERATE_SKYPIAX can only be 8000 or 16000\n", SKYPIAX_P_LOG);
}
- /* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party*/
+ /* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party */
len = send(fd, (char *) cli_out, got, 0);
- skypiax_sleep(5000); //5 msec
+ skypiax_sleep(5000); //5 msec
if (len == -1) {
break;
@@ -656,15 +665,15 @@
} else {
WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
- (int)(SAMPLES_PER_FRAME * sizeof(short)));
+ (int) (SAMPLES_PER_FRAME * sizeof(short)));
}
} else {
if (rt)
ERRORA("CLI rt=%d\n", SKYPIAX_P_LOG, rt);
- memset(cli_out, 0, sizeof(cli_out));
- len = send(fd, (char *) cli_out, sizeof(cli_out), 0);
- len = send(fd, (char *) cli_out, sizeof(cli_out)/2, 0);
- //DEBUGA_SKYPE("sent %d of zeros to keep the Skype client socket busy\n", SKYPIAX_P_LOG, sizeof(cli_out) + sizeof(cli_out)/2);
+ memset(cli_out, 0, sizeof(cli_out));
+ len = send(fd, (char *) cli_out, sizeof(cli_out), 0);
+ len = send(fd, (char *) cli_out, sizeof(cli_out) / 2, 0);
+ //DEBUGA_SKYPE("sent %d of zeros to keep the Skype client socket busy\n", SKYPIAX_P_LOG, sizeof(cli_out) + sizeof(cli_out)/2);
}
}
@@ -689,7 +698,7 @@
if (samples != SAMPLES_PER_FRAME * sizeof(short)) {
if (samples)
WARNINGA("read samples=%u expected=%u\n", SKYPIAX_P_LOG, samples,
- (int)(SAMPLES_PER_FRAME * sizeof(short)));
+ (int) (SAMPLES_PER_FRAME * sizeof(short)));
return 0;
} else {
/* A real frame */
1
0