[Freeswitch-svn] [commit] r3943 - in freeswitch/trunk: conf src/include src/mod/applications/mod_conference

Freeswitch SVN anthm at freeswitch.org
Thu Jan 11 13:14:02 EST 2007


Author: anthm
Date: Thu Jan 11 13:14:02 2007
New Revision: 3943

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

Log:
update conference to add lock sounds, sound prefix, and use say: syntax

Modified: freeswitch/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/trunk/conf/freeswitch.xml	(original)
+++ freeswitch/trunk/conf/freeswitch.xml	Thu Jan 11 13:14:02 2007
@@ -397,6 +397,7 @@
 
       <!-- 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"/>
@@ -406,38 +407,43 @@
 	  <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 -->

Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h	(original)
+++ freeswitch/trunk/src/include/switch_utils.h	Thu Jan 11 13:14:02 2007
@@ -62,6 +62,12 @@
 									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

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 Jan 11 13:14:02 2007
@@ -170,9 +170,12 @@
 	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 @@
     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 @@
         }
     }
 
-    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 @@
 
 
     switch_safe_free(expanded);
+    switch_safe_free(dfile);
 
 	
 
@@ -2831,6 +2841,10 @@
     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 @@
     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 @@
     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 @@
     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 @@
             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 @@
             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 @@
     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 @@
         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);
     }



More information about the Freeswitch-svn mailing list