[Freeswitch-svn] [commit] r5359 - freeswitch/trunk/src/mod/applications/mod_conference
Freeswitch SVN
mikej at freeswitch.org
Thu Jun 14 11:24:20 EDT 2007
Author: mikej
Date: Thu Jun 14 11:24:20 2007
New Revision: 5359
Modified:
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
Log:
merge patch from MODAPP-15 with 2 changes as discussed with the submitter:
add missing part of if for starting sound.
add a file stop specific to async and only stop the async file play.
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 Thu Jun 14 11:24:20 2007
@@ -57,7 +57,8 @@
typedef enum {
FILE_STOP_CURRENT,
- FILE_STOP_ALL
+ FILE_STOP_ALL,
+ FILE_STOP_ASYNC
} file_stop_t;
/* Global Values */
@@ -179,6 +180,7 @@
char *exit_sound;
char *alone_sound;
char *perpetual_sound;
+ char *moh_sound;
char *ack_sound;
char *nack_sound;
char *muted_sound;
@@ -503,8 +505,14 @@
switch_event_fire(&event);
}
- if (conference->count > 1 && conference->enter_sound) {
- conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
+ if (conference->count > 1) {
+ if(conference->moh_sound) {
+ /* stop MoH if any */
+ conference_stop_file(conference, FILE_STOP_ASYNC);
+ }
+ if(conference->enter_sound) {
+ conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
+ }
}
channel = switch_core_session_get_channel(member->session);
@@ -544,6 +552,7 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "add-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Size", "%u", conference->count);
switch_event_fire(&event);
}
}
@@ -641,6 +650,7 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Name", "%s", conference->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "del-member");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Size", "%u", conference->count);
switch_event_fire(&event);
}
}
@@ -689,7 +699,9 @@
int has_file_data = 0;
if (conference->perpetual_sound && !conference->fnode) {
- conference_play_file(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 0);
+ conference_play_file(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 1);
+ } else if (conference->moh_sound && conference->count == 1 && !conference->fnode) {
+ conference_play_file(conference, conference->moh_sound, CONF_DEFAULT_LEADIN, NULL, 1);
}
/* Sync the conference to a single timing source */
@@ -1938,6 +1950,11 @@
conference->async_fnode->done++;
count++;
}
+ } else if (stop == FILE_STOP_ASYNC) {
+ if (conference->async_fnode) {
+ conference->async_fnode->done++;
+ count++;
+ }
} else {
if (conference->fnode) {
conference->fnode->done++;
@@ -4546,6 +4563,7 @@
char *caller_controls = NULL;
char *member_flags = NULL;
char *perpetual_sound = NULL;
+ char *moh_sound = NULL;
uint32_t max_members = 0;
uint32_t anounce_count = 0;
char *maxmember_sound = NULL;
@@ -4595,6 +4613,8 @@
alone_sound = val;
} else if (!strcasecmp(var, "perpetual-sound")) {
perpetual_sound = val;
+ } else if (!strcasecmp(var, "moh-sound")) {
+ moh_sound = val;
} else if (!strcasecmp(var, "ack-sound")) {
ack_sound = val;
} else if (!strcasecmp(var, "nack-sound")) {
@@ -4716,6 +4736,10 @@
conference->mflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
}
+ if (!switch_strlen_zero(moh_sound)) {
+ conference->moh_sound = switch_core_strdup(conference->pool, moh_sound);
+ }
+
if (member_flags) {
set_mflags(member_flags, &conference->mflags);
}
More information about the Freeswitch-svn
mailing list