[Freeswitch-users] mod_http_cache in version 1.10.8 is not working

tihomir at nexios.cc tihomir at nexios.cc
Thu Jan 12 13:09:40 UTC 2023

Hi Gregor, 


I would start here



static char *cached_url_filename_create(url_cache_t *cache, const char *url, char **extension)


        char *filename;

        char *dirname;

        char uuid_dir[3] = { 0 };

        switch_uuid_t uuid;

        char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 };

        const char *found_extension = NULL;

        size_t found_extension_len = 0;


        find_extension(url, &found_extension, &found_extension_len);


        /* filename is constructed from UUID and is stored in cache dir (first 2 characters of UUID) */


        switch_uuid_format(uuid_str, &uuid);

        snprintf(uuid_dir, sizeof(uuid_dir), "%.2s", uuid_str);

        dirname = switch_mprintf("%s%s%s", cache->location, SWITCH_PATH_SEPARATOR, uuid_dir);


        /* create sub-directory if it doesn't exist */

        switch_dir_make_recursive(dirname, SWITCH_DEFAULT_DIR_PERMS, cache->pool);


        if (!zstr(found_extension) && found_extension_len > 0) {

                char *found_extension_dup = strndup(found_extension, found_extension_len);

                filename = switch_mprintf("%s%s%s.%s", dirname, SWITCH_PATH_SEPARATOR, &uuid_str[2], found_extension_dup);

                if (extension) {

                        *extension = found_extension_dup;

                } else {



        } else {

                filename = switch_mprintf("%s%s%s", dirname, SWITCH_PATH_SEPARATOR, &uuid_str[2]);

                if (extension) {

                        *extension = NULL;




        return filename;




Put some logging, recompile and see how the file path and name is built up.


This created a file name with 0000000000000000000000 

char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }


my guess:

switch_uuid_get(&uuid); didn't return a valid UUID


switch_uuid_format(uuid_str, &uuid); messed something out..


anyhow.. put logging there, recompile and see what you get.









Tihomir Culjaga 

Business Development 
& Presales Manager 

 <https://www.facebook.com/nexios.cc>    <https://www.linkedin.com/company/nexioscc/>    <https://twitter.com/nexioscc>   


 <tel:+385916331550> 385 (0)91 633 1550 


 <mailto:tihomir at nexios.cc> tihomir at nexios.cc 


 <https://nexios.cc/> www.nexios.cc 



From: FreeSWITCH-users [mailto:freeswitch-users-bounces at lists.freeswitch.org] On Behalf Of Gregor Nanger
Sent: 12. siječnja 2023. 9:32
To: FreeSWITCH Users Help <freeswitch-users at lists.freeswitch.org>
Subject: Re: [Freeswitch-users] mod_http_cache in version 1.10.8 is not working


Am I the only one that has this issue? 


Br, Gregor 


On Wed, 11 Jan 2023, 00:41 Gregor Nanger, <gregor at infomedia.si <mailto:gregor at infomedia.si> > wrote:

Caching files stopped working after upgrade.


First file that is in playback is saved as: storage/http_file_cache/00000000000000000000000000000000.wav


And after that all files are played as this cache. Basically it doesn't cache files anymore and always pulls this one from cache.


This is the log when it is first cached:

EXECUTE [depth=0] sofia/external/041600611 at <mailto:041600611 at>  playback(http://wav.files.com/109da642-87ed-4596-8b82-ddefd379c3bb.wav)
2023-01-10 23:59:45.823739 97.05% [DEBUG] mod_httapi.c:2665 caching: url:http://wav.files.com/109da642-87ed-4596-8b82-ddefd379c3bb.wav to C:/Program Files/FreeSWITCH/storage/http_file_cache/00000000000000000000000000000000.wav (344649 bytes)


It looks like it doesn't pass file name down to http_cache or it is passed as 00000...


I checked source code of this module and there is some md5 functions that hash name. Could this function returns 00000000... as name? We are using FS on windows, but version 1.10.7 works ok.


BR, Greg

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20230112/5f52f616/attachment-0001.html>

More information about the FreeSWITCH-users mailing list