]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add perpetual-sound option to conference
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 11 Jun 2007 21:44:41 +0000 (21:44 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 11 Jun 2007 21:44:41 +0000 (21:44 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5307 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/conference.conf.xml
src/mod/applications/mod_conference/mod_conference.c

index c5d05dabdb2fd4c6de491dfcaea83fb3b3c801ae..526f22951e22af8c2834897a041f4b8c7a99e4ea 100644 (file)
@@ -62,6 +62,8 @@
       <!--<param name="unmuted-sound" value="unmuted.wav"/>-->
       <!-- File to play if you are alone in the conference -->
       <!--<param name="alone-sound" value="yactopitc.wav"/>-->
+      <!-- File to play endlessly (nobody will ever be able to talk) -->
+      <!--<param name="perpetual-sound" value="music.wav"/>-->
       <!-- File to play when you join the conference -->
       <!--<param name="enter-sound" value="welcome.wav"/>-->
       <!-- File to play when you leave the conference -->
index 2d16e70c3eaa485bb8b939b32bc65f57f62a7fe6..bd203b3190c3032c507b541e4efd081b6de7450d 100644 (file)
@@ -175,6 +175,7 @@ typedef struct conference_obj {
        char *enter_sound;
        char *exit_sound;
        char *alone_sound;
+       char *perpetual_sound;
        char *ack_sound;
        char *nack_sound;
        char *muted_sound;
@@ -516,7 +517,7 @@ static switch_status_t conference_add_member(conference_obj_t * conference, conf
                                if (conference->count >= conference->anounce_count && conference->anounce_count > 1) {
                                        snprintf(msg, sizeof(msg), "There are %d callers", conference->count);
                                        conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
-                               } else if (conference->count == 1) {
+                               } else if (conference->count == 1 && !conference->perpetual_sound) {
                                        if (conference->alone_sound) {
                                                conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
                                        } else {
@@ -684,6 +685,10 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread,
                switch_size_t file_data_len = samples * 2;
                int has_file_data = 0;
 
+               if (conference->perpetual_sound && !conference->fnode) {
+                       conference_play_file(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 0);
+               }
+
                /* Sync the conference to a single timing source */
                if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
                        switch_set_flag(conference, CFLAG_DESTRUCT);
@@ -4536,6 +4541,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
        char *caller_id_number = NULL;
        char *caller_controls = NULL;
        char *member_flags = NULL;
+       char *perpetual_sound = NULL;
        uint32_t max_members = 0;
        uint32_t anounce_count = 0;
        char *maxmember_sound = NULL;
@@ -4583,6 +4589,8 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
                        exit_sound = val;
                } else if (!strcasecmp(var, "alone-sound")) {
                        alone_sound = val;
+               } else if (!strcasecmp(var, "perpetual-sound")) {
+                       perpetual_sound = val;
                } else if (!strcasecmp(var, "ack-sound")) {
                        ack_sound = val;
                } else if (!strcasecmp(var, "nack-sound")) {
@@ -4696,7 +4704,13 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
        conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
        conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
 
-       conference->mflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
+
+       if (!switch_strlen_zero(perpetual_sound)) {
+               conference->perpetual_sound = switch_core_strdup(conference->pool, perpetual_sound);
+               conference->mflags = MFLAG_CAN_HEAR;
+       } else {
+               conference->mflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
+       }
 
        if (member_flags) {
                set_mflags(member_flags, &conference->mflags);