How long does asterisk cache sound files for?

I vaguely remember reading that when you try to play a sound file from a http source by default Asterisk will use the same file for X amount of time. Every time it tries to play the file it does a head request and if the file size has not changed it uses the cached file so long as the file has not expired. Is that correct? Does anyone know where the docs for this is?

EDIT1: I see the values here asterisk/res/res_http_media_cache.c at master · asterisk/asterisk · GitHub but there is no explanation on what the possible values are and what they do.


Those are non-Asterisk specific HTTP headers.

I understand. Is there any docs on default expiration for files as well as how Asterisk determines if it should re-download the file? Like does Asterisk do a head request first to see if the file is even the same? Is it based on curl and how curl operates?

I don’t know of any explicit documentation, 'nor do I have any knowledge of the underlying implementation.

1 Like

I will test with a http server and see how Asterisk performs. Once I get done is there any place where this can be documented to help others (including myself in a few years when I inevitably google it again ;)) ?

There is a documentation repo[1] with documentation stored as markdown. There is also the sample configuration file for the http media cache module[2].

[1] GitHub - asterisk/documentation: The Asterisk Documentation Project.
[2] asterisk/configs/samples/res_http_media_cache.conf.sample at master · asterisk/asterisk · GitHub

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.