add some more mime types for wav and mp3

This commit is contained in:
Anthony Minessale 2013-03-15 15:24:55 -05:00
parent bd72a7fc60
commit abdc4bf091
3 changed files with 24 additions and 2 deletions

View File

@ -898,6 +898,7 @@ SWITCH_DECLARE(const char *) switch_cut_path(const char *in);
SWITCH_DECLARE(char *) switch_string_replace(const char *string, const char *search, const char *replace);
SWITCH_DECLARE(switch_status_t) switch_string_match(const char *string, size_t string_len, const char *search, size_t search_len);
SWITCH_DECLARE(int) switch_strcasecmp_any(const char *str, ...);
/*!
\brief Quote shell argument

View File

@ -2601,9 +2601,10 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
if ((!context->url_params || !switch_event_get_header(context->url_params, "ext"))
&& headers && (ct = switch_event_get_header(headers, "content-type"))) {
if (!strcasecmp(ct, "audio/mpeg")) {
if (switch_strcasecmp_any(ct, "audio/mpeg", "audio/x-mpeg", "audio/mp3", "audio/x-mp3", "audio/mpeg3",
"audio/x-mpeg3", "audio/mpg", "audio/x-mpg", "audio/x-mpegaudio")) {
newext = "mp3";
} else if (!strcasecmp(ct, "audio/wav")) {
} else if (switch_strcasecmp_any(ct, "audio/wav", "audio/x-wave", "audio/wav")) {
newext = "wav";
}
}

View File

@ -122,6 +122,26 @@ SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(int) switch_strcasecmp_any(const char *str, ...)
{
va_list ap;
const char *next_str = 0;
int r = 0;
va_start(ap, str);
while ((next_str = va_arg(ap, const char *))) {
if (!strcasecmp(str, next_str)) {
r = 1;
break;
}
}
va_end(ap);
return r;
}
SWITCH_DECLARE(char *) switch_find_parameter(const char *str, const char *param, switch_memory_pool_t *pool)
{