Merge branch 'master' of git.freeswitch.org:freeswitch

This commit is contained in:
Mathieu Parent
2010-04-08 20:52:30 +02:00
75 changed files with 4520 additions and 1946 deletions
+9 -9
View File
@@ -1,9 +1,9 @@
Makefile
Makefile.in
include/stamp-h1
include/switch_am_config.h
include/switch_private.h
include/switch_private.h.in
include/switch_swigable_cpp.h
include/switch_version.h
include/switch_version.h.in
/Makefile
/Makefile.in
/include/stamp-h1
/include/switch_am_config.h
/include/switch_private.h
/include/switch_private.h.in
/include/switch_swigable_cpp.h
/include/switch_version.h
/include/switch_version.h.in
+1
View File
@@ -1213,6 +1213,7 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_
*/
SWITCH_DECLARE(switch_status_t) switch_mcast_hops(switch_socket_t *sock, uint8_t ttl);
SWITCH_DECLARE(switch_status_t) switch_mcast_loopback(switch_socket_t *sock, uint8_t opt);
/** @} */
+4 -2
View File
@@ -246,9 +246,11 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_
#define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE)
SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check, switch_bool_t nolocal);
SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check);
#define switch_channel_export_variable(_channel, _varname, _value) switch_channel_export_variable_var_check(_channel, _varname, _value, SWITCH_TRUE)
SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...);
#define switch_channel_export_variable(_channel, _varname, _value, _nolocal) switch_channel_export_variable_var_check(_channel, _varname, _value, SWITCH_TRUE, _nolocal)
/*!
\brief Retrieve a variable from a given channel
+59 -59
View File
@@ -1,59 +1,59 @@
Makefile
Makefile.in
applications/mod_commands/Makefile
applications/mod_conference/Makefile
applications/mod_dptools/Makefile
applications/mod_enum/Makefile
applications/mod_enum/Makefile.in
applications/mod_enum/mod_enum.log
applications/mod_expr/Makefile
applications/mod_expr/Makefile.in
applications/mod_expr/mod_expr.log
applications/mod_fifo/Makefile
applications/mod_fsv/Makefile
applications/mod_limit/Makefile
applications/mod_stress/Makefile
applications/mod_stress/Makefile.in
applications/mod_t38gateway/Makefile
applications/mod_t38gateway/Makefile.in
applications/mod_valet_parking/Makefile
applications/mod_voicemail/Makefile
asr_tts/mod_unimrcp/Makefile
asr_tts/mod_unimrcp/Makefile.in
dialplans/mod_dialplan_asterisk/Makefile
dialplans/mod_dialplan_xml/Makefile
endpoints/mod_portaudio/Makefile
endpoints/mod_portaudio/Makefile.in
endpoints/mod_skinny/Makefile
endpoints/mod_skinny/Makefile.in
endpoints/mod_skypopen/Makefile
endpoints/mod_skypopen/Makefile.in
endpoints/mod_sofia/Makefile
endpoints/mod_sofia/Makefile.in
endpoints/mod_sofia/mod_sofia.log
event_handlers/mod_erlang_event/Makefile
event_handlers/mod_event_socket/Makefile
formats/mod_native_file/Makefile
formats/mod_portaudio_stream/Makefile
formats/mod_portaudio_stream/Makefile.in
formats/mod_tone_stream/Makefile
languages/mod_java/Makefile
languages/mod_lua/Makefile
languages/mod_lua/Makefile.in
languages/mod_lua/mod_lua.log
languages/mod_python/Makefile
languages/mod_spidermonkey/Makefile
languages/mod_spidermonkey/Makefile.in
languages/mod_spidermonkey/mod_spidermonkey.log
loggers/mod_console/Makefile
loggers/mod_logfile/Makefile
loggers/mod_syslog/Makefile
say/mod_say_en/Makefile
say/mod_say_ru/Makefile
applications/mod_stress/mod_stress.log
asr_tts/mod_unimrcp/mod_unimrcp.log
endpoints/mod_portaudio/mod_portaudio.log
endpoints/mod_skypopen/mod_skypopen.log
formats/mod_portaudio_stream/mod_portaudio_stream.log
languages/mod_java/freeswitch.jar
languages/mod_managed/freeswitch_wrap.cpp
/Makefile
/Makefile.in
/applications/mod_commands/Makefile
/applications/mod_conference/Makefile
/applications/mod_dptools/Makefile
/applications/mod_enum/Makefile
/applications/mod_enum/Makefile.in
/applications/mod_enum/mod_enum.log
/applications/mod_expr/Makefile
/applications/mod_expr/Makefile.in
/applications/mod_expr/mod_expr.log
/applications/mod_fifo/Makefile
/applications/mod_fsv/Makefile
/applications/mod_limit/Makefile
/applications/mod_stress/Makefile
/applications/mod_stress/Makefile.in
/applications/mod_t38gateway/Makefile
/applications/mod_t38gateway/Makefile.in
/applications/mod_valet_parking/Makefile
/applications/mod_voicemail/Makefile
/asr_tts/mod_unimrcp/Makefile
/asr_tts/mod_unimrcp/Makefile.in
/dialplans/mod_dialplan_asterisk/Makefile
/dialplans/mod_dialplan_xml/Makefile
/endpoints/mod_portaudio/Makefile
/endpoints/mod_portaudio/Makefile.in
/endpoints/mod_skinny/Makefile
/endpoints/mod_skinny/Makefile.in
/endpoints/mod_skypopen/Makefile
/endpoints/mod_skypopen/Makefile.in
/endpoints/mod_sofia/Makefile
/endpoints/mod_sofia/Makefile.in
/endpoints/mod_sofia/mod_sofia.log
/event_handlers/mod_erlang_event/Makefile
/event_handlers/mod_event_socket/Makefile
/formats/mod_native_file/Makefile
/formats/mod_portaudio_stream/Makefile
/formats/mod_portaudio_stream/Makefile.in
/formats/mod_tone_stream/Makefile
/languages/mod_java/Makefile
/languages/mod_lua/Makefile
/languages/mod_lua/Makefile.in
/languages/mod_lua/mod_lua.log
/languages/mod_python/Makefile
/languages/mod_spidermonkey/Makefile
/languages/mod_spidermonkey/Makefile.in
/languages/mod_spidermonkey/mod_spidermonkey.log
/loggers/mod_console/Makefile
/loggers/mod_logfile/Makefile
/loggers/mod_syslog/Makefile
/say/mod_say_en/Makefile
/say/mod_say_ru/Makefile
/applications/mod_stress/mod_stress.log
/asr_tts/mod_unimrcp/mod_unimrcp.log
/endpoints/mod_portaudio/mod_portaudio.log
/endpoints/mod_skypopen/mod_skypopen.log
/formats/mod_portaudio_stream/mod_portaudio_stream.log
/languages/mod_java/freeswitch.jar
/languages/mod_managed/freeswitch_wrap.cpp
@@ -25,7 +25,7 @@
*
* Rupa Schomaker <rupa@rupa.com>
*
* mod_cidlookup.c -- API for querying cid->name services
* mod_cidlookup.c -- API for querying cid->name services and local data
*
*/
@@ -3231,6 +3231,8 @@ SWITCH_STANDARD_API(show_function)
char *command = NULL, *as = NULL;
switch_core_flag_t cflags = switch_core_flags();
switch_status_t status = SWITCH_STATUS_SUCCESS;
char hostname[256] = "";
gethostname(hostname, sizeof(hostname));
if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "%s", "-ERR Databse Error!\n");
@@ -3283,29 +3285,30 @@ SWITCH_STANDARD_API(show_function)
if (end_of(command) == 's') {
end_of(command) = '\0';
}
sprintf(sql, "select type, name, ikey from interfaces where type = '%s' order by type,name", command);
sprintf(sql, "select type, name, ikey from interfaces where hostname='%s' and type = '%s' order by type,name", hostname, command);
} else if (!strncasecmp(command, "module", 6)) {
if (argv[1]) {
sprintf(sql, "select distinct type, name, ikey, filename from interfaces where ikey = '%s' order by type,name", argv[1]);
sprintf(sql, "select distinct type, name, ikey, filename from interfaces where hostname='%s' and ikey = '%s' order by type,name",
hostname, argv[1]);
} else {
sprintf(sql, "select distinct type, name, ikey, filename from interfaces order by type,name");
sprintf(sql, "select distinct type, name, ikey, filename from interfaces where hostname='%s' order by type,name", hostname);
}
} else if (!strcasecmp(command, "interfaces")) {
sprintf(sql, "select type, name, ikey from interfaces order by type,name");
sprintf(sql, "select type, name, ikey from interfaces where hostname='%s' order by type,name", hostname);
} else if (!strcasecmp(command, "interface_types")) {
sprintf(sql, "select type,count(type) as total from interfaces group by type order by type");
sprintf(sql, "select type,count(type) as total from interfaces where hostname='%s' group by type order by type", hostname);
} else if (!strcasecmp(command, "tasks")) {
sprintf(sql, "select * from %s", command);
sprintf(sql, "select * from %s where hostname='%s'", command, hostname);
} else if (!strcasecmp(command, "application") || !strcasecmp(command, "api")) {
if (argv[1] && strcasecmp(argv[1], "as")) {
sprintf(sql,
"select name, description, syntax, ikey from interfaces where type = '%s' and description != '' and name = '%s' order by type,name",
command, argv[1]);
"select name, description, syntax, ikey from interfaces where hostname='%s' and type = '%s' and description != '' and name = '%s' order by type,name",
hostname, command, argv[1]);
} else {
sprintf(sql, "select name, description, syntax, ikey from interfaces where type = '%s' and description != '' order by type,name", command);
sprintf(sql, "select name, description, syntax, ikey from interfaces where hostname='%s' and type = '%s' and description != '' order by type,name", hostname, command);
}
} else if (!strcasecmp(command, "calls")) {
sprintf(sql, "select * from calls order by call_created_epoch");
sprintf(sql, "select * from calls where hostname='%s' order by call_created_epoch", hostname);
if (argv[1] && !strcasecmp(argv[1], "count")) {
holder.justcount = 1;
if (argv[3] && !strcasecmp(argv[2], "as")) {
@@ -3322,12 +3325,12 @@ SWITCH_STANDARD_API(show_function)
}
if (strchr(argv[2], '%')) {
sprintf(sql,
"select * from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch",
argv[2], argv[2], argv[2], argv[2]);
"select * from channels where hostname='%s' and uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch",
hostname, argv[2], argv[2], argv[2], argv[2]);
} else {
sprintf(sql,
"select * from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch",
argv[2], argv[2], argv[2], argv[2]);
"select * from channels where hostname='%s' and uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch",
hostname, argv[2], argv[2], argv[2], argv[2]);
}
@@ -3335,10 +3338,10 @@ SWITCH_STANDARD_API(show_function)
as = argv[4];
}
} else {
sprintf(sql, "select * from channels order by created_epoch");
sprintf(sql, "select * from channels where hostname='%s' order by created_epoch", hostname);
}
} else if (!strcasecmp(command, "channels")) {
sprintf(sql, "select * from channels order by created_epoch");
sprintf(sql, "select * from channels where hostname='%s' order by created_epoch", hostname);
if (argv[1] && !strcasecmp(argv[1], "count")) {
holder.justcount = 1;
if (argv[3] && !strcasecmp(argv[2], "as")) {
@@ -3347,14 +3350,14 @@ SWITCH_STANDARD_API(show_function)
}
} else if (!strcasecmp(command, "distinct_channels")) {
sprintf(sql, "select * from channels left join calls on "
"channels.uuid=calls.caller_uuid where channels.uuid not in (select callee_uuid from calls) order by created_epoch");
"channels.uuid=calls.caller_uuid where channels.hostname='%s' channels.uuid not in (select callee_uuid from calls where hostname='%s') order by created_epoch", hostname, hostname);
if (argv[2] && !strcasecmp(argv[1], "as")) {
as = argv[2];
}
} else if (!strcasecmp(command, "aliases")) {
sprintf(sql, "select * from aliases order by alias");
sprintf(sql, "select * from aliases where hostname='%s' order by alias", hostname);
} else if (!strcasecmp(command, "complete")) {
sprintf(sql, "select * from complete order by a1,a2,a3,a4,a5,a6,a7,a8,a9,a10");
sprintf(sql, "select * from complete where hostname='%s' order by a1,a2,a3,a4,a5,a6,a7,a8,a9,a10", hostname);
} else if (!strncasecmp(command, "help", 4)) {
char *cmdname = NULL;
@@ -3363,9 +3366,10 @@ SWITCH_STANDARD_API(show_function)
if ((cmdname = strchr(command, ' ')) && strcasecmp(cmdname, "as")) {
*cmdname++ = '\0';
switch_snprintf(sql, sizeof(sql) - 1,
"select name, syntax, description, ikey from interfaces where type = 'api' and name = '%s' order by name", cmdname);
"select name, syntax, description, ikey from interfaces where hostname='%s' and type = 'api' and name = '%s' order by name",
hostname, cmdname);
} else {
switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description, ikey from interfaces where type = 'api' order by name");
switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description, ikey from interfaces where hostname='%s' and type = 'api' order by name", hostname);
}
} else if (!strcasecmp(command, "nat_map")) {
switch_snprintf(sql, sizeof(sql) - 1,
@@ -3373,7 +3377,7 @@ SWITCH_STANDARD_API(show_function)
" CASE proto "
" WHEN 0 THEN 'udp' "
" WHEN 1 THEN 'tcp' "
" ELSE 'unknown' " " END AS proto, " " proto AS proto_num, " " sticky " " FROM nat ORDER BY port, proto");
" ELSE 'unknown' " " END AS proto, " " proto AS proto_num, " " sticky " " FROM nat where hostname='%s' ORDER BY port, proto", hostname);
} else {
stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
goto end;
@@ -0,0 +1 @@
Makefile
@@ -0,0 +1 @@
Makefile
+1
View File
@@ -0,0 +1 @@
Makefile
@@ -0,0 +1 @@
Makefile
+2
View File
@@ -0,0 +1,2 @@
!/gsmlib/gsmlib-*/aclocal.m4
!/gsmlib/gsmlib-*/configure
+1 -1
View File
@@ -2,6 +2,6 @@ include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_skypopen
mod_LTLIBRARIES = mod_skypopen.la
mod_skypopen_la_SOURCES = mod_skypopen.c skypopen_protocol.c
mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -DSKYPOPEN_SVN_VERSION=\"`cat $(switch_builddir)/.version`\" -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff
mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -DSKYPOPEN_SVN_VERSION=\"`git describe`\" -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff
mod_skypopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_skypopen_la_LDFLAGS = -L../../../../libs/spandsp/src -avoid-version -module -no-undefined -shared -lX11 -lspandsp
+3 -3
View File
@@ -236,7 +236,7 @@ static void snd_card_dummy_pcm_timer_function(unsigned long data)
giovatimer.expires = 1 + jiffies;
add_timer(&giovatimer);
spin_lock_bh(&giovalock);
//spin_lock_bh(&giovalock);
for (i = 0; i < giovaindex + 1; i++) {
if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) {
@@ -262,7 +262,7 @@ static void snd_card_dummy_pcm_timer_function(unsigned long data)
//spin_unlock_bh(&dpcm->lock);
}
}
spin_unlock_bh(&giovalock);
//spin_unlock_bh(&giovalock);
for (i = 0; i < giovaindex + 1; i++) {
if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) {
@@ -774,7 +774,7 @@ static int __init alsa_card_dummy_init(void)
giovatimer.function = snd_card_dummy_pcm_timer_function;
giovatimer.expires = 1 + jiffies;
add_timer(&giovatimer);
printk("snd-dummy skypopen driver version: 5, %s:%d working on a machine with %dHZ kernel\n", __FILE__, __LINE__, HZ);
printk("snd-dummy skypopen driver version: 6, %s:%d working on a machine with %dHZ kernel\n", __FILE__, __LINE__, HZ);
spin_unlock_bh(&giovalock);
}
@@ -151,6 +151,7 @@ static struct {
char *report_incoming_chatmessages;
char *silent_mode;
char *write_silence_when_idle;
char *setsockopt;
int calls;
int real_interfaces;
int next_interface;
@@ -171,6 +172,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_skype_user, globals.skype_user);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_report_incoming_chatmessages, globals.report_incoming_chatmessages);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_silent_mode, globals.silent_mode);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_write_silence_when_idle, globals.write_silence_when_idle);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_setsockopt, globals.setsockopt);
static switch_status_t interface_exists(char *the_interface);
static switch_status_t remove_interface(char *the_interface);
@@ -1241,6 +1243,9 @@ static switch_status_t load_config(int reload_type)
} else if (!strcmp(var, "write_silence_when_idle")) {
set_global_write_silence_when_idle(val);
DEBUGA_SKYPE("globals.write_silence_when_idle=%s\n", SKYPOPEN_P_LOG, globals.write_silence_when_idle);
} else if (!strcmp(var, "setsockopt")) {
set_global_setsockopt(val);
DEBUGA_SKYPE("globals.setsockopt=%s\n", SKYPOPEN_P_LOG, globals.setsockopt);
}
}
@@ -1261,6 +1266,7 @@ static switch_status_t load_config(int reload_type)
char *report_incoming_chatmessages = "true";
char *silent_mode = "false";
char *write_silence_when_idle = "true";
char *setsockopt = "false";
uint32_t interface_id = 0;
if(globals.context)
@@ -1277,6 +1283,8 @@ static switch_status_t load_config(int reload_type)
silent_mode=globals.silent_mode;
if(globals.write_silence_when_idle)
write_silence_when_idle=globals.write_silence_when_idle;
if(globals.setsockopt)
setsockopt=globals.setsockopt;
tech_pvt = NULL;
@@ -1298,6 +1306,8 @@ static switch_status_t load_config(int reload_type)
silent_mode = val;
} else if (!strcasecmp(var, "write_silence_when_idle")) {
write_silence_when_idle = val;
} else if (!strcasecmp(var, "setsockopt")) {
setsockopt = val;
} else if (!strcasecmp(var, "X11-display") || !strcasecmp(var, "X11_display")) {
X11_display = val;
}
@@ -1397,6 +1407,13 @@ static switch_status_t load_config(int reload_type)
}
if (!strcmp(setsockopt, "true") || !strcmp(setsockopt, "1")) {
globals.SKYPOPEN_INTERFACES[interface_id].setsockopt = 1;
} else {
globals.SKYPOPEN_INTERFACES[interface_id].setsockopt = 0; //redundant, just in case
}
DEBUGA_SKYPE("interface_id=%d globals.SKYPOPEN_INTERFACES[interface_id].name=%s\n",
SKYPOPEN_P_LOG, interface_id, globals.SKYPOPEN_INTERFACES[interface_id].name);
DEBUGA_SKYPE
@@ -1423,6 +1440,9 @@ static switch_status_t load_config(int reload_type)
DEBUGA_SKYPE
("interface_id=%d globals.SKYPOPEN_INTERFACES[interface_id].write_silence_when_idle=%d\n",
SKYPOPEN_P_LOG, interface_id, globals.SKYPOPEN_INTERFACES[interface_id].write_silence_when_idle);
DEBUGA_SKYPE
("interface_id=%d globals.SKYPOPEN_INTERFACES[interface_id].setsockopt=%d\n",
SKYPOPEN_P_LOG, interface_id, globals.SKYPOPEN_INTERFACES[interface_id].setsockopt);
WARNINGA("STARTING interface_id=%d\n", SKYPOPEN_P_LOG, interface_id);
@@ -1532,6 +1552,7 @@ static switch_status_t load_config(int reload_type)
globals.SKYPOPEN_INTERFACES[i].report_incoming_chatmessages);
DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].silent_mode=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].silent_mode);
DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].write_silence_when_idle=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].write_silence_when_idle);
DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].setsockopt=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].setsockopt);
}
}
}
@@ -1775,6 +1796,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown)
switch_safe_free(globals.report_incoming_chatmessages);
switch_safe_free(globals.silent_mode);
switch_safe_free(globals.write_silence_when_idle);
switch_safe_free(globals.setsockopt);
return SWITCH_STATUS_SUCCESS;
}
@@ -287,6 +287,7 @@ struct private_object {
switch_buffer_t *read_buffer;
int silent_mode;
int write_silence_when_idle;
int setsockopt;
};
@@ -103,7 +103,9 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_
sockbufsize = SAMPLES_PER_FRAME * 8;
#endif //WIN32
size = sizeof(int);
setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, size);
if(tech_pvt->setsockopt){
setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, size);
}
sockbufsize = 0;
size = sizeof(int);
@@ -120,7 +122,9 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_
sockbufsize = SAMPLES_PER_FRAME * 8;
#endif //WIN32
size = sizeof(int);
setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, size);
if(tech_pvt->setsockopt){
setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, size);
}
sockbufsize = 0;
size = sizeof(int);
@@ -131,7 +135,9 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_
getsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, &size);
DEBUGA_SKYPE("TCP_NODELAY is %d\n", SKYPOPEN_P_LOG, flag);
flag = 1;
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, size);
if(tech_pvt->setsockopt){
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, size);
}
flag = 0;
getsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, &size);
DEBUGA_SKYPE("TCP_NODELAY is %d\n", SKYPOPEN_P_LOG, flag);
@@ -1563,6 +1569,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
Window root = -1;
Window win = -1;
int xfd;
fd_set xfds;
if (!strlen(tech_pvt->X11_display))
strcpy(tech_pvt->X11_display, getenv("DISPLAY"));
@@ -1623,6 +1630,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
int i;
int continue_is_broken = 0;
int there_were_continues = 0;
struct timeval tv;
Atom atom_begin = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
Atom atom_continue = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
@@ -1631,6 +1639,22 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
b = buffer;
while (running && tech_pvt->running) {
FD_ZERO(&xfds);
FD_SET(xfd, &xfds);
tv.tv_usec = 100000;
tv.tv_sec = 0;
if (select(xfd+1, &xfds, 0, 0, &tv)){
while(XPending(disp)){
XNextEvent(disp, &an_event);
if (!(running && tech_pvt->running))
break;
@@ -1664,7 +1688,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
}
if (an_event.xclient.message_type == atom_continue) {
if (!strlen(buffer)) {
DEBUGA_SKYPE
WARNINGA
("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||, let's store it and hope next 'begin' will be the good one\n",
SKYPOPEN_P_LOG, buf);
strcat(continuebuffer, buf);
@@ -1703,8 +1727,16 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
default:
skypopen_sleep(1000); //0.1 msec
break;
}
}
} //switch event.type
} //while XPending
} // if select
} //while running
}
} else {
ERRORA("Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypopen\n", SKYPOPEN_P_LOG);
@@ -52,7 +52,6 @@ static struct {
char *bindings;
uint32_t key_count;
char hostname[80];
uint64_t host_hash;
switch_port_t port;
switch_sockaddr_t *addr;
switch_socket_t *udp_socket;
@@ -295,36 +294,35 @@ static void event_handler(switch_event_t *event)
switch_uuid_get(&uuid);
switch_uuid_format(uuid_str, &uuid);
len = strlen(packet) + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + EVP_MAX_IV_LENGTH + strlen((char *) MAGIC);
len = strlen(packet) + SWITCH_UUID_FORMATTED_LENGTH + EVP_MAX_IV_LENGTH + strlen((char *) MAGIC);
#else
len = strlen(packet) + sizeof(globals.host_hash) + strlen((char *) MAGIC);
len = strlen(packet) + strlen((char *) MAGIC);
#endif
buf = malloc(len + 1);
memset(buf, 0, len + 1);
switch_assert(buf);
memcpy(buf, &globals.host_hash, sizeof(globals.host_hash));
#ifdef HAVE_OPENSSL
if (globals.psk) {
switch_copy_string(buf + sizeof(globals.host_hash), uuid_str, SWITCH_UUID_FORMATTED_LENGTH);
switch_copy_string(buf, uuid_str, SWITCH_UUID_FORMATTED_LENGTH);
EVP_CIPHER_CTX_init(&ctx);
EVP_EncryptInit(&ctx, EVP_bf_cbc(), NULL, NULL);
EVP_CIPHER_CTX_set_key_length(&ctx, strlen(globals.psk));
EVP_EncryptInit(&ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str);
EVP_EncryptUpdate(&ctx, (unsigned char *) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH,
EVP_EncryptUpdate(&ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH,
&outlen, (unsigned char *) packet, (int) strlen(packet));
EVP_EncryptUpdate(&ctx, (unsigned char *) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + outlen,
EVP_EncryptUpdate(&ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen,
&tmplen, (unsigned char *) MAGIC, (int) strlen((char *) MAGIC));
outlen += tmplen;
EVP_EncryptFinal(&ctx, (unsigned char *) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen);
EVP_EncryptFinal(&ctx, (unsigned char *) buf + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen);
outlen += tmplen;
len = (size_t) outlen + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH;
*(buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + outlen) = '\0';
len = (size_t) outlen + SWITCH_UUID_FORMATTED_LENGTH;
*(buf + SWITCH_UUID_FORMATTED_LENGTH + outlen) = '\0';
} else {
#endif
switch_copy_string(buf + sizeof(globals.host_hash), packet, len - sizeof(globals.host_hash));
switch_copy_string(buf + sizeof(globals.host_hash) + strlen(packet), (char *) MAGIC, strlen((char *) MAGIC) + 1);
switch_copy_string(buf, packet, len);
switch_copy_string(buf + strlen(packet), (char *) MAGIC, strlen((char *) MAGIC) + 1);
#ifdef HAVE_OPENSSL
}
#endif
@@ -369,7 +367,6 @@ SWITCH_STANDARD_API(multicast_peers)
SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load)
{
switch_api_interface_t *api_interface;
switch_ssize_t hlen = -1;
switch_status_t status = SWITCH_STATUS_GENERR;
memset(&globals, 0, sizeof(globals));
@@ -381,7 +378,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load)
switch_core_hash_init(&globals.peer_hash, module_pool);
gethostname(globals.hostname, sizeof(globals.hostname));
globals.host_hash = switch_hashfunc_default(globals.hostname, &hlen);
globals.key_count = 0;
if (load_config() != SWITCH_STATUS_SUCCESS) {
@@ -414,6 +410,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load)
switch_goto_status(SWITCH_STATUS_TERM, fail);
}
if (switch_mcast_loopback(globals.udp_socket, 0) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to disable loopback\n");
switch_goto_status(SWITCH_STATUS_TERM, fail);
}
if (switch_socket_bind(globals.udp_socket, globals.addr) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bind Error\n");
switch_goto_status(SWITCH_STATUS_TERM, fail);
@@ -501,7 +502,6 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime)
char *myaddr;
size_t len = MULTICAST_BUFFSIZE;
char *packet;
uint64_t host_hash = 0;
switch_status_t status;
memset(buf, 0, len);
@@ -520,12 +520,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime)
}
#endif
memcpy(&host_hash, buf, sizeof(host_hash));
packet = buf + sizeof(host_hash);
packet = buf;
if (host_hash == globals.host_hash) {
continue;
}
#ifdef HAVE_OPENSSL
if (globals.psk) {
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
@@ -533,7 +529,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime)
int outl, tmplen;
EVP_CIPHER_CTX ctx;
len -= sizeof(host_hash) + SWITCH_UUID_FORMATTED_LENGTH;
len -= SWITCH_UUID_FORMATTED_LENGTH;
tmp = malloc(len);
@@ -0,0 +1 @@
Makefile
+4
View File
@@ -768,6 +768,10 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_hops(switch_socket_t *sock, uint8_t
return apr_mcast_hops(sock, ttl);
}
SWITCH_DECLARE(switch_status_t) switch_mcast_loopback(switch_socket_t *sock, uint8_t opt)
{
return apr_mcast_loopback(sock, opt);
}
/* socket functions */
+30 -15
View File
@@ -737,34 +737,49 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t
return status;
}
SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check, switch_bool_t nolocal)
SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check)
{
const char *exports, *exports_varname = varname;
switch_status_t status;
const char *exports;
switch_status_t status = SWITCH_STATUS_FALSE;
exports = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE);
if (nolocal) {
exports_varname = switch_mprintf("nolocal:%s", varname);
}
if ((status = switch_channel_set_variable_var_check(channel, exports_varname, value, var_check)) != SWITCH_STATUS_SUCCESS) {
goto done;
if ((status = switch_channel_set_variable_var_check(channel, varname, value, var_check)) != SWITCH_STATUS_SUCCESS) {
return status;
}
if (varname && value) {
if (exports) {
switch_channel_set_variable_printf(channel, SWITCH_EXPORT_VARS_VARIABLE, "%s,%s", exports, exports_varname);
switch_channel_set_variable_printf(channel, SWITCH_EXPORT_VARS_VARIABLE, "%s,%s", exports, varname);
} else {
switch_channel_set_variable(channel, SWITCH_EXPORT_VARS_VARIABLE, exports_varname);
switch_channel_set_variable(channel, SWITCH_EXPORT_VARS_VARIABLE, varname);
}
}
done:
if (exports_varname != varname) {
free((char*)exports_varname);
return status;
}
SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...)
{
switch_status_t status = SWITCH_STATUS_FALSE;
char *data = NULL;
va_list ap;
int ret;
switch_assert(channel != NULL);
va_start(ap, fmt);
ret = switch_vasprintf(&data, fmt, ap);
va_end(ap);
if (ret == -1) {
return SWITCH_STATUS_FALSE;
}
status = switch_channel_export_variable(channel, varname, data);
free(data);
return status;
}
+5 -1
View File
@@ -304,6 +304,7 @@ static int switch_console_process(char *xcmd)
switch_stream_handle_t stream = { 0 };
switch_status_t status;
FILE *handle = switch_core_get_console();
int r = 1;
SWITCH_STANDARD_STREAM(stream);
switch_assert(stream.data);
@@ -316,6 +317,9 @@ static int switch_console_process(char *xcmd)
fflush(handle);
}
} else {
if (!strcasecmp(xcmd, "...") || !strcasecmp(xcmd, "shutdown")) {
r = 0;
}
if (handle) {
fprintf(handle, "Unknown Command: %s\n", xcmd);
fflush(handle);
@@ -324,7 +328,7 @@ static int switch_console_process(char *xcmd)
switch_safe_free(stream.data);
return 1;
return r;
}
+29 -26
View File
@@ -128,17 +128,20 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_partner(switch_core_sess
}
struct str_node {
char *str;
struct str_node *next;
};
SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_name, const char *var_val, switch_call_cause_t cause)
{
switch_hash_index_t *hi;
void *val;
switch_core_session_t *session;
switch_memory_pool_t *pool;
switch_queue_t *queue;
void *pop;
struct str_node *head = NULL, *np;
switch_core_new_memory_pool(&pool);
switch_queue_create(&queue, 250000, pool);
if (!var_val)
return;
@@ -152,7 +155,10 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
if (switch_channel_up(session->channel) &&
(this_val = switch_channel_get_variable(session->channel, var_name)) && (!strcmp(this_val, var_val))) {
switch_queue_push(queue, switch_core_strdup(pool, session->uuid_str));
np = switch_core_alloc(pool, sizeof(*np));
np->str = switch_core_strdup(pool, session->uuid_str);
np->next = head;
head = np;
}
switch_core_session_rwunlock(session);
}
@@ -160,10 +166,8 @@ SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_nam
}
switch_mutex_unlock(runtime.session_hash_mutex);
while (switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
char *uuid = (char *) pop;
if ((session = switch_core_session_locate(uuid))) {
for(np = head; np; np = np->next) {
if ((session = switch_core_session_locate(np->str))) {
switch_channel_hangup(session->channel, cause);
switch_core_session_rwunlock(session);
}
@@ -179,12 +183,10 @@ SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_i
void *val;
switch_core_session_t *session;
switch_memory_pool_t *pool;
switch_queue_t *queue;
void *pop;
struct str_node *head = NULL, *np;
switch_core_new_memory_pool(&pool);
switch_queue_create(&queue, 250000, pool);
switch_mutex_lock(runtime.session_hash_mutex);
for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
@@ -192,7 +194,10 @@ SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_i
session = (switch_core_session_t *) val;
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
if (session->endpoint_interface == endpoint_interface) {
switch_queue_push(queue, switch_core_strdup(pool, session->uuid_str));
np = switch_core_alloc(pool, sizeof(*np));
np->str = switch_core_strdup(pool, session->uuid_str);
np->next = head;
head = np;
}
switch_core_session_rwunlock(session);
}
@@ -200,10 +205,8 @@ SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_i
}
switch_mutex_unlock(runtime.session_hash_mutex);
while (switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
char *uuid = (char *) pop;
if ((session = switch_core_session_locate(uuid))) {
for(np = head; np; np = np->next) {
if ((session = switch_core_session_locate(np->str))) {
switch_channel_hangup(session->channel, cause);
switch_core_session_rwunlock(session);
}
@@ -219,11 +222,10 @@ SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause)
void *val;
switch_core_session_t *session;
switch_memory_pool_t *pool;
switch_queue_t *queue;
void *pop;
struct str_node *head = NULL, *np;
switch_core_new_memory_pool(&pool);
switch_queue_create(&queue, 250000, pool);
switch_mutex_lock(runtime.session_hash_mutex);
for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
@@ -231,17 +233,18 @@ SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause)
if (val) {
session = (switch_core_session_t *) val;
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
switch_queue_push(queue, switch_core_strdup(pool, session->uuid_str));
np = switch_core_alloc(pool, sizeof(*np));
np->str = switch_core_strdup(pool, session->uuid_str);
np->next = head;
head = np;
switch_core_session_rwunlock(session);
}
}
}
switch_mutex_unlock(runtime.session_hash_mutex);
while (switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
char *uuid = (char *) pop;
if ((session = switch_core_session_locate(uuid))) {
for(np = head; np; np = np->next) {
if ((session = switch_core_session_locate(np->str))) {
switch_channel_hangup(session->channel, cause);
switch_core_session_rwunlock(session);
}
+1
View File
@@ -633,6 +633,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
mod_g711_load(module_interface, pool);
return SWITCH_STATUS_SUCCESS;
//return SWITCH_STATUS_NOUNLOAD;
}
SWITCH_MODULE_SHUTDOWN_FUNCTION(core_pcm_shutdown)