]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update conference to add lock sounds, sound prefix, and use say: syntax
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 11 Jan 2007 18:14:02 +0000 (18:14 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 11 Jan 2007 18:14:02 +0000 (18:14 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3943 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/freeswitch.xml
src/include/switch_utils.h
src/mod/applications/mod_conference/mod_conference.c

index 08e09ef16c2f2550c6771e42a53796c1a70010e9..ae22349252badc66e045f8c75b5bcb7b4841e432 100644 (file)
 
       <!-- Profiles are collections of settings you can reference by name. -->
       <profiles>
+       <!--If no profile is specified it will default to "default"-->
        <profile name="default">
          <!-- Domain (for presence) -->
          <param name="domain" value="sub.mydomain.com"/>
          <param name="interval" value="20"/>
          <!-- Energy level required for audio to be sent to the other users -->
          <param name="energy-level" value="300"/>
-               <!-- Name of the caller control group to use for this profile -->
-               <!-- <param name="caller-controls" value="some name"/> -->
+         <!-- Name of the caller control group to use for this profile -->
+         <!-- <param name="caller-controls" value="some name"/> -->
          <!-- TTS Engine to use -->
          <!--<param name="tts-engine" value="cepstral"/>-->
          <!-- TTS Voice to use -->
          <!--<param name="tts-voice" value="david"/>-->
 
-         <!-- If TTS is enabled all audio-file params not beginning with -->
-         <!-- '/' or with drive: (i.e. c:) will be considered text to say with TTS -->
-
+         <!-- If TTS is enabled all audio-file params beginning with -->
+         <!-- 'say:' will be considered text to say with TTS -->
+         <!-- Set a default path here so you can use relative paths in the other sound params-->
+         <!--<param name="sound-prefix" value="/soundfiles"/>-->
          <!-- File to play to acknowledge succees -->
-         <!--<param name="ack-sound" value="/soundfiles/beep.wav"/>-->
+         <!--<param name="ack-sound" value="beep.wav"/>-->
          <!-- File to play to acknowledge failure -->
-         <!--<param name="nack-sound" value="/soundfiles/beeperr.wav"/>-->
+         <!--<param name="nack-sound" value="beeperr.wav"/>-->
          <!-- File to play to acknowledge muted -->
-         <!--<param name="muted-sound" value="/soundfiles/muted.wav"/>-->
+         <!--<param name="muted-sound" value="muted.wav"/>-->
          <!-- File to play to acknowledge unmuted -->
-         <!--<param name="unmuted-sound" value="/soundfiles/unmuted.wav"/>-->
+         <!--<param name="unmuted-sound" value="unmuted.wav"/>-->
          <!-- File to play if you are alone in the conference -->
-         <!--<param name="alone-sound" value="/soundfiles/yactopitc.wav"/>-->
+         <!--<param name="alone-sound" value="yactopitc.wav"/>-->
          <!-- File to play when you join the conference -->
-         <!--<param name="enter-sound" value="/soundfiles/welcome.wav"/>-->
+         <!--<param name="enter-sound" value="welcome.wav"/>-->
          <!-- File to play when you leave the conference -->
-         <!--<param name="exit-sound" value="/soundfiles/exit.wav"/>-->
+         <!--<param name="exit-sound" value="exit.wav"/>-->
          <!-- File to play when you ae ejected from the conference -->
-         <!--<param name="kicked-sound" value="/soundfiles/kicked.wav"/>-->
+         <!--<param name="kicked-sound" value="kicked.wav"/>-->
          <!-- File to play when the conference is locked -->
-         <!--<param name="locked-sound" value="/soundfiles/locked.wav"/>-->
+         <!--<param name="locked-sound" value="locked.wav"/>-->
+         <!-- File to play when the conference is locked during the call-->
+         <!--<param name="is-locked-sound" value="is-locked.wav"/>-->
+         <!-- File to play when the conference is unlocked during the call-->
+         <!--<param name="is-unlocked-sound" value="is-unlocked.wav"/>-->
          <!-- File to play to prompt for a pin -->
-         <!--<param name="pin-sound" value="/soundfiles/pin.wav"/>-->
+         <!--<param name="pin-sound" value="pin.wav"/>-->
          <!-- File to play to when the pin is invalid -->
-         <!--<param name="bad-pin-sound" value="/soundfiles/invalid-pin.wav"/>-->
+         <!--<param name="bad-pin-sound" value="invalid-pin.wav"/>-->
          <!-- Conference pin -->
          <!--<param name="pin" value="12345"/>-->
          <!-- Default Caller ID Name for outbound calls -->
index 696fbc22dba3055fa506823acfd19139fdd181cb..80a600d6e6a2cbd45b2fd4d464ba59fb552edba1 100644 (file)
@@ -62,6 +62,12 @@ SWITCH_DECLARE(apr_status_t) switch_socket_recvfrom(apr_sockaddr_t *from, apr_so
                                                                        apr_size_t *len);
 
 
+#ifdef WIN32
+#define switch_is_file_path(file) (*(file +1) == ':' || *file == '/')
+#else
+#define switch_is_file_path(file) (*file == '/')
+#endif
+
 /*!
   \brief Evaluate the truthfullness of a string expression
   \param expr a string expression
index e06d9922f69e2c7b4d07a8073361253df2d788ec..2432c5fe25c032ae6dfc025f676955ee386518dc 100644 (file)
@@ -170,9 +170,12 @@ typedef struct conference_obj {
        char *muted_sound;
        char *unmuted_sound;
        char *locked_sound;
+       char *is_locked_sound;
+       char *is_unlocked_sound;
        char *kicked_sound;
        char *caller_id_name;
        char *caller_id_number;
+    char *sound_prefix;
        switch_ivr_digit_stream_parser_t *dtmf_parser;
        char *pin;
        char *pin_sound;
@@ -1805,7 +1808,7 @@ static switch_status_t conference_play_file(conference_obj_t *conference, char *
     conference_file_node_t *fnode, *nptr;
     switch_memory_pool_t *pool;
     uint32_t count;
-    char *expanded = NULL;
+    char *dfile = NULL, *expanded = NULL;
 
     assert(conference != NULL);
 
@@ -1828,16 +1831,22 @@ static switch_status_t conference_play_file(conference_obj_t *conference, char *
         }
     }
 
-    if 
-#ifdef WIN32
-        (*(file +1) != ':' && *file != '/')
-#else
-        (*file != '/')
-#endif
-            {
-                status = conference_say(conference, file, leadin);
+    if (!strncasecmp(file, "say:", 4)) {
+        status = conference_say(conference, file + 4, leadin);
+        goto done;
+    } 
+
+    if (!switch_is_file_path(file)) {
+        if (conference->sound_prefix) {
+            if (!(dfile = switch_mprintf("%s/%s", conference->sound_prefix, file))) {
                 goto done;
             }
+            file = dfile;
+        } else {
+            status = conference_say(conference, file + 4, leadin);
+            goto done;  
+        }
+    }
 
     /* Setup a memory pool to use. */
     if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
@@ -1884,6 +1893,7 @@ static switch_status_t conference_play_file(conference_obj_t *conference, char *
 
 
     switch_safe_free(expanded);
+    switch_safe_free(dfile);
 
        
 
@@ -2831,6 +2841,10 @@ static switch_status_t conf_api_sub_lock(conference_obj_t *conference, switch_st
     assert(conference != NULL);
     assert(stream != NULL);
 
+    if (conference->is_locked_sound) {
+        conference_play_file(conference, conference->is_locked_sound, CONF_DEFAULT_LEADIN, NULL);
+    }
+
     switch_set_flag_locked(conference, CFLAG_LOCKED);
     stream->write_function(stream, "OK %s locked\n", argv[0]);
     if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
@@ -2849,6 +2863,10 @@ static switch_status_t conf_api_sub_unlock(conference_obj_t *conference, switch_
     assert(conference != NULL);
     assert(stream != NULL);
 
+    if (conference->is_unlocked_sound) {
+        conference_play_file(conference, conference->is_unlocked_sound, CONF_DEFAULT_LEADIN, NULL);
+    }
+
     switch_clear_flag_locked(conference, CFLAG_LOCKED);
     stream->write_function(stream, "OK %s unlocked\n", argv[0]);
     if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
@@ -4187,6 +4205,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
     char *tts_engine = NULL;
     char *tts_voice = NULL;
     char *enter_sound = NULL;
+    char *sound_prefix = NULL;
     char *exit_sound = NULL;
     char *alone_sound = NULL;
     char *ack_sound = NULL;
@@ -4194,6 +4213,8 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
     char *muted_sound = NULL;
     char *unmuted_sound = NULL;
     char *locked_sound = NULL;
+    char *is_locked_sound = NULL;
+    char *is_unlocked_sound = NULL;
     char *kicked_sound = NULL;
     char *pin = NULL;
     char *pin_sound = NULL; 
@@ -4256,6 +4277,10 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
             unmuted_sound = val;
         } else if (!strcasecmp(var, "locked-sound")) {
             locked_sound = val;
+        } else if (!strcasecmp(var, "is-locked-sound")) {
+            is_locked_sound = val;
+        } else if (!strcasecmp(var, "is-unlocked-sound")) {
+            is_unlocked_sound = val;
         } else if (!strcasecmp(var, "kicked-sound")) {
             kicked_sound = val;
         } else if (!strcasecmp(var, "pin")) {
@@ -4272,6 +4297,8 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
             caller_id_number = val;
         } else if (!strcasecmp(var, "caller-controls")) {
             caller_controls = val;
+        } else if (!strcasecmp(var, "sound-prefix")) {
+            sound_prefix = val;
         }
     }
 
@@ -4333,6 +4360,11 @@ 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);
 
+
+    if (sound_prefix) {
+        conference->sound_prefix = switch_core_strdup(conference->pool, sound_prefix);
+    }
+
     if (!switch_strlen_zero(enter_sound)) {
         conference->enter_sound = switch_core_strdup(conference->pool, enter_sound);
     }
@@ -4381,6 +4413,14 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
         conference->locked_sound = switch_core_strdup(conference->pool, locked_sound);
     }
 
+    if (!switch_strlen_zero(is_locked_sound)) {
+        conference->is_locked_sound = switch_core_strdup(conference->pool, is_locked_sound);
+    }
+
+    if (!switch_strlen_zero(is_unlocked_sound)) {
+        conference->is_unlocked_sound = switch_core_strdup(conference->pool, is_unlocked_sound);
+    }
+
     if (!switch_strlen_zero(energy_level)) {
         conference->energy_level = atoi(energy_level);
     }