Freeswitch-svn
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
October 2006
- 13 participants
- 341 discussions
22 Oct '06
Author: mikej
Date: Sun Oct 22 13:44:41 2006
New Revision: 3158
Modified:
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
whitespace cleanup.
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Sun Oct 22 13:44:41 2006
@@ -197,7 +197,6 @@
};
typedef struct conference_record conference_record_t;
-
/* Function Prototypes */
static uint32_t next_member_id(void);
static conference_relationship_t *member_get_relationship(conference_member_t *member, conference_member_t *other_member);
@@ -235,9 +234,9 @@
static void launch_conference_record_thread(conference_obj_t *conference, char *path);
static void conference_member_itterator(conference_obj_t *conference,
- switch_stream_handle_t *stream,
- int (*pfncallback)(conference_obj_t*, conference_member_t*, int, switch_stream_handle_t*, void*),
- void *data);
+ switch_stream_handle_t *stream,
+ int (*pfncallback)(conference_obj_t*, conference_member_t*, int, switch_stream_handle_t*, void*),
+ void *data);
/* Return a Distinct ID # */
static uint32_t next_member_id(void)
@@ -251,7 +250,6 @@
return id;
}
-
static void switch_change_sln_volume(int16_t *data, uint32_t samples, int32_t vol)
{
int16_t *p = data;
@@ -287,7 +285,7 @@
if (rel->id == other_member->id) {
break;
}
-
+
/* 0 matches everyone.
(We will still test the others brcause a real match carries more clout) */
@@ -312,7 +310,7 @@
conference_member_t *member = NULL;
for(member = conference->members; member; member = member->next) {
-
+
if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
continue;
}
@@ -321,7 +319,7 @@
break;
}
}
-
+
return member;
}
@@ -410,11 +408,11 @@
switch_event_fire(&event);
}
-
+
if (conference->enter_sound) {
conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN);
}
-
+
if (conference->count == 1 && conference->alone_sound) {
conference_play_file(conference, conference->alone_sound, 0);
}
@@ -481,7 +479,7 @@
if ((conference->min && switch_test_flag(conference, CFLAG_ENFORCE_MIN) && conference->count < conference->min)
|| (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0) ) {
- switch_set_flag(conference, CFLAG_DESTRUCT);
+ switch_set_flag(conference, CFLAG_DESTRUCT);
} else {
if (conference->exit_sound) {
conference_play_file(conference, conference->exit_sound, 0);
@@ -490,7 +488,7 @@
conference_play_file(conference, conference->alone_sound, 0);
}
}
-
+
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(member->session);
switch_channel_event_set_data(channel, event);
@@ -541,7 +539,7 @@
/* Sync the conference to a single timing source */
switch_core_timer_next(&timer);
-
+
switch_mutex_lock(conference->mutex);
ready = 0;
@@ -584,7 +582,7 @@
}
switch_mutex_unlock(imember->audio_in_mutex);
}
-
+
/* If a file or speech event is being played */
if (conference->fnode) {
/* Lead in time */
@@ -595,7 +593,7 @@
if (conference->fnode->type == NODE_TYPE_SPEECH) {
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
uint32_t rate = conference->rate;
-
+
if (switch_core_speech_read_tts(&conference->fnode->sh,
file_frame,
&file_data_len,
@@ -614,7 +612,7 @@
}
}
}
-
+
if (ready) {
/* Build a muxed frame for every member that contains the mixed audio of everyone else */
for (omember = conference->members; omember; omember = omember->next) {
@@ -649,7 +647,7 @@
/* If we are not supposed to hear them then don't let it happen */
if (imember->relationships) {
conference_relationship_t *rel;
-
+
if ((rel = member_get_relationship(imember, omember))) {
if (! switch_test_flag(rel, RFLAG_CAN_SPEAK)) {
continue;
@@ -660,18 +658,17 @@
if (imember->read > imember->len) {
imember->len = imember->read;
}
-
+
bptr = (int16_t *) imember->frame;
muxed = (int16_t *) omember->mux_frame;
-
-
+
for (x = 0; x < imember->read / 2; x++) {
int32_t z = muxed[x] + bptr[x];
switch_normalize_to_16bit(z);
muxed[x] = (int16_t)z;
}
-
+
ready++;
}
}
@@ -684,7 +681,6 @@
switch_mutex_unlock(imember->audio_out_mutex);
}
}
-
if (conference->fnode && conference->fnode->done) {
confernce_file_node_t *fnode;
@@ -705,7 +701,7 @@
switch_core_destroy_memory_pool(&pool);
}
-
+
switch_mutex_unlock(conference->mutex);
} /* Rinse ... Repeat */
@@ -735,7 +731,7 @@
}
switch_mutex_unlock(conference->mutex);
-
+
/* Wait till everybody is out */
switch_clear_flag_locked(conference, CFLAG_RUNNING);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock ON\n");
@@ -760,7 +756,7 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Inactive");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
-
+
switch_event_fire(&event);
}
switch_mutex_lock(globals.hash_mutex);
@@ -783,7 +779,7 @@
channel = switch_core_session_get_channel(member->session);
- assert(channel != NULL);
+ assert(channel != NULL);
assert(member->conference != NULL);
if (switch_core_timer_init(&timer,
@@ -805,7 +801,7 @@
if (switch_test_flag(member->conference, CFLAG_ANSWERED)) {
switch_channel_answer(channel);
}
-
+
/* Start a thread to read data and feed it into the buffer and use this thread to generate output */
launch_input_thread(member, switch_core_session_get_pool(member->session));
@@ -832,7 +828,6 @@
switch_event_destroy(&event);
}
-#if 1
if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
// test to see if outbound channel has answered
if (switch_channel_test_flag(channel, CF_ANSWERED) && !switch_test_flag(member->conference, CFLAG_ANSWERED)) {
@@ -845,10 +840,10 @@
switch_channel_answer(channel);
}
}
-#endif
- if (switch_channel_has_dtmf(channel)) {
- switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
+ if (switch_channel_has_dtmf(channel)) {
+ switch_channel_dequeue_dtmf(channel, dtmf, sizeof(dtmf));
+
for (digit = dtmf; *digit; digit++) {
switch(*digit) {
case '0':
@@ -999,7 +994,7 @@
if (member->fnode->type == NODE_TYPE_SPEECH) {
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
uint32_t rate = member->conference->rate;
-
+
if (switch_core_speech_read_tts(&member->fnode->sh,
file_frame,
&file_data_len,
@@ -1038,7 +1033,7 @@
switch_buffer_t *use_buffer = NULL;
uint32_t mux_used = (uint32_t)switch_buffer_inuse(member->mux_buffer);
//uint32_t res_used = member->mux_resampler ? switch_buffer_inuse(member->resample_buffer) : 0;
-
+
if (mux_used) {
/* Flush the output buffer and write all the data (presumably muxed) back to the channel */
switch_mutex_lock(member->audio_out_mutex);
@@ -1053,11 +1048,11 @@
if (member->volume_out_level) {
switch_change_sln_volume(write_frame.data, write_frame.samples, member->volume_out_level);
}
-
+
switch_core_session_write_frame(member->session, &write_frame, -1, 0);
}
}
-
+
switch_mutex_unlock(member->audio_out_mutex);
} else {
switch_core_timer_next(&timer);
@@ -1068,7 +1063,6 @@
switch_clear_flag_locked(member, MFLAG_RUNNING);
switch_core_timer_destroy(&timer);
-
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel leaving conference, cause: %s\n",
switch_channel_cause2str(switch_channel_get_cause(channel)));
@@ -1083,7 +1077,6 @@
}
}
-
/* Sub-Routine called by a record entity inside a conference */
static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, void *obj)
{
@@ -1092,9 +1085,9 @@
switch_file_handle_t fh = {0};
conference_member_t smember = {0}, *member;
conference_record_t *rec = (conference_record_t *) obj;
- uint32_t divider = 1000 / rec->conference->interval;
- uint32_t samples = (rec->conference->rate / divider);
- uint32_t bytes = samples * 2;
+ uint32_t divider = 1000 / rec->conference->interval;
+ uint32_t samples = (rec->conference->rate / divider);
+ uint32_t bytes = samples * 2;
uint32_t mux_used;
char *vval;
@@ -1107,7 +1100,7 @@
member->flags = MFLAG_CAN_HEAR | MFLAG_NOCHANNEL | MFLAG_RUNNING;
write_frame.data = data;
- write_frame.buflen = sizeof(data);
+ write_frame.buflen = sizeof(data);
assert(rec->conference != NULL);
member->conference = rec->conference;
@@ -1139,7 +1132,6 @@
goto end;
}
-
if (switch_core_file_open(&fh,
rec->path,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
@@ -1147,7 +1139,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s]\n", rec->path);
goto end;
}
-
+
if ((vval = switch_mprintf("Conference %s", rec->conference->name))) {
switch_core_file_set_string(&fh, SWITCH_AUDIO_COL_STR_TITLE, vval);
switch_safe_free(vval);
@@ -1177,9 +1169,8 @@
switch_core_file_close(&fh);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording Stopped\n");
- end:
+end:
-
if (rec->pool) {
switch_memory_pool_t *pool = rec->pool;
rec = NULL;
@@ -1193,7 +1184,6 @@
return NULL;
}
-
/* Make files stop playing in a conference either the current one or all of them */
static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop)
{
@@ -1257,8 +1247,8 @@
switch_mutex_unlock(conference->mutex);
if (!count) {
- return SWITCH_STATUS_FALSE;
- }
+ return SWITCH_STATUS_FALSE;
+ }
#ifdef WIN32
if (*(file +1) != ':' && *file != '/') {
@@ -1298,7 +1288,7 @@
/* Queue the node */
switch_mutex_lock(conference->mutex);
for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
-
+
if (nptr) {
nptr->next = fnode;
} else {
@@ -1309,7 +1299,6 @@
return SWITCH_STATUS_SUCCESS;
}
-
/* Play a file in the conference rooom to a member */
static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin)
{
@@ -1350,7 +1339,7 @@
/* Queue the node */
switch_mutex_lock(member->flag_mutex);
for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
-
+
if (nptr) {
nptr->next = fnode;
} else {
@@ -1405,7 +1394,7 @@
/* Queue the node */
switch_mutex_lock(member->flag_mutex);
for (nptr = member->fnode; nptr && nptr->next; nptr = nptr->next);
-
+
if (nptr) {
nptr->next = fnode;
} else {
@@ -1432,8 +1421,8 @@
switch_mutex_lock(conference->member_mutex);
count = conference->count;
if (!(conference->tts_engine && conference->tts_voice)) {
- count = 0;
- }
+ count = 0;
+ }
switch_mutex_unlock(conference->member_mutex);
switch_mutex_unlock(conference->mutex);
@@ -1468,13 +1457,12 @@
return SWITCH_STATUS_FALSE;
}
-
fnode->pool = pool;
/* Queue the node */
switch_mutex_lock(conference->mutex);
for (nptr = conference->fnode; nptr && nptr->next; nptr = nptr->next);
-
+
if (nptr) {
nptr->next = fnode;
} else {
@@ -1548,7 +1536,6 @@
switch_mutex_unlock(conference->member_mutex);
}
-
static void conference_list_pretty(conference_obj_t *conference, switch_stream_handle_t *stream)
{
conference_member_t *member = NULL;
@@ -1591,7 +1578,7 @@
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(member->session);
switch_channel_event_set_data(channel, event);
-
+
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "mute-member");
@@ -1620,7 +1607,7 @@
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(member->session);
switch_channel_event_set_data(channel, event);
-
+
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unmute-member");
@@ -1646,7 +1633,7 @@
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(member->session);
switch_channel_event_set_data(channel, event);
-
+
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "deaf-member");
@@ -1672,7 +1659,7 @@
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(member->session);
switch_channel_event_set_data(channel, event);
-
+
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "undeaf-member");
@@ -1699,11 +1686,11 @@
switch_mutex_unlock(member->flag_mutex);
stream->write_function(stream, "OK kicked %u\n", id);
-
+
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(member->session);
switch_channel_event_set_data(channel, event);
-
+
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "kick-member");
@@ -1724,31 +1711,31 @@
if (member != NULL || (member = conference_member_get(conference, id))) {
switch_event_t *event;
- if (data) {
- switch_mutex_lock(member->flag_mutex);
- member->energy_level = atoi((char *)data);
- switch_mutex_unlock(member->flag_mutex);
- }
-
- stream->write_function(stream, "Energy %u=%d\n", id, member->energy_level);
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->energy_level = atoi((char *)data);
+ switch_mutex_unlock(member->flag_mutex);
+ }
- if (data) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
-
- switch_event_fire(&event);
- }
+ stream->write_function(stream, "Energy %u=%d\n", id, member->energy_level);
+
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
+
+ switch_event_fire(&event);
}
- } else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
- err = 1;
}
+ } else {
+ stream->write_function(stream, "Non-Existant ID %u\n", id);
+ err = 1;
+ }
return err;
}
@@ -1766,18 +1753,18 @@
normalize_volume(member->volume_in_level);
switch_mutex_unlock(member->flag_mutex);
}
-
+
stream->write_function(stream, "Volume IN %u=%d\n", id, member->volume_in_level);
if (data) {
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(member->session);
switch_channel_event_set_data(channel, event);
-
+
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
-
+
switch_event_fire(&event);
}
}
@@ -1802,19 +1789,19 @@
normalize_volume(member->volume_out_level);
switch_mutex_unlock(member->flag_mutex);
}
-
+
stream->write_function(stream, "Volume OUT %u=%d\n", id, member->volume_out_level);
if (data) {
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_channel_t *channel = switch_core_session_get_channel(member->session);
switch_channel_event_set_data(channel, event);
-
+
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
-
+
switch_event_fire(&event);
}
}
@@ -1868,11 +1855,11 @@
switch_hash_index_t *hi;
void *val;
char *d = ";";
-
+
if (argv[1]) {
if (argv[2] && !strcasecmp(argv[1], "delim")) {
d = argv[2];
-
+
if (*d == '"') {
if (++d) {
char *p;
@@ -2011,7 +1998,7 @@
if ((tbuf = strdup(buf))) {
if ((name = strstr(tbuf, "saymember "))) {
name += 10;
-
+
if (*name) {
text = strchr(name, ' ');
id = atoi(name);
@@ -2021,7 +2008,7 @@
}
-
+
if ((member = conference_member_get(conference, id))) {
if (text && conference_member_say(conference, member, text, 0) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "(saymember) OK\n");
@@ -2041,13 +2028,13 @@
} else {
stream->write_function(stream, "(saymember) Syntax Error!");
}
-
+
free(tbuf);
goto done;
}
} else if (!strcasecmp(argv[1], "stop")) {
uint8_t current = 0, all = 0;
-
+
if (argc > 2) {
current = strcasecmp(argv[2], "current") ? 0 : 1;
all = strcasecmp(argv[2], "all") ? 0 : 1;
@@ -2238,9 +2225,9 @@
stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
goto done;
}
-
+
channel = switch_core_session_get_channel(member->session);
-
+
if (!(new_conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, argv[3]))) {
switch_memory_pool_t *pool;
char *conf_name;
@@ -2252,22 +2239,22 @@
}
conf_name = switch_core_strdup(pool, argv[3]);
-
+
if ((profile_name = strchr(conf_name, '@'))) {
*profile_name++ = '\0';
-
+
/* Open the config from the xml registry */
if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
goto done;
}
-
+
if ((profiles = switch_xml_child(cfg, "profiles"))) {
profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
}
}
-
+
/* Release the config registry handle */
if (cxml) {
switch_xml_free(cxml);
@@ -2276,19 +2263,19 @@
/* Create the conference object. */
new_conference = conference_new(conf_name, profile, pool);
-
-
+
+
if (!new_conference) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
goto done;
}
-
+
/* Set the minimum number of members (once you go above it you cannot go below it) */
new_conference->min = 1;
-
+
/* Indicate the conference is dynamic */
switch_set_flag_locked(new_conference, CFLAG_DYNAMIC);
-
+
/* Start the conference thread for this conference */
launch_conference_thread(new_conference);
}
@@ -2296,7 +2283,7 @@
conference_del_member(member->last_conference, member);
conference_add_member(new_conference, member);
stream->write_function(stream, "OK Member %u sent to conference %s.\n", id, argv[3]);
-
+
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
@@ -2305,7 +2292,7 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
switch_event_fire(&event);
}
-
+
} else {
stream->write_function(stream, transfer_usage);
goto done;
@@ -2316,7 +2303,7 @@
uint8_t nospeak = 0, nohear = 0, clear = 0;
nospeak = strstr(argv[4], "nospeak") ? 1 : 0;
nohear = strstr(argv[4], "nohear") ? 1 : 0;
-
+
if (!strcasecmp(argv[4], "clear")) {
clear = 1;
}
@@ -2330,7 +2317,7 @@
conference_member_t *member = NULL;
uint32_t id = atoi(argv[2]);
uint32_t oid = atoi(argv[3]);
-
+
switch_mutex_lock(conference->mutex);
switch_mutex_lock(conference->member_mutex);
if ((member = conference_member_get(conference, id))) {
@@ -2345,7 +2332,7 @@
conference_member_t *member = NULL, *other_member = NULL;
uint32_t id = atoi(argv[2]);
uint32_t oid = atoi(argv[3]);
-
+
switch_mutex_lock(conference->mutex);
switch_mutex_lock(conference->member_mutex);
if ((member = conference_member_get(conference, id)) && (other_member = conference_member_get(conference, oid))) {
@@ -2382,11 +2369,11 @@
}
} else if (!strcasecmp(argv[1], "list")) {
char *d = ";";
-
+
if (argv[2]) {
if (argv[3] && !strcasecmp(argv[2], "delim")) {
d = argv[3];
-
+
if (*d == '"') {
if (++d) {
char *p;
@@ -2416,12 +2403,12 @@
stream->write_function(stream, "Memory Error!\n");
}
- done:
+done:
if (lbuf) {
free(lbuf);
}
-
+
return status;
}
@@ -2486,7 +2473,7 @@
peer_channel = switch_core_session_get_channel(peer_session);
assert(peer_channel != NULL);
-
+
if (caller_channel && switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
switch_channel_answer(caller_channel);
}
@@ -2515,7 +2502,7 @@
goto done;
}
- done:
+done:
return status;
}
@@ -2528,7 +2515,7 @@
for (x = 0; x < leadin; x++) {
switch_frame_t *read_frame;
switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);
-
+
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
@@ -2562,9 +2549,9 @@
switch_core_session_message_t msg = {0};
uint8_t isbr = 0;
char *dpin = NULL;
-
+
channel = switch_core_session_get_channel(session);
- assert(channel != NULL);
+ assert(channel != NULL);
if (!mydata) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
@@ -2619,7 +2606,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", global_cf_name);
goto done;
}
-
+
if ((profiles = switch_xml_child(cfg, "profiles"))) {
profile = switch_xml_find_child(profiles, "profile", "name", profile_name);
}
@@ -2627,7 +2614,7 @@
if (isbr) {
char *uuid = switch_core_session_get_uuid(session);
-
+
if (!strcmp(conf_name, "_uuid_")) {
conf_name = uuid;
}
@@ -2665,17 +2652,17 @@
} else {
/* Create the conference object. */
conference = conference_new(conf_name, profile, pool);
-
+
if (!conference) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
goto done;
}
-
+
if (dpin) {
conference->pin = switch_core_strdup(conference->pool, dpin);
}
-
+
/* Set the minimum number of members (once you go above it you cannot go below it) */
conference->min = 1;
@@ -2725,7 +2712,6 @@
}
goto done;
}
-
}
/* Release the config registry handle */
@@ -2734,7 +2720,6 @@
cxml = NULL;
}
-
if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
if (conference_outcall(conference, session, bridgeto, 60, NULL, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
goto done;
@@ -2746,12 +2731,10 @@
switch_set_flag(conference, CFLAG_ANSWERED);
}
-
-
/* Save the original read codec. */
read_codec = switch_core_session_get_read_codec(session);
member.native_rate = read_codec->implementation->samples_per_second;
-
+
/* Setup a Signed Linear codec for reading audio. */
if (switch_core_codec_init(&member.read_codec,
"L16",
@@ -2776,14 +2759,14 @@
if (read_codec->implementation->samples_per_second != conference->rate) {
switch_audio_resampler_t **resampler = read_codec->implementation->samples_per_second > conference->rate ?
&member.read_resampler : &member.mux_resampler;
-
+
switch_resample_create(resampler,
read_codec->implementation->samples_per_second,
read_codec->implementation->samples_per_second * 20,
conference->rate,
conference->rate * 20,
switch_core_session_get_pool(session));
-
+
/* Setup an audio buffer for the resampled audio */
if (switch_buffer_create_dynamic(&member.resample_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
@@ -2810,7 +2793,7 @@
flags = 0;
goto codec_done2;
}
-
+
/* Setup an audio buffer for the incoming audio */
if (switch_buffer_create_dynamic(&member.audio_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
@@ -2822,9 +2805,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error Creating Audio Buffer!\n");
goto codec_done1;
}
-
-
/* Prepare MUTEXS */
member.id = next_member_id();
member.pool = pool;
@@ -2860,18 +2841,18 @@
/* Put the original codec back */
switch_core_session_set_read_codec(member.session, read_codec);
-
+
/* Clean Up. codec_done(X): is for error situations after the codecs were setup and done: is for situations before */
- 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_buffer_destroy(&member.resample_buffer);
switch_buffer_destroy(&member.audio_buffer);
switch_buffer_destroy(&member.mux_buffer);
-
+
/* Release the config registry handle */
if (cxml) {
switch_xml_free(cxml);
@@ -2886,7 +2867,7 @@
}
switch_core_session_reset(session);
-
+
}
/* Create a thread for the conference and launch it */
@@ -2894,7 +2875,7 @@
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
-
+
switch_set_flag_locked(conference, CFLAG_RUNNING);
switch_threadattr_create(&thd_attr, conference->pool);
switch_threadattr_detach_set(thd_attr, 1);
@@ -2911,7 +2892,7 @@
switch_threadattr_t *thd_attr = NULL;
switch_memory_pool_t *pool;
conference_record_t *rec;
-
+
/* Setup a memory pool to use. */
if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n");
@@ -2922,7 +2903,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n");
switch_core_destroy_memory_pool(&pool);
}
-
+
rec->conference = conference;
rec->path = switch_core_strdup(pool, path);
rec->pool = pool;
@@ -2951,10 +2932,10 @@
assert(member != NULL);
channel = switch_core_session_get_channel(member->session);
- assert(channel != NULL);
+ assert(channel != NULL);
read_codec = switch_core_session_get_read_codec(member->session);
- assert(read_codec != NULL);
+ assert(read_codec != NULL);
/* 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. */
@@ -2962,7 +2943,7 @@
while(switch_test_flag(member, MFLAG_RUNNING) && switch_channel_ready(channel)) {
/* Read a frame. */
status = switch_core_session_read_frame(member->session, &read_frame, -1, 0);
-
+
/* end the loop, if appropriate */
if (!SWITCH_READ_ACCEPTABLE(status) || !switch_test_flag(member, MFLAG_RUNNING)) {
break;
@@ -2985,7 +2966,7 @@
energy += abs(data[j]);
j += read_codec->implementation->number_of_channels;
}
-
+
score = energy / samples;
if (score > energy_level) {
@@ -2993,7 +2974,7 @@
if (hangover_hits) {
hangover_hits--;
}
-
+
if (diff >= diff_level || ++hangunder_hits >= hangunder) {
hangover_hits = hangunder_hits = 0;
@@ -3008,7 +2989,6 @@
switch_event_fire(&event);
}
}
-
}
} else {
if (hangunder_hits) {
@@ -3031,13 +3011,13 @@
}
}
}
-
+
/* skip frames that are not actual media or when we are muted or silent */
if ((talking || energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK)) {
if (member->read_resampler) {
int16_t *bptr = (int16_t *) read_frame->data;
int len = (int) read_frame->datalen;;
-
+
member->read_resampler->from_len = switch_short_to_float(bptr, member->read_resampler->from, (int) len / 2);
member->read_resampler->to_len = switch_resample_process(member->read_resampler, member->read_resampler->from,
member->read_resampler->from_len, member->read_resampler->to,
@@ -3058,7 +3038,7 @@
switch_mutex_unlock(member->audio_in_mutex);
}
}
-
+
switch_clear_flag_locked(member, MFLAG_ITHREAD);
return NULL;
@@ -3069,7 +3049,7 @@
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
-
+
switch_threadattr_create(&thd_attr, pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -3123,7 +3103,7 @@
if (!body) {
return SWITCH_STATUS_SUCCESS;
}
-
+
if (!(ci = switch_loadable_module_get_chat_interface(proto))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invaid Chat Interface [%s]!\n", proto);
}
@@ -3138,7 +3118,7 @@
ci->chat_send(CONF_CHAT_PROTO, to, from, "", "Sorry, We're Closed", "");
return SWITCH_STATUS_FALSE;
}
-
+
SWITCH_STANDARD_STREAM(stream);
if (strstr(body, "list")) {
@@ -3150,15 +3130,14 @@
ci->chat_send(CONF_CHAT_PROTO, to, from, "", stream.data, "");
switch_safe_free(stream.data);
-
+
return SWITCH_STATUS_SUCCESS;
}
-
static const switch_chat_interface_t conference_chat_interface = {
/*.name */ CONF_CHAT_PROTO,
/*.chat_send */ chat_send,
-
+
};
static switch_loadable_module_interface_t conference_module_interface = {
@@ -3225,7 +3204,7 @@
}
var = buf;
}
-
+
if (!strcasecmp(var, "rate")) {
rate_name = val;
} else if (!strcasecmp(var, "domain")) {
@@ -3288,7 +3267,7 @@
interval = i;
}
}
-
+
/* Timer module to use */
if (switch_strlen_zero(timer_name)) {
timer_name = "soft";
@@ -3312,7 +3291,7 @@
return NULL;
}
}
-
+
/* Create the conference object. */
if (!(conference = switch_core_alloc(pool, sizeof(*conference)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
@@ -3328,7 +3307,7 @@
conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
-
+
if (!switch_strlen_zero(enter_sound)) {
conference->enter_sound = switch_core_strdup(conference->pool, enter_sound);
}
@@ -3400,7 +3379,6 @@
return conference;
}
-
/* Called by FreeSWITCH when the module loads */
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{
@@ -3422,7 +3400,6 @@
return SWITCH_STATUS_TERM;
}
-
/* Setup a hash to store conferences by name */
switch_core_hash_init(&globals.conference_hash, globals.conference_pool);
switch_mutex_init(&globals.conference_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
@@ -3433,7 +3410,6 @@
/* indicate that the module should continue to be loaded */
return status;
}
-
SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
{
1
0
22 Oct '06
Author: mikej
Date: Sun Oct 22 13:07:28 2006
New Revision: 3157
Modified:
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
add "all" member target for vol and energy commands, fix init of len for record.
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Sun Oct 22 13:07:28 2006
@@ -325,15 +325,19 @@
return member;
}
-static void conference_record_stop(conference_obj_t *conference, char *path)
+static int conference_record_stop(conference_obj_t *conference, char *path)
{
conference_member_t *member = NULL;
+ int count = 0;
for(member = conference->members; member; member = member->next) {
if (switch_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path))) {
switch_clear_flag_locked(member, MFLAG_RUNNING);
+ count++;
}
}
+
+ return count;
}
/* Add a custom relationship to a member */
@@ -614,9 +618,9 @@
if (ready) {
/* Build a muxed frame for every member that contains the mixed audio of everyone else */
for (omember = conference->members; omember; omember = omember->next) {
+ omember->len = bytes;
if (conference->fnode) {
memcpy(omember->mux_frame, file_frame, file_sample_len * 2);
- omember->len = bytes;
} else {
memset(omember->mux_frame, 255, bytes);
}
@@ -1151,7 +1155,7 @@
while(switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(rec->conference, CFLAG_RUNNING) && rec->conference->count) {
if ((mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer)) >= bytes) {
- /* Flush the output buffer and write all the data (presumably muxed) back to the channel */
+ /* Flush the output buffer and write all the data (presumably muxed) to the file */
switch_mutex_lock(member->audio_out_mutex);
write_frame.data = data;
while ((write_frame.datalen = (uint32_t)switch_buffer_read(member->mux_buffer, write_frame.data, mux_used))) {
@@ -1713,6 +1717,115 @@
return err;
}
+static int conference_function_energy_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+{
+ int err = 0;
+
+ if (member != NULL || (member = conference_member_get(conference, id))) {
+ switch_event_t *event;
+
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->energy_level = atoi((char *)data);
+ switch_mutex_unlock(member->flag_mutex);
+ }
+
+ stream->write_function(stream, "Energy %u=%d\n", id, member->energy_level);
+
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
+
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ stream->write_function(stream, "Non-Existant ID %u\n", id);
+ err = 1;
+ }
+
+ return err;
+}
+
+static int conference_function_volume_in_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+{
+ int err = 0;
+
+ if (member != NULL || (member = conference_member_get(conference, id))) {
+ switch_event_t *event;
+
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_in_level = atoi((char *)data);
+ normalize_volume(member->volume_in_level);
+ switch_mutex_unlock(member->flag_mutex);
+ }
+
+ stream->write_function(stream, "Volume IN %u=%d\n", id, member->volume_in_level);
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
+
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ stream->write_function(stream, "Non-Existant ID %u\n", id);
+ err = 1;
+ }
+
+ return err;
+}
+
+static int conference_function_volume_out_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+{
+ int err = 0;
+
+ if (member != NULL || (member = conference_member_get(conference, id))) {
+ switch_event_t *event;
+
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_out_level = atoi((char *)data);
+ normalize_volume(member->volume_out_level);
+ switch_mutex_unlock(member->flag_mutex);
+ }
+
+ stream->write_function(stream, "Volume OUT %u=%d\n", id, member->volume_out_level);
+
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
+
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ stream->write_function(stream, "Non-Existant ID %u\n", id);
+ err = 1;
+ }
+
+ return err;
+}
+
/* API Interface Function */
static switch_status_t conf_function(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream)
{
@@ -1963,112 +2076,50 @@
} else if (!strcasecmp(argv[1], "energy")) {
if (argc > 2) {
uint32_t id = atoi(argv[2]);
- conference_member_t *member;
+ int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
- if ((member = conference_member_get(conference, id))) {
-
- if (argv[3]) {
- switch_mutex_lock(member->flag_mutex);
- member->energy_level = atoi(argv[3]);
- switch_mutex_unlock(member->flag_mutex);
- }
-
- stream->write_function(stream, "Energy %u=%d\n", id, member->energy_level);
- if (argv[3]) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
-
- switch_event_fire(&event);
- }
- }
+ if (!all) {
+ conference_function_energy_member(conference, NULL, id, stream, argv[3]);
goto done;
} else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
+ conference_member_itterator(conference, stream, &conference_function_energy_member, argv[3]);
goto done;
}
} else {
- stream->write_function(stream, "usage energy <id> [<newval>]\n");
+ stream->write_function(stream, "usage energy <id|all> [<newval>]\n");
goto done;
}
} else if (!strcasecmp(argv[1], "volume_in")) {
if (argc > 2) {
uint32_t id = atoi(argv[2]);
- conference_member_t *member;
+ int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
- if ((member = conference_member_get(conference, id))) {
-
- if (argv[3]) {
- switch_mutex_lock(member->flag_mutex);
- member->volume_in_level = atoi(argv[3]);
- normalize_volume(member->volume_in_level);
- switch_mutex_unlock(member->flag_mutex);
- }
-
- stream->write_function(stream, "Volume IN %u=%d\n", id, member->volume_in_level);
- if (argv[3]) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
-
- switch_event_fire(&event);
- }
- }
+ if (!all) {
+ conference_function_volume_in_member(conference, NULL, id, stream, argv[3]);
goto done;
} else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
+ conference_member_itterator(conference, stream, &conference_function_volume_in_member, argv[3]);
goto done;
}
} else {
- stream->write_function(stream, "usage volume_in <id> [<newval>]\n");
+ stream->write_function(stream, "usage volume_in <[id|all]> [<newval>]\n");
goto done;
}
} else if (!strcasecmp(argv[1], "volume_out")) {
if (argc > 2) {
uint32_t id = atoi(argv[2]);
- conference_member_t *member;
+ int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
- if ((member = conference_member_get(conference, id))) {
-
- if (argv[3]) {
- switch_mutex_lock(member->flag_mutex);
- member->volume_out_level = atoi(argv[3]);
- normalize_volume(member->volume_out_level);
- switch_mutex_unlock(member->flag_mutex);
- }
-
- stream->write_function(stream, "Volume OUT %u=%d\n", id, member->volume_out_level);
- if (argv[3]) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
-
- switch_event_fire(&event);
- }
- }
+ if (!all) {
+ conference_function_volume_out_member(conference, NULL, id, stream, argv[3]);
goto done;
} else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
+ conference_member_itterator(conference, stream, &conference_function_volume_out_member, argv[3]);
goto done;
}
} else {
- stream->write_function(stream, "usage volume_out <id> [<newval>]\n");
+ stream->write_function(stream, "usage volume_out <[id|all> [<newval>]\n");
goto done;
}
} else if (!strcasecmp(argv[1], "mute")) {
@@ -2139,17 +2190,28 @@
} else if (!strcasecmp(argv[1], "record")) {
if (argc > 2) {
launch_conference_record_thread(conference, argv[2]);
+ goto done;
} else {
- stream->write_function(stream, "-ERR No Path Specified!\n");
+ stream->write_function(stream, "usage record <filename>\n");
+ goto done;
}
} else if (!strcasecmp(argv[1], "norecord")) {
- conference_record_stop(conference, argv[1]);
+ if (argc > 2) {
+ int all = (strcasecmp(argv[2], "all") == 0 );
+
+ if(!conference_record_stop(conference, all ? NULL : argv[2]) && !all) {
+ stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
+ }
+ goto done;
+ } else {
+ stream->write_function(stream, "usage norecord <[filename | all]>\n");
+ goto done;
+ }
} else if (!strcasecmp(argv[1], "kick")) {
if (argc > 2) {
uint32_t id = atoi(argv[2]);
int all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "conference kick all %u\n",all);
if (!all) {
conference_function_kick_member(conference, NULL, id, stream, NULL);
goto done;
@@ -3028,24 +3090,26 @@
/*.function */ conf_function,
/*.syntax */
"list [delim <string>]\n"
- "<confname> list [delim <string>]\n"
- "<confname> energy <member_id> [<newval>]\n"
- "<confname> volume_in <member_id> [<newval>]\n"
- "<confname> volume_out <member_id> [<newval>]\n"
- "<confname> play <file_path> [<member_id>]\n"
- "<confname> say <text>\n"
- "<confname> saymember <member_id><text>\n"
- "<confname> stop <[current|all]> [<member_id>]\n"
- "<confname> kick <[member_id|all]>\n"
- "<confname> mute <[member_id|all]>\n"
- "<confname> unmute <[member_id|all]>\n"
- "<confname> deaf <[member_id|all]>\n"
- "<confname> undef <[member_id|all]>\n"
- "<confname> relate <member_id> <other_member_id> [nospeak|nohear]\n"
- "<confname> lock\n"
- "<confname> unlock\n"
- "<confname> dial <endpoint_module_name>/<destination>\n"
- "<confname> transfer <member_id> <conference_name>\n",
+ "\t<confname> list [delim <string>]\n"
+ "\t<confname> energy <member_id|all> [<newval>]\n"
+ "\t<confname> volume_in <member_id|all> [<newval>]\n"
+ "\t<confname> volume_out <member_id|all> [<newval>]\n"
+ "\t<confname> play <file_path> [<member_id>]\n"
+ "\t<confname> say <text>\n"
+ "\t<confname> saymember <member_id><text>\n"
+ "\t<confname> stop <[current|all]> [<member_id>]\n"
+ "\t<confname> kick <[member_id|all]>\n"
+ "\t<confname> mute <[member_id|all]>\n"
+ "\t<confname> unmute <[member_id|all]>\n"
+ "\t<confname> deaf <[member_id|all]>\n"
+ "\t<confname> undef <[member_id|all]>\n"
+ "\t<confname> relate <member_id> <other_member_id> [nospeak|nohear]\n"
+ "\t<confname> lock\n"
+ "\t<confname> unlock\n"
+ "\t<confname> dial <endpoint_module_name>/<destination>\n"
+ "\t<confname> transfer <member_id> <conference_name>\n"
+ "\t<confname> record <filename>\n"
+ "\t<confname> norecord <[filename|all]>\n",
/*.next */
};
1
0
22 Oct '06
Author: mikej
Date: Sun Oct 22 11:46:23 2006
New Revision: 3156
Modified:
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
Log:
initialize to null so we can check for null before we free.
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Sun Oct 22 11:46:23 2006
@@ -1975,7 +1975,7 @@
static void do_vcard(ldl_handle_t *handle, char *to, char *from, char *id)
{
char *params = NULL, *real_to, *to_user, *xmlstr = NULL, *to_host = NULL;
- switch_xml_t domain, xml, user, vcard;
+ switch_xml_t domain, xml = NULL, user, vcard;
if (!strncasecmp(to, "user+", 5)) {
real_to = to + 5;
1
0
22 Oct '06
Author: mikej
Date: Sun Oct 22 11:46:01 2006
New Revision: 3155
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
Log:
code before declaration
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Sun Oct 22 11:46:01 2006
@@ -3810,7 +3810,12 @@
nua_handle_destroy(nh);
}
} else if (status == 401 || status == 407) {
+ char const *realm = (char const *) *authenticate->au_params;
+ char const *scheme = (char const *) authenticate->au_scheme;
+ char authentication[256] = "";
+ int ss_state;
+
if (sip->sip_www_authenticate) {
authenticate = sip->sip_www_authenticate;
} else if (sip->sip_proxy_authenticate) {
@@ -3820,10 +3825,6 @@
return;
}
- char const *realm = (char const *) *authenticate->au_params;
- char const *scheme = (char const *) authenticate->au_scheme;
- char authentication[256] = "";
- int ss_state;
snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, strstr(realm, "=") + 1,
oreg->register_username,
1
0
Author: sphere
Date: Sun Oct 22 08:30:58 2006
New Revision: 3154
Added:
freeswitch/branches/princeazom/
Log:
Creating empty folder for princeazom
1
0
Author: sphere
Date: Sun Oct 22 07:25:57 2006
New Revision: 3153
Added:
freeswitch/branches/jserve/
Log:
Creating empty folder for jserve
1
0
Author: anthm
Date: Sun Oct 22 00:49:46 2006
New Revision: 3152
Modified:
freeswitch/trunk/conf/freeswitch.xml
Log:
A change has been made to the user directory.
the <param> tags that was in the <user>
are now nested in thier own <params> tag.
Also when using dingaling in component mode you can add a <vcard> to the
user that will be deliverd when requested when using an id like
user+stpeter(a)jabber.org assuming the comonent subdomain is jabber.org
Modified: freeswitch/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/trunk/conf/freeswitch.xml (original)
+++ freeswitch/trunk/conf/freeswitch.xml Sun Oct 22 00:49:46 2006
@@ -484,17 +484,65 @@
<section name="directory" description="User Directory">
<!--the domain or ip (the right hand side of the @ in the addr-->
- <domain name="mydomain.com">
+ <domain name="jabber.org">
<!--the user id (the left hand side of the @ in the addr-->
- <user id="1000">
- <!-- omit password for authless registration -->
- <param name="password" value="mypass"/>
- <!--various endpoints and application will look for user specific settings here -->
- <param name="mypref" value="myval"/>
+ <user id="stpeter">
+ <params>
+ <!-- omit password for authless registration -->
+ <param name="password" value="mypass"/>
+ </params>
+
+ <vcard xmlns='vcard-temp'>
+ <FN>Peter Saint-Andre</FN>
+ <N>
+ <FAMILY>Saint-Andre</FAMILY>
+ <GIVEN>Peter</GIVEN>
+ <MIDDLE/>
+ </N>
+ <NICKNAME>stpeter</NICKNAME>
+ <URL>http://www.jabber.org/people/stpeter.php</URL>
+ <BDAY>1966-08-06</BDAY>
+ <ORG>
+ <ORGNAME>Jabber Software Foundation</ORGNAME>
+ <ORGUNIT>Jabber Software Foundation</ORGUNIT>
+ </ORG>
+ <TITLE>Executive Director</TITLE>
+ <ROLE>Patron Saint</ROLE>
+ <TEL><WORK/><VOICE/><NUMBER>303-308-3282</NUMBER></TEL>
+ <TEL><WORK/><FAX/><NUMBER/></TEL>
+ <TEL><WORK/><MSG/><NUMBER/></TEL>
+ <ADR>
+ <WORK/>
+ <EXTADD>Suite 600</EXTADD>
+ <STREET>1899 Wynkoop Street</STREET>
+ <LOCALITY>Denver</LOCALITY>
+ <REGION>CO</REGION>
+ <PCODE>80202</PCODE>
+ <CTRY>USA</CTRY>
+ </ADR>
+ <TEL><HOME/><VOICE/><NUMBER>303-555-1212</NUMBER></TEL>
+ <TEL><HOME/><FAX/><NUMBER/></TEL>
+ <TEL><HOME/><MSG/><NUMBER/></TEL>
+ <ADR>
+ <HOME/>
+ <EXTADD/>
+ <STREET/>
+ <LOCALITY>Denver</LOCALITY>
+ <REGION>CO</REGION>
+ <PCODE>80209</PCODE>
+ <CTRY>USA</CTRY>
+ </ADR>
+ <EMAIL><INTERNET/><PREF/><USERID>stpeter(a)jabber.org</USERID></EMAIL>
+ <JABBERID>stpeter(a)jabber.org</JABBERID>
+ <DESC>
+ More information about me is located on my
+ personal website: http://www.saint-andre.com/
+ </DESC>
+ </vcard>
+
</user>
</domain>
</section>
-
</document>
1
0
[commit] r3151 - in freeswitch/trunk: libs/libdingaling/src src/mod/applications/mod_conference src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_sofia
by Freeswitch SVN 22 Oct '06
by Freeswitch SVN 22 Oct '06
22 Oct '06
Author: anthm
Date: Sun Oct 22 00:37:19 2006
New Revision: 3151
Modified:
freeswitch/trunk/libs/libdingaling/src/libdingaling.c
freeswitch/trunk/libs/libdingaling/src/libdingaling.h
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
Log:
your run-of-the mill nightmarish attempt at normalizing not one crazy protocol but many....
Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.c (original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.c Sun Oct 22 00:37:19 2006
@@ -461,6 +461,19 @@
const char *marker = "TRUE";
+static int on_vcard(void *user_data, ikspak *pak)
+{
+ ldl_handle_t *handle = user_data;
+ char *from = iks_find_attrib(pak->x, "from");
+ char *to = iks_find_attrib(pak->x, "to");
+
+ if (handle->session_callback) {
+ handle->session_callback(handle, NULL, LDL_SIGNAL_VCARD, to, from, pak->id, NULL);
+ }
+
+ return IKS_FILTER_EAT;
+}
+
static int on_disco_info(void *user_data, ikspak *pak)
{
ldl_handle_t *handle = user_data;
@@ -1240,6 +1253,8 @@
IKS_RULE_SUBTYPE, IKS_TYPE_GET, IKS_RULE_NS, "jabber:iq:register", IKS_RULE_DONE);
iks_filter_add_rule(handle->filter, on_disco_reg_out, handle,
IKS_RULE_SUBTYPE, IKS_TYPE_SET, IKS_RULE_NS, "jabber:iq:register", IKS_RULE_DONE);
+ iks_filter_add_rule(handle->filter, on_vcard, handle,
+ IKS_RULE_SUBTYPE, IKS_TYPE_GET, IKS_RULE_NS, "vcard-temp", IKS_RULE_DONE);
} else {
iks_filter_add_rule(handle->filter, on_disco_info, handle,
IKS_RULE_NS, "http://jabber.org/protocol/disco#info", IKS_RULE_DONE);
@@ -1569,6 +1584,34 @@
void ldl_handle_send_presence(ldl_handle_t *handle, char *from, char *to, char *type, char *rpid, char *message)
{
do_presence(handle, from, to, type, rpid, message);
+}
+
+void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id, char *vcard)
+{
+ iks *vxml, *iq;
+ int e = 0;
+
+ if (!(vxml = iks_tree(vcard, 0, &e))) {
+ globals.logger(DL_LOG_ERR, "Parse returned error [%d]\n", e);
+ return;
+ }
+
+ if (!(iq = iks_new("iq"))) {
+ globals.logger(DL_LOG_ERR, "Memory Error\n");
+ return;
+ }
+
+ iks_insert_attrib(iq, "to", to);
+ iks_insert_attrib(iq, "xmlns", "jabber:client");
+ iks_insert_attrib(iq,"from", from);
+ iks_insert_attrib(iq, "type", "result");
+ iks_insert_attrib(iq, "id", id);
+ iks_insert_node(iq, vxml);
+
+ apr_queue_push(handle->queue, iq);
+
+ iks_free(vxml);
+
}
void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, char *subject, char *body)
Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.h
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.h (original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.h Sun Oct 22 00:37:19 2006
@@ -126,6 +126,7 @@
LDL_SIGNAL_ROSTER,
LDL_SIGNAL_SUBSCRIBE,
LDL_SIGNAL_UNSUBSCRIBE,
+ LDL_SIGNAL_VCARD,
LDL_SIGNAL_TERMINATE,
LDL_SIGNAL_ERROR,
LDL_SIGNAL_LOGIN_SUCCESS,
@@ -373,6 +374,16 @@
\param message a status message
*/
void ldl_handle_send_presence(ldl_handle_t *handle, char *from, char *to, char *type, char *rpid, char *message);
+
+/*!
+ \brief Send a vcard
+ \param handle the handle to send with
+ \param from the from address
+ \param to the to address
+ \param id the request id
+ \param vcard the text xml of the vcard
+*/
+void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id, char *vcard);
/*!
\brief Send a message
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Sun Oct 22 00:37:19 2006
@@ -3341,7 +3341,6 @@
SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
- switch_xml_t cfg, xml, param, ads;
memset(&globals, 0, sizeof(globals));
@@ -3357,28 +3356,6 @@
if (switch_core_new_memory_pool(&globals.conference_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no conference pool\n");
return SWITCH_STATUS_TERM;
- }
-
- if ((xml = switch_xml_open_cfg(global_cf_name, &cfg, NULL))) {
- if ((ads = switch_xml_child(cfg, "advertise"))) {
- switch_event_t *event;
-
- for (param = switch_xml_child(ads, "room"); param; param = param->next) {
- char *status = (char *) switch_xml_attr_soft(param, "status");
- char *name = (char *) switch_xml_attr_soft(param, "name");
-
- if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", status ? status : "Inactive");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "idle");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
-
- switch_event_fire(&event);
- }
- }
- }
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Sun Oct 22 00:37:19 2006
@@ -465,6 +465,29 @@
return 0;
}
+
+static int sin_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+ struct mdl_profile *profile = (struct mdl_profile *) pArg;
+ switch_event_t *event;
+
+ //char *sub_from = argv[0];
+ char *sub_to = argv[1];
+
+ if (strstr(sub_to, "ext+") || strstr(sub_to, "user+") || strstr(sub_to, "conf+")) {
+ if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", sub_to);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "available");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Online");
+ switch_event_fire(&event);
+ }
+ }
+
+ return 0;
+}
+
static void sign_off(void)
{
struct mdl_profile *profile = NULL;
@@ -505,6 +528,25 @@
}
+static void sign_on(struct mdl_profile *profile)
+{
+ char *sql;
+ switch_core_db_t *db;
+ char *errmsg;
+
+ if ((sql = switch_mprintf("select * from subscriptions where sub_to like 'ext+%%' or sub_to like 'user+%%' or sub_to like 'conf+%%'"))) {
+ if (!(db = switch_core_db_open_file(profile->dbname))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
+ return;
+ }
+ switch_mutex_lock(profile->mutex);
+ switch_core_db_exec(db, sql, sin_callback, profile, &errmsg);
+ switch_mutex_unlock(profile->mutex);
+ switch_core_db_close(db);
+ switch_safe_free(sql);
+ }
+}
+
static void terminate_session(switch_core_session_t **session, int line, switch_call_cause_t cause)
{
if (*session) {
@@ -1482,7 +1524,7 @@
if (outbound_profile) {
char name[128];
- snprintf(name, sizeof(name), "DingaLing/%s-%04x", outbound_profile->destination_number, rand() & 0xffff);
+ snprintf(name, sizeof(name), "DingaLing/%s", outbound_profile->destination_number);
switch_channel_set_name(channel, name);
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
@@ -1930,6 +1972,72 @@
}
}
+static void do_vcard(ldl_handle_t *handle, char *to, char *from, char *id)
+{
+ char *params = NULL, *real_to, *to_user, *xmlstr = NULL, *to_host = NULL;
+ switch_xml_t domain, xml, user, vcard;
+
+ if (!strncasecmp(to, "user+", 5)) {
+ real_to = to + 5;
+ } else {
+ real_to = to;
+ }
+
+
+ if ((to_user = strdup(real_to))) {
+ if ((to_host = strchr(to_user, '@'))) {
+ *to_host++ = '\0';
+ }
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ goto end;
+ }
+
+ if (!to_host) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Missing Host!\n");
+ goto end;
+ }
+
+ if (!(params = switch_mprintf("to=%s@%s&from=%s&object=vcard",
+ to_user,
+ to_host,
+ from
+ ))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ goto end;
+ }
+
+
+ if (switch_xml_locate("directory", "domain", "name", to_host, &xml, &domain, params) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "can't find domain for [%s@%s]\n", to_user, to_host);
+ goto end;
+ }
+
+ if (!(user = switch_xml_find_child(domain, "user", "id", to_user))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", to_user, to_host);
+ goto end;
+ }
+
+ if (!(vcard = switch_xml_child(user, "vcard"))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find <vcard> tag for user [%s@%s]\n", to_user, to_host);
+ goto end;
+ }
+
+ switch_xml_set_attr(vcard, "xmlns", "vcard-tmp");
+
+ if ((xmlstr = switch_xml_toxml(vcard))) {
+ ldl_handle_send_vcard(handle, to, from, id, xmlstr);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+ }
+
+ end:
+ if (xml) switch_xml_free(xml);
+ switch_safe_free(to_user);
+ switch_safe_free(params);
+ switch_safe_free(xmlstr);
+}
+
static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t signal, char *to, char *from, char *subject, char *msg)
{
struct mdl_profile *profile = NULL;
@@ -1951,6 +2059,9 @@
if (!dlsession) {
if (profile->user_flags & LDL_FLAG_COMPONENT) {
switch(signal) {
+ case LDL_SIGNAL_VCARD:
+ do_vcard(handle, to, from, subject);
+ break;
case LDL_SIGNAL_UNSUBSCRIBE:
if ((sql = switch_mprintf("delete from subscriptions where sub_from='%q' and sub_to='%q';", from, to))) {
@@ -1966,7 +2077,16 @@
execute_sql(profile->dbname, sql, profile->mutex);
switch_core_db_free(sql);
}
-
+ if (strstr(to, "ext+") || strstr(to, "user+") || strstr(to, "conf+") ) {
+ if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Click To Call");
+ switch_event_fire(&event);
+ }
+ }
break;
case LDL_SIGNAL_ROSTER:
if (switch_event_create(&event, SWITCH_EVENT_ROSTER) == SWITCH_STATUS_SUCCESS) {
@@ -1991,6 +2111,16 @@
switch_event_fire(&event);
}
+ if (strstr(to, "ext+") || strstr(to, "user+") || strstr(to, "conf+")) {
+ if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", to);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Click To Call");
+ switch_event_fire(&event);
+ }
+ }
break;
case LDL_SIGNAL_PRESENCE_OUT:
@@ -2054,6 +2184,10 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
switch_event_fire(&event);
}
+ if (profile->user_flags & LDL_FLAG_COMPONENT) {
+ sign_on(profile);
+ }
+
break;
case LDL_SIGNAL_LOGIN_FAILURE:
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_FAILURE) == SWITCH_STATUS_SUCCESS) {
@@ -2309,6 +2443,7 @@
if (!(exten = ldl_session_get_value(dlsession, "dnis"))) {
exten = profile->exten;
+ /* if it's _auto_ set the extension to match the username portion of the called address */
if (!strcmp(exten, "_auto_")) {
if ((t = ldl_session_get_callee(dlsession))) {
if ((them = strdup(t))) {
@@ -2318,14 +2453,18 @@
}
if ((a = strchr(them, '+')) && (b = strrchr(them, '+')) && a != b) {
- *b = '@';
+ *b++ = '\0';
+ switch_channel_set_variable(channel, "dl_user", them);
+ switch_channel_set_variable(channel, "dl_host", b);
}
exten = them;
}
}
}
}
-
+
+
+
if (!(context = ldl_session_get_value(dlsession, "context"))) {
context = profile->context;
}
@@ -2337,6 +2476,11 @@
if (!(cid_num = ldl_session_get_value(dlsession, "caller_id_number"))) {
cid_num = tech_pvt->recip;
}
+
+ /* context of "_auto_" means set it to the domain */
+ if (profile->context && !strcmp(profile->context, "_auto_")) {
+ context = profile->name;
+ }
if (!tech_pvt->caller_profile) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating an identity for %s %s <%s> %s\n",
@@ -2355,7 +2499,7 @@
context,
exten)) != 0) {
char name[128];
- snprintf(name, sizeof(name), "DingaLing/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
+ snprintf(name, sizeof(name), "DingaLing/%s", tech_pvt->caller_profile->destination_number);
switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Sun Oct 22 00:37:19 2006
@@ -2614,7 +2614,7 @@
sip_expires_t const *expires = sip->sip_expires;
sip_authorization_t const *authorization = sip->sip_authorization;
sip_contact_t const *contact = sip->sip_contact;
- switch_xml_t domain, xml, user, param;
+ switch_xml_t domain, xml, user, param, xparams;
char params[1024] = "";
char *sql;
switch_event_t *s_event;
@@ -2695,9 +2695,16 @@
switch_xml_free(xml);
return 1;
}
+
+ if ((xparams = switch_xml_child(user, "params"))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find params for user [%s@%s]\n", from_user, from_host);
+ nua_respond(nh, SIP_401_UNAUTHORIZED, SIPTAG_CONTACT(contact), TAG_END());
+ switch_xml_free(xml);
+ return 1;
+ }
- for (param = switch_xml_child(user, "param"); param; param = param->next) {
+ for (param = switch_xml_child(xparams, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
@@ -2889,10 +2896,15 @@
char *host = argv[1];
char *status = argv[2];
char *rpid = argv[3];
+ char *proto = argv[4];
switch_event_t *event;
+ if (switch_strlen_zero(proto)) {
+ proto = NULL;
+ }
+
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", proto ? proto : SOFIA_CHAT_PROTO);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->url);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", user, host);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "%s", status);
@@ -3015,6 +3027,7 @@
switch_core_db_t *db;
char *errmsg;
char *sstr;
+ switch_event_t *sevent;
if (from) {
from_user = (char *) from->a_url->url_user;
@@ -3047,6 +3060,26 @@
to_host = (char *) to->a_url->url_host;
}
+
+ if (strstr(to_user, "ext+") || strstr(to_user, "user+") || strstr(to_user, "conf+")) {
+ char proto[80];
+ char *p;
+
+ switch_copy_string(proto, to_user, sizeof(proto));
+ if ((p = strchr(proto, '+'))) {
+ *p = '\0';
+ }
+
+ if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
+ switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "login", "%s", profile->name);
+ switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host);
+ switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "rpid", "unknown");
+ switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "status", "Click To Call");
+ switch_event_fire(&sevent);
+ }
+ }
+
if (strchr(to_user, '+')) {
char *h;
if ((proto = (d_user = strdup(to_user)))) {
@@ -3123,7 +3156,7 @@
}
switch_core_db_close(db);
end:
-
+
if (event) {
su_free(profile->home, event);
}
@@ -4629,13 +4662,21 @@
return;
}
- if ((sql = switch_mprintf("select user,host,'Registered','unavailable' from sip_registrations"))) {
+ if ((sql = switch_mprintf("select user,host,'Registered','unknown','' from sip_registrations"))) {
switch_mutex_lock(profile->ireg_mutex);
switch_core_db_exec(db, sql, resub_callback, profile, &errmsg);
switch_mutex_unlock(profile->ireg_mutex);
switch_safe_free(sql);
}
+ if ((sql = switch_mprintf("select sub_to_user,sub_to_host,'Online','unknown',proto from sip_subscriptions "
+ "where proto='ext' or proto='user' or proto='conf'"))) {
+ switch_mutex_lock(profile->ireg_mutex);
+ switch_core_db_exec(db, sql, resub_callback, profile, &errmsg);
+ switch_mutex_unlock(profile->ireg_mutex);
+ switch_safe_free(sql);
+ }
+
switch_core_db_close(db);
}
@@ -4753,7 +4794,11 @@
if ((user = strdup(from))) {
if ((host = strchr(user, '@'))) {
+ char *p;
*host++ = '\0';
+ if ((p = strchr(host, '/'))) {
+ *p = '\0';
+ }
} else {
switch_safe_free(user);
return;
1
0
[commit] r3150 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference
by Freeswitch SVN 22 Oct '06
by Freeswitch SVN 22 Oct '06
22 Oct '06
Author: knhor
Date: Sun Oct 22 00:27:34 2006
New Revision: 3150
Modified:
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
Fix conference record member's frame_mux len so that the thread has some data to send to disk.
Add ALL option to Energy, Volume-out, Volume-In, and Norecord.
Document Record and Norecord in api syntax member.
Remove extraneous switch_log_printf left over from previous round of changes.
Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c Sun Oct 22 00:27:34 2006
@@ -324,15 +324,19 @@
return member;
}
-static void conference_record_stop(conference_obj_t *conference, char *path)
+static int conference_record_stop(conference_obj_t *conference, char *path)
{
conference_member_t *member = NULL;
+ int count = 0;
for(member = conference->members; member; member = member->next) {
if (switch_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path))) {
switch_clear_flag_locked(member, MFLAG_RUNNING);
+ count++;
}
}
+
+ return count;
}
/* Add a custom relationship to a member */
@@ -613,9 +617,9 @@
if (ready) {
/* Build a muxed frame for every member that contains the mixed audio of everyone else */
for (omember = conference->members; omember; omember = omember->next) {
+ omember->len = bytes;
if (conference->fnode) {
memcpy(omember->mux_frame, file_frame, file_sample_len * 2);
- omember->len = bytes;
} else {
memset(omember->mux_frame, 255, bytes);
}
@@ -1087,9 +1091,9 @@
switch_file_handle_t fh = {0};
conference_member_t smember = {0}, *member;
conference_record_t *rec = (conference_record_t *) obj;
- uint32_t divider = 1000 / rec->conference->interval;
- uint32_t samples = (rec->conference->rate / divider);
- uint32_t bytes = samples * 2;
+ uint32_t divider = 1000 / rec->conference->interval;
+ uint32_t samples = (rec->conference->rate / divider);
+ uint32_t bytes = samples * 2;
uint32_t mux_used;
char *vval;
@@ -1102,7 +1106,7 @@
member->flags = MFLAG_CAN_HEAR | MFLAG_NOCHANNEL | MFLAG_RUNNING;
write_frame.data = data;
- write_frame.buflen = sizeof(data);
+ write_frame.buflen = sizeof(data);
assert(rec->conference != NULL);
member->conference = rec->conference;
@@ -1134,7 +1138,6 @@
goto end;
}
-
if (switch_core_file_open(&fh,
rec->path,
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT,
@@ -1150,7 +1153,7 @@
while(switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(rec->conference, CFLAG_RUNNING) && rec->conference->count) {
if ((mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer)) >= bytes) {
- /* Flush the output buffer and write all the data (presumably muxed) back to the channel */
+ /* Flush the output buffer and write all the data (presumably muxed) to the file */
switch_mutex_lock(member->audio_out_mutex);
write_frame.data = data;
while ((write_frame.datalen = (uint32_t)switch_buffer_read(member->mux_buffer, write_frame.data, mux_used))) {
@@ -1710,6 +1713,115 @@
return err;
}
+static int conference_function_energy_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+{
+ int err = 0;
+
+ if (member != NULL || (member = conference_member_get(conference, id))) {
+ switch_event_t *event;
+
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->energy_level = atoi((char *)data);
+ switch_mutex_unlock(member->flag_mutex);
+ }
+
+ stream->write_function(stream, "Energy %u=%d\n", id, member->energy_level);
+
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
+
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ stream->write_function(stream, "Non-Existant ID %u\n", id);
+ err = 1;
+ }
+
+ return err;
+}
+
+static int conference_function_volume_in_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+{
+ int err = 0;
+
+ if (member != NULL || (member = conference_member_get(conference, id))) {
+ switch_event_t *event;
+
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_in_level = atoi((char *)data);
+ normalize_volume(member->volume_in_level);
+ switch_mutex_unlock(member->flag_mutex);
+ }
+
+ stream->write_function(stream, "Volume IN %u=%d\n", id, member->volume_in_level);
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
+
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ stream->write_function(stream, "Non-Existant ID %u\n", id);
+ err = 1;
+ }
+
+ return err;
+}
+
+static int conference_function_volume_out_member(conference_obj_t *conference, conference_member_t *member, int id, switch_stream_handle_t *stream, void *data)
+{
+ int err = 0;
+
+ if (member != NULL || (member = conference_member_get(conference, id))) {
+ switch_event_t *event;
+
+ if (data) {
+ switch_mutex_lock(member->flag_mutex);
+ member->volume_out_level = atoi((char *)data);
+ normalize_volume(member->volume_out_level);
+ switch_mutex_unlock(member->flag_mutex);
+ }
+
+ stream->write_function(stream, "Volume OUT %u=%d\n", id, member->volume_out_level);
+
+ if (data) {
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_t *channel = switch_core_session_get_channel(member->session);
+ switch_channel_event_set_data(channel, event);
+
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
+
+ switch_event_fire(&event);
+ }
+ }
+ } else {
+ stream->write_function(stream, "Non-Existant ID %u\n", id);
+ err = 1;
+ }
+
+ return err;
+}
+
/* API Interface Function */
static switch_status_t conf_function(char *buf, switch_core_session_t *session, switch_stream_handle_t *stream)
{
@@ -1960,112 +2072,50 @@
} else if (!strcasecmp(argv[1], "energy")) {
if (argc > 2) {
uint32_t id = atoi(argv[2]);
- conference_member_t *member;
+ uint8_t all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
- if ((member = conference_member_get(conference, id))) {
-
- if (argv[3]) {
- switch_mutex_lock(member->flag_mutex);
- member->energy_level = atoi(argv[3]);
- switch_mutex_unlock(member->flag_mutex);
- }
-
- stream->write_function(stream, "Energy %u=%d\n", id, member->energy_level);
- if (argv[3]) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
-
- switch_event_fire(&event);
- }
- }
+ if (!all) {
+ conference_function_energy_member(conference, NULL, id, stream, argv[3]);
goto done;
} else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
+ conference_member_itterator(conference, stream, &conference_function_energy_member, argv[3]);
goto done;
}
} else {
- stream->write_function(stream, "usage energy <id> [<newval>]\n");
+ stream->write_function(stream, "usage energy <id|all> [<newval>]\n");
goto done;
}
} else if (!strcasecmp(argv[1], "volume_in")) {
if (argc > 2) {
uint32_t id = atoi(argv[2]);
- conference_member_t *member;
+ uint8_t all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
- if ((member = conference_member_get(conference, id))) {
-
- if (argv[3]) {
- switch_mutex_lock(member->flag_mutex);
- member->volume_in_level = atoi(argv[3]);
- normalize_volume(member->volume_in_level);
- switch_mutex_unlock(member->flag_mutex);
- }
-
- stream->write_function(stream, "Volume IN %u=%d\n", id, member->volume_in_level);
- if (argv[3]) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
-
- switch_event_fire(&event);
- }
- }
+ if (!all) {
+ conference_function_volume_in_member(conference, NULL, id, stream, argv[3]);
goto done;
} else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
+ conference_member_itterator(conference, stream, &conference_function_volume_in_member, argv[3]);
goto done;
}
} else {
- stream->write_function(stream, "usage volume_in <id> [<newval>]\n");
+ stream->write_function(stream, "usage volume_in <[id|all]> [<newval>]\n");
goto done;
}
} else if (!strcasecmp(argv[1], "volume_out")) {
if (argc > 2) {
uint32_t id = atoi(argv[2]);
- conference_member_t *member;
+ uint8_t all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
- if ((member = conference_member_get(conference, id))) {
-
- if (argv[3]) {
- switch_mutex_lock(member->flag_mutex);
- member->volume_out_level = atoi(argv[3]);
- normalize_volume(member->volume_out_level);
- switch_mutex_unlock(member->flag_mutex);
- }
-
- stream->write_function(stream, "Volume OUT %u=%d\n", id, member->volume_out_level);
- if (argv[3]) {
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_t *channel = switch_core_session_get_channel(member->session);
- switch_channel_event_set_data(channel, event);
-
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
-
- switch_event_fire(&event);
- }
- }
+ if (!all) {
+ conference_function_volume_out_member(conference, NULL, id, stream, argv[3]);
goto done;
} else {
- stream->write_function(stream, "Non-Existant ID %u\n", id);
+ conference_member_itterator(conference, stream, &conference_function_volume_out_member, argv[3]);
goto done;
}
} else {
- stream->write_function(stream, "usage volume_out <id> [<newval>]\n");
+ stream->write_function(stream, "usage volume_out <[id|all> [<newval>]\n");
goto done;
}
} else if (!strcasecmp(argv[1], "mute")) {
@@ -2136,17 +2186,28 @@
} else if (!strcasecmp(argv[1], "record")) {
if (argc > 2) {
launch_conference_record_thread(conference, argv[2]);
+ goto done;
} else {
- stream->write_function(stream, "-ERR No Path Specified!\n");
+ stream->write_function(stream, "usage record <filename>\n");
+ goto done;
}
} else if (!strcasecmp(argv[1], "norecord")) {
- conference_record_stop(conference, argv[1]);
+ if (argc > 2) {
+ uint8_t all = (strcasecmp(argv[2], "all") == 0 );
+
+ if(!conference_record_stop(conference, all ? NULL : argv[2]) && !all) {
+ stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
+ }
+ goto done;
+ } else {
+ stream->write_function(stream, "usage norecord <[filename | all]>\n");
+ goto done;
+ }
} else if (!strcasecmp(argv[1], "kick")) {
if (argc > 2) {
uint32_t id = atoi(argv[2]);
uint8_t all = ( id == 0 && strcasecmp(argv[2], "all") == 0 );
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "conference kick all %u\n",all);
if (!all) {
conference_function_kick_member(conference, NULL, id, stream, NULL);
goto done;
@@ -3025,24 +3086,26 @@
/*.function */ conf_function,
/*.syntax */
"list [delim <string>]\n"
- "<confname> list [delim <string>]\n"
- "<confname> energy <member_id> [<newval>]\n"
- "<confname> volume_in <member_id> [<newval>]\n"
- "<confname> volume_out <member_id> [<newval>]\n"
- "<confname> play <file_path> [<member_id>]\n"
- "<confname> say <text>\n"
- "<confname> saymember <member_id><text>\n"
- "<confname> stop <[current|all]> [<member_id>]\n"
- "<confname> kick <[member_id|all]>\n"
- "<confname> mute <[member_id|all]>\n"
- "<confname> unmute <[member_id|all]>\n"
- "<confname> deaf <[member_id|all]>\n"
- "<confname> undef <[member_id|all]>\n"
- "<confname> relate <member_id> <other_member_id> [nospeak|nohear]\n"
- "<confname> lock\n"
- "<confname> unlock\n"
- "<confname> dial <endpoint_module_name>/<destination>\n"
- "<confname> transfer <member_id> <conference_name>",
+ "\t<confname> list [delim <string>]\n"
+ "\t<confname> energy <member_id|all> [<newval>]\n"
+ "\t<confname> volume_in <member_id|all> [<newval>]\n"
+ "\t<confname> volume_out <member_id|all> [<newval>]\n"
+ "\t<confname> play <file_path> [<member_id>]\n"
+ "\t<confname> say <text>\n"
+ "\t<confname> saymember <member_id><text>\n"
+ "\t<confname> stop <[current|all]> [<member_id>]\n"
+ "\t<confname> kick <[member_id|all]>\n"
+ "\t<confname> mute <[member_id|all]>\n"
+ "\t<confname> unmute <[member_id|all]>\n"
+ "\t<confname> deaf <[member_id|all]>\n"
+ "\t<confname> undef <[member_id|all]>\n"
+ "\t<confname> relate <member_id> <other_member_id> [nospeak|nohear]\n"
+ "\t<confname> lock\n"
+ "\t<confname> unlock\n"
+ "\t<confname> dial <endpoint_module_name>/<destination>\n"
+ "\t<confname> transfer <member_id> <conference_name>\n"
+ "\t<confname> record <filename>\n"
+ "\t<confname> norecord <[filename|all]>\n",
/*.next */
};
1
0
[commit] r3149 - freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference
by Freeswitch SVN 22 Oct '06
by Freeswitch SVN 22 Oct '06
22 Oct '06
Author: knhor
Date: Sat Oct 21 23:30:15 2006
New Revision: 3149
Modified:
freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
rename conference_list_itterator to conference_member_itterator so that it matches trunk
Modified: freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/knhor/trunk/src/mod/applications/mod_conference/mod_conference.c Sat Oct 21 23:30:15 2006
@@ -233,7 +233,7 @@
static switch_status_t chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint);
static void launch_conference_record_thread(conference_obj_t *conference, char *path);
-static void conference_list_itterator(conference_obj_t *conference,
+static void conference_member_itterator(conference_obj_t *conference,
switch_stream_handle_t *stream,
int (*pfncallback)(conference_obj_t*, conference_member_t*, int, switch_stream_handle_t*, void*),
void *data);
@@ -1484,7 +1484,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static void conference_list_itterator(conference_obj_t *conference, switch_stream_handle_t *stream, int (*pfncallback)(conference_obj_t*, conference_member_t*, int, switch_stream_handle_t*, void*), void *data)
+static void conference_member_itterator(conference_obj_t *conference, switch_stream_handle_t *stream, int (*pfncallback)(conference_obj_t*, conference_member_t*, int, switch_stream_handle_t*, void*), void *data)
{
conference_member_t *member = NULL;
@@ -2077,7 +2077,7 @@
conference_function_mute_member(conference, NULL, id, stream, NULL);
goto done;
} else {
- conference_list_itterator(conference, stream, &conference_function_mute_member, NULL);
+ conference_member_itterator(conference, stream, &conference_function_mute_member, NULL);
goto done;
}
} else {
@@ -2093,7 +2093,7 @@
conference_function_unmute_member(conference, NULL, id, stream, NULL);
goto done;
} else {
- conference_list_itterator(conference, stream, &conference_function_unmute_member, NULL);
+ conference_member_itterator(conference, stream, &conference_function_unmute_member, NULL);
goto done;
}
} else {
@@ -2109,7 +2109,7 @@
conference_function_deaf_member(conference, NULL, id, stream, NULL);
goto done;
} else {
- conference_list_itterator(conference, stream, &conference_function_deaf_member, NULL);
+ conference_member_itterator(conference, stream, &conference_function_deaf_member, NULL);
goto done;
}
} else {
@@ -2125,7 +2125,7 @@
conference_function_undeaf_member(conference, NULL, id, stream, NULL);
goto done;
} else {
- conference_list_itterator(conference, stream, &conference_function_undeaf_member, NULL);
+ conference_member_itterator(conference, stream, &conference_function_undeaf_member, NULL);
goto done;
}
} else {
@@ -2151,7 +2151,7 @@
conference_function_kick_member(conference, NULL, id, stream, NULL);
goto done;
} else {
- conference_list_itterator(conference, stream, &conference_function_kick_member, NULL);
+ conference_member_itterator(conference, stream, &conference_function_kick_member, NULL);
goto done;
}
} else {
1
0