mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-08 20:43:51 +00:00
Merge branch 'master' of git@git.freeswitch.org:freeswitch
Conflicts: src/mod/applications/mod_conference/mod_conference.c
This commit is contained in:
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;
|
||||
|
||||
Reference in new issue
Block a user