Asterisk strftime %B

64 views Asked by At

I want to record calls with mixmimonitor and save it with this format of the filename - %d-%B-%Y-%H:%M:%S.wav

%B - is the full month name (July for example) - it works, but I get the name of the month in English. What should I do to make Asterisk and strftime with EPOCH respect my locale?

P.S. Ubuntu 22.04.2 and Asterisk 18.10

1

There are 1 answers

3
arheops On

So far this one is used with locale set to NULL:

const char *ast_setlocale(const char *locale)
{
        struct locale_entry *cur;
        locale_t prevlocale = LC_GLOBAL_LOCALE;

        if (locale == NULL) {
                return store_by_locale(uselocale(LC_GLOBAL_LOCALE));
        }

        AST_LIST_LOCK(&localelist);
        if ((cur = find_by_name(locale))) {
                prevlocale = uselocale(cur->locale);
        }

        if (!cur) {
                if ((cur = ast_calloc(1, sizeof(*cur) + strlen(locale) + 1))) {
                        cur->locale = newlocale(LC_ALL_MASK, locale, NULL);
                        strcpy(cur->name, locale); /* SAFE */
                        AST_LIST_INSERT_TAIL(&localelist, cur, list);
                        prevlocale = uselocale(cur->locale);
                }
        }
        AST_LIST_UNLOCK(&localelist);
        return store_by_locale(prevlocale);
}

Ast you can see here, it use LC_GLOBAL_LOCALE. which is linux global locale. You have check your system's settings.