<param name="" value="">
debug : <true|false> false Print debug data
file-cache-ttl : <number of sec> 300 How long to wait before checking the server to see if audio file has changed.
+ Whichever is smaller that or the max-age returned by the server (if present).
+abs-file-cache-ttl : <number of sec> 0 Force the cache time no matter what anything else says.
file-not-found-expires : <number of sec> 300 How long to still preserve cached audio files that are not found by the server.
<profile name="<name>"> : CREATE NEW PROFILE TO REFERENCE BY NAME
int debug;
int not_found_expires;
int cache_ttl;
+ int abs_cache_ttl;
} globals;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s]for file-cache-ttl\n", val);
}
+ } else if (!strcasecmp(var, "abs-file-cache-ttl")) {
+ int tmp = atoi(val);
+
+ if (tmp > -1) {
+ globals.abs_cache_ttl = tmp;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s]for file-cache-ttl\n", val);
+ }
} else if (!strcasecmp(var, "file-not-found-expires")) {
globals.not_found_expires = atoi(val);
}
if (!zstr(data)) {
- int ttl = globals.cache_ttl;
+ int ttl = globals.cache_ttl, abs_cache_ttl = globals.abs_cache_ttl;
const char *cc;
const char *p;
+ int x;
+
+ if (context->url_params) {
+ if ((cc = switch_event_get_header(context->url_params, "abs_cache_control"))) {
+ x = atoi(cc);
- if (headers && (cc = switch_event_get_header(headers, "Cache-Control"))) {
+ if (x > 0) {
+ abs_cache_ttl = x;
+ }
+ } else if ((cc = switch_event_get_header(context->url_params, "cache_control"))) {
+ x = atoi(cc);
+
+ if (x > 0) {
+ ttl = x;
+ }
+ }
+ }
+
+ if (abs_cache_ttl) {
+ ttl = abs_cache_ttl;
+ } else if (headers && (cc = switch_event_get_header(headers, "Cache-Control"))) {
if ((p = switch_stristr("max-age=", cc))) {
p += 8;
if (!zstr(p)) {
- ttl = atoi(p);
- if (ttl < 0) ttl = globals.cache_ttl;
+ x = atoi(p);
+
+ if (x < ttl) {
+ ttl = x;
+ }
}
}