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

Conflicts:

	src/mod/applications/mod_conference/mod_conference.c
This commit is contained in:
Joao Mesquita committed 2010-12-27 21:31:40 -03:00
commit 49a524b79b
75 files changed
+2077 -1236

No files matched your search

@@ -2488,6 +2488,48 @@ SWITCH_STANDARD_API(uuid_display_function)
return SWITCH_STATUS_SUCCESS;
}
#define BUGLIST_SYNTAX "<uuid>"
SWITCH_STANDARD_API(uuid_buglist_function)
{
char *mydata = NULL, *argv[2] = { 0 };
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
if (zstr(cmd)) {
goto error;
}
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc < 1) {
goto error;
}
if (argv[0]) {
switch_core_session_t *lsession = NULL;
if ((lsession = switch_core_session_locate(argv[0]))) {
status = switch_core_media_bug_enumerate(lsession, stream);
switch_core_session_rwunlock(lsession);
}
goto ok;
} else {
goto error;
}
error:
stream->write_function(stream, "-USAGE: %s\n", BUGLIST_SYNTAX);
switch_safe_free(mydata);
return SWITCH_STATUS_SUCCESS;
ok:
switch_safe_free(mydata);
return SWITCH_STATUS_SUCCESS;
}
#define SIMPLIFY_SYNTAX "<uuid>"
SWITCH_STANDARD_API(uuid_simplify_function)
{
@@ -2541,7 +2583,6 @@ SWITCH_STANDARD_API(uuid_simplify_function)
return SWITCH_STATUS_SUCCESS;
}
#define JITTERBUFFER_SYNTAX "<uuid> [0|<min_msec>[:<max_msec>]]"
SWITCH_STANDARD_API(uuid_jitterbuffer_function)
{
@@ -4797,6 +4838,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
SWITCH_ADD_API(commands_api_interface, "uuid_break", "Break", break_function, BREAK_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_bridge", "uuid_bridge", uuid_bridge_function, "");
SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_buglist", "List media bugs on a session", uuid_buglist_function, BUGLIST_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_chat", "Send a chat message", uuid_chat, UUID_CHAT_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_debug_audio", "debug audio", uuid_debug_audio_function, DEBUG_AUDIO_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX);
@@ -4911,6 +4953,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
switch_console_set_complete("add uuid_break ::console::list_uuid both");
switch_console_set_complete("add uuid_bridge ::console::list_uuid ::console::list_uuid");
switch_console_set_complete("add uuid_broadcast ::console::list_uuid");
switch_console_set_complete("add uuid_buglist ::console::list_uuid");
switch_console_set_complete("add uuid_chat ::console::list_uuid");
switch_console_set_complete("add uuid_debug_audio ::console::list_uuid");
switch_console_set_complete("add uuid_deflect ::console::list_uuid");
@@ -4939,7 +4982,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
switch_console_set_complete("add uuid_phone_event ::console::list_uuid talk");
switch_console_set_complete("add uuid_phone_event ::console::list_uuid hold");
switch_console_set_complete("add uuid_preprocess ::console::list_uuid");
switch_console_set_complete("add uuid_record ::console::list_uuid");
switch_console_set_complete("add uuid_record ::console::list_uuid ::[start:stop");
switch_console_set_complete("add uuid_recv_dtmf ::console::list_uuid");
switch_console_set_complete("add uuid_send_dtmf ::console::list_uuid");
switch_console_set_complete("add uuid_session_heartbeat ::console::list_uuid");
@@ -409,7 +409,7 @@ static switch_status_t conference_local_play_file(conference_obj_t *conference,
static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin);
static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin);
static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop);
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool);
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_core_session_t *session, switch_memory_pool_t *pool);
static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject,
const char *body, const char *type, const char *hint);
@@ -2501,7 +2501,9 @@ static void conference_loop_output(conference_member_t *member)
use_buffer = NULL;
mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer);
use_timer = 1;
if (mux_used) {
if (mux_used < bytes) {
if (++low_count >= 5) {
@@ -2514,10 +2516,7 @@ static void conference_loop_output(conference_member_t *member)
}
}
use_timer = 1;
if (mux_used) {
if (mux_used >= bytes) {
/* Flush the output buffer and write all the data (presumably muxed) back to the channel */
switch_mutex_lock(member->audio_out_mutex);
write_frame.data = data;
@@ -2525,7 +2524,7 @@ static void conference_loop_output(conference_member_t *member)
low_count = 0;
if ((write_frame.datalen = (uint32_t) switch_buffer_read(use_buffer, write_frame.data, bytes))) {
if (write_frame.datalen) {
write_frame.samples = write_frame.datalen / 2;
write_frame.samples = write_frame.datalen / 2;
if( !switch_test_flag(member, MFLAG_CAN_HEAR)) {
memset(write_frame.data, 255, write_frame.datalen);
@@ -4355,7 +4354,7 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc
}
/* Create the conference object. */
new_conference = conference_new(conf_name, xml_cfg, pool);
new_conference = conference_new(conf_name, xml_cfg, member->session, pool);
/* Release the config registry handle */
if (cxml) {
@@ -5480,7 +5479,7 @@ SWITCH_STANDARD_APP(conference_function)
}
/* Create the conference object. */
conference = conference_new(conf_name, xml_cfg, NULL);
conference = conference_new(conf_name, xml_cfg, session, NULL);
if (!conference) {
goto done;
@@ -5525,7 +5524,7 @@ SWITCH_STANDARD_APP(conference_function)
const char *max_members_str;
/* couldn't find the conference, create one */
conference = conference_new(conf_name, xml_cfg, NULL);
conference = conference_new(conf_name, xml_cfg, session, NULL);
if (!conference) {
goto done;
@@ -5950,7 +5949,7 @@ static conference_obj_t *conference_find(char *name)
}
/* create a new conferene with a specific profile */
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool)
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_core_session_t *session, switch_memory_pool_t *pool)
{
conference_obj_t *conference;
switch_xml_t xml_kvp;
@@ -5995,6 +5994,10 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
char *terminate_on_silence = NULL;
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
switch_uuid_t uuid;
switch_codec_implementation_t read_impl = { 0 };
switch_channel_t *channel = NULL;
const char *force_rate = NULL, *force_interval = NULL;
uint32_t force_rate_i = 0, force_interval_i = 0;
/* Validate the conference name */
if (zstr(name)) {
@@ -6002,6 +6005,37 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
return NULL;
}
if (session) {
uint32_t tmp;
switch_core_session_get_read_impl(session, &read_impl);
channel = switch_core_session_get_channel(session);
if ((force_rate = switch_channel_get_variable(channel, "conference_force_rate"))) {
if (!strcasecmp(force_rate, "auto")) {
force_rate_i = read_impl.actual_samples_per_second;
} else {
tmp = atoi(force_rate);
if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) {
force_rate_i = rate = tmp;
}
}
}
if ((force_interval = switch_channel_get_variable(channel, "conference_force_interval"))) {
if (!strcasecmp(force_interval, "auto")) {
force_interval_i = read_impl.microseconds_per_packet / 1000;
} else {
tmp = atoi(force_interval);
if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
force_interval_i = interval = tmp;
}
}
}
}
switch_mutex_lock(globals.hash_mutex);
/* parse the profile tree for param values */
@@ -6022,20 +6056,33 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
var = buf;
}
if (!strcasecmp(var, "rate") && !zstr(val)) {
if (!force_rate_i && !strcasecmp(var, "rate") && !zstr(val)) {
uint32_t tmp = atoi(val);
if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) {
rate = tmp;
if (session && tmp == 0) {
if (!strcasecmp(val, "auto")) {
rate = read_impl.actual_samples_per_second;
}
} else {
if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) {
rate = tmp;
}
}
} else if (!strcasecmp(var, "domain") && !zstr(val)) {
domain = val;
} else if (!strcasecmp(var, "interval") && !zstr(val)) {
} else if (!force_interval_i && !strcasecmp(var, "interval") && !zstr(val)) {
uint32_t tmp = atoi(val);
if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
interval = tmp;
if (session && tmp == 0) {
if (!strcasecmp(val, "auto")) {
interval = read_impl.microseconds_per_packet / 1000;
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
interval = tmp;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
}
}
} else if (!strcasecmp(var, "timer-name") && !zstr(val)) {
timer_name = val;
@@ -6306,6 +6353,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
} else {
conference->domain = "cluecon.com";
}
conference->rate = rate;
conference->interval = interval;
@@ -3112,6 +3112,11 @@ SWITCH_STANDARD_APP(verbose_events_function)
switch_channel_set_flag(switch_core_session_get_channel(session), CF_VERBOSE_EVENTS);
}
SWITCH_STANDARD_APP(cng_plc_function)
{
switch_channel_set_flag(switch_core_session_get_channel(session), CF_CNG_PLC);
}
SWITCH_STANDARD_APP(early_hangup_function)
{
switch_channel_set_flag(switch_core_session_get_channel(session), CF_EARLY_HANGUP);
@@ -3497,6 +3502,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
"<ip> <acl | cidr> [<hangup_cause>]", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
SWITCH_ADD_APP(app_interface, "verbose_events", "Make ALL Events verbose.", "Make ALL Events verbose.", verbose_events_function, "",
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
SWITCH_ADD_APP(app_interface, "cng_plc", "Do PLC on CNG frames", "", cng_plc_function, "",
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
SWITCH_ADD_APP(app_interface, "early_hangup", "Enable early hangup", "", early_hangup_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
SWITCH_ADD_APP(app_interface, "sleep", "Pause a channel", SLEEP_LONG_DESC, sleep_function, "<pausemilliseconds>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "delay_echo", "echo audio at a specified delay", "Delay n ms", delay_function, "<delay ms>", SAF_NONE);
@@ -188,10 +188,12 @@ static switch_status_t do_snap(switch_core_session_t *session)
switch_core_file_close(&fh);
switch_core_set_variable("file", file);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Wrote %s\n", file);
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_SUCCESS;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Bug is not attached.\n", switch_channel_get_name(channel));
return SWITCH_STATUS_FALSE;
}
#define SNAP_SYNTAX "start <sec> <read|write>"
@@ -249,7 +251,7 @@ SWITCH_STANDARD_APP(snapshot_app_function)
}
#define SNAP_API_SYNTAX "<uuid> <warning>"
#define SNAP_API_SYNTAX "<uuid> snap|start [<sec> read|write <base>]"
SWITCH_STANDARD_API(snapshot_function)
{
char *mycmd = NULL, *argv[5] = { 0 };
@@ -260,7 +262,7 @@ SWITCH_STANDARD_API(snapshot_function)
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (zstr(cmd) || argc < 1 || zstr(argv[0])) {
if (zstr(cmd) || argc < 2 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", SNAP_API_SYNTAX);
goto done;
} else {
@@ -270,9 +272,9 @@ SWITCH_STANDARD_API(snapshot_function)
if (!strcasecmp(argv[1], "snap")) {
status = do_snap(lsession);
} else if (!strcasecmp(argv[1], "start")) {
char *sec = argv[1];
char *fl = argv[2];
const char *base = argv[3];
char *sec = argv[2];
char *fl = argv[3];
const char *base = argv[4];
int seconds = 5;
switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING;
@@ -325,10 +327,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snapshot_load)
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
SWITCH_ADD_API(api_interface, "uuid_snapshot", "Snapshot API", snapshot_function, SNAP_API_SYNTAX);
SWITCH_ADD_APP(app_interface, "snapshot", "", "", snapshot_app_function, SNAP_SYNTAX, SAF_SUPPORT_NOMEDIA);
switch_console_set_complete("add uuid_snapshot ::console::list_uuid");
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
+1 -1
View File
@@ -589,7 +589,7 @@ FSH323EndPoint::FSH323EndPoint()
,m_fax_old_asn(false)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323EndPoint::FSH323EndPoint [%p]\n",this);
terminalType = e_GatewayOnly;
terminalType = e_GatewayAndMC;
}
FSH323EndPoint::~FSH323EndPoint()
+25 -1
View File
@@ -249,6 +249,7 @@ static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count,
loff_t *f_pos)
{
DEFINE_WAIT(wait);
size_t written;
struct skypopen_dev *dev = filp->private_data;
if(unload)
@@ -273,8 +274,31 @@ static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count,
prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE);
schedule();
finish_wait(&dev->inq, &wait);
return count;
if (!count)
return 0;
if (!access_ok(VERIFY_WRITE, buf, count))
return -EFAULT;
written = 0;
while (count) {
unsigned long unwritten;
size_t chunk = count;
if (chunk > PAGE_SIZE)
chunk = PAGE_SIZE; /* Just for latency reasons */
unwritten = __clear_user(buf, chunk);
written += chunk - unwritten;
if (unwritten)
break;
if (signal_pending(current))
return written ? written : -ERESTARTSYS;
buf += chunk;
count -= chunk;
cond_resched();
}
return written ? written : -EFAULT;
}
static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count,
@@ -6588,6 +6588,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_all(void * jarg1)
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_enumerate(void * jarg1, void * jarg2) {
int jresult ;
switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
switch_stream_handle_t *arg2 = (switch_stream_handle_t *) 0 ;
switch_status_t result;
arg1 = (switch_core_session_t *)jarg1;
arg2 = (switch_stream_handle_t *)jarg2;
result = (switch_status_t)switch_core_media_bug_enumerate(arg1,arg2);
jresult = result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_read(void * jarg1, void * jarg2, int jarg3) {
int jresult ;
switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
@@ -1045,6 +1045,11 @@ public class freeswitch {
return ret;
}
public static switch_status_t switch_core_media_bug_enumerate(SWIGTYPE_p_switch_core_session session, switch_stream_handle stream) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_enumerate(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_stream_handle.getCPtr(stream));
return ret;
}
public static switch_status_t switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug bug, switch_frame frame, switch_bool_t fill) {
switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame), (int)fill);
return ret;
@@ -7269,6 +7274,9 @@ class freeswitchPINVOKE {
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_all")]
public static extern int switch_core_media_bug_remove_all(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_enumerate")]
public static extern int switch_core_media_bug_enumerate(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_read")]
public static extern int switch_core_media_bug_read(HandleRef jarg1, HandleRef jarg2, int jarg3);
@@ -21525,6 +21533,8 @@ public enum switch_channel_flag_t {
CF_RECOVERED,
CF_JITTERBUFFER,
CF_DIALPLAN,
CF_BLOCK_BROADCAST_UNTIL_MEDIA,
CF_CNG_PLC,
CF_FLAG_MAX
}
+3 -3
View File
@@ -9732,17 +9732,17 @@ XS(SWIG_init) {
SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
SvREADONLY_on(sv);
} while(0) /*@SWIG@*/;
/*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
/*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
SvREADONLY_on(sv);