]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
BOUNTY-9 (Thank you Xpander Communications) [part 2]
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 16 Sep 2009 20:46:36 +0000 (20:46 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 16 Sep 2009 20:46:36 +0000 (20:46 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14891 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_async.c
src/switch_ivr_play_say.c

index 3f5fa5a94e7818706aa37545ca1596bb8a3bb06e..047df14153bf173e86ec2f36bd19ce1f15c313fd 100644 (file)
@@ -933,6 +933,32 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
        fh->channels = channels;
        fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;
 
+
+       
+       if (!switch_is_file_path(file)) {
+               char *tfile = NULL;
+               char *e;
+               const char *prefix;
+
+               prefix = switch_channel_get_variable(channel, "sound_prefix");
+
+               if (!prefix) {
+                       prefix = SWITCH_GLOBAL_dirs.base_dir;
+               }
+
+               if (*file == '[') {
+                       tfile = switch_core_session_strdup(session, file);
+                       if ((e = switch_find_end_paren(tfile, '[', ']'))) {
+                               *e = '\0';
+                               file = e + 1;
+                       } else {
+                               tfile = NULL;
+                       }
+               }
+               
+               file = switch_core_session_sprintf(session, "%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file);
+       }
+       
        if (switch_core_file_open(fh,
                                                          file,
                                                          channels,
index 380049bf26c511ebaddee56a0c195c0475bbfbe9..ac30567274f29c7753792ab3063154d529532f7d 100644 (file)
@@ -461,12 +461,26 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                const char *prefix;
 
                prefix = switch_channel_get_variable(channel, "sound_prefix");
+
                if (!prefix) {
                        prefix = SWITCH_GLOBAL_dirs.base_dir;
                }
                
                if (!switch_is_file_path(file)) {
-                       file = switch_core_session_sprintf(session, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, file);
+                       char *tfile = NULL;
+                       char *e;
+
+                       if (*file == '[') {
+                               tfile = switch_core_session_strdup(session, file);
+                               if ((e = switch_find_end_paren(tfile, '[', ']'))) {
+                                       *e = '\0';
+                                       file = e + 1;
+                               } else {
+                                       tfile = NULL;
+                               }
+                       }
+                       
+                       file = switch_core_session_sprintf(session, "%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file);
                }
                if ((ext = strrchr(file, '.'))) {
                        ext++;
@@ -1001,7 +1015,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
 
                if (!strstr(file, SWITCH_URL_SEPARATOR)) {
                        if (!switch_is_file_path(file)) {
-                               file = switch_core_session_sprintf(session, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, file);
+                               char *tfile = NULL;
+                               char *e;
+
+                               if (*file == '[') {
+                                       tfile = switch_core_session_strdup(session, file);
+                                       if ((e = switch_find_end_paren(tfile, '[', ']'))) {
+                                               *e = '\0';
+                                               file = e + 1;
+                                       } else {
+                                               tfile = NULL;
+                                       }
+                               }
+
+                               file = switch_core_session_sprintf(session, "%s%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file);
                        }
                        if ((ext = strrchr(file, '.'))) {
                                ext++;