FS-7845 whitespace and indention

This commit is contained in:
William King 2015-07-16 17:42:21 -07:00
parent d8194e9edb
commit 59d1bdae1e
12 changed files with 1521 additions and 1418 deletions

View File

@ -9,7 +9,7 @@
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter at 0xdecafbad dot com>
@ -95,7 +95,7 @@ void conference_al_gen_arc(conference_obj_t *conference, switch_stream_handle_t
if (stream) {
stream->write_function(stream, "Member %d (%s) 0.0:0.0:0.0\n", member->id, switch_channel_get_name(member->channel));
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member %d (%s) 0.0:0.0:0.0\n",
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member %d (%s) 0.0:0.0:0.0\n",
member->id, switch_channel_get_name(member->channel));
}
}
@ -109,7 +109,7 @@ void conference_al_gen_arc(conference_obj_t *conference, switch_stream_handle_t
radius = 1.0f;
pos = -90.0f;
for (member = conference->members; member; member = member->next) {
if (!member->channel || conference_utils_member_test_flag(member, MFLAG_NO_POSITIONAL) || !conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK)) {
@ -146,13 +146,13 @@ void conference_al_gen_arc(conference_obj_t *conference, switch_stream_handle_t
if (stream) {
stream->write_function(stream, "Member %d (%s) %0.2f:0.0:%0.2f\n", member->id, switch_channel_get_name(member->channel), x, z);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member %d (%s) %0.2f:0.0:%0.2f\n",
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member %d (%s) %0.2f:0.0:%0.2f\n",
member->id, switch_channel_get_name(member->channel), x, z);
}
pos += offset;
}
end:
switch_mutex_unlock(conference->member_mutex);
@ -184,16 +184,16 @@ void conference_al_process(al_handle_t *al, void *data, switch_size_t datalen, i
if ((al->device = alcLoopbackOpenDeviceSOFT(NULL))) {
const ALshort silence[16] = { 0 };
float orient[6] = { /*fwd:*/ 0., 0., -1., /*up:*/ 0., 1., 0. };
al->context = alcCreateContext(al->device, contextAttr);
alcSetThreadContext(al->context);
/* listener at origin, facing down -z (ears at 0.0m height) */
alListener3f( AL_POSITION, 0. ,0, 0. );
alListener3f( AL_VELOCITY, 0., 0., 0. );
alListenerfv( AL_ORIENTATION, orient );
alGenSources(1, &al->source);
alSourcef( al->source, AL_PITCH, 1.);
alSourcef( al->source, AL_GAIN, 1.);
@ -210,17 +210,17 @@ void conference_al_process(al_handle_t *al, void *data, switch_size_t datalen, i
if (al->device) {
ALint processed = 0, state = 0;
//alcSetThreadContext(al->context);
alGetSourcei(al->source, AL_SOURCE_STATE, &state);
alGetSourcei(al->source, AL_BUFFERS_PROCESSED, &processed);
if (al->setpos) {
al->setpos = 0;
alSource3f(al->source, AL_POSITION, al->pos_x, al->pos_y, al->pos_z);
//alSource3f(al->source, AL_VELOCITY, .01, 0., 0.);
}
if (processed > 0) {
ALuint bufid;
alSourceUnqueueBuffers(al->source, 1, &bufid);
@ -231,29 +231,29 @@ void conference_al_process(al_handle_t *al, void *data, switch_size_t datalen, i
if (state != AL_PLAYING) {
alSourcePlay(al->source);
}
alcRenderSamplesSOFT(al->device, data, datalen / 2);
}
}
#endif
#ifndef OPENAL_POSITIONING
switch_status_t conference_al_parse_position(al_handle_t *al, const char *data)
switch_status_t conference_al_parse_position(al_handle_t *al, const char *data)
{
return SWITCH_STATUS_FALSE;
}
#else
switch_status_t conference_al_parse_position(al_handle_t *al, const char *data)
#else
switch_status_t conference_al_parse_position(al_handle_t *al, const char *data)
{
char *args[3];
int num;
char *dup;
dup = strdup((char *)data);
switch_assert(dup);
if ((num = switch_split(dup, ':', args)) != 3) {
return SWITCH_STATUS_FALSE;
}
@ -274,7 +274,7 @@ void conference_al_close(al_handle_t *al)
{
if (!al) return;
switch_mutex_lock(conference_globals.setup_mutex);
switch_mutex_lock(conference_globals.setup_mutex);
if (al->source) {
alDeleteSources(1, &al->source);
al->source = 0;
@ -299,3 +299,13 @@ void conference_al_close(al_handle_t *al)
}
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -9,7 +9,7 @@
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter at 0xdecafbad dot com>
@ -186,7 +186,7 @@ switch_status_t conference_api_main_real(const char *cmd, switch_core_session_t
} else if (argv[1] && strcasecmp(argv[1], "dial") == 0) {
if (conference_api_sub_dial(NULL, stream, argc, argv) != SWITCH_STATUS_SUCCESS) {
/* command returned error, so show syntax usage */
stream->write_function(stream, "%s %s", conference_api_sub_commands[CONF_API_COMMAND_DIAL].pcommand,
stream->write_function(stream, "%s %s", conference_api_sub_commands[CONF_API_COMMAND_DIAL].pcommand,
conference_api_sub_commands[CONF_API_COMMAND_DIAL].psyntax);
}
} else if (argv[1] && strcasecmp(argv[1], "bgdial") == 0) {
@ -208,50 +208,50 @@ switch_status_t conference_api_main_real(const char *cmd, switch_core_session_t
}
}
switch_safe_free(lbuf);
return status;
}
switch_status_t conference_api_sub_syntax(char **syntax)
switch_status_t conference_api_sub_syntax(char **syntax)
{
/* build api interface help ".syntax" field string */
uint32_t i;
size_t nl = 0, ol = 0;
char cmd_str[256];
char *tmp = NULL, *p = strdup("");
/* build api interface help ".syntax" field string */
uint32_t i;
size_t nl = 0, ol = 0;
char cmd_str[256];
char *tmp = NULL, *p = strdup("");
for (i = 0; i < CONFFUNCAPISIZE; i++) {
nl = strlen(conference_api_sub_commands[i].pcommand) + strlen(conference_api_sub_commands[i].psyntax) + 5;
switch_snprintf(cmd_str, sizeof(cmd_str), "add conference ::conference::conference_list_conferences %s", conference_api_sub_commands[i].pcommand);
switch_console_set_complete(cmd_str);
if (p != NULL) {
ol = strlen(p);
}
tmp = realloc(p, ol + nl);
if (tmp != NULL) {
p = tmp;
strcat(p, "\t\t");
strcat(p, conference_api_sub_commands[i].pcommand);
if (!zstr(conference_api_sub_commands[i].psyntax)) {
strcat(p, " ");
strcat(p, conference_api_sub_commands[i].psyntax);
}
if (i < CONFFUNCAPISIZE - 1) {
strcat(p, "\n");
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't realloc\n");
return SWITCH_STATUS_TERM;
}
}
for (i = 0; i < CONFFUNCAPISIZE; i++) {
nl = strlen(conference_api_sub_commands[i].pcommand) + strlen(conference_api_sub_commands[i].psyntax) + 5;
*syntax = p;
switch_snprintf(cmd_str, sizeof(cmd_str), "add conference ::conference::conference_list_conferences %s", conference_api_sub_commands[i].pcommand);
switch_console_set_complete(cmd_str);
return SWITCH_STATUS_SUCCESS;
if (p != NULL) {
ol = strlen(p);
}
tmp = realloc(p, ol + nl);
if (tmp != NULL) {
p = tmp;
strcat(p, "\t\t");
strcat(p, conference_api_sub_commands[i].pcommand);
if (!zstr(conference_api_sub_commands[i].psyntax)) {
strcat(p, " ");
strcat(p, conference_api_sub_commands[i].psyntax);
}
if (i < CONFFUNCAPISIZE - 1) {
strcat(p, "\n");
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't realloc\n");
return SWITCH_STATUS_TERM;
}
}
*syntax = p;
return SWITCH_STATUS_SUCCESS;
}
@ -271,7 +271,7 @@ switch_status_t conference_api_sub_agc(conference_obj_t *conference, switch_stre
conference->agc_level = 0;
return SWITCH_STATUS_SUCCESS;
}
if (argc > 3) {
level = atoi(argv[3]);
} else {
@ -287,7 +287,7 @@ switch_status_t conference_api_sub_agc(conference_obj_t *conference, switch_stre
if (stream) {
stream->write_function(stream, "OK AGC ENABLED %d\n", conference->agc_level);
}
} else {
if (stream) {
stream->write_function(stream, "-ERR invalid level\n");
@ -298,7 +298,7 @@ switch_status_t conference_api_sub_agc(conference_obj_t *conference, switch_stre
return SWITCH_STATUS_SUCCESS;
}
switch_status_t conference_api_sub_mute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
@ -417,7 +417,7 @@ switch_status_t conference_api_sub_conference_video_vmute_snap(conference_member
}
conference_video_vmute_snap(member, clear);
return SWITCH_STATUS_SUCCESS;
}
@ -434,7 +434,7 @@ switch_status_t conference_api_sub_vmute(conference_member_t *member, switch_str
conference_utils_member_clear_flag_locked(member, MFLAG_CAN_BE_SEEN);
conference_video_reset_video_bitrate_counters(member);
if (member->channel) {
switch_channel_set_flag(member->channel, CF_VIDEO_PAUSE_READ);
switch_core_session_request_video_refresh(member->session);
@ -483,7 +483,7 @@ switch_status_t conference_api_sub_unvmute(conference_member_t *member, switch_s
if (member == NULL)
return SWITCH_STATUS_GENERR;
if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) {
return SWITCH_STATUS_SUCCESS;
}
@ -579,7 +579,7 @@ switch_status_t conference_api_sub_hup(conference_member_t *member, switch_strea
if (member == NULL) {
return SWITCH_STATUS_GENERR;
}
conference_utils_member_clear_flag(member, MFLAG_RUNNING);
if (member->conference && test_eflag(member->conference, EFLAG_HUP_MEMBER)) {
@ -600,7 +600,7 @@ switch_status_t conference_api_sub_kick(conference_member_t *member, switch_stre
if (member == NULL) {
return SWITCH_STATUS_GENERR;
}
conference_utils_member_clear_flag(member, MFLAG_RUNNING);
conference_utils_member_set_flag_locked(member, MFLAG_KICKED);
switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
@ -643,10 +643,10 @@ switch_status_t conference_api_sub_dtmf(conference_member_t *member, switch_stre
for(p = dtmf; p && *p; p++) {
switch_dtmf_t *dt, digit = { *p, SWITCH_DEFAULT_DTMF_DURATION };
switch_zmalloc(dt, sizeof(*dt));
*dt = digit;
switch_queue_push(member->dtmf_queue, dt);
switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
}
@ -757,7 +757,7 @@ switch_status_t conference_api_sub_layer(conference_member_t *member, switch_str
if (switch_is_number(val)) {
index = atoi(val) - 1;
if (index < 0) {
index = 0;
}
@ -860,10 +860,10 @@ switch_status_t conference_api_sub_auto_position(conference_obj_t *conference, s
}
stream->write_function(stream, "+OK positioning %s\n", conference_utils_test_flag(conference, CFLAG_POSITIONAL) ? "on" : "off");
#else
stream->write_function(stream, "-ERR not supported\n");
#endif
return SWITCH_STATUS_SUCCESS;
@ -891,7 +891,7 @@ switch_status_t conference_api_sub_position(conference_member_t *member, switch_
conference_utils_member_set_flag(member, MFLAG_POSITIONAL);
member->al = conference_al_create(member->pool);
} else {
if (stream) {
stream->write_function(stream, "Positional audio not avalilable %d\n", member->conference->channels);
}
@ -908,7 +908,7 @@ switch_status_t conference_api_sub_position(conference_member_t *member, switch_
return SWITCH_STATUS_FALSE;
}
}
if (stream != NULL) {
stream->write_function(stream, "Position %u = %0.2f:%0.2f:%0.2f\n", member->id, member->al->pos_x, member->al->pos_y, member->al->pos_z);
@ -1047,7 +1047,7 @@ switch_status_t conference_api_sub_vid_fps(conference_obj_t *conference, switch_
}
return SWITCH_STATUS_SUCCESS;
}
switch_status_t conference_api_sub_write_png(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
@ -1113,22 +1113,22 @@ switch_status_t conference_api_sub_vid_layout(conference_obj_t *conference, swit
int xx = 4;
if ((group_name = strchr(argv[2], ':'))) {
group_name++;
xx--;
group_name++;
xx--;
} else {
group_name = argv[3];
group_name = argv[3];
}
if (!group_name) {
stream->write_function(stream, "Group name not specified.\n");
return SWITCH_STATUS_SUCCESS;
stream->write_function(stream, "Group name not specified.\n");
return SWITCH_STATUS_SUCCESS;
} else {
if (((lg = switch_core_hash_find(conference->layout_group_hash, group_name)))) {
if (((lg = switch_core_hash_find(conference->layout_group_hash, group_name)))) {
vlayout = conference_video_find_best_layout(conference, lg, 0);
}
if (!vlayout) {
stream->write_function(stream, "Invalid group layout [%s]\n", group_name);
stream->write_function(stream, "Invalid group layout [%s]\n", group_name);
return SWITCH_STATUS_SUCCESS;
}
@ -1152,9 +1152,9 @@ switch_status_t conference_api_sub_vid_layout(conference_obj_t *conference, swit
stream->write_function(stream, "Invalid layout [%s]\n", argv[2]);
return SWITCH_STATUS_SUCCESS;
}
if (idx < 0 || idx > conference->canvas_count - 1) idx = 0;
stream->write_function(stream, "Change canvas %d to layout [%s]\n", idx + 1, vlayout->name);
switch_mutex_lock(conference->member_mutex);
@ -1468,7 +1468,7 @@ switch_status_t conference_api_sub_vid_logo_img(conference_member_t *member, swi
layer = &member->conference->canvas->layers[member->video_layer_id];
switch_mutex_lock(layer->canvas->mutex);
if (strcasecmp(text, "clear")) {
member->video_logo = switch_core_strdup(member->pool, text);
}
@ -1510,7 +1510,7 @@ switch_status_t conference_api_sub_vid_res_id(conference_member_t *member, switc
switch_mutex_lock(member->conference->canvas->mutex);
//layer = &member->conference->canvas->layers[member->video_layer_id];
if (!strcasecmp(text, "clear") || (member->video_reservation_id && !strcasecmp(text, member->video_reservation_id))) {
member->video_reservation_id = NULL;
stream->write_function(stream, "+OK reservation_id cleared\n");
@ -1595,14 +1595,14 @@ switch_status_t conference_api_sub_vid_floor(conference_member_t *member, switch
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "conference %s OK video floor auto\n", member->conference->name);
} else {
stream->write_function(stream, "OK floor none\n");
}
}
} else if (force || member->conference->video_floor_holder == 0) {
conference_utils_set_flag(member->conference, CFLAG_VID_FLOOR_LOCK);
conference_video_set_floor_holder(member->conference, member, SWITCH_TRUE);
if (test_eflag(member->conference, EFLAG_FLOOR_CHANGE)) {
if (stream == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "conference %s OK video floor %d %s\n",
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "conference %s OK video floor %d %s\n",
member->conference->name, member->id, switch_channel_get_name(member->channel));
} else {
stream->write_function(stream, "OK floor %u\n", member->id);
@ -1610,7 +1610,7 @@ switch_status_t conference_api_sub_vid_floor(conference_member_t *member, switch
}
} else {
if (stream == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "conference %s floor already held by %d %s\n",
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "conference %s floor already held by %d %s\n",
member->conference->name, member->id, switch_channel_get_name(member->channel));
} else {
stream->write_function(stream, "ERR floor is held by %u\n", member->conference->video_floor_holder);
@ -1630,7 +1630,7 @@ switch_status_t conference_api_sub_file_seek(conference_obj_t *conference, switc
switch_mutex_lock(conference->mutex);
conference_fnode_seek(conference->fnode, stream, argv[2]);
switch_mutex_unlock(conference->mutex);
return SWITCH_STATUS_SUCCESS;
}
@ -1638,10 +1638,10 @@ switch_status_t conference_api_sub_file_seek(conference_obj_t *conference, switc
uint32_t id = atoi(argv[3]);
conference_member_t *member = conference_member_get(conference, id);
if (member == NULL) {
stream->write_function(stream, "Member: %u not found.\n", id);
return SWITCH_STATUS_GENERR;
stream->write_function(stream, "Member: %u not found.\n", id);
return SWITCH_STATUS_GENERR;
}
switch_mutex_lock(member->fnode_mutex);
conference_fnode_seek(member->fnode, stream, argv[2]);
switch_mutex_unlock(member->fnode_mutex);
@ -1676,7 +1676,7 @@ switch_status_t conference_api_sub_play(conference_obj_t *conference, switch_str
if (conference->fnode && conference->fnode->fh.params) {
switch_event_merge(event, conference->fnode->fh.params);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "play-file");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "File", argv[2]);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Async", async ? "true" : "false");
@ -1805,7 +1805,7 @@ switch_status_t conference_api_sub_saymember(conference_obj_t *conference, switc
}
ret_status = SWITCH_STATUS_SUCCESS;
done:
done:
if (member) {
switch_thread_rwlock_unlock(member->rwlock);
@ -1876,9 +1876,9 @@ switch_status_t conference_api_sub_relate(conference_obj_t *conference, switch_s
for (rel = member->relationships; rel; rel = rel->next) {
stream->write_function(stream, "%d -> %d %s%s%s\n", member->id, rel->id,
(rel->flags & RFLAG_CAN_SPEAK) ? "SPEAK " : "NOSPEAK ",
(rel->flags & RFLAG_CAN_HEAR) ? "HEAR " : "NOHEAR ",
(rel->flags & RFLAG_CAN_SEND_VIDEO) ? "SENDVIDEO " : "NOSENDVIDEO ");
(rel->flags & RFLAG_CAN_SPEAK) ? "SPEAK " : "NOSPEAK ",
(rel->flags & RFLAG_CAN_HEAR) ? "HEAR " : "NOHEAR ",
(rel->flags & RFLAG_CAN_SEND_VIDEO) ? "SENDVIDEO " : "NOSENDVIDEO ");
}
}
} else {
@ -1976,7 +1976,7 @@ switch_status_t conference_api_sub_relate(conference_obj_t *conference, switch_s
stream->write_function(stream, "relationship %u->%u not found.\n", id, oid);
}
skip:
skip:
if (member) {
switch_thread_rwlock_unlock(member->rwlock);
}
@ -2039,12 +2039,12 @@ switch_status_t conference_api_sub_exit_sound(conference_obj_t *conference, swit
switch_assert(conference != NULL);
switch_assert(stream != NULL);
if (argc <= 2) {
stream->write_function(stream, "Not enough args\n");
return SWITCH_STATUS_GENERR;
}
if ( !strcasecmp(argv[2], "on") ) {
conference_utils_set_flag_locked(conference, CFLAG_EXIT_SOUND);
stream->write_function(stream, "OK %s exit sounds on (%s)\n", argv[0], conference->exit_sound);
@ -2060,7 +2060,7 @@ switch_status_t conference_api_sub_exit_sound(conference_obj_t *conference, swit
conference_event_add_data(conference, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "exit-sounds-off");
switch_event_fire(&event);
}
}
} else if ( !strcasecmp(argv[2], "file") ) {
if (! argv[3]) {
stream->write_function(stream, "No filename specified\n");
@ -2073,13 +2073,13 @@ switch_status_t conference_api_sub_exit_sound(conference_obj_t *conference, swit
conference_event_add_data(conference, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "exit-sound-file-changed");
switch_event_fire(&event);
}
}
}
} else {
stream->write_function(stream, "Bad args\n");
return SWITCH_STATUS_GENERR;
return SWITCH_STATUS_GENERR;
}
return 0;
}
@ -2090,12 +2090,12 @@ switch_status_t conference_api_sub_enter_sound(conference_obj_t *conference, swi
switch_assert(conference != NULL);
switch_assert(stream != NULL);
if (argc <= 2) {
stream->write_function(stream, "Not enough args\n");
return SWITCH_STATUS_GENERR;
}
if ( !strcasecmp(argv[2], "on") ) {
conference_utils_set_flag_locked(conference, CFLAG_ENTER_SOUND);
stream->write_function(stream, "OK %s enter sounds on (%s)\n", argv[0], conference->enter_sound);
@ -2111,7 +2111,7 @@ switch_status_t conference_api_sub_enter_sound(conference_obj_t *conference, swi
conference_event_add_data(conference, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "enter-sounds-off");
switch_event_fire(&event);
}
}
} else if ( !strcasecmp(argv[2], "file") ) {
if (! argv[3]) {
stream->write_function(stream, "No filename specified\n");
@ -2123,13 +2123,13 @@ switch_status_t conference_api_sub_enter_sound(conference_obj_t *conference, swi
conference_event_add_data(conference, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "enter-sound-file-changed");
switch_event_fire(&event);
}
}
}
} else {
stream->write_function(stream, "Bad args\n");
return SWITCH_STATUS_GENERR;
return SWITCH_STATUS_GENERR;
}
return 0;
}
@ -2147,7 +2147,7 @@ switch_status_t conference_api_sub_dial(conference_obj_t *conference, switch_str
}
if (conference && argv[2] && strstr(argv[2], "vlc/")) {
tmp = switch_core_sprintf(conference->pool, "{vlc_rate=%d,vlc_channels=%d,vlc_interval=%d}%s",
tmp = switch_core_sprintf(conference->pool, "{vlc_rate=%d,vlc_channels=%d,vlc_interval=%d}%s",
conference->rate, conference->channels, conference->interval, argv[2]);
argv[2] = tmp;
}
@ -2198,7 +2198,7 @@ switch_status_t conference_api_sub_transfer(conference_obj_t *conference, switch
switch_assert(conference != NULL);
switch_assert(stream != NULL);
if (argc > 3 && !zstr(argv[2])) {
int x;
@ -2216,7 +2216,7 @@ switch_status_t conference_api_sub_transfer(conference_obj_t *conference, switch
switch_channel_t *channel;
switch_event_t *event;
char *xdest = NULL;
if (!id || !(member = conference_member_get(conference, id))) {
stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
continue;
@ -2225,11 +2225,11 @@ switch_status_t conference_api_sub_transfer(conference_obj_t *conference, switch
channel = switch_core_session_get_channel(member->session);
xdest = switch_core_session_sprintf(member->session, "conference:%s@%s", conference_name, profile_name);
switch_ivr_session_transfer(member->session, xdest, "inline", NULL);
switch_channel_set_variable(channel, "last_transfered_conference", conference_name);
stream->write_function(stream, "OK Member '%d' sent to conference %s.\n", member->id, argv[2]);
/* tell them what happened */
if (test_eflag(conference, EFLAG_TRANSFER) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
@ -2307,7 +2307,7 @@ switch_status_t conference_api_sub_norecord(conference_obj_t *conference, switch
stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
} else {
if (test_eflag(conference, EFLAG_RECORD) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_event_add_data(conference, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "stop-recording");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", all ? "all" : argv[2]);
@ -2341,25 +2341,25 @@ switch_status_t conference_api_sub_pauserec(conference_obj_t *conference, switch
return SWITCH_STATUS_GENERR;
}
stream->write_function(stream, "%s recording file %s\n",
action == REC_ACTION_PAUSE ? "Pause" : "Resume", argv[2]);
action == REC_ACTION_PAUSE ? "Pause" : "Resume", argv[2]);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s recording file %s\n",
action == REC_ACTION_PAUSE ? "Pause" : "Resume", argv[2]);
action == REC_ACTION_PAUSE ? "Pause" : "Resume", argv[2]);
if (!conference_record_action(conference, argv[2], action)) {
stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
} else {
if (test_eflag(conference, EFLAG_RECORD) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS)
{
conference_event_add_data(conference, event);
if (action == REC_ACTION_PAUSE) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "pause-recording");
} else {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "resume-recording");
{
conference_event_add_data(conference, event);
if (action == REC_ACTION_PAUSE) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "pause-recording");
} else {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "resume-recording");
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", argv[2]);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Other-Recordings", conference->record_count ? "true" : "false");
switch_event_fire(&event);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", argv[2]);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Other-Recordings", conference->record_count ? "true" : "false");
switch_event_fire(&event);
}
}
return SWITCH_STATUS_SUCCESS;
@ -2437,7 +2437,7 @@ switch_status_t conference_api_sub_file_vol(conference_obj_t *conference, switch
ok = 1;
}
switch_mutex_unlock(conference->mutex);
if (ok) {
stream->write_function(stream, "volume changed\n");
@ -2478,7 +2478,7 @@ switch_status_t conference_api_sub_pin(conference_obj_t *conference, switch_stre
}
switch_status_t conference_api_sub_get(conference_obj_t *conference,
switch_stream_handle_t *stream, int argc, char **argv) {
switch_stream_handle_t *stream, int argc, char **argv) {
int ret_status = SWITCH_STATUS_GENERR;
if (argc != 3) {
@ -2487,43 +2487,43 @@ switch_status_t conference_api_sub_get(conference_obj_t *conference,
ret_status = SWITCH_STATUS_SUCCESS;
if (strcasecmp(argv[2], "run_time") == 0) {
stream->write_function(stream, "%ld",
switch_epoch_time_now(NULL) - conference->run_time);
switch_epoch_time_now(NULL) - conference->run_time);
} else if (strcasecmp(argv[2], "count") == 0) {
stream->write_function(stream, "%d",
conference->count);
conference->count);
} else if (strcasecmp(argv[2], "count_ghosts") == 0) {
stream->write_function(stream, "%d",
conference->count_ghosts);
conference->count_ghosts);
} else if (strcasecmp(argv[2], "max_members") == 0) {
stream->write_function(stream, "%d",
conference->max_members);
conference->max_members);
} else if (strcasecmp(argv[2], "rate") == 0) {
stream->write_function(stream, "%d",
conference->rate);
conference->rate);
} else if (strcasecmp(argv[2], "profile_name") == 0) {
stream->write_function(stream, "%s",
conference->profile_name);
conference->profile_name);
} else if (strcasecmp(argv[2], "sound_prefix") == 0) {
stream->write_function(stream, "%s",
conference->sound_prefix);
conference->sound_prefix);
} else if (strcasecmp(argv[2], "caller_id_name") == 0) {
stream->write_function(stream, "%s",
conference->caller_id_name);
conference->caller_id_name);
} else if (strcasecmp(argv[2], "caller_id_number") == 0) {
stream->write_function(stream, "%s",
conference->caller_id_number);
conference->caller_id_number);
} else if (strcasecmp(argv[2], "is_locked") == 0) {
stream->write_function(stream, "%s",
conference_utils_test_flag(conference, CFLAG_LOCKED) ? "locked" : "");
conference_utils_test_flag(conference, CFLAG_LOCKED) ? "locked" : "");
} else if (strcasecmp(argv[2], "endconference_grace_time") == 0) {
stream->write_function(stream, "%d",
conference->endconference_grace_time);
conference->endconference_grace_time);
} else if (strcasecmp(argv[2], "uuid") == 0) {
stream->write_function(stream, "%s",
conference->uuid_str);
conference->uuid_str);
} else if (strcasecmp(argv[2], "wait_mod") == 0) {
stream->write_function(stream, "%s",
conference_utils_test_flag(conference, CFLAG_WAIT_MOD) ? "true" : "");
conference_utils_test_flag(conference, CFLAG_WAIT_MOD) ? "true" : "");
} else {
ret_status = SWITCH_STATUS_FALSE;
}
@ -2533,7 +2533,7 @@ switch_status_t conference_api_sub_get(conference_obj_t *conference,
}
switch_status_t conference_api_sub_set(conference_obj_t *conference,
switch_stream_handle_t *stream, int argc, char **argv) {
switch_stream_handle_t *stream, int argc, char **argv) {
int ret_status = SWITCH_STATUS_GENERR;
if (argc != 4 || zstr(argv[3])) {
@ -2548,23 +2548,23 @@ switch_status_t conference_api_sub_set(conference_obj_t *conference,
} else {
ret_status = SWITCH_STATUS_FALSE;
}
} else if (strcasecmp(argv[2], "sound_prefix") == 0) {
} else if (strcasecmp(argv[2], "sound_prefix") == 0) {
stream->write_function(stream, "%s",conference->sound_prefix);
conference->sound_prefix = switch_core_strdup(conference->pool, argv[3]);
} else if (strcasecmp(argv[2], "caller_id_name") == 0) {
} else if (strcasecmp(argv[2], "caller_id_name") == 0) {
stream->write_function(stream, "%s",conference->caller_id_name);
conference->caller_id_name = switch_core_strdup(conference->pool, argv[3]);
} else if (strcasecmp(argv[2], "caller_id_number") == 0) {
} else if (strcasecmp(argv[2], "caller_id_number") == 0) {
stream->write_function(stream, "%s",conference->caller_id_number);
conference->caller_id_number = switch_core_strdup(conference->pool, argv[3]);
} else if (strcasecmp(argv[2], "endconference_grace_time") == 0) {
int new_gt = atoi(argv[3]);
if (new_gt >= 0) {
stream->write_function(stream, "%d", conference->endconference_grace_time);
conference->endconference_grace_time = new_gt;
} else {
ret_status = SWITCH_STATUS_FALSE;
}
int new_gt = atoi(argv[3]);
if (new_gt >= 0) {
stream->write_function(stream, "%d", conference->endconference_grace_time);
conference->endconference_grace_time = new_gt;
} else {
ret_status = SWITCH_STATUS_FALSE;
}
} else {
ret_status = SWITCH_STATUS_FALSE;
}
@ -2737,3 +2737,14 @@ switch_status_t conference_api_dispatch(conference_obj_t *conference, switch_str
return status;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -9,7 +9,7 @@
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter at 0xdecafbad dot com>
@ -78,7 +78,7 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
if (!(xml = switch_xml_new("conference-info"))) {
abort();
}
switch_mutex_lock(conference->mutex);
switch_snprintf(tmp, sizeof(tmp), "%u", conference->doc_version);
conference->doc_version++;
@ -98,12 +98,12 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
}
}
}
switch_xml_set_attr_d(xml, "version", tmpp);
switch_xml_set_attr_d(xml, "state", "full");
switch_xml_set_attr_d(xml, "xmlns", "urn:ietf:params:xml:ns:conference-info");
uri = switch_mprintf("sip:%s@%s", name, domain);
switch_xml_set_attr_d(xml, "entity", uri);
@ -111,7 +111,7 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
if (!(x_tag = switch_xml_add_child_d(xml, "conference-description", off++))) {
abort();
}
if (!(x_tag1 = switch_xml_add_child_d(x_tag, "display-text", off1++))) {
abort();
}
@ -140,7 +140,7 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
abort();
}
switch_snprintf(tmp, sizeof(tmp), "%u", conference->count);
switch_xml_set_txt_d(x_tag1, tmpp);
switch_xml_set_txt_d(x_tag1, tmpp);
#if 0
if (conference->count == 0) {
@ -151,20 +151,20 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
if (!(x_tag1 = switch_xml_add_child_d(x_tag, "active", off1++))) {
abort();
}
switch_xml_set_txt_d(x_tag1, "true");
switch_xml_set_txt_d(x_tag1, "true");
off1 = off2 = off3 = off4 = 0;
if (!(x_tag = switch_xml_add_child_d(xml, "users", off++))) {
abort();
}
switch_mutex_lock(conference->member_mutex);
for (np = conference->cdr_nodes; np; np = np->next) {
char *user_uri = NULL;
switch_channel_t *channel = NULL;
if (!np->cp || (np->member && !np->member->session) || np->leave_time) { /* for now we'll remove participants when the leave */
continue;
}
@ -184,12 +184,12 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
user_uri = strdup(uri);
}
}
if (!user_uri) {
user_uri = switch_mprintf("sip:%s@%s", np->cp->caller_id_number, domain);
}
switch_xml_set_attr_d(x_tag1, "state", "full");
switch_xml_set_attr_d(x_tag1, "entity", user_uri);
@ -197,13 +197,13 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
abort();
}
switch_xml_set_txt_d(x_tag2, np->cp->caller_id_name);
if (!(x_tag2 = switch_xml_add_child_d(x_tag1, "endpoint", off2++))) {
abort();
}
switch_xml_set_attr_d(x_tag2, "entity", user_uri);
if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "display-text", off3++))) {
abort();
}
@ -228,7 +228,7 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
char *p;
switch_time_exp_lt(&tm, (switch_time_t) conference->start_time * 1000000);
switch_strftime_nocheck(tmp, &retsize, sizeof(tmp), fmt, &tm);
switch_strftime_nocheck(tmp, &retsize, sizeof(tmp), fmt, &tm);
p = end_of_p(tmpp) -1;
snprintf(p, 4, ":00");
@ -237,13 +237,13 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
}
/** ok so this is in the rfc but not the xsd
if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "joining-method", off3++))) {
/** ok so this is in the rfc but not the xsd
if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "joining-method", off3++))) {
abort();
}
switch_xml_set_txt_d(x_tag3, np->cp->direction == SWITCH_CALL_DIRECTION_INBOUND ? "dialed-in" : "dialed-out");
}
switch_xml_set_txt_d(x_tag3, np->cp->direction == SWITCH_CALL_DIRECTION_INBOUND ? "dialed-in" : "dialed-out");
*/
if (np->member) {
@ -256,7 +256,7 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "media", off3++))) {
abort();
}
snprintf(tmp, sizeof(tmp), "%ua", np->member->id);
switch_xml_set_attr_d(x_tag3, "id", tmpp);
@ -272,20 +272,20 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
}
switch_xml_set_txt_d(x_tag4, var);
}
if (!(x_tag4 = switch_xml_add_child_d(x_tag3, "status", off4++))) {
abort();
}
switch_xml_set_txt_d(x_tag4, conference_cdr_audio_flow(np->member));
if (switch_channel_test_flag(channel, CF_VIDEO)) {
off4 = 0;
if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "media", off3++))) {
abort();
}
snprintf(tmp, sizeof(tmp), "%uv", np->member->id);
switch_xml_set_attr_d(x_tag3, "id", tmpp);
@ -301,15 +301,15 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
}
switch_xml_set_txt_d(x_tag4, var);
}
if (!(x_tag4 = switch_xml_add_child_d(x_tag3, "status", off4++))) {
abort();
}
switch_xml_set_txt_d(x_tag4, switch_channel_test_flag(channel, CF_HOLD) ? "sendonly" : "sendrecv");
}
}
switch_safe_free(user_uri);
}
@ -319,9 +319,9 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
xml_text = switch_xml_toxml(xml, SWITCH_TRUE);
switch_xml_free(xml);
switch_safe_free(dup_domain);
switch_safe_free(uri);
switch_safe_free(uri);
return xml_text;
}
@ -338,7 +338,7 @@ cJSON *conference_cdr_json_render(conference_obj_t *conference, cJSON *req)
cJSON *json = cJSON_CreateObject(), *jusers = NULL, *jold_users = NULL, *juser = NULL, *jvars = NULL;
switch_assert(json);
switch_mutex_lock(conference->mutex);
switch_snprintf(tmp, sizeof(tmp), "%u", conference->doc_version);
conference->doc_version++;
@ -354,20 +354,20 @@ cJSON *conference_cdr_json_render(conference_obj_t *conference, cJSON *req)
domain = "cluecon.com";
}
}
uri = switch_mprintf("%s@%s", name, domain);
json_add_child_string(json, "entity", uri);
json_add_child_string(json, "conferenceDescription", conference->desc ? conference->desc : "FreeSWITCH Conference");
json_add_child_string(json, "conferenceState", "active");
json_add_child_string(json, "entity", uri);
json_add_child_string(json, "conferenceDescription", conference->desc ? conference->desc : "FreeSWITCH Conference");
json_add_child_string(json, "conferenceState", "active");
switch_snprintf(tmp, sizeof(tmp), "%u", conference->count);
json_add_child_string(json, "userCount", tmp);
json_add_child_string(json, "userCount", tmp);
jusers = json_add_child_array(json, "users");
jold_users = json_add_child_array(json, "oldUsers");
switch_mutex_lock(conference->member_mutex);
for (np = conference->cdr_nodes; np; np = np->next) {
char *user_uri = NULL;
switch_channel_t *channel = NULL;
@ -375,7 +375,7 @@ cJSON *conference_cdr_json_render(conference_obj_t *conference, cJSON *req)
switch_size_t retsize;
const char *fmt = "%Y-%m-%dT%H:%M:%S%z";
char *p;
if (np->record_path || !np->cp) {
continue;
}
@ -397,25 +397,25 @@ cJSON *conference_cdr_json_render(conference_obj_t *conference, cJSON *req)
user_uri = strdup(uri);
}
}
if (np->cp) {
if (!user_uri) {
user_uri = switch_mprintf("%s@%s", np->cp->caller_id_number, domain);
}
json_add_child_string(juser, "entity", user_uri);
json_add_child_string(juser, "displayText", np->cp->caller_id_name);
}
//if (np->record_path) {
//json_add_child_string(juser, "recordingPATH", np->record_path);
//json_add_child_string(juser, "recordingPATH", np->record_path);
//}
json_add_child_string(juser, "status", np->leave_time ? "disconnected" : "connected");
switch_time_exp_lt(&tm, (switch_time_t) conference->start_time * 1000000);
switch_strftime_nocheck(tmp, &retsize, sizeof(tmp), fmt, &tm);
switch_strftime_nocheck(tmp, &retsize, sizeof(tmp), fmt, &tm);
p = end_of_p(tmpp) -1;
snprintf(p, 4, ":00");
@ -448,7 +448,7 @@ cJSON *conference_cdr_json_render(conference_obj_t *conference, cJSON *req)
json_add_child_string(jvars, hp->name, hp->value);
}
}
switch_json_add_presence_data_cols(var_event, jvars, "PD-");
switch_event_destroy(&var_event);
@ -456,15 +456,15 @@ cJSON *conference_cdr_json_render(conference_obj_t *conference, cJSON *req)
if ((var = switch_channel_get_variable(channel, "rtp_use_ssrc"))) {
json_add_child_string(juser, "rtpAudioSSRC", var);
}
json_add_child_string(juser, "rtpAudioDirection", conference_cdr_audio_flow(np->member));
if (switch_channel_test_flag(channel, CF_VIDEO)) {
if ((var = switch_channel_get_variable(channel, "rtp_use_video_ssrc"))) {
json_add_child_string(juser, "rtpVideoSSRC", var);
}
json_add_child_string(juser, "rtpVideoDirection", switch_channel_test_flag(channel, CF_HOLD) ? "sendonly" : "sendrecv");
}
}
@ -474,14 +474,14 @@ cJSON *conference_cdr_json_render(conference_obj_t *conference, cJSON *req)
}
cJSON_AddItemToArray(np->leave_time ? jold_users : jusers, juser);
switch_safe_free(user_uri);
}
switch_mutex_unlock(conference->member_mutex);
switch_safe_free(dup_domain);
switch_safe_free(uri);
switch_safe_free(uri);
return json;
}
@ -525,9 +525,9 @@ void conference_cdr_add(conference_member_t *member)
member->cdr_node->cp = switch_caller_profile_dup(member->conference->pool, cp);
member->cdr_node->id = member->id;
}
void conference_cdr_rejected(conference_obj_t *conference, switch_channel_t *channel, cdr_reject_reason_t reason)
@ -570,38 +570,38 @@ void conference_cdr_render(conference_obj_t *conference)
if (!(x_conference = switch_xml_add_child_d(cdr, "conference", cdr_off++))) {
abort();
}
if (!(x_ptr = switch_xml_add_child_d(x_conference, "name", conference_off++))) {
abort();
}
switch_xml_set_txt_d(x_ptr, conference->name);
if (!(x_ptr = switch_xml_add_child_d(x_conference, "hostname", conference_off++))) {
abort();
}
switch_xml_set_txt_d(x_ptr, switch_core_get_hostname());
if (!(x_ptr = switch_xml_add_child_d(x_conference, "rate", conference_off++))) {
abort();
}
switch_snprintf(str, sizeof(str), "%d", conference->rate);
switch_xml_set_txt_d(x_ptr, str);
if (!(x_ptr = switch_xml_add_child_d(x_conference, "interval", conference_off++))) {
abort();
}
switch_snprintf(str, sizeof(str), "%d", conference->interval);
switch_xml_set_txt_d(x_ptr, str);
if (!(x_ptr = switch_xml_add_child_d(x_conference, "start_time", conference_off++))) {
abort();
}
switch_xml_set_attr_d(x_ptr, "type", "UNIX-epoch");
switch_snprintf(str, sizeof(str), "%ld", (long)conference->start_time);
switch_xml_set_txt_d(x_ptr, str);
if (!(x_ptr = switch_xml_add_child_d(x_conference, "end_time", conference_off++))) {
abort();
}
@ -626,7 +626,7 @@ void conference_cdr_render(conference_obj_t *conference)
}
switch_xml_set_attr_d(x_member, "type", np->cp ? "caller" : "recording_node");
if (!(x_ptr = switch_xml_add_child_d(x_member, "join_time", member_off++))) {
abort();
}
@ -693,7 +693,7 @@ void conference_cdr_render(conference_obj_t *conference)
switch_xml_set_txt_d(x_ptr, "conference_locked");
} else if (rp->reason == CDRR_MAXMEMBERS) {
switch_xml_set_txt_d(x_ptr, "max_members_reached");
} else if (rp->reason == CDRR_PIN) {
} else if (rp->reason == CDRR_PIN) {
switch_xml_set_txt_d(x_ptr, "invalid_pin");
}
@ -711,51 +711,62 @@ void conference_cdr_render(conference_obj_t *conference)
switch_ivr_set_xml_profile_data(x_cp, rp->cp, 0);
}
}
xml_text = switch_xml_toxml(cdr, SWITCH_TRUE);
if (!zstr(conference->log_dir)) {
path = switch_mprintf("%s%s%s.cdr.xml", conference->log_dir, SWITCH_PATH_SEPARATOR, conference->uuid_str);
#ifdef _MSC_VER
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
#else
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) {
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) {
#endif
int wrote;
wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
wrote++;
close(fd);
fd = -1;
} else {
char ebuf[512] = { 0 };
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n",
path, switch_strerror_r(errno, ebuf, sizeof(ebuf)));
}
if (conference->cdr_event_mode != CDRE_NONE) {
switch_event_t *event;
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_CDR) == SWITCH_STATUS_SUCCESS)
// if (switch_event_create(&event, SWITCH_EVENT_CDR) == SWITCH_STATUS_SUCCESS)
{
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CDR-Source", CONF_EVENT_CDR);
if (conference->cdr_event_mode == CDRE_AS_CONTENT) {
switch_event_set_body(event, xml_text);
} else {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CDR-Path", path);
}
switch_event_fire(&event);
int wrote;
wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
wrote++;
close(fd);
fd = -1;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create CDR event");
char ebuf[512] = { 0 };
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n",
path, switch_strerror_r(errno, ebuf, sizeof(ebuf)));
}
if (conference->cdr_event_mode != CDRE_NONE) {
switch_event_t *event;
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_CDR) == SWITCH_STATUS_SUCCESS)
// if (switch_event_create(&event, SWITCH_EVENT_CDR) == SWITCH_STATUS_SUCCESS)
{
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CDR-Source", CONF_EVENT_CDR);
if (conference->cdr_event_mode == CDRE_AS_CONTENT) {
switch_event_set_body(event, xml_text);
} else {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CDR-Path", path);
}
switch_event_fire(&event);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create CDR event");
}
}
}
switch_safe_free(path);
switch_safe_free(xml_text);
switch_xml_free(cdr);
}
switch_safe_free(path);
switch_safe_free(xml_text);
switch_xml_free(cdr);
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -9,7 +9,7 @@
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter at 0xdecafbad dot com>
@ -44,7 +44,7 @@
void conference_event_mod_channel_handler(const char *event_channel, cJSON *json, const char *key, switch_event_channel_id_t id)
{
cJSON *data, *addobj = NULL;
cJSON *data, *addobj = NULL;
const char *action = NULL;
char *value = NULL;
cJSON *jid = 0;
@ -80,7 +80,7 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json
argv[i] = str->valuestring;
}
}
} else if (jvalue->type == cJSON_String) {
} else if (jvalue->type == cJSON_String) {
value = jvalue->valuestring;
argv[argc++] = value;
}
@ -94,20 +94,20 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json
}
SWITCH_STANDARD_STREAM(stream);
if (!strcasecmp(action, "kick") ||
!strcasecmp(action, "mute") ||
!strcasecmp(action, "unmute") ||
if (!strcasecmp(action, "kick") ||
!strcasecmp(action, "mute") ||
!strcasecmp(action, "unmute") ||
!strcasecmp(action, "tmute") ||
!strcasecmp(action, "vmute") ||
!strcasecmp(action, "unvmute") ||
!strcasecmp(action, "tvmute")
!strcasecmp(action, "vmute") ||
!strcasecmp(action, "unvmute") ||
!strcasecmp(action, "tvmute")
) {
exec = switch_mprintf("%s %s %d", conference_name, action, cid);
} else if (!strcasecmp(action, "volume_in") ||
!strcasecmp(action, "volume_out") ||
!strcasecmp(action, "vid-res-id") ||
!strcasecmp(action, "vid-floor") ||
} else if (!strcasecmp(action, "volume_in") ||
!strcasecmp(action, "volume_out") ||
!strcasecmp(action, "vid-res-id") ||
!strcasecmp(action, "vid-floor") ||
!strcasecmp(action, "vid-layer") ||
!strcasecmp(action, "vid-canvas") ||
!strcasecmp(action, "vid-watching-canvas") ||
@ -135,7 +135,7 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json
switch_ivr_session_transfer(member->session, argv[0], argv[1], argv[2]);
switch_thread_rwlock_unlock(member->rwlock);
}
switch_thread_rwlock_unlock(conference->rwlock);
switch_thread_rwlock_unlock(conference->rwlock);
}
goto end;
} else if (!strcasecmp(action, "list-videoLayouts")) {
@ -154,13 +154,13 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json
}
if (conference->layout_group_hash) {
for (hi = switch_core_hash_first(conference->layout_group_hash); hi; hi = switch_core_hash_next(&hi)) {
char *name;
switch_core_hash_this(hi, &vvar, NULL, &val);
name = switch_mprintf("group:%s", (char *)vvar);
cJSON_AddItemToArray(array, cJSON_CreateString(name));
free(name);
}
for (hi = switch_core_hash_first(conference->layout_group_hash); hi; hi = switch_core_hash_next(&hi)) {
char *name;
switch_core_hash_this(hi, &vvar, NULL, &val);
name = switch_mprintf("group:%s", (char *)vvar);
cJSON_AddItemToArray(array, cJSON_CreateString(name));
free(name);
}
}
switch_mutex_unlock(conference_globals.setup_mutex);
@ -180,7 +180,7 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json
cJSON_AddItemToObject(msg, "eventChannel", cJSON_CreateString(event_channel));
cJSON_AddItemToObject(jdata, "action", cJSON_CreateString("response"));
if (addobj) {
cJSON_AddItemToObject(jdata, "conf-command", cJSON_CreateString(action));
cJSON_AddItemToObject(jdata, "response", cJSON_CreateString("OK"));
@ -234,9 +234,9 @@ void conference_event_channel_handler(const char *event_channel, cJSON *json, co
*domain++ = '\0';
}
}
if (!strcasecmp(action, "bootstrap")) {
if (!zstr(name) && (conference = conference_find(name, domain))) {
if (!zstr(name) && (conference = conference_find(name, domain))) {
conference_desc = conference_cdr_json_render(conference, json);
} else {
conference_desc = cJSON_CreateObject();
@ -251,7 +251,7 @@ void conference_event_channel_handler(const char *event_channel, cJSON *json, co
}
json_add_child_string(conference_desc, "action", "conferenceDescription");
cJSON_AddItemToObject(reply, "data", conference_desc);
switch_safe_free(dup);
@ -286,9 +286,9 @@ void conference_event_send_json(conference_obj_t *conference)
event = cJSON_CreateObject();
json_add_child_string(event, "eventChannel", event_channel);
json_add_child_string(event, "eventChannel", event_channel);
cJSON_AddItemToObject(event, "data", conference_desc);
switch_event_channel_broadcast(event_channel, &event, "mod_conference", conference_globals.event_channel_id);
switch_safe_free(dup_domain);
@ -306,9 +306,9 @@ void conference_event_adv_la(conference_obj_t *conference, conference_member_t *
//if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) {
switch_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ);
switch_core_media_gen_key_frame(member->session);
//}
//}
if (conference && conference->la && member->session &&
if (conference && conference->la && member->session &&
!switch_channel_test_flag(member->channel, CF_VIDEO_ONLY)) {
cJSON *msg, *data;
const char *uuid = switch_core_session_get_uuid(member->session);
@ -329,16 +329,16 @@ void conference_event_adv_la(conference_obj_t *conference, conference_member_t *
cJSON_AddItemToObject(data, "role", cJSON_CreateString(conference_utils_member_test_flag(member, MFLAG_MOD) ? "moderator" : "participant"));
cJSON_AddItemToObject(data, "chatID", cJSON_CreateString(conference->chat_id));
cJSON_AddItemToObject(data, "canvasCount", cJSON_CreateNumber(conference->canvas_count));
if (conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN)) {
cJSON_AddItemToObject(data, "secondScreen", cJSON_CreateTrue());
}
if (conference_utils_member_test_flag(member, MFLAG_MOD)) {
cJSON_AddItemToObject(data, "modChannel", cJSON_CreateString(conference->mod_event_channel));
}
switch_core_get_variables(&variables);
switch_core_get_variables(&variables);
for (hp = variables->headers; hp; hp = hp->next) {
if (!strncasecmp(hp->name, "conference_verto_", 11)) {
char *var = hp->name + 11;
@ -363,7 +363,7 @@ void conference_event_send_rfc(conference_obj_t *conference)
switch_event_t *event;
char *body;
char *name = NULL, *domain = NULL, *dup_domain = NULL;
if (!conference_utils_test_flag(conference, CFLAG_RFC4579)) {
return;
}
@ -425,7 +425,7 @@ void conference_event_chat_message_broadcast(conference_obj_t *conference, switc
const char *presence_id = switch_channel_get_variable(member->channel, "presence_id");
const char *chat_proto = switch_channel_get_variable(member->channel, "chat_proto");
switch_event_t *reply = NULL;
if (presence_id && chat_proto) {
if (switch_event_get_header(processed, presence_id)) {
continue;
@ -434,9 +434,9 @@ void conference_event_chat_message_broadcast(conference_obj_t *conference, switc
switch_event_add_header_string(reply, SWITCH_STACK_BOTTOM, "to", presence_id);
switch_event_add_header_string(reply, SWITCH_STACK_BOTTOM, "conference_name", conference->name);
switch_event_add_header_string(reply, SWITCH_STACK_BOTTOM, "conference_domain", conference->domain);
switch_event_set_body(reply, switch_event_get_body(event));
switch_core_chat_deliver(chat_proto, &reply);
switch_event_add_header_string(processed, SWITCH_STACK_BOTTOM, presence_id, "true");
}
@ -469,7 +469,7 @@ void conference_event_call_setup_handler(switch_event_t *event)
if (conference_utils_test_flag(conference, CFLAG_RFC4579)) {
char *key = switch_mprintf("conference_%s_%s_%s_%s", conference->name, conference->domain, ext, ext_domain);
char *expanded = NULL, *ostr = dial_str;;
if (!strcasecmp(action, "call")) {
if((conference->max_members > 0) && (conference->count >= conference->max_members)) {
// Conference member limit has been reached; do not proceed with setup request
@ -509,7 +509,7 @@ void conference_event_call_setup_handler(switch_event_t *event)
switch_safe_free(expanded);
}
}
} else if (!strcasecmp(action, "end")) {
if (switch_core_session_hupall_matching_var("conference_call_key", key, SWITCH_CAUSE_NORMAL_CLEARING)) {
conference_send_notify(conference, "SIP/2.0 200 OK\r\n", call_id, SWITCH_TRUE);
@ -544,7 +544,7 @@ void conference_event_call_setup_handler(switch_event_t *event)
switch_event_fire(&event);
}
}
}
void conference_data_event_handler(switch_event_t *event)
@ -586,7 +586,7 @@ void conference_event_pres_handler(switch_event_t *event)
if (!(dup_to = strdup(to))) {
return;
}
conference_name = dup_to + 5;
@ -595,7 +595,7 @@ void conference_event_pres_handler(switch_event_t *event)
}
dup_conference_name = switch_mprintf("%q@%q", conference_name, domain_name);
if ((conference = conference_find(conference_name, NULL)) || (conference = conference_find(dup_conference_name, NULL))) {
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
@ -642,7 +642,7 @@ switch_status_t chat_send(switch_event_t *message_event)
conference_obj_t *conference = NULL;
switch_stream_handle_t stream = { 0 };
const char *proto;
const char *from;
const char *from;
const char *to;
//const char *subject;
const char *body;
@ -671,7 +671,7 @@ switch_status_t chat_send(switch_event_t *message_event)
}
if (!(conference = conference_find(name, NULL))) {
switch_core_chat_send_args(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "",
switch_core_chat_send_args(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "",
"Conference not active.", NULL, NULL, SWITCH_FALSE);
return SWITCH_STATUS_FALSE;
}
@ -702,3 +702,13 @@ switch_status_t chat_send(switch_event_t *message_event)
return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -9,7 +9,7 @@
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter at 0xdecafbad dot com>
@ -49,7 +49,7 @@ switch_status_t conference_file_close(conference_obj_t *conference, conference_f
if (test_eflag(conference, EFLAG_PLAY_FILE_DONE) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_event_add_data(conference, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "seconds", "%ld", (long) node->fh.samples_in / node->fh.native_rate);
@ -62,7 +62,7 @@ switch_status_t conference_file_close(conference_obj_t *conference, conference_f
if (node->member_id) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "play-file-member-done");
if ((member = conference_member_get(conference, node->member_id))) {
conference_member_add_event_data(member, event);
switch_thread_rwlock_unlock(member->rwlock);
@ -81,7 +81,7 @@ switch_status_t conference_file_close(conference_obj_t *conference, conference_f
switch_event_fire(&event);
}
#ifdef OPENAL_POSITIONING
#ifdef OPENAL_POSITIONING
if (node->al && node->al->device) {
conference_al_close(node->al);
}
@ -227,7 +227,7 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u
/* positional requires mono input */
fnode->fh.channels = channels = 1;
}
retry:
flags = SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT;
@ -245,11 +245,11 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u
if (test_eflag(conference, EFLAG_PLAY_FILE) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_event_add_data(conference, event);
if (fnode->fh.params) {
switch_event_merge(event, conference->fnode->fh.params);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "play-file");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "File", file);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Async", async ? "true" : "false");
@ -286,7 +286,7 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u
fnode->pool = pool;
fnode->async = async;
fnode->file = switch_core_strdup(fnode->pool, file);
if (!conference->fnode || (async && !conference->async_fnode)) {
conference_video_fnode_check(fnode);
}
@ -319,7 +319,7 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u
switch_mutex_unlock(conference->mutex);
done:
done:
switch_safe_free(expanded);
switch_safe_free(dfile);
@ -329,7 +329,7 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u
/* Play a file */
switch_status_t conference_file_local_play(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin, void *buf,
uint32_t buflen)
uint32_t buflen)
{
uint32_t x = 0;
switch_status_t status = SWITCH_STATUS_SUCCESS;
@ -385,8 +385,19 @@ switch_status_t conference_file_local_play(conference_obj_t *conference, switch_
switch_safe_free(dpath);
}
done:
done:
switch_safe_free(expanded);
return status;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -9,7 +9,7 @@
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter at 0xdecafbad dot com>
@ -42,37 +42,37 @@
#include <mod_conference.h>
struct _mapping control_mappings[] = {
{"mute", conference_loop_mute_toggle},
{"mute on", conference_loop_mute_on},
{"mute off", conference_loop_mute_off},
{"vmute", conference_loop_vmute_toggle},
{"vmute on", conference_loop_vmute_on},
{"vmute off", conference_loop_vmute_off},
{"vmute snap", conference_loop_conference_video_vmute_snap},
{"vmute snapoff", conference_loop_conference_video_vmute_snapoff},
{"deaf mute", conference_loop_deafmute_toggle},
{"energy up", conference_loop_energy_up},
{"energy equ", conference_loop_energy_equ_conf},
{"energy dn", conference_loop_energy_dn},
{"vol talk up", conference_loop_volume_talk_up},
{"vol talk zero", conference_loop_volume_talk_zero},
{"vol talk dn", conference_loop_volume_talk_dn},
{"vol listen up", conference_loop_volume_listen_up},
{"vol listen zero", conference_loop_volume_listen_zero},
{"vol listen dn", conference_loop_volume_listen_dn},
{"hangup", conference_loop_hangup},
{"event", conference_loop_event},
{"lock", conference_loop_lock_toggle},
{"transfer", conference_loop_transfer},
{"execute_application", conference_loop_exec_app},
{"floor", conference_loop_floor_toggle},
{"vid-floor", conference_loop_vid_floor_toggle},
{"vid-floor-force", conference_loop_vid_floor_force}
{"mute", conference_loop_mute_toggle},
{"mute on", conference_loop_mute_on},
{"mute off", conference_loop_mute_off},
{"vmute", conference_loop_vmute_toggle},
{"vmute on", conference_loop_vmute_on},
{"vmute off", conference_loop_vmute_off},
{"vmute snap", conference_loop_conference_video_vmute_snap},
{"vmute snapoff", conference_loop_conference_video_vmute_snapoff},
{"deaf mute", conference_loop_deafmute_toggle},
{"energy up", conference_loop_energy_up},
{"energy equ", conference_loop_energy_equ_conf},
{"energy dn", conference_loop_energy_dn},
{"vol talk up", conference_loop_volume_talk_up},
{"vol talk zero", conference_loop_volume_talk_zero},
{"vol talk dn", conference_loop_volume_talk_dn},
{"vol listen up", conference_loop_volume_listen_up},
{"vol listen zero", conference_loop_volume_listen_zero},
{"vol listen dn", conference_loop_volume_listen_dn},
{"hangup", conference_loop_hangup},
{"event", conference_loop_event},
{"lock", conference_loop_lock_toggle},
{"transfer", conference_loop_transfer},
{"execute_application", conference_loop_exec_app},
{"floor", conference_loop_floor_toggle},
{"vid-floor", conference_loop_vid_floor_toggle},
{"vid-floor-force", conference_loop_vid_floor_force}
};
int conference_loop_mapping_len()
{
return (sizeof(control_mappings)/sizeof(control_mappings[0]));
return (sizeof(control_mappings)/sizeof(control_mappings[0]));
}
switch_status_t conference_loop_dmachine_dispatcher(switch_ivr_dmachine_match_t *match)
@ -198,7 +198,7 @@ void conference_loop_lock_toggle(conference_member_t *member, caller_control_act
return;
if (conference_utils_test_flag(member->conference, CFLAG_WAIT_MOD) && !conference_utils_member_test_flag(member, MFLAG_MOD) )
return;
return;
if (!conference_utils_test_flag(member->conference, CFLAG_LOCKED)) {
if (member->conference->is_locked_sound) {
@ -279,7 +279,7 @@ void conference_loop_energy_up(conference_member_t *member, caller_control_actio
}
}
@ -309,7 +309,7 @@ void conference_loop_energy_equ_conf(conference_member_t *member, caller_control
switch_snprintf(msg, sizeof(msg), "digits/%c.wav", *p);
conference_member_play_file(member, msg, 0, SWITCH_TRUE);
}
}
void conference_loop_energy_dn(conference_member_t *member, caller_control_action_t *action)
@ -341,7 +341,7 @@ void conference_loop_energy_dn(conference_member_t *member, caller_control_actio
switch_snprintf(msg, sizeof(msg), "digits/%c.wav", *p);
conference_member_play_file(member, msg, 0, SWITCH_TRUE);
}
}
void conference_loop_volume_talk_up(conference_member_t *member, caller_control_action_t *action)
@ -498,7 +498,7 @@ void conference_loop_volume_listen_zero(conference_member_t *member, caller_cont
switch_snprintf(msg, sizeof(msg), "digits/%d.wav", abs(member->volume_in_level));
conference_member_play_file(member, msg, 0, SWITCH_TRUE);
}
void conference_loop_volume_listen_dn(conference_member_t *member, caller_control_action_t *action)
@ -528,8 +528,8 @@ void conference_loop_volume_listen_dn(conference_member_t *member, caller_contro
conference_member_play_file(member, msg, 0, SWITCH_TRUE);
}
switch_snprintf(msg, sizeof(msg), "digits/%d.wav", abs(member->volume_in_level));
conference_member_play_file(member, msg, 0, SWITCH_TRUE);
switch_snprintf(msg, sizeof(msg), "digits/%d.wav", abs(member->volume_in_level));
conference_member_play_file(member, msg, 0, SWITCH_TRUE);
}
void conference_loop_event(conference_member_t *member, caller_control_action_t *action)
@ -587,7 +587,7 @@ void conference_loop_transfer(conference_member_t *member, caller_control_action
switch_ivr_session_transfer(member->session, exten, dialplan, context);
done:
done:
return;
}
@ -623,7 +623,7 @@ void conference_loop_exec_app(conference_member_t *member, caller_control_action
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty execute app string [%s]\n",
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty execute app string [%s]\n",
(char *) action->expanded_data);
goto done;
}
@ -643,7 +643,7 @@ void conference_loop_exec_app(conference_member_t *member, caller_control_action
switch_core_session_set_read_codec(member->session, &member->read_codec);
switch_channel_clear_app_flag(channel, CF_APP_TAGGED);
done:
done:
switch_safe_free(mydata);
@ -658,7 +658,7 @@ void conference_loop_hangup(conference_member_t *member, caller_control_action_t
/* marshall frames from the call leg to the conference thread for muxing to other call legs */
void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj)
{
switch_event_t *event;
switch_event_t *event;
conference_member_t *member = obj;
switch_channel_t *channel;
switch_status_t status;
@ -684,7 +684,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
flush_len = switch_samples_per_packet(member->conference->rate, member->conference->interval) * 2 * member->conference->channels * (500 / member->conference->interval);
/* As long as we have a valid read, feed that data into an input buffer where the conference thread will take it
/* As long as we have a valid read, feed that data into an input buffer where the conference thread will take it
and mux it with any audio from other channels. */
while (conference_utils_member_test_flag(member, MFLAG_RUNNING) && switch_channel_ready(channel)) {
@ -717,7 +717,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
/* if we have caller digits, feed them to the parser to find an action */
if (switch_channel_has_dtmf(channel)) {
char dtmf[128] = "";
switch_channel_dequeue_dtmf_string(channel, dtmf, sizeof(dtmf));
if (conference_utils_member_test_flag(member, MFLAG_DIST_DTMF)) {
@ -733,18 +733,18 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
} else if (member->dmachine) {
switch_ivr_dmachine_ping(member->dmachine, NULL);
}
if (switch_queue_size(member->dtmf_queue)) {
switch_dtmf_t *dt;
void *pop;
if (switch_queue_trypop(member->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
dt = (switch_dtmf_t *) pop;
switch_core_session_send_dtmf(member->session, dt);
free(dt);
}
}
if (switch_test_flag(read_frame, SFF_CNG)) {
if (member->conference->agc_level) {
member->nt_tally++;
@ -785,7 +785,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
member->conference->agc_level = 0;
conference_member_clear_avg(member);
}
/* if the member can speak, compute the audio energy level and */
/* generate events when the level crosses the threshold */
@ -793,7 +793,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
uint32_t energy = 0, i = 0, samples = 0, j = 0;
int16_t *data;
int agc_period = (member->read_impl.actual_samples_per_second / member->read_impl.samples_per_packet) / 4;
data = read_frame->data;
member->score = 0;
@ -801,33 +801,33 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
if (member->volume_in_level) {
switch_change_sln_volume(read_frame->data, (read_frame->datalen / 2) * member->conference->channels, member->volume_in_level);
}
if (member->agc_volume_in_level) {
switch_change_sln_volume_granular(read_frame->data, (read_frame->datalen / 2) * member->conference->channels, member->agc_volume_in_level);
}
if ((samples = read_frame->datalen / sizeof(*data) / member->read_impl.number_of_channels)) {
for (i = 0; i < samples; i++) {
energy += abs(data[j]);
j += member->read_impl.number_of_channels;
}
member->score = energy / samples;
}
if (member->vol_period) {
member->vol_period--;
}
if (member->conference->agc_level && member->score &&
if (member->conference->agc_level && member->score &&
conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK) &&
conference_member_noise_gate_check(member)
) {
int last_shift = abs((int)(member->last_score - member->score));
if (member->score && member->last_score && last_shift > 900) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG7,
"AGC %s:%d drop anomalous shift of %d\n",
"AGC %s:%d drop anomalous shift of %d\n",
member->conference->name,
member->id, last_shift);
@ -839,11 +839,11 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG7,
"AGC %s:%d diff:%d level:%d cur:%d avg:%d vol:%d\n",
"AGC %s:%d diff:%d level:%d cur:%d avg:%d vol:%d\n",
member->conference->name,
member->id, member->conference->agc_level - member->avg_score, member->conference->agc_level,
member->id, member->conference->agc_level - member->avg_score, member->conference->agc_level,
member->score, member->avg_score, member->agc_volume_in_level);
if (++member->agc_concur >= agc_period) {
if (!member->vol_period) {
conference_member_check_agc_levels(member);
@ -859,7 +859,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
if (member->score_iir > SCORE_MAX_IIR) {
member->score_iir = SCORE_MAX_IIR;
}
if (conference_member_noise_gate_check(member)) {
uint32_t diff = member->score - member->energy_level;
if (hangover_hits) {
@ -874,7 +874,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
member->floor_packets++;
}
if (diff >= diff_level || ++hangunder_hits >= hangunder) {
if (diff >= diff_level || ++hangunder_hits >= hangunder) {
hangover_hits = hangunder_hits = 0;
member->last_talking = switch_epoch_time_now(NULL);
@ -923,7 +923,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
conference_member_update_status_field(member);
conference_member_check_agc_levels(member);
conference_member_clear_avg(member);
if (test_eflag(member->conference, EFLAG_STOP_TALKING) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_member_add_event_data(member, event);
@ -938,7 +938,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
member->last_score = member->score;
if (member == member->conference->floor_holder) {
if (member->id != member->conference->video_floor_holder &&
if (member->id != member->conference->video_floor_holder &&
(member->floor_packets > member->conference->video_floor_packets || member->energy_level == 0)) {
conference_video_set_floor_holder(member->conference, member, SWITCH_FALSE);
}
@ -962,7 +962,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
}
/* skip frames that are not actual media or when we are muted or silent */
if ((conference_utils_member_test_flag(member, MFLAG_TALKING) || member->energy_level == 0 || conference_utils_test_flag(member->conference, CFLAG_AUDIO_ALWAYS))
if ((conference_utils_member_test_flag(member, MFLAG_TALKING) || member->energy_level == 0 || conference_utils_test_flag(member->conference, CFLAG_AUDIO_ALWAYS))
&& conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK) && !conference_utils_test_flag(member->conference, CFLAG_WAIT_MOD)
&& (member->conference->count > 1 || (member->conference->record_count && member->conference->count >= member->conference->min_recording_participants))) {
switch_audio_resampler_t *read_resampler = member->read_resampler;
@ -987,7 +987,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
tmp_frame.datalen = datalen;
tmp_frame.rate = member->conference->rate;
conference_member_check_channels(&tmp_frame, member, SWITCH_TRUE);
if (datalen) {
switch_size_t ok = 1;
@ -1006,7 +1006,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
}
}
do_continue:
do_continue:
switch_mutex_unlock(member->read_mutex);
@ -1096,7 +1096,7 @@ void conference_loop_output(conference_member_t *member)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, "Setup timer %s success interval: %u samples: %u\n",
member->conference->timer_name, interval, tsamples);
write_frame.data = data = switch_core_session_alloc(member->session, SWITCH_RECOMMENDED_BUFFER_SIZE);
write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
@ -1151,7 +1151,7 @@ void conference_loop_output(conference_member_t *member)
for (x = 0; x < argc; x++) {
char *dial_str = switch_mprintf("%s%s", switch_str_nil(prefix), argv[x]);
switch_assert(dial_str);
conference_outcall_bg(member->conference, NULL, NULL, dial_str, to, switch_str_nil(flags), cid_name, cid_num, NULL,
conference_outcall_bg(member->conference, NULL, NULL, dial_str, to, switch_str_nil(flags), cid_name, cid_num, NULL,
profile, &member->conference->cancel_cause, NULL);
switch_safe_free(dial_str);
}
@ -1167,7 +1167,7 @@ void conference_loop_output(conference_member_t *member)
loops = wait_sec * 10;
switch_channel_set_app_flag(channel, CF_APP_TAGGED);
do {
switch_ivr_sleep(member->session, 100, SWITCH_TRUE, NULL);
@ -1178,10 +1178,10 @@ void conference_loop_output(conference_member_t *member)
member->conference->cancel_cause = SWITCH_CAUSE_ORIGINATOR_CANCEL;
goto end;
}
conference_member_play_file(member, "tone_stream://%(500,0,640)", 0, SWITCH_TRUE);
}
if (!conference_utils_test_flag(member->conference, CFLAG_ANSWERED)) {
switch_channel_answer(channel);
}
@ -1204,7 +1204,7 @@ void conference_loop_output(conference_member_t *member)
switch_mutex_lock(member->write_mutex);
if (switch_channel_test_flag(member->channel, CF_CONFERENCE_ADV)) {
if (member->conference->la) {
conference_event_adv_la(member->conference, member, SWITCH_TRUE);
@ -1218,7 +1218,7 @@ void conference_loop_output(conference_member_t *member)
char *from = switch_event_get_header(event, "from");
char *to = switch_event_get_header(event, "to");
char *body = switch_event_get_body(event);
if (to && from && body) {
if (strchr(to, '+') && strncmp(to, CONF_CHAT_PROTO, strlen(CONF_CHAT_PROTO))) {
switch_event_del_header(event, "to");
@ -1250,7 +1250,7 @@ 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) {
@ -1277,25 +1277,25 @@ void conference_loop_output(conference_member_t *member)
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 / member->conference->channels;
if( !conference_utils_member_test_flag(member, MFLAG_CAN_HEAR)) {
memset(write_frame.data, 255, write_frame.datalen);
} else if (member->volume_out_level) { /* Check for output volume adjustments */
switch_change_sln_volume(write_frame.data, write_frame.samples * member->conference->channels, member->volume_out_level);
}
write_frame.timestamp = timer.samplecount;
if( !conference_utils_member_test_flag(member, MFLAG_CAN_HEAR)) {
memset(write_frame.data, 255, write_frame.datalen);
} else if (member->volume_out_level) { /* Check for output volume adjustments */
switch_change_sln_volume(write_frame.data, write_frame.samples * member->conference->channels, member->volume_out_level);
}
if (member->fnode) {
conference_member_add_file_data(member, write_frame.data, write_frame.datalen);
}
write_frame.timestamp = timer.samplecount;
conference_member_check_channels(&write_frame, member, SWITCH_FALSE);
if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
switch_mutex_unlock(member->audio_out_mutex);
break;
}
if (member->fnode) {
conference_member_add_file_data(member, write_frame.data, write_frame.datalen);
}
conference_member_check_channels(&write_frame, member, SWITCH_FALSE);
if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
switch_mutex_unlock(member->audio_out_mutex);
break;
}
}
}
@ -1319,7 +1319,7 @@ void conference_loop_output(conference_member_t *member)
conference_member_play_file(member, member->conference->muted_sound, 0, SWITCH_TRUE);
} else {
char msg[512];
switch_snprintf(msg, sizeof(msg), "Muted");
conference_member_say(member, msg, 0);
}
@ -1331,19 +1331,19 @@ void conference_loop_output(conference_member_t *member)
conference_member_play_file(member, member->conference->mute_detect_sound, 0, SWITCH_TRUE);
} else {
char msg[512];
switch_snprintf(msg, sizeof(msg), "Currently Muted");
conference_member_say(member, msg, 0);
}
conference_utils_member_clear_flag(member, MFLAG_INDICATE_MUTE_DETECT);
}
if (conference_utils_member_test_flag(member, MFLAG_INDICATE_UNMUTE)) {
if (!zstr(member->conference->unmuted_sound)) {
conference_member_play_file(member, member->conference->unmuted_sound, 0, SWITCH_TRUE);
} else {
char msg[512];
switch_snprintf(msg, sizeof(msg), "Un-Muted");
conference_member_say(member, msg, 0);
}
@ -1395,3 +1395,13 @@ void conference_loop_output(conference_member_t *member)
}
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -9,7 +9,7 @@
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter at 0xdecafbad dot com>
@ -54,7 +54,7 @@ int conference_member_noise_gate_check(conference_member_t *member)
if (target_score < 0) target_score = 0;
r = (int)member->score > target_score;
} else {
r = (int32_t)member->score > member->energy_level;
}
@ -86,7 +86,7 @@ void conference_member_do_binding(conference_member_t *member, conference_key_ca
binding->handler = handler;
switch_ivr_dmachine_bind(member->dmachine, "conf", digits, 0, conference_loop_dmachine_dispatcher, binding);
}
void conference_member_bind_controls(conference_member_t *member, const char *controls)
@ -117,15 +117,15 @@ void conference_member_bind_controls(conference_member_t *member, const char *co
for (xcontrol = switch_xml_child(xgroups, "control"); xcontrol; xcontrol = xcontrol->next) {
const char *key = switch_xml_attr(xcontrol, "action");
const char *digits = switch_xml_attr(xcontrol, "digits");
const char *data = switch_xml_attr_soft(xcontrol, "data");
const char *key = switch_xml_attr(xcontrol, "action");
const char *digits = switch_xml_attr(xcontrol, "digits");
const char *data = switch_xml_attr_soft(xcontrol, "data");
if (zstr(key) || zstr(digits)) continue;
for(i = 0; i < conference_loop_mapping_len(); i++) {
if (!strcasecmp(key, control_mappings[i].name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s binding '%s' to '%s'\n",
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s binding '%s' to '%s'\n",
switch_core_session_get_name(member->session), digits, key);
conference_member_do_binding(member, control_mappings[i].handler, digits, data);
@ -140,9 +140,9 @@ void conference_member_bind_controls(conference_member_t *member, const char *co
switch_xml_free(cxml);
cxml = NULL;
}
if (params) switch_event_destroy(&params);
}
void conference_member_update_status_field(conference_member_t *member)
@ -150,7 +150,7 @@ void conference_member_update_status_field(conference_member_t *member)
char *str, *vstr = "", display[128] = "", *json_display = NULL;
cJSON *json, *audio, *video;
if (!member->conference->la || !member->json ||
if (!member->conference->la || !member->json ||
!member->status_field || switch_channel_test_flag(member->channel, CF_VIDEO_ONLY) || conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN)) {
return;
}
@ -160,13 +160,13 @@ void conference_member_update_status_field(conference_member_t *member)
if (conference_utils_test_flag(member->conference, CFLAG_JSON_STATUS)) {
json = cJSON_CreateObject();
audio = cJSON_CreateObject();
cJSON_AddItemToObject(audio, "muted", cJSON_CreateBool(!conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK)));
cJSON_AddItemToObject(audio, "onHold", cJSON_CreateBool(switch_channel_test_flag(member->channel, CF_HOLD)));
cJSON_AddItemToObject(audio, "muted", cJSON_CreateBool(!conference_utils_member_test_flag(member, MFLAG_CAN_SPEAK)));
cJSON_AddItemToObject(audio, "onHold", cJSON_CreateBool(switch_channel_test_flag(member->channel, CF_HOLD)));
cJSON_AddItemToObject(audio, "talking", cJSON_CreateBool(conference_utils_member_test_flag(member, MFLAG_TALKING)));
cJSON_AddItemToObject(audio, "floor", cJSON_CreateBool(member == member->conference->floor_holder));
cJSON_AddItemToObject(audio, "energyScore", cJSON_CreateNumber(member->score));
cJSON_AddItemToObject(json, "audio", audio);
if (switch_channel_test_flag(member->channel, CF_VIDEO) || member->avatar_png_img) {
video = cJSON_CreateObject();
cJSON_AddItemToObject(video, "avatarPresented", cJSON_CreateBool(!!member->avatar_png_img));
@ -176,11 +176,11 @@ void conference_member_update_status_field(conference_member_t *member)
if (member && member->id == member->conference->video_floor_holder && conference_utils_test_flag(member->conference, CFLAG_VID_FLOOR_LOCK)) {
cJSON_AddItemToObject(video, "floorLocked", cJSON_CreateTrue());
}
cJSON_AddItemToObject(video, "reservationID", member->video_reservation_id ?
cJSON_AddItemToObject(video, "reservationID", member->video_reservation_id ?
cJSON_CreateString(member->video_reservation_id) : cJSON_CreateNull());
cJSON_AddItemToObject(video, "videoLayerID", cJSON_CreateNumber(member->video_layer_id));
cJSON_AddItemToObject(json, "video", video);
} else {
cJSON_AddItemToObject(json, "video", cJSON_CreateFalse());
@ -204,7 +204,7 @@ void conference_member_update_status_field(conference_member_t *member)
} else {
str = "ACTIVE";
}
if (switch_channel_test_flag(member->channel, CF_VIDEO)) {
if (!conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN)) {
vstr = " VIDEO (BLIND)";
@ -285,7 +285,7 @@ switch_status_t conference_member_parse_position(conference_member_t *member, co
}
return status;
}
#endif
@ -371,8 +371,8 @@ conference_member_t *conference_member_get(conference_obj_t *conference, uint32_
}
if (member) {
if (!conference_utils_member_test_flag(member, MFLAG_INTREE) ||
conference_utils_member_test_flag(member, MFLAG_KICKED) ||
if (!conference_utils_member_test_flag(member, MFLAG_INTREE) ||
conference_utils_member_test_flag(member, MFLAG_KICKED) ||
(member->session && !switch_channel_up(switch_core_session_get_channel(member->session)))) {
/* member is kicked or hanging up so forget it */
@ -397,7 +397,7 @@ void conference_member_check_agc_levels(conference_member_t *member)
int x = 0;
if (!member->avg_score) return;
if ((int)member->avg_score < member->conference->agc_level - 100) {
member->agc_volume_in_level++;
switch_normalize_volume_granular(member->agc_volume_in_level);
@ -410,11 +410,11 @@ void conference_member_check_agc_levels(conference_member_t *member)
if (x) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG7,
"AGC %s:%d diff:%d level:%d cur:%d avg:%d vol:%d %s\n",
"AGC %s:%d diff:%d level:%d cur:%d avg:%d vol:%d %s\n",
member->conference->name,
member->id, member->conference->agc_level - member->avg_score, member->conference->agc_level,
member->id, member->conference->agc_level - member->avg_score, member->conference->agc_level,
member->score, member->avg_score, member->agc_volume_in_level, x > 0 ? "+++" : "---");
conference_member_clear_avg(member);
}
}
@ -433,7 +433,7 @@ void conference_member_check_channels(switch_frame_t *frame, conference_member_t
to = member->read_impl.number_of_channels;
}
rlen = frame->datalen / 2 / from;
rlen = frame->datalen / 2 / from;
if (in && frame->rate == 48000 && ((from == 1 && to == 2) || (from == 2 && to == 2)) && conference_utils_member_test_flag(member, MFLAG_POSITIONAL)) {
if (from == 2 && to == 2) {
@ -441,14 +441,14 @@ void conference_member_check_channels(switch_frame_t *frame, conference_member_t
frame->datalen /= 2;
rlen = frame->datalen / 2;
}
conference_al_process(member->al, frame->data, frame->datalen, frame->rate);
} else {
switch_mux_channels((int16_t *) frame->data, rlen, from, to);
}
frame->datalen = rlen * 2 * to;
}
}
@ -494,9 +494,9 @@ void conference_member_add_file_data(conference_member_t *member, int16_t *data,
if (member->fnode->al) {
speech_len /= 2;
}
if (switch_core_speech_read_tts(member->fnode->sh, file_frame, &speech_len, &flags) == SWITCH_STATUS_SUCCESS) {
file_sample_len = file_data_len / 2 / member->conference->channels;
file_sample_len = file_data_len / 2 / member->conference->channels;
} else {
file_sample_len = file_data_len = 0;
}
@ -574,7 +574,7 @@ switch_status_t conference_member_del_relationship(conference_member_t *member,
lock_member(member);
for (rel = member->relationships; rel; rel = rel->next) {
if (id == 0 || rel->id == id) {
/* we just forget about rel here cos it was allocated by the member's pool
/* we just forget about rel here cos it was allocated by the member's pool
it will be freed when the member is */
conference_member_t *omember;
@ -665,7 +665,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
switch_mutex_unlock(conference->member_mutex);
conference_cdr_add(member);
if (!conference_utils_member_test_flag(member, MFLAG_NOCHANNEL)) {
if (conference_utils_member_test_flag(member, MFLAG_GHOST)) {
conference->count_ghosts++;
@ -733,7 +733,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
}
if (!switch_channel_get_variable(channel, "conference_call_key")) {
char *key = switch_core_session_sprintf(member->session, "conference_%s_%s_%s",
char *key = switch_core_session_sprintf(member->session, "conference_%s_%s_%s",
conference->name, conference->domain, switch_channel_get_variable(channel, "caller_id_number"));
switch_channel_set_variable(channel, "conference_call_key", key);
}
@ -745,7 +745,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
if (conference->count > 1) {
if ((conference->moh_sound && !conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) ||
(conference_utils_test_flag(conference, CFLAG_WAIT_MOD) && !switch_true(switch_channel_get_variable(channel, "conference_permanent_wait_mod_moh")))) {
(conference_utils_test_flag(conference, CFLAG_WAIT_MOD) && !switch_true(switch_channel_get_variable(channel, "conference_permanent_wait_mod_moh")))) {
/* stop MoH if any */
conference_file_stop(conference, FILE_STOP_ASYNC);
}
@ -754,9 +754,9 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
const char * enter_sound = switch_channel_get_variable(channel, "conference_enter_sound");
if (conference_utils_test_flag(conference, CFLAG_ENTER_SOUND) && !conference_utils_member_test_flag(member, MFLAG_SILENT)) {
if (!zstr(enter_sound)) {
conference_file_play(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN,
switch_core_session_get_channel(member->session), 0);
} else {
conference_file_play(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN,
switch_core_session_get_channel(member->session), 0);
} else {
conference_file_play(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
}
}
@ -815,12 +815,12 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"%s has positional audio blocked.\n", switch_channel_get_name(channel));
} else {
if (conference_member_parse_position(member, position) != SWITCH_STATUS_SUCCESS) {
if (conference_member_parse_position(member, position) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s invalid position data\n", switch_channel_get_name(channel));
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s position data set\n", switch_channel_get_name(channel));
}
conference_utils_member_set_flag(member, MFLAG_POSITIONAL);
member->al = conference_al_create(member->pool);
}
@ -828,8 +828,8 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s cannot set position data on mono conference.\n", switch_channel_get_name(channel));
}
}
controls = switch_channel_get_variable(channel, "conference_controls");
@ -846,11 +846,11 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
}
if (strcasecmp(controls, "none")) {
switch_ivr_dmachine_create(&member->dmachine, "mod_conference", NULL,
switch_ivr_dmachine_create(&member->dmachine, "mod_conference", NULL,
conference->ivr_dtmf_timeout, conference->ivr_input_timeout, NULL, NULL, NULL);
conference_member_bind_controls(member, controls);
}
}
unlock_member(member);
@ -863,7 +863,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
cJSON_AddItemToArray(member->json, cJSON_CreateStringPrintf("%0.4d", member->id));
cJSON_AddItemToArray(member->json, cJSON_CreateString(switch_channel_get_variable(member->channel, "caller_id_number")));
cJSON_AddItemToArray(member->json, cJSON_CreateString(switch_channel_get_variable(member->channel, "caller_id_name")));
cJSON_AddItemToArray(member->json, cJSON_CreateStringPrintf("%s@%s",
switch_channel_get_variable(member->channel, "original_read_codec"),
switch_channel_get_variable(member->channel, "original_read_rate")
@ -871,19 +871,19 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
member->status_field = cJSON_CreateString("");
cJSON_AddItemToArray(member->json, member->status_field);
cJSON_AddItemToArray(member->json, cJSON_CreateNull());
conference_member_update_status_field(member);
//switch_live_array_add_alias(conference->la, switch_core_session_get_uuid(member->session), "conference");
}
conference_event_adv_la(conference, member, SWITCH_TRUE);
if (!conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN)) {
if (!conference_utils_member_test_flag(member, MFLAG_SECOND_SCREEN)) {
switch_live_array_add(conference->la, switch_core_session_get_uuid(member->session), -1, &member->json, SWITCH_FALSE);
}
}
@ -927,7 +927,7 @@ void conference_member_set_floor_holder(conference_obj_t *conference, conference
return;
} else {
old_member = conference->floor_holder;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Dropping floor %s\n",
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Dropping floor %s\n",
switch_channel_get_name(old_member->channel));
}
@ -935,7 +935,7 @@ void conference_member_set_floor_holder(conference_obj_t *conference, conference
switch_mutex_lock(conference->mutex);
if (member) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Adding floor %s\n",
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Adding floor %s\n",
switch_channel_get_name(member->channel));
conference->floor_holder = member;
@ -965,7 +965,7 @@ void conference_member_set_floor_holder(conference_obj_t *conference, conference
}
if (conference->floor_holder) {
conference_member_add_event_data(conference->floor_holder, event);
conference_member_add_event_data(conference->floor_holder, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-ID", "%d", conference->floor_holder->id);
} else {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "New-ID", "none");
@ -1003,7 +1003,7 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m
conference_cdr_del(member);
#ifdef OPENAL_POSITIONING
#ifdef OPENAL_POSITIONING
if (member->al && member->al->device) {
conference_al_close(member->al);
}
@ -1037,7 +1037,7 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m
if (member->rec) {
conference->recording_members--;
}
for (imember = conference->members; imember; imember = imember->next) {
if (imember == member) {
if (last) {
@ -1051,7 +1051,7 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m
}
switch_thread_rwlock_unlock(member->rwlock);
/* Close Unused Handles */
if (member_fnode) {
conference_file_node_t *fnode, *cur;
@ -1183,7 +1183,7 @@ void conference_member_send_all_dtmf(conference_member_t *member, conference_obj
const char *p;
for (p = dtmf; p && *p; p++) {
switch_dtmf_t *dt, digit = { *p, SWITCH_DEFAULT_DTMF_DURATION };
switch_zmalloc(dt, sizeof(*dt));
*dt = digit;
switch_queue_push(imember->dtmf_queue, dt);
@ -1274,7 +1274,7 @@ switch_status_t conference_member_play_file(conference_member_t *member, char *f
if (fnode->fh.params) {
const char *position = switch_event_get_header(fnode->fh.params, "position");
if (!bad_params && !zstr(position) && member->conference->channels == 2) {
fnode->al = conference_al_create(pool);
if (conference_al_parse_position(fnode->al, position) != SWITCH_STATUS_SUCCESS) {
@ -1300,7 +1300,7 @@ switch_status_t conference_member_play_file(conference_member_t *member, char *f
switch_mutex_unlock(member->fnode_mutex);
status = SWITCH_STATUS_SUCCESS;
done:
done:
switch_safe_free(expanded);
switch_safe_free(dfile);
@ -1349,7 +1349,7 @@ switch_status_t conference_member_say(conference_member_t *member, char *text, u
if (*text == '{') {
char *new_fp;
fp = switch_core_strdup(pool, text);
switch_assert(fp);
@ -1457,7 +1457,7 @@ void conference_member_itterator(conference_obj_t *conference, switch_stream_han
}
} else {
stream->write_function(stream, "Skipping moderator (member id %d).\n", member->id);
}
}
}
switch_mutex_unlock(conference->member_mutex);
}
@ -1467,7 +1467,7 @@ int conference_member_get_canvas_id(conference_member_t *member, const char *val
{
int index = -1;
int cur;
if (watching) {
cur = member->watching_canvas_id;
} else {
@ -1480,7 +1480,7 @@ int conference_member_get_canvas_id(conference_member_t *member, const char *val
if (switch_is_number(val)) {
index = atoi(val) - 1;
if (index < 0) {
index = 0;
}
@ -1493,7 +1493,7 @@ int conference_member_get_canvas_id(conference_member_t *member, const char *val
index--;
}
}
if (watching) {
if (index > member->conference->canvas_count || !member->conference->canvases[index]) {
index = 0;
@ -1507,11 +1507,11 @@ int conference_member_get_canvas_id(conference_member_t *member, const char *val
index = member->conference->canvas_count;
}
}
if (index > MAX_CANVASES || index < 0) {
return -1;
}
if (member->conference->canvas_count > 1) {
if (index > member->conference->canvas_count) {
return -1;
@ -1555,7 +1555,7 @@ int conference_member_setup_media(conference_member_t *member, conference_obj_t
if (switch_core_codec_init(&member->read_codec,
"L16",
NULL, NULL, read_impl.actual_samples_per_second, read_impl.microseconds_per_packet / 1000,
read_impl.number_of_channels,
read_impl.number_of_channels,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member->pool) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG,
"Raw Codec Activation Success L16@%uhz %d channel %dms\n",
@ -1602,10 +1602,10 @@ int conference_member_setup_media(conference_member_t *member, conference_obj_t
NULL,
conference->rate,
read_impl.microseconds_per_packet / 1000,
read_impl.number_of_channels,
read_impl.number_of_channels,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member->pool) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG,
"Raw Codec Activation Success L16@%uhz %d channel %dms\n",
"Raw Codec Activation Success L16@%uhz %d channel %dms\n",
conference->rate, conference->channels, read_impl.microseconds_per_packet / 1000);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz %d channel %dms\n",
@ -1629,11 +1629,11 @@ int conference_member_setup_media(conference_member_t *member, conference_obj_t
return 0;
codec_done1:
codec_done1:
switch_core_codec_destroy(&member->read_codec);
codec_done2:
codec_done2:
switch_core_codec_destroy(&member->write_codec);
done:
done:
switch_mutex_unlock(member->audio_out_mutex);
@ -1641,3 +1641,14 @@ int conference_member_setup_media(conference_member_t *member, conference_obj_t
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -9,7 +9,7 @@
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter at 0xdecafbad dot com>
@ -115,27 +115,27 @@ switch_status_t conference_record_action(conference_obj_t *conference, char *pat
switch_assert(conference != NULL);
switch_mutex_lock(conference->member_mutex);
for (member = conference->members; member; member = member->next)
{
if (conference_utils_member_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path)))
{
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Action: %d\n", action);
switch (action)
{
case REC_ACTION_STOP:
conference_utils_member_clear_flag_locked(member, MFLAG_RUNNING);
count++;
break;
case REC_ACTION_PAUSE:
conference_utils_member_set_flag_locked(member, MFLAG_PAUSE_RECORDING);
count = 1;
break;
case REC_ACTION_RESUME:
conference_utils_member_clear_flag_locked(member, MFLAG_PAUSE_RECORDING);
count = 1;
break;
}
if (conference_utils_member_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path)))
{
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Action: %d\n", action);
switch (action)
{
case REC_ACTION_STOP:
conference_utils_member_clear_flag_locked(member, MFLAG_RUNNING);
count++;
break;
case REC_ACTION_PAUSE:
conference_utils_member_set_flag_locked(member, MFLAG_PAUSE_RECORDING);
count = 1;
break;
case REC_ACTION_RESUME:
conference_utils_member_clear_flag_locked(member, MFLAG_PAUSE_RECORDING);
count = 1;
break;
}
}
}
}
switch_mutex_unlock(conference->member_mutex);
return count;
}
@ -225,7 +225,7 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v
flags |= SWITCH_FILE_FLAG_VIDEO;
if (conference->canvas) {
char *orig_path = rec->path;
rec->path = switch_core_sprintf(rec->pool, "{channels=%d,samplerate=%d,vw=%d,vh=%d,fps=%0.2f}%s",
rec->path = switch_core_sprintf(rec->pool, "{channels=%d,samplerate=%d,vw=%d,vh=%d,fps=%0.2f}%s",
conference->channels,
conference->rate,
conference->canvas->width,
@ -277,7 +277,7 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v
switch_core_file_set_string(&member->rec->fh, SWITCH_AUDIO_COL_STR_ARTIST, "FreeSWITCH mod_conference Software Conference Module");
if (test_eflag(conference, EFLAG_RECORD) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_event_add_data(conference, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "start-recording");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", rec->path);
@ -325,7 +325,7 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v
if (len == 0) {
mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer);
if (mux_used >= data_buf_len) {
goto again;
}
@ -346,16 +346,16 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v
switch_core_timer_next(&timer);
} /* Rinse ... Repeat */
end:
end:
for(;;) {
switch_mutex_lock(member->audio_out_mutex);
rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data_buf, data_buf_len);
switch_mutex_unlock(member->audio_out_mutex);
if (rlen > 0) {
len = (switch_size_t) rlen / sizeof(int16_t)/ conference->channels;
switch_core_file_write(&member->rec->fh, data_buf, &len);
switch_core_file_write(&member->rec->fh, data_buf, &len);
} else {
break;
}
@ -382,9 +382,9 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v
conference_event_add_data(conference, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "stop-recording");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", rec->path);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Samples-Out", "%ld", (long) member->rec->fh.samples_out);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Samplerate", "%ld", (long) member->rec->fh.samplerate);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Milliseconds-Elapsed", "%ld", (long) member->rec->fh.samples_out / (member->rec->fh.samplerate / 1000));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Samples-Out", "%ld", (long) member->rec->fh.samples_out);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Samplerate", "%ld", (long) member->rec->fh.samplerate);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Milliseconds-Elapsed", "%ld", (long) member->rec->fh.samples_out / (member->rec->fh.samplerate / 1000));
switch_event_fire(&event);
}
@ -419,5 +419,13 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v
return NULL;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -9,7 +9,7 @@
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter at 0xdecafbad dot com>
@ -41,7 +41,7 @@
*/
#include <mod_conference.h>
const char *conference_utils_combine_flag_var(switch_core_session_t *session, const char *var_name)
const char *conference_utils_combine_flag_var(switch_core_session_t *session, const char *var_name)
{
switch_event_header_t *hp;
switch_event_t *event, *cevent;
@ -52,7 +52,7 @@ const char *conference_utils_combine_flag_var(switch_core_session_t *session, co
switch_channel_get_variables(channel, &cevent);
switch_event_merge(event, cevent);
for (hp = event->headers; hp; hp = hp->next) {
char *var = hp->name;
char *val = hp->value;
@ -76,7 +76,7 @@ const char *conference_utils_combine_flag_var(switch_core_session_t *session, co
}
}
}
switch_event_destroy(&event);
switch_event_destroy(&cevent);
@ -196,7 +196,7 @@ void conference_utils_set_cflags(const char *flags, conference_flag_t *f)
} else if (!strcasecmp(argv[i], "video-muxing-personal-canvas")) {
f[CFLAG_PERSONAL_CANVAS] = 1;
}
}
}
free(dup);
}
@ -358,3 +358,13 @@ switch_bool_t conference_utils_member_test_flag(conference_member_t *member, mem
return !!member->flags[flag];
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
@ -22,7 +22,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Anthony Minessale II <anthm@freeswitch.org>
* Neal Horman <neal at wanlink dot com>
* Bret McDanel <trixter at 0xdecafbad dot com>
@ -138,7 +138,7 @@ void conference_list(conference_obj_t *conference, switch_stream_handle_t *strea
}
stream->write_function(stream, "%s%d%s%d%s%d%s%d\n", delim,
member->volume_in_level,
member->volume_in_level,
delim,
member->agc_volume_in_level,
delim, member->volume_out_level, delim, member->energy_level);
@ -151,7 +151,7 @@ void conference_send_notify(conference_obj_t *conference, const char *status, co
{
switch_event_t *event;
char *name = NULL, *domain = NULL, *dup_domain = NULL;
if (!conference_utils_test_flag(conference, CFLAG_RFC4579)) {
return;
}
@ -233,7 +233,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT);
conference_event_add_data(conference, event);
conference_event_add_data(conference, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "conference-create");
switch_event_fire(&event);
@ -277,7 +277,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
has_file_data = ready = total = 0;
floor_holder = conference->floor_holder;
/* Read one frame of audio from each member channel and save it for redistribution */
for (imember = conference->members; imember; imember = imember->next) {
uint32_t buf_read = 0;
@ -291,7 +291,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
//(!conference_utils_test_flag(conference, CFLAG_VID_FLOOR) || switch_channel_test_flag(channel, CF_VIDEO))) {
floor_holder = imember;
}
if (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_VIDEO) && imember->video_flow != SWITCH_MEDIA_FLOW_SENDONLY) {
members_with_video++;
}
@ -316,7 +316,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
}
switch_mutex_unlock(imember->audio_in_mutex);
}
conference->members_with_video = members_with_video;
conference->members_with_avatar = members_with_avatar;
@ -326,8 +326,8 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
if (conference->perpetual_sound && !conference->async_fnode) {
conference_file_play(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 1);
} else if (conference->moh_sound && ((nomoh == 0 && conference->count == 1)
|| conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) && !conference->async_fnode && !conference->fnode) {
} else if (conference->moh_sound && ((nomoh == 0 && conference->count == 1)
|| conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) && !conference->async_fnode && !conference->fnode) {
conference_file_play(conference, conference->moh_sound, CONF_DEFAULT_LEADIN, NULL, 1);
}
@ -384,31 +384,31 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
conference->fnode->leadin--;
} else if (!conference->fnode->done) {
file_sample_len = samples;
if (conference->fnode->type == NODE_TYPE_SPEECH) {
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
switch_size_t speech_len = file_data_len;
if (conference->fnode->al) {
speech_len /= 2;
}
if (switch_core_speech_read_tts(conference->fnode->sh, file_frame, &speech_len, &flags) == SWITCH_STATUS_SUCCESS) {
if (conference->fnode->al) {
conference_al_process(conference->fnode->al, file_frame, speech_len, conference->rate);
}
file_sample_len = file_data_len / 2 / conference->fnode->sh->channels;
} else {
file_sample_len = file_data_len = 0;
}
} else if (conference->fnode->type == NODE_TYPE_FILE) {
switch_core_file_read(&conference->fnode->fh, file_frame, &file_sample_len);
if (conference->fnode->fh.vol) {
switch_change_sln_volume_granular((void *)file_frame, (uint32_t)file_sample_len * conference->fnode->fh.channels,
switch_change_sln_volume_granular((void *)file_frame, (uint32_t)file_sample_len * conference->fnode->fh.channels,
conference->fnode->fh.vol);
}
if (conference->fnode->al) {
@ -456,7 +456,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
}
}
}
if (ready || has_file_data) {
/* Use more bits in the main_frame to preserve the exact sum of the audio samples. */
int main_frame[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
@ -484,7 +484,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
/* Copy audio from every member known to be producing audio into the main frame. */
for (omember = conference->members; omember; omember = omember->next) {
conference->member_loop_count++;
if (!(conference_utils_member_test_flag(omember, MFLAG_RUNNING) && conference_utils_member_test_flag(omember, MFLAG_HAS_AUDIO))) {
continue;
}
@ -495,7 +495,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
conference->mux_loop_count++;
}
}
bptr = (int16_t *) omember->frame;
for (x = 0; x < omember->read / 2; x++) {
main_frame[x] += (int32_t) bptr[x];
@ -504,24 +504,24 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
if (conference->agc_level && conference->member_loop_count) {
conference_energy = 0;
for (x = 0; x < bytes / 2; x++) {
z = abs(main_frame[x]);
switch_normalize_to_16bit(z);
conference_energy += (int16_t) z;
}
conference->score = conference_energy / ((bytes / 2) / divisor) / conference->member_loop_count;
conference->avg_tally += conference->score;
conference->avg_score = conference->avg_tally / ++conference->avg_itt;
if (!conference->avg_itt) conference->avg_tally = conference->score;
}
/* Create write frame once per member who is not deaf for each sample in the main frame
check if our audio is involved and if so, subtract it from the sample so we don't hear ourselves.
Since main frame was 32 bit int, we did not lose any detail, now that we have to convert to 16 bit we can
cut it off at the min and max range if need be and write the frame to the output buffer.
*/
*/
for (omember = conference->members; omember; omember = omember->next) {
switch_size_t ok = 1;
@ -538,7 +538,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
}
bptr = (int16_t *) omember->frame;
for (x = 0; x < bytes / 2 ; x++) {
z = main_frame[x];
@ -547,9 +547,9 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
z -= (int32_t) bptr[x];
}
/* when there are relationships, we have to do more work by scouring all the members to see if there are any
/* when there are relationships, we have to do more work by scouring all the members to see if there are any
reasons why we should not be hearing a paticular member, and if not, delete their samples as well.
*/
*/
if (conference->relationship_total) {
for (imember = conference->members; imember; imember = imember->next) {
if (imember != omember && conference_utils_member_test_flag(imember, MFLAG_HAS_AUDIO)) {
@ -580,7 +580,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
switch_normalize_to_16bit(z);
write_frame[x] = (int16_t) z;
}
switch_mutex_lock(omember->audio_out_mutex);
ok = switch_buffer_write(omember->mux_buffer, write_frame, bytes);
switch_mutex_unlock(omember->audio_out_mutex);
@ -598,14 +598,14 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
} else {
memset(write_frame, 255, bytes);
}
for (omember = conference->members; omember; omember = omember->next) {
switch_size_t ok = 1;
if (!conference_utils_member_test_flag(omember, MFLAG_RUNNING)) {
continue;
}
switch_mutex_lock(omember->audio_out_mutex);
ok = switch_buffer_write(omember->mux_buffer, write_frame, bytes);
switch_mutex_unlock(omember->audio_out_mutex);
@ -637,7 +637,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
if (conference->canvas && conference->fnode->layer_id > -1 ) {
conference_video_canvas_del_fnode_layer(conference, conference->fnode);
}
if (conference->fnode->type != NODE_TYPE_SPEECH) {
conference_file_close(conference, conference->fnode);
}
@ -656,16 +656,16 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
}
if (!conference->end_count && conference->endconference_time &&
switch_epoch_time_now(NULL) - conference->endconference_time > conference->endconference_grace_time) {
switch_epoch_time_now(NULL) - conference->endconference_time > conference->endconference_grace_time) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Conference %s: endconf grace time exceeded (%u)\n",
conference->name, conference->endconference_grace_time);
conference->name, conference->endconference_grace_time);
conference_utils_set_flag(conference, CFLAG_DESTRUCT | CFLAG_ENDCONF_FORCED);
}
switch_mutex_unlock(conference->mutex);
}
/* Rinse ... Repeat */
end:
end:
if (conference_utils_test_flag(conference, CFLAG_OUTCALL)) {
conference->cancel_cause = SWITCH_CAUSE_ORIGINATOR_CANCEL;
@ -680,7 +680,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
switch_mutex_lock(conference->mutex);
conference_file_stop(conference, FILE_STOP_ASYNC);
conference_file_stop(conference, FILE_STOP_ALL);
for (np = conference->cdr_nodes; np; np = np->next) {
if (np->var_event) {
switch_event_destroy(&np->var_event);
@ -747,16 +747,16 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
if (conference->vh[1].up == 1) {
conference->vh[1].up = -1;
}
while (conference->vh[0].up || conference->vh[1].up) {
switch_cond_next();
}
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT);
conference_event_add_data(conference, event);
conference_event_add_data(conference, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "conference-destroy");
switch_event_fire(&event);
switch_core_timer_destroy(&timer);
switch_mutex_lock(conference_globals.hash_mutex);
if (conference_utils_test_flag(conference, CFLAG_INHASH)) {
@ -873,7 +873,7 @@ switch_status_t conference_say(conference_obj_t *conference, const char *text, u
if (*text == '{') {
char *new_fp;
fp = switch_core_strdup(pool, text);
switch_assert(fp);
@ -972,10 +972,10 @@ switch_status_t conference_list_conferences(const char *line, const char *cursor
switch_mutex_lock(conference_globals.hash_mutex);
for (hi = switch_core_hash_first(conference_globals.conference_hash); hi; hi = switch_core_hash_next(&hi)) {
switch_core_hash_this(hi, &vvar, NULL, &val);
switch_console_push_match(&my_matches, (const char *) vvar);
switch_console_push_match(&my_matches, (const char *) vvar);
}
switch_mutex_unlock(conference_globals.hash_mutex);
if (my_matches) {
*matches = my_matches;
status = SWITCH_STATUS_SUCCESS;
@ -1061,7 +1061,7 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
switch_snprintf(i, sizeof(i), "%u", conference->rate);
switch_xml_set_attr_d(x_conference, "rate", ival);
switch_xml_set_attr_d(x_conference, "uuid", conference->uuid_str);
if (conference_utils_test_flag(conference, CFLAG_LOCKED)) {
switch_xml_set_attr_d(x_conference, "locked", "true");
}
@ -1101,11 +1101,11 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
if (conference_utils_test_flag(conference, CFLAG_EXIT_SOUND)) {
switch_xml_set_attr_d(x_conference, "exit_sound", "true");
}
if (conference_utils_test_flag(conference, CFLAG_ENTER_SOUND)) {
switch_xml_set_attr_d(x_conference, "enter_sound", "true");
}
if (conference->max_members > 0) {
switch_snprintf(i, sizeof(i), "%d", conference->max_members);
switch_xml_set_attr_d(x_conference, "max_members", ival);
@ -1158,7 +1158,7 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
switch_assert(x_member);
switch_xml_set_attr_d(x_member, "type", "recording_node");
/* or:
x_member = switch_xml_add_child_d(x_members, "recording_node", moff++);
x_member = switch_xml_add_child_d(x_members, "recording_node", moff++);
*/
x_tag = switch_xml_add_child_d(x_member, "record_path", count++);
@ -1195,7 +1195,7 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
switch_snprintf(i, sizeof(i), "%d", switch_epoch_time_now(NULL) - member->join_time);
add_x_tag(x_member, "join_time", i, toff++);
switch_snprintf(i, sizeof(i), "%d", switch_epoch_time_now(NULL) - member->last_talking);
add_x_tag(x_member, "last_talking", member->last_talking ? i : "N/A", toff++);
@ -1207,7 +1207,7 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
switch_snprintf(i, sizeof(i), "%d", member->volume_out_level);
add_x_tag(x_member, "volume_out", i, toff++);
x_flags = switch_xml_add_child_d(x_member, "flags", count++);
switch_assert(x_flags);
@ -1257,60 +1257,60 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
void conference_fnode_toggle_pause(conference_file_node_t *fnode, switch_stream_handle_t *stream)
{
if (fnode) {
if (fnode) {
if (switch_test_flag(fnode, NFLAG_PAUSE)) {
stream->write_function(stream, "+OK Resume\n");
stream->write_function(stream, "+OK Resume\n");
switch_clear_flag(fnode, NFLAG_PAUSE);
} else {
stream->write_function(stream, "+OK Pause\n");
} else {
stream->write_function(stream, "+OK Pause\n");
switch_set_flag(fnode, NFLAG_PAUSE);
}
}
}
}
void conference_fnode_seek(conference_file_node_t *fnode, switch_stream_handle_t *stream, char *arg)
{
if (fnode && fnode->type == NODE_TYPE_FILE) {
if (fnode && fnode->type == NODE_TYPE_FILE) {
unsigned int samps = 0;
unsigned int pos = 0;
if (*arg == '+' || *arg == '-') {
int step;
int32_t target;
int step;
int32_t target;
if (!(step = atoi(arg))) {
step = 1000;
}
step = 1000;
}
samps = step * (fnode->fh.native_rate / 1000);
target = (int32_t)fnode->fh.pos + samps;
if (target < 0) {
target = 0;
}
stream->write_function(stream, "+OK seek to position %d\n", target);
switch_core_file_seek(&fnode->fh, &pos, target, SEEK_SET);
} else {
samps = switch_atoui(arg) * (fnode->fh.native_rate / 1000);
stream->write_function(stream, "+OK seek to position %d\n", samps);
switch_core_file_seek(&fnode->fh, &pos, samps, SEEK_SET);
if (target < 0) {
target = 0;
}
stream->write_function(stream, "+OK seek to position %d\n", target);
switch_core_file_seek(&fnode->fh, &pos, target, SEEK_SET);
} else {
samps = switch_atoui(arg) * (fnode->fh.native_rate / 1000);
stream->write_function(stream, "+OK seek to position %d\n", samps);
switch_core_file_seek(&fnode->fh, &pos, samps, SEEK_SET);
}
}
}
/* generate an outbound call from the conference */
switch_status_t conference_outcall(conference_obj_t *conference,
char *conference_name,
switch_core_session_t *session,
char *bridgeto, uint32_t timeout,
char *flags, char *cid_name,
char *cid_num,
char *profile,
switch_call_cause_t *cause,
switch_call_cause_t *cancel_cause, switch_event_t *var_event)
char *conference_name,
switch_core_session_t *session,
char *bridgeto, uint32_t timeout,
char *flags, char *cid_name,
char *cid_num,
char *profile,
switch_call_cause_t *cause,
switch_call_cause_t *cancel_cause, switch_event_t *var_event)
{
switch_core_session_t *peer_session = NULL;
switch_channel_t *peer_channel;
@ -1414,7 +1414,7 @@ switch_status_t conference_outcall(conference_obj_t *conference,
switch_channel_answer(caller_channel);
}
callup:
callup:
/* if the outbound call leg is ready */
if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) {
@ -1439,8 +1439,8 @@ switch_status_t conference_outcall(conference_obj_t *conference,
/* add them to the conference */
switch_snprintf(appdata, sizeof(appdata), "%s%s%s%s%s%s", conference_name,
profile?"@":"", profile?profile:"",
have_flags?"+flags{":"", have_flags?flags:"", have_flags?"}":"");
profile?"@":"", profile?profile:"",
have_flags?"+flags{":"", have_flags?flags:"", have_flags?"}":"");
switch_caller_extension_add_application(peer_session, extension, (char *) mod_conference_app_name, appdata);
switch_channel_set_caller_extension(peer_channel, extension);
@ -1452,7 +1452,7 @@ switch_status_t conference_outcall(conference_obj_t *conference,
goto done;
}
done:
done:
if (conference) {
switch_thread_rwlock_unlock(conference->rwlock);
}
@ -1473,7 +1473,7 @@ void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread, void *o
conference_outcall(call->conference, call->conference_name,
call->session, call->bridgeto, call->timeout,
call->session, call->bridgeto, call->timeout,
call->flags, call->cid_name, call->cid_num, call->profile, &cause, call->cancel_cause, call->var_event);
if (call->conference && test_eflag(call->conference, EFLAG_BGDIAL_RESULT) &&
@ -1506,9 +1506,9 @@ void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread, void *o
}
switch_status_t conference_outcall_bg(conference_obj_t *conference,
char *conference_name,
switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
const char *cid_num, const char *call_uuid, const char *profile, switch_call_cause_t *cancel_cause, switch_event_t **var_event)
char *conference_name,
switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
const char *cid_num, const char *call_uuid, const char *profile, switch_call_cause_t *cancel_cause, switch_event_t **var_event)
{
struct bg_call *call = NULL;
switch_thread_t *thread;
@ -1637,7 +1637,7 @@ SWITCH_STANDARD_APP(conference_function)
if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel answer failed.\n");
goto end;
goto end;
}
/* Save the original read codec. */
@ -1677,7 +1677,7 @@ SWITCH_STANDARD_APP(conference_function)
}
}
cflags_str = flags_str;
cflags_str = flags_str;
//if ((v_cflags_str = switch_channel_get_variable(channel, "conference_flags"))) {
if ((v_cflags_str = conference_utils_combine_flag_var(session, "conference_flags"))) {
@ -1729,7 +1729,7 @@ SWITCH_STANDARD_APP(conference_function)
if (switch_channel_test_flag(channel, CF_RECOVERED)) {
const char *check = switch_channel_get_variable(channel, "last_transfered_conference");
if (!zstr(check)) {
conference_name = (char *) check;
}
@ -1845,8 +1845,8 @@ SWITCH_STANDARD_APP(conference_function)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Cannot create a conference since join-only flag is set\n");
jos_xml = switch_xml_find_child(xml_cfg.profile, "param", "name", "join-only-sound");
if (jos_xml && (val = (char *) switch_xml_attr_soft(jos_xml, "value"))) {
switch_channel_answer(channel);
switch_ivr_play_file(session, NULL, val, NULL);
switch_channel_answer(channel);
switch_ivr_play_file(session, NULL, val, NULL);
}
if (!switch_false(switch_channel_get_variable(channel, "hangup_after_conference"))) {
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
@ -1929,7 +1929,7 @@ SWITCH_STANDARD_APP(conference_function)
}
rl++;
/* Start the conference thread for this conference */
conference_launch_thread(conference);
} else { /* setup user variable */
@ -2126,9 +2126,9 @@ SWITCH_STANDARD_APP(conference_function)
/* Install our Signed Linear codec so we get the audio in that format */
switch_core_session_set_read_codec(member.session, &member.read_codec);
memcpy(mflags, conference->mflags, sizeof(mflags));
conference_utils_set_mflags(flags_str, mflags);
mflags[MFLAG_RUNNING] = 1;
@ -2155,7 +2155,7 @@ SWITCH_STANDARD_APP(conference_function)
switch_queue_create(&member.mux_out_queue, 200, member.pool);
switch_frame_buffer_create(&member.fb);
}
/* Add the caller to the conference */
if (conference_member_add(conference, &member) != SWITCH_STATUS_SUCCESS) {
switch_core_codec_destroy(&member.read_codec);
@ -2165,7 +2165,7 @@ SWITCH_STANDARD_APP(conference_function)
if (conference->conference_video_mode == CONF_VIDEO_MODE_MUX) {
conference_video_launch_muxing_write_thread(&member);
}
msg.from = __FILE__;
/* Tell the channel we are going to be in a bridge */
@ -2176,7 +2176,7 @@ SWITCH_STANDARD_APP(conference_function)
switch_channel_set_flag(channel, CF_VIDEO_DECODED_READ);
switch_core_media_gen_key_frame(session);
}
/* Chime in the core video thread */
switch_core_session_set_video_read_callback(session, conference_video_thread_callback, (void *)&member);
@ -2208,7 +2208,7 @@ SWITCH_STANDARD_APP(conference_function)
/* Clean Up. */
done:
done:
if (member.video_muxing_write_thread) {
switch_status_t st = SWITCH_STATUS_SUCCESS;
@ -2217,7 +2217,7 @@ SWITCH_STANDARD_APP(conference_function)
member.video_muxing_write_thread = NULL;
}
if (locked) {
switch_mutex_unlock(conference_globals.setup_mutex);
}
@ -2264,7 +2264,7 @@ SWITCH_STANDARD_APP(conference_function)
toplay = expanded;
} else {
expanded = NULL;
toplay = src;
toplay = src;
}
if (!switch_is_file_path(toplay) && conference->sound_prefix) {
@ -2425,7 +2425,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
switch_core_session_get_read_impl(session, &read_impl);
channel = switch_core_session_get_channel(session);
presence_id = switch_channel_get_variable(channel, "presence_id");
if ((force_rate = switch_channel_get_variable(channel, "conference_force_rate"))) {
@ -2457,7 +2457,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
force_interval_i = read_impl.microseconds_per_packet / 1000;
} else {
tmp = atoi(force_interval);
if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
force_interval_i = interval = tmp;
}
@ -2613,18 +2613,18 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
caller_id_number = val;
} else if (!strcasecmp(var, "caller-controls") && !zstr(val)) {
caller_controls = val;
} else if (!strcasecmp(var, "ivr-dtmf-timeout") && !zstr(val)) {
ivr_dtmf_timeout = atoi(val);
if (ivr_dtmf_timeout < 500) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "not very smart value for ivr-dtmf-timeout found (%d), defaulting to 500ms\n", ivr_dtmf_timeout);
ivr_dtmf_timeout = 500;
}
} else if (!strcasecmp(var, "ivr-input-timeout") && !zstr(val)) {
ivr_input_timeout = atoi(val);
if (ivr_input_timeout != 0 && ivr_input_timeout < 500) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "not very smart value for ivr-input-timeout found (%d), defaulting to 500ms\n", ivr_input_timeout);
ivr_input_timeout = 5000;
}
} else if (!strcasecmp(var, "ivr-dtmf-timeout") && !zstr(val)) {
ivr_dtmf_timeout = atoi(val);
if (ivr_dtmf_timeout < 500) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "not very smart value for ivr-dtmf-timeout found (%d), defaulting to 500ms\n", ivr_dtmf_timeout);
ivr_dtmf_timeout = 500;
}
} else if (!strcasecmp(var, "ivr-input-timeout") && !zstr(val)) {
ivr_input_timeout = atoi(val);
if (ivr_input_timeout != 0 && ivr_input_timeout < 500) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "not very smart value for ivr-input-timeout found (%d), defaulting to 500ms\n", ivr_input_timeout);
ivr_input_timeout = 5000;
}
} else if (!strcasecmp(var, "moderator-controls") && !zstr(val)) {
moderator_controls = val;
} else if (!strcasecmp(var, "broadcast-chat-messages") && !zstr(val)) {
@ -2651,7 +2651,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
errno = 0; /* sanity first */
max_members = strtol(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
if (errno == ERANGE || errno == EINVAL || (int32_t) max_members < 0 || max_members == 1) {
/* a negative wont work well, and its foolish to have a conference limited to 1 person unless the outbound
/* a negative wont work well, and its foolish to have a conference limited to 1 person unless the outbound
* stuff is added, see comments above
*/
max_members = 0; /* set to 0 to disable max counts */
@ -2753,19 +2753,19 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
conference->moderator_controls = switch_core_strdup(conference->pool, moderator_controls);
conference->broadcast_chat_messages = broadcast_chat_messages;
conference->conference_video_mode = conference_video_mode;
if (!switch_core_has_video() && (conference->conference_video_mode == CONF_VIDEO_MODE_MUX || conference->conference_video_mode == CONF_VIDEO_MODE_TRANSCODE)) {
conference->conference_video_mode = CONF_VIDEO_MODE_PASSTHROUGH;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "video-mode invalid, only valid setting is 'passthrough' due to no video capabilities\n");
}
if (conference->conference_video_mode == CONF_VIDEO_MODE_MUX) {
int canvas_w = 0, canvas_h = 0;
if (video_canvas_size) {
char *p;
if ((canvas_w = atoi(video_canvas_size))) {
if ((p = strchr(video_canvas_size, 'x'))) {
p++;
@ -2782,10 +2782,10 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
canvas_w = CONFERENCE_CANVAS_DEFAULT_WIDTH;
canvas_h = CONFERENCE_CANVAS_DEFAULT_HIGHT;
}
conference_video_parse_layouts(conference, canvas_w, canvas_h);
if (!video_canvas_bgcolor) {
video_canvas_bgcolor = "#333333";
}
@ -2821,7 +2821,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
conference->video_codec_settings.video.bandwidth = switch_parse_bandwidth_string(video_codec_bandwidth);
}
}
if (zstr(video_layout_name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No video-layout-name specified, using " CONFERENCE_MUX_DEFAULT_LAYOUT "\n");
video_layout_name = CONFERENCE_MUX_DEFAULT_LAYOUT;
@ -2880,7 +2880,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
conference->log_dir = path;
}
if (!zstr(cdr_event_mode)) {
if (!strcmp(cdr_event_mode, "content")) {
conference->cdr_event_mode = CDRE_AS_CONTENT;
@ -3078,7 +3078,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
/* Set enter sound and exit sound flags so that default is on */
conference_utils_set_flag(conference, CFLAG_ENTER_SOUND);
conference_utils_set_flag(conference, CFLAG_EXIT_SOUND);
/* Activate the conference mutex for exclusivity */
switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
@ -3095,10 +3095,10 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
conference->super_canvas_show_all_layers = video_super_canvas_show_all_layers;
if (video_canvas_count < 1) video_canvas_count = 1;
if (conference->conference_video_mode == CONF_VIDEO_MODE_MUX) {
video_layout_t *vlayout = conference_video_get_layout(conference, conference->video_layout_name, conference->video_layout_group);
if (!vlayout) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot find layout\n");
conference->video_layout_name = conference->video_layout_group = NULL;
@ -3132,7 +3132,7 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
}
}
end:
end:
switch_mutex_unlock(conference_globals.hash_mutex);
@ -3173,7 +3173,7 @@ void conference_send_presence(conference_obj_t *conference)
switch_event_fire(&event);
}
}
#if 0
uint32_t conference_kickall_matching_var(conference_obj_t *conference, const char *var, const char *val)
@ -3192,7 +3192,7 @@ uint32_t conference_kickall_matching_var(conference_obj_t *conference, const cha
continue;
}
channel = switch_core_session_get_channel(member->session);
channel = switch_core_session_get_channel(member->session);
vval = switch_channel_get_variable(channel, var);
if (vval && !strcmp(vval, val)) {
@ -3202,7 +3202,7 @@ uint32_t conference_kickall_matching_var(conference_obj_t *conference, const cha
r++;
}
}
}
switch_mutex_unlock(conference->member_mutex);
switch_mutex_unlock(conference->mutex);
@ -3245,7 +3245,7 @@ void send_presence(switch_event_types_t id)
}
}
done:
done:
switch_event_destroy(&params);
/* Release the config registry handle */
@ -3270,7 +3270,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_conference_load)
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
switch_console_add_complete_func("::conference::conference_list_conferences", conference_list_conferences);
switch_event_channel_bind("conference", conference_event_channel_handler, &conference_globals.event_channel_id);
switch_event_channel_bind("conference-liveArray", conference_event_la_channel_handler, &conference_globals.event_channel_id);

File diff suppressed because it is too large Load Diff