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

@ -299,3 +299,13 @@ void conference_al_close(al_handle_t *al)
} }
#endif #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

@ -216,42 +216,42 @@ switch_status_t conference_api_main_real(const char *cmd, switch_core_session_t
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 */ /* build api interface help ".syntax" field string */
uint32_t i; uint32_t i;
size_t nl = 0, ol = 0; size_t nl = 0, ol = 0;
char cmd_str[256]; char cmd_str[256];
char *tmp = NULL, *p = strdup(""); char *tmp = NULL, *p = strdup("");
for (i = 0; i < CONFFUNCAPISIZE; i++) { for (i = 0; i < CONFFUNCAPISIZE; i++) {
nl = strlen(conference_api_sub_commands[i].pcommand) + strlen(conference_api_sub_commands[i].psyntax) + 5; 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_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); switch_console_set_complete(cmd_str);
if (p != NULL) { if (p != NULL) {
ol = strlen(p); ol = strlen(p);
} }
tmp = realloc(p, ol + nl); tmp = realloc(p, ol + nl);
if (tmp != NULL) { if (tmp != NULL) {
p = tmp; p = tmp;
strcat(p, "\t\t"); strcat(p, "\t\t");
strcat(p, conference_api_sub_commands[i].pcommand); strcat(p, conference_api_sub_commands[i].pcommand);
if (!zstr(conference_api_sub_commands[i].psyntax)) { if (!zstr(conference_api_sub_commands[i].psyntax)) {
strcat(p, " "); strcat(p, " ");
strcat(p, conference_api_sub_commands[i].psyntax); strcat(p, conference_api_sub_commands[i].psyntax);
} }
if (i < CONFFUNCAPISIZE - 1) { if (i < CONFFUNCAPISIZE - 1) {
strcat(p, "\n"); strcat(p, "\n");
} }
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't realloc\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't realloc\n");
return SWITCH_STATUS_TERM; return SWITCH_STATUS_TERM;
} }
} }
*syntax = p; *syntax = p;
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
@ -1113,22 +1113,22 @@ switch_status_t conference_api_sub_vid_layout(conference_obj_t *conference, swit
int xx = 4; int xx = 4;
if ((group_name = strchr(argv[2], ':'))) { if ((group_name = strchr(argv[2], ':'))) {
group_name++; group_name++;
xx--; xx--;
} else { } else {
group_name = argv[3]; group_name = argv[3];
} }
if (!group_name) { if (!group_name) {
stream->write_function(stream, "Group name not specified.\n"); stream->write_function(stream, "Group name not specified.\n");
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} else { } 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); vlayout = conference_video_find_best_layout(conference, lg, 0);
} }
if (!vlayout) { 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; return SWITCH_STATUS_SUCCESS;
} }
@ -1638,8 +1638,8 @@ switch_status_t conference_api_sub_file_seek(conference_obj_t *conference, switc
uint32_t id = atoi(argv[3]); uint32_t id = atoi(argv[3]);
conference_member_t *member = conference_member_get(conference, id); conference_member_t *member = conference_member_get(conference, id);
if (member == NULL) { if (member == NULL) {
stream->write_function(stream, "Member: %u not found.\n", id); stream->write_function(stream, "Member: %u not found.\n", id);
return SWITCH_STATUS_GENERR; return SWITCH_STATUS_GENERR;
} }
switch_mutex_lock(member->fnode_mutex); switch_mutex_lock(member->fnode_mutex);
@ -1805,7 +1805,7 @@ switch_status_t conference_api_sub_saymember(conference_obj_t *conference, switc
} }
ret_status = SWITCH_STATUS_SUCCESS; ret_status = SWITCH_STATUS_SUCCESS;
done: done:
if (member) { if (member) {
switch_thread_rwlock_unlock(member->rwlock); 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) { for (rel = member->relationships; rel; rel = rel->next) {
stream->write_function(stream, "%d -> %d %s%s%s\n", member->id, rel->id, 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_SPEAK) ? "SPEAK " : "NOSPEAK ",
(rel->flags & RFLAG_CAN_HEAR) ? "HEAR " : "NOHEAR ", (rel->flags & RFLAG_CAN_HEAR) ? "HEAR " : "NOHEAR ",
(rel->flags & RFLAG_CAN_SEND_VIDEO) ? "SENDVIDEO " : "NOSENDVIDEO "); (rel->flags & RFLAG_CAN_SEND_VIDEO) ? "SENDVIDEO " : "NOSENDVIDEO ");
} }
} }
} else { } 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); stream->write_function(stream, "relationship %u->%u not found.\n", id, oid);
} }
skip: skip:
if (member) { if (member) {
switch_thread_rwlock_unlock(member->rwlock); switch_thread_rwlock_unlock(member->rwlock);
} }
@ -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]); stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
} else { } else {
if (test_eflag(conference, EFLAG_RECORD) && 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); 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, "Action", "stop-recording");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", all ? "all" : argv[2]); 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; return SWITCH_STATUS_GENERR;
} }
stream->write_function(stream, "%s recording file %s\n", 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", 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)) { if (!conference_record_action(conference, argv[2], action)) {
stream->write_function(stream, "non-existant recording '%s'\n", argv[2]); stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
} else { } else {
if (test_eflag(conference, EFLAG_RECORD) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) 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); conference_event_add_data(conference, event);
if (action == REC_ACTION_PAUSE) { if (action == REC_ACTION_PAUSE) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "pause-recording"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "pause-recording");
} else { } else {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "resume-recording"); 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; return SWITCH_STATUS_SUCCESS;
@ -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_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; int ret_status = SWITCH_STATUS_GENERR;
if (argc != 3) { if (argc != 3) {
@ -2487,43 +2487,43 @@ switch_status_t conference_api_sub_get(conference_obj_t *conference,
ret_status = SWITCH_STATUS_SUCCESS; ret_status = SWITCH_STATUS_SUCCESS;
if (strcasecmp(argv[2], "run_time") == 0) { if (strcasecmp(argv[2], "run_time") == 0) {
stream->write_function(stream, "%ld", 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) { } else if (strcasecmp(argv[2], "count") == 0) {
stream->write_function(stream, "%d", stream->write_function(stream, "%d",
conference->count); conference->count);
} else if (strcasecmp(argv[2], "count_ghosts") == 0) { } else if (strcasecmp(argv[2], "count_ghosts") == 0) {
stream->write_function(stream, "%d", stream->write_function(stream, "%d",
conference->count_ghosts); conference->count_ghosts);
} else if (strcasecmp(argv[2], "max_members") == 0) { } else if (strcasecmp(argv[2], "max_members") == 0) {
stream->write_function(stream, "%d", stream->write_function(stream, "%d",
conference->max_members); conference->max_members);
} else if (strcasecmp(argv[2], "rate") == 0) { } else if (strcasecmp(argv[2], "rate") == 0) {
stream->write_function(stream, "%d", stream->write_function(stream, "%d",
conference->rate); conference->rate);
} else if (strcasecmp(argv[2], "profile_name") == 0) { } else if (strcasecmp(argv[2], "profile_name") == 0) {
stream->write_function(stream, "%s", stream->write_function(stream, "%s",
conference->profile_name); conference->profile_name);
} else if (strcasecmp(argv[2], "sound_prefix") == 0) { } else if (strcasecmp(argv[2], "sound_prefix") == 0) {
stream->write_function(stream, "%s", stream->write_function(stream, "%s",
conference->sound_prefix); conference->sound_prefix);
} else if (strcasecmp(argv[2], "caller_id_name") == 0) { } else if (strcasecmp(argv[2], "caller_id_name") == 0) {
stream->write_function(stream, "%s", stream->write_function(stream, "%s",
conference->caller_id_name); conference->caller_id_name);
} else if (strcasecmp(argv[2], "caller_id_number") == 0) { } else if (strcasecmp(argv[2], "caller_id_number") == 0) {
stream->write_function(stream, "%s", stream->write_function(stream, "%s",
conference->caller_id_number); conference->caller_id_number);
} else if (strcasecmp(argv[2], "is_locked") == 0) { } else if (strcasecmp(argv[2], "is_locked") == 0) {
stream->write_function(stream, "%s", 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) { } else if (strcasecmp(argv[2], "endconference_grace_time") == 0) {
stream->write_function(stream, "%d", stream->write_function(stream, "%d",
conference->endconference_grace_time); conference->endconference_grace_time);
} else if (strcasecmp(argv[2], "uuid") == 0) { } else if (strcasecmp(argv[2], "uuid") == 0) {
stream->write_function(stream, "%s", stream->write_function(stream, "%s",
conference->uuid_str); conference->uuid_str);
} else if (strcasecmp(argv[2], "wait_mod") == 0) { } else if (strcasecmp(argv[2], "wait_mod") == 0) {
stream->write_function(stream, "%s", stream->write_function(stream, "%s",
conference_utils_test_flag(conference, CFLAG_WAIT_MOD) ? "true" : ""); conference_utils_test_flag(conference, CFLAG_WAIT_MOD) ? "true" : "");
} else { } else {
ret_status = SWITCH_STATUS_FALSE; 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_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; int ret_status = SWITCH_STATUS_GENERR;
if (argc != 4 || zstr(argv[3])) { if (argc != 4 || zstr(argv[3])) {
@ -2548,23 +2548,23 @@ switch_status_t conference_api_sub_set(conference_obj_t *conference,
} else { } else {
ret_status = SWITCH_STATUS_FALSE; 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); stream->write_function(stream, "%s",conference->sound_prefix);
conference->sound_prefix = switch_core_strdup(conference->pool, argv[3]); 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); stream->write_function(stream, "%s",conference->caller_id_name);
conference->caller_id_name = switch_core_strdup(conference->pool, argv[3]); 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); stream->write_function(stream, "%s",conference->caller_id_number);
conference->caller_id_number = switch_core_strdup(conference->pool, argv[3]); conference->caller_id_number = switch_core_strdup(conference->pool, argv[3]);
} else if (strcasecmp(argv[2], "endconference_grace_time") == 0) { } else if (strcasecmp(argv[2], "endconference_grace_time") == 0) {
int new_gt = atoi(argv[3]); int new_gt = atoi(argv[3]);
if (new_gt >= 0) { if (new_gt >= 0) {
stream->write_function(stream, "%d", conference->endconference_grace_time); stream->write_function(stream, "%d", conference->endconference_grace_time);
conference->endconference_grace_time = new_gt; conference->endconference_grace_time = new_gt;
} else { } else {
ret_status = SWITCH_STATUS_FALSE; ret_status = SWITCH_STATUS_FALSE;
} }
} else { } else {
ret_status = SWITCH_STATUS_FALSE; ret_status = SWITCH_STATUS_FALSE;
} }
@ -2737,3 +2737,14 @@ switch_status_t conference_api_dispatch(conference_obj_t *conference, switch_str
return status; 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

@ -240,10 +240,10 @@ char *conference_cdr_rfc4579_render(conference_obj_t *conference, switch_event_t
/** ok so this is in the rfc but not the xsd /** ok so this is in the rfc but not the xsd
if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "joining-method", off3++))) { if (!(x_tag3 = switch_xml_add_child_d(x_tag2, "joining-method", off3++))) {
abort(); 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) { if (np->member) {
@ -409,7 +409,7 @@ cJSON *conference_cdr_json_render(conference_obj_t *conference, cJSON *req)
} }
//if (np->record_path) { //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"); json_add_child_string(juser, "status", np->leave_time ? "disconnected" : "connected");
@ -693,7 +693,7 @@ void conference_cdr_render(conference_obj_t *conference)
switch_xml_set_txt_d(x_ptr, "conference_locked"); switch_xml_set_txt_d(x_ptr, "conference_locked");
} else if (rp->reason == CDRR_MAXMEMBERS) { } else if (rp->reason == CDRR_MAXMEMBERS) {
switch_xml_set_txt_d(x_ptr, "max_members_reached"); 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"); switch_xml_set_txt_d(x_ptr, "invalid_pin");
} }
@ -723,39 +723,50 @@ void conference_cdr_render(conference_obj_t *conference)
#ifdef _MSC_VER #ifdef _MSC_VER
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
#else #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 #endif
int wrote; int wrote;
wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
wrote++; wrote++;
close(fd); close(fd);
fd = -1; 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);
} else { } 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); /* For Emacs:
switch_safe_free(xml_text); * Local Variables:
switch_xml_free(cdr); * 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

@ -154,13 +154,13 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json
} }
if (conference->layout_group_hash) { if (conference->layout_group_hash) {
for (hi = switch_core_hash_first(conference->layout_group_hash); hi; hi = switch_core_hash_next(&hi)) { for (hi = switch_core_hash_first(conference->layout_group_hash); hi; hi = switch_core_hash_next(&hi)) {
char *name; char *name;
switch_core_hash_this(hi, &vvar, NULL, &val); switch_core_hash_this(hi, &vvar, NULL, &val);
name = switch_mprintf("group:%s", (char *)vvar); name = switch_mprintf("group:%s", (char *)vvar);
cJSON_AddItemToArray(array, cJSON_CreateString(name)); cJSON_AddItemToArray(array, cJSON_CreateString(name));
free(name); free(name);
} }
} }
switch_mutex_unlock(conference_globals.setup_mutex); switch_mutex_unlock(conference_globals.setup_mutex);
@ -306,7 +306,7 @@ void conference_event_adv_la(conference_obj_t *conference, conference_member_t *
//if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) { //if (member->video_flow == SWITCH_MEDIA_FLOW_SENDONLY) {
switch_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ); switch_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ);
switch_core_media_gen_key_frame(member->session); 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)) { !switch_channel_test_flag(member->channel, CF_VIDEO_ONLY)) {
@ -702,3 +702,13 @@ switch_status_t chat_send(switch_event_t *message_event)
return SWITCH_STATUS_SUCCESS; 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

@ -319,7 +319,7 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u
switch_mutex_unlock(conference->mutex); switch_mutex_unlock(conference->mutex);
done: done:
switch_safe_free(expanded); switch_safe_free(expanded);
switch_safe_free(dfile); switch_safe_free(dfile);
@ -329,7 +329,7 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u
/* Play a file */ /* 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, 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; uint32_t x = 0;
switch_status_t status = SWITCH_STATUS_SUCCESS; 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); switch_safe_free(dpath);
} }
done: done:
switch_safe_free(expanded); switch_safe_free(expanded);
return status; 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

@ -42,37 +42,37 @@
#include <mod_conference.h> #include <mod_conference.h>
struct _mapping control_mappings[] = { struct _mapping control_mappings[] = {
{"mute", conference_loop_mute_toggle}, {"mute", conference_loop_mute_toggle},
{"mute on", conference_loop_mute_on}, {"mute on", conference_loop_mute_on},
{"mute off", conference_loop_mute_off}, {"mute off", conference_loop_mute_off},
{"vmute", conference_loop_vmute_toggle}, {"vmute", conference_loop_vmute_toggle},
{"vmute on", conference_loop_vmute_on}, {"vmute on", conference_loop_vmute_on},
{"vmute off", conference_loop_vmute_off}, {"vmute off", conference_loop_vmute_off},
{"vmute snap", conference_loop_conference_video_vmute_snap}, {"vmute snap", conference_loop_conference_video_vmute_snap},
{"vmute snapoff", conference_loop_conference_video_vmute_snapoff}, {"vmute snapoff", conference_loop_conference_video_vmute_snapoff},
{"deaf mute", conference_loop_deafmute_toggle}, {"deaf mute", conference_loop_deafmute_toggle},
{"energy up", conference_loop_energy_up}, {"energy up", conference_loop_energy_up},
{"energy equ", conference_loop_energy_equ_conf}, {"energy equ", conference_loop_energy_equ_conf},
{"energy dn", conference_loop_energy_dn}, {"energy dn", conference_loop_energy_dn},
{"vol talk up", conference_loop_volume_talk_up}, {"vol talk up", conference_loop_volume_talk_up},
{"vol talk zero", conference_loop_volume_talk_zero}, {"vol talk zero", conference_loop_volume_talk_zero},
{"vol talk dn", conference_loop_volume_talk_dn}, {"vol talk dn", conference_loop_volume_talk_dn},
{"vol listen up", conference_loop_volume_listen_up}, {"vol listen up", conference_loop_volume_listen_up},
{"vol listen zero", conference_loop_volume_listen_zero}, {"vol listen zero", conference_loop_volume_listen_zero},
{"vol listen dn", conference_loop_volume_listen_dn}, {"vol listen dn", conference_loop_volume_listen_dn},
{"hangup", conference_loop_hangup}, {"hangup", conference_loop_hangup},
{"event", conference_loop_event}, {"event", conference_loop_event},
{"lock", conference_loop_lock_toggle}, {"lock", conference_loop_lock_toggle},
{"transfer", conference_loop_transfer}, {"transfer", conference_loop_transfer},
{"execute_application", conference_loop_exec_app}, {"execute_application", conference_loop_exec_app},
{"floor", conference_loop_floor_toggle}, {"floor", conference_loop_floor_toggle},
{"vid-floor", conference_loop_vid_floor_toggle}, {"vid-floor", conference_loop_vid_floor_toggle},
{"vid-floor-force", conference_loop_vid_floor_force} {"vid-floor-force", conference_loop_vid_floor_force}
}; };
int conference_loop_mapping_len() 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) switch_status_t conference_loop_dmachine_dispatcher(switch_ivr_dmachine_match_t *match)
@ -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); conference_member_play_file(member, msg, 0, SWITCH_TRUE);
} }
switch_snprintf(msg, sizeof(msg), "digits/%d.wav", abs(member->volume_in_level)); switch_snprintf(msg, sizeof(msg), "digits/%d.wav", abs(member->volume_in_level));
conference_member_play_file(member, msg, 0, SWITCH_TRUE); conference_member_play_file(member, msg, 0, SWITCH_TRUE);
} }
void conference_loop_event(conference_member_t *member, caller_control_action_t *action) 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); switch_ivr_session_transfer(member->session, exten, dialplan, context);
done: done:
return; return;
} }
@ -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_core_session_set_read_codec(member->session, &member->read_codec);
switch_channel_clear_app_flag(channel, CF_APP_TAGGED); switch_channel_clear_app_flag(channel, CF_APP_TAGGED);
done: done:
switch_safe_free(mydata); 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 */ /* 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) 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; conference_member_t *member = obj;
switch_channel_t *channel; switch_channel_t *channel;
switch_status_t status; switch_status_t status;
@ -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); switch_mutex_unlock(member->read_mutex);
@ -1278,24 +1278,24 @@ void conference_loop_output(conference_member_t *member)
if (write_frame.datalen) { if (write_frame.datalen) {
write_frame.samples = write_frame.datalen / 2 / member->conference->channels; write_frame.samples = write_frame.datalen / 2 / member->conference->channels;
if( !conference_utils_member_test_flag(member, MFLAG_CAN_HEAR)) { if( !conference_utils_member_test_flag(member, MFLAG_CAN_HEAR)) {
memset(write_frame.data, 255, write_frame.datalen); memset(write_frame.data, 255, write_frame.datalen);
} else if (member->volume_out_level) { /* Check for output volume adjustments */ } 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); switch_change_sln_volume(write_frame.data, write_frame.samples * member->conference->channels, member->volume_out_level);
} }
write_frame.timestamp = timer.samplecount; write_frame.timestamp = timer.samplecount;
if (member->fnode) { if (member->fnode) {
conference_member_add_file_data(member, write_frame.data, write_frame.datalen); conference_member_add_file_data(member, write_frame.data, write_frame.datalen);
} }
conference_member_check_channels(&write_frame, member, SWITCH_FALSE); 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) { 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); switch_mutex_unlock(member->audio_out_mutex);
break; break;
} }
} }
} }
@ -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

@ -117,9 +117,9 @@ void conference_member_bind_controls(conference_member_t *member, const char *co
for (xcontrol = switch_xml_child(xgroups, "control"); xcontrol; xcontrol = xcontrol->next) { for (xcontrol = switch_xml_child(xgroups, "control"); xcontrol; xcontrol = xcontrol->next) {
const char *key = switch_xml_attr(xcontrol, "action"); const char *key = switch_xml_attr(xcontrol, "action");
const char *digits = switch_xml_attr(xcontrol, "digits"); const char *digits = switch_xml_attr(xcontrol, "digits");
const char *data = switch_xml_attr_soft(xcontrol, "data"); const char *data = switch_xml_attr_soft(xcontrol, "data");
if (zstr(key) || zstr(digits)) continue; if (zstr(key) || zstr(digits)) continue;
@ -745,7 +745,7 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
if (conference->count > 1) { if (conference->count > 1) {
if ((conference->moh_sound && !conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) || 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 */ /* stop MoH if any */
conference_file_stop(conference, FILE_STOP_ASYNC); 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"); 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 (conference_utils_test_flag(conference, CFLAG_ENTER_SOUND) && !conference_utils_member_test_flag(member, MFLAG_SILENT)) {
if (!zstr(enter_sound)) { if (!zstr(enter_sound)) {
conference_file_play(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN, conference_file_play(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN,
switch_core_session_get_channel(member->session), 0); switch_core_session_get_channel(member->session), 0);
} else { } else {
conference_file_play(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0); conference_file_play(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
} }
} }
@ -965,7 +965,7 @@ void conference_member_set_floor_holder(conference_obj_t *conference, conference
} }
if (conference->floor_holder) { 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); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-ID", "%d", conference->floor_holder->id);
} else { } else {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "New-ID", "none"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "New-ID", "none");
@ -1300,7 +1300,7 @@ switch_status_t conference_member_play_file(conference_member_t *member, char *f
switch_mutex_unlock(member->fnode_mutex); switch_mutex_unlock(member->fnode_mutex);
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
done: done:
switch_safe_free(expanded); switch_safe_free(expanded);
switch_safe_free(dfile); switch_safe_free(dfile);
@ -1629,11 +1629,11 @@ int conference_member_setup_media(conference_member_t *member, conference_obj_t
return 0; return 0;
codec_done1: codec_done1:
switch_core_codec_destroy(&member->read_codec); switch_core_codec_destroy(&member->read_codec);
codec_done2: codec_done2:
switch_core_codec_destroy(&member->write_codec); switch_core_codec_destroy(&member->write_codec);
done: done:
switch_mutex_unlock(member->audio_out_mutex); 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

@ -115,27 +115,27 @@ switch_status_t conference_record_action(conference_obj_t *conference, char *pat
switch_assert(conference != NULL); switch_assert(conference != NULL);
switch_mutex_lock(conference->member_mutex); switch_mutex_lock(conference->member_mutex);
for (member = conference->members; member; member = member->next) 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); if (conference_utils_member_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path)))
switch (action) {
{ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Action: %d\n", action);
case REC_ACTION_STOP: switch (action)
conference_utils_member_clear_flag_locked(member, MFLAG_RUNNING); {
count++; case REC_ACTION_STOP:
break; conference_utils_member_clear_flag_locked(member, MFLAG_RUNNING);
case REC_ACTION_PAUSE: count++;
conference_utils_member_set_flag_locked(member, MFLAG_PAUSE_RECORDING); break;
count = 1; case REC_ACTION_PAUSE:
break; conference_utils_member_set_flag_locked(member, MFLAG_PAUSE_RECORDING);
case REC_ACTION_RESUME: count = 1;
conference_utils_member_clear_flag_locked(member, MFLAG_PAUSE_RECORDING); break;
count = 1; case REC_ACTION_RESUME:
break; conference_utils_member_clear_flag_locked(member, MFLAG_PAUSE_RECORDING);
} count = 1;
break;
}
} }
} }
switch_mutex_unlock(conference->member_mutex); switch_mutex_unlock(conference->member_mutex);
return count; return count;
} }
@ -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"); 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) && 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); 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, "Action", "start-recording");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", rec->path); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", rec->path);
@ -346,7 +346,7 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v
switch_core_timer_next(&timer); switch_core_timer_next(&timer);
} /* Rinse ... Repeat */ } /* Rinse ... Repeat */
end: end:
for(;;) { for(;;) {
switch_mutex_lock(member->audio_out_mutex); switch_mutex_lock(member->audio_out_mutex);
@ -419,5 +419,13 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v
return NULL; 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

@ -358,3 +358,13 @@ switch_bool_t conference_utils_member_test_flag(conference_member_t *member, mem
return !!member->flags[flag]; 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:
*/

View File

@ -974,8 +974,8 @@ void conference_video_destroy_canvas(mcu_canvas_t **canvasP) {
} }
void conference_video_write_canvas_image_to_codec_group(conference_obj_t *conference, mcu_canvas_t *canvas, codec_set_t *codec_set, void conference_video_write_canvas_image_to_codec_group(conference_obj_t *conference, mcu_canvas_t *canvas, codec_set_t *codec_set,
int codec_index, uint32_t timestamp, switch_bool_t need_refresh, int codec_index, uint32_t timestamp, switch_bool_t need_refresh,
switch_bool_t need_keyframe, switch_bool_t need_reset) switch_bool_t need_keyframe, switch_bool_t need_reset)
{ {
conference_member_t *imember; conference_member_t *imember;
@ -1808,13 +1808,13 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
} }
if (!layer) { if (!layer) {
if (conference_video_find_layer(conference, canvas, imember, &layer) == SWITCH_STATUS_SUCCESS) { if (conference_video_find_layer(conference, canvas, imember, &layer) == SWITCH_STATUS_SUCCESS) {
imember->layer_timeout = 0; imember->layer_timeout = 0;
} else { } else {
if (--imember->layer_timeout <= 0) { if (--imember->layer_timeout <= 0) {
conference_video_next_canvas(imember); conference_video_next_canvas(imember);
} }
} }
} }
conference_video_check_auto_bitrate(imember, layer); conference_video_check_auto_bitrate(imember, layer);
@ -2201,7 +2201,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
for (i = 0; write_codecs[i] && switch_core_codec_ready(&write_codecs[i]->codec) && i < MAX_MUX_CODECS; i++) { for (i = 0; write_codecs[i] && switch_core_codec_ready(&write_codecs[i]->codec) && i < MAX_MUX_CODECS; i++) {
write_codecs[i]->frame.img = write_img; write_codecs[i]->frame.img = write_img;
conference_video_write_canvas_image_to_codec_group(conference, canvas, write_codecs[i], i, conference_video_write_canvas_image_to_codec_group(conference, canvas, write_codecs[i], i,
timestamp, need_refresh, need_keyframe, need_reset); timestamp, need_refresh, need_keyframe, need_reset);
if (canvas->video_write_bandwidth) { if (canvas->video_write_bandwidth) {
switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH, SCCT_INT, &canvas->video_write_bandwidth, NULL, NULL); switch_core_codec_control(&write_codecs[i]->codec, SCC_VIDEO_BANDWIDTH, SCCT_INT, &canvas->video_write_bandwidth, NULL, NULL);
@ -2852,8 +2852,8 @@ void conference_video_write_frame(conference_obj_t *conference, conference_membe
send_frame = 1; send_frame = 1;
} }
} else if (!conference_utils_member_test_flag(imember, MFLAG_RECEIVING_VIDEO) && } else if (!conference_utils_member_test_flag(imember, MFLAG_RECEIVING_VIDEO) &&
(conference_utils_test_flag(conference, CFLAG_VID_FLOOR_LOCK) || (conference_utils_test_flag(conference, CFLAG_VID_FLOOR_LOCK) ||
!(imember->id == imember->conference->video_floor_holder && imember->conference->last_video_floor_holder))) { !(imember->id == imember->conference->video_floor_holder && imember->conference->last_video_floor_holder))) {
send_frame = 1; send_frame = 1;
} }
@ -2977,3 +2977,14 @@ switch_status_t conference_video_thread_callback(switch_core_session_t *session,
return SWITCH_STATUS_SUCCESS; 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

@ -327,7 +327,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
if (conference->perpetual_sound && !conference->async_fnode) { if (conference->perpetual_sound && !conference->async_fnode) {
conference_file_play(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 1); conference_file_play(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 1);
} else if (conference->moh_sound && ((nomoh == 0 && conference->count == 1) } else if (conference->moh_sound && ((nomoh == 0 && conference->count == 1)
|| conference_utils_test_flag(conference, CFLAG_WAIT_MOD)) && !conference->async_fnode && !conference->fnode) { || 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); conference_file_play(conference, conference->moh_sound, CONF_DEFAULT_LEADIN, NULL, 1);
} }
@ -521,7 +521,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
check if our audio is involved and if so, subtract it from the sample so we don't hear ourselves. 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 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. 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) { for (omember = conference->members; omember; omember = omember->next) {
switch_size_t ok = 1; switch_size_t ok = 1;
@ -549,7 +549,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
/* 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. reasons why we should not be hearing a paticular member, and if not, delete their samples as well.
*/ */
if (conference->relationship_total) { if (conference->relationship_total) {
for (imember = conference->members; imember; imember = imember->next) { for (imember = conference->members; imember; imember = imember->next) {
if (imember != omember && conference_utils_member_test_flag(imember, MFLAG_HAS_AUDIO)) { if (imember != omember && conference_utils_member_test_flag(imember, MFLAG_HAS_AUDIO)) {
@ -656,16 +656,16 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob
} }
if (!conference->end_count && conference->endconference_time && 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", 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); conference_utils_set_flag(conference, CFLAG_DESTRUCT | CFLAG_ENDCONF_FORCED);
} }
switch_mutex_unlock(conference->mutex); switch_mutex_unlock(conference->mutex);
} }
/* Rinse ... Repeat */ /* Rinse ... Repeat */
end: end:
if (conference_utils_test_flag(conference, CFLAG_OUTCALL)) { if (conference_utils_test_flag(conference, CFLAG_OUTCALL)) {
conference->cancel_cause = SWITCH_CAUSE_ORIGINATOR_CANCEL; conference->cancel_cause = SWITCH_CAUSE_ORIGINATOR_CANCEL;
@ -1158,7 +1158,7 @@ void conference_xlist(conference_obj_t *conference, switch_xml_t x_conference, i
switch_assert(x_member); switch_assert(x_member);
switch_xml_set_attr_d(x_member, "type", "recording_node"); switch_xml_set_attr_d(x_member, "type", "recording_node");
/* or: /* 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++); x_tag = switch_xml_add_child_d(x_member, "record_path", count++);
@ -1259,13 +1259,13 @@ void conference_fnode_toggle_pause(conference_file_node_t *fnode, switch_stream_
{ {
if (fnode) { if (fnode) {
if (switch_test_flag(fnode, NFLAG_PAUSE)) { 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); switch_clear_flag(fnode, NFLAG_PAUSE);
} else { } else {
stream->write_function(stream, "+OK Pause\n"); stream->write_function(stream, "+OK Pause\n");
switch_set_flag(fnode, NFLAG_PAUSE); switch_set_flag(fnode, NFLAG_PAUSE);
}
} }
}
} }
@ -1276,41 +1276,41 @@ void conference_fnode_seek(conference_file_node_t *fnode, switch_stream_handle_t
unsigned int pos = 0; unsigned int pos = 0;
if (*arg == '+' || *arg == '-') { if (*arg == '+' || *arg == '-') {
int step; int step;
int32_t target; int32_t target;
if (!(step = atoi(arg))) { if (!(step = atoi(arg))) {
step = 1000; step = 1000;
} }
samps = step * (fnode->fh.native_rate / 1000); samps = step * (fnode->fh.native_rate / 1000);
target = (int32_t)fnode->fh.pos + samps; target = (int32_t)fnode->fh.pos + samps;
if (target < 0) { if (target < 0) {
target = 0; target = 0;
} }
stream->write_function(stream, "+OK seek to position %d\n", target); stream->write_function(stream, "+OK seek to position %d\n", target);
switch_core_file_seek(&fnode->fh, &pos, target, SEEK_SET); switch_core_file_seek(&fnode->fh, &pos, target, SEEK_SET);
} else { } else {
samps = switch_atoui(arg) * (fnode->fh.native_rate / 1000); samps = switch_atoui(arg) * (fnode->fh.native_rate / 1000);
stream->write_function(stream, "+OK seek to position %d\n", samps); stream->write_function(stream, "+OK seek to position %d\n", samps);
switch_core_file_seek(&fnode->fh, &pos, samps, SEEK_SET); switch_core_file_seek(&fnode->fh, &pos, samps, SEEK_SET);
}
} }
}
} }
/* generate an outbound call from the conference */ /* generate an outbound call from the conference */
switch_status_t conference_outcall(conference_obj_t *conference, switch_status_t conference_outcall(conference_obj_t *conference,
char *conference_name, char *conference_name,
switch_core_session_t *session, switch_core_session_t *session,
char *bridgeto, uint32_t timeout, char *bridgeto, uint32_t timeout,
char *flags, char *cid_name, char *flags, char *cid_name,
char *cid_num, char *cid_num,
char *profile, char *profile,
switch_call_cause_t *cause, switch_call_cause_t *cause,
switch_call_cause_t *cancel_cause, switch_event_t *var_event) switch_call_cause_t *cancel_cause, switch_event_t *var_event)
{ {
switch_core_session_t *peer_session = NULL; switch_core_session_t *peer_session = NULL;
switch_channel_t *peer_channel; switch_channel_t *peer_channel;
@ -1414,7 +1414,7 @@ switch_status_t conference_outcall(conference_obj_t *conference,
switch_channel_answer(caller_channel); switch_channel_answer(caller_channel);
} }
callup: callup:
/* if the outbound call leg is ready */ /* 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)) { 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 */ /* add them to the conference */
switch_snprintf(appdata, sizeof(appdata), "%s%s%s%s%s%s", conference_name, switch_snprintf(appdata, sizeof(appdata), "%s%s%s%s%s%s", conference_name,
profile?"@":"", profile?profile:"", profile?"@":"", profile?profile:"",
have_flags?"+flags{":"", have_flags?flags:"", have_flags?"}":""); have_flags?"+flags{":"", have_flags?flags:"", have_flags?"}":"");
switch_caller_extension_add_application(peer_session, extension, (char *) mod_conference_app_name, appdata); switch_caller_extension_add_application(peer_session, extension, (char *) mod_conference_app_name, appdata);
switch_channel_set_caller_extension(peer_channel, extension); switch_channel_set_caller_extension(peer_channel, extension);
@ -1452,7 +1452,7 @@ switch_status_t conference_outcall(conference_obj_t *conference,
goto done; goto done;
} }
done: done:
if (conference) { if (conference) {
switch_thread_rwlock_unlock(conference->rwlock); switch_thread_rwlock_unlock(conference->rwlock);
} }
@ -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, switch_status_t conference_outcall_bg(conference_obj_t *conference,
char *conference_name, char *conference_name,
switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_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) 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; struct bg_call *call = NULL;
switch_thread_t *thread; switch_thread_t *thread;
@ -1637,7 +1637,7 @@ SWITCH_STANDARD_APP(conference_function)
if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) { if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel answer failed.\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel answer failed.\n");
goto end; goto end;
} }
/* Save the original read codec. */ /* 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 = switch_channel_get_variable(channel, "conference_flags"))) {
if ((v_cflags_str = conference_utils_combine_flag_var(session, "conference_flags"))) { if ((v_cflags_str = conference_utils_combine_flag_var(session, "conference_flags"))) {
@ -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"); 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"); 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"))) { if (jos_xml && (val = (char *) switch_xml_attr_soft(jos_xml, "value"))) {
switch_channel_answer(channel); switch_channel_answer(channel);
switch_ivr_play_file(session, NULL, val, NULL); switch_ivr_play_file(session, NULL, val, NULL);
} }
if (!switch_false(switch_channel_get_variable(channel, "hangup_after_conference"))) { if (!switch_false(switch_channel_get_variable(channel, "hangup_after_conference"))) {
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
@ -2208,7 +2208,7 @@ SWITCH_STANDARD_APP(conference_function)
/* Clean Up. */ /* Clean Up. */
done: done:
if (member.video_muxing_write_thread) { if (member.video_muxing_write_thread) {
switch_status_t st = SWITCH_STATUS_SUCCESS; switch_status_t st = SWITCH_STATUS_SUCCESS;
@ -2613,18 +2613,18 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co
caller_id_number = val; caller_id_number = val;
} else if (!strcasecmp(var, "caller-controls") && !zstr(val)) { } else if (!strcasecmp(var, "caller-controls") && !zstr(val)) {
caller_controls = val; caller_controls = val;
} else if (!strcasecmp(var, "ivr-dtmf-timeout") && !zstr(val)) { } else if (!strcasecmp(var, "ivr-dtmf-timeout") && !zstr(val)) {
ivr_dtmf_timeout = atoi(val); ivr_dtmf_timeout = atoi(val);
if (ivr_dtmf_timeout < 500) { 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); 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; ivr_dtmf_timeout = 500;
} }
} else if (!strcasecmp(var, "ivr-input-timeout") && !zstr(val)) { } else if (!strcasecmp(var, "ivr-input-timeout") && !zstr(val)) {
ivr_input_timeout = atoi(val); ivr_input_timeout = atoi(val);
if (ivr_input_timeout != 0 && ivr_input_timeout < 500) { 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); 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; ivr_input_timeout = 5000;
} }
} else if (!strcasecmp(var, "moderator-controls") && !zstr(val)) { } else if (!strcasecmp(var, "moderator-controls") && !zstr(val)) {
moderator_controls = val; moderator_controls = val;
} else if (!strcasecmp(var, "broadcast-chat-messages") && !zstr(val)) { } else if (!strcasecmp(var, "broadcast-chat-messages") && !zstr(val)) {
@ -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); switch_mutex_unlock(conference_globals.hash_mutex);
@ -3245,7 +3245,7 @@ void send_presence(switch_event_types_t id)
} }
} }
done: done:
switch_event_destroy(&params); switch_event_destroy(&params);
/* Release the config registry handle */ /* Release the config registry handle */

File diff suppressed because it is too large Load Diff