diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index f1903c8c29..8e019f1fb3 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -955,8 +955,40 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, const char *body, const char *file, const char *convert_cmd, const char *convert_ext); SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char close); +static inline void switch_separate_file_params(const char *file, char **file_portion, char **params_portion) +{ + char *e = NULL; + int x; + char *space = strdup(file); - static inline switch_bool_t switch_is_file_path(const char *file) + file = space; + + *file_portion = NULL; + *params_portion = NULL; + + for (x = 0; x < 2; x++) { + if (*file == '[' && *(file + 1) == *SWITCH_PATH_SEPARATOR) { + e = switch_find_end_paren(file, '[', ']'); + } else if (*file == '{') { + e = switch_find_end_paren(file, '{', '}'); + } else { + break; + } + } + + if (e) { + file = e + 1; + *file_portion = strdup((char *)file); + *++e = '\0'; + *params_portion = (char *)space; + } else { + *file_portion = (char *)space; + } + + return; +} + +static inline switch_bool_t switch_is_file_path(const char *file) { const char *e; int r, x; @@ -974,6 +1006,7 @@ SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char clos break; } } + #ifdef WIN32 r = (file && (*file == '\\' || *(file + 1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR))); #else diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index f4a6757572..4d2478ce7c 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -5443,10 +5443,20 @@ static switch_status_t conference_play_file(conference_obj_t *conference, char * if (!switch_is_file_path(file)) { if (!say && conference->sound_prefix) { - if (!(dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, file))) { - goto done; + char *params_portion = NULL; + char *file_portion = NULL; + switch_separate_file_params(file, &file_portion, ¶ms_portion); + + if (params_portion) { + dfile = switch_mprintf("%s%s%s%s", params_portion, conference->sound_prefix, SWITCH_PATH_SEPARATOR, file_portion); + } else { + dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, file_portion); } + file = dfile; + switch_safe_free(file_portion); + switch_safe_free(params_portion); + } else if (!async) { status = conference_say(conference, file, leadin); goto done;