mikopbx / Core

Main repository! MikoPBX - is free, easy to setup PBX for small business based on Asterisk 16 core
https://www.mikopbx.com
GNU General Public License v3.0
377 stars 62 forks source link

Day Time Saving option on TimeZone setup page #700

Closed jorikfon closed 1 month ago

jorikfon commented 7 months ago

Hii In 2 years ago the iran government cancel change time by DST rule So iran time fixed in +3:30 But in time setting can’t cancel Day Time Saving and time set in +4:30

jorikfon commented 7 months ago

https://github.com/php/php-src/issues/10946

jorikfon commented 7 months ago

Тут должно быть 3:30, у нас старая Верси системных тайм зон

Screenshot 2024-04-15 at 19 03 05
boffart commented 1 month ago

Выбираем тайм зону Asia/Qyzylorda (UTC+05:00):

date
php -r 'echo (new DateTime())->format("Y-m-d H:i:s.v");'
lua -e 'print(os.date("%Y-%m-%d %H:%M:%S"))'

# 2024-10-04 14:52:28

тут все норм

но в pbx_lua в asterisk выдает не корректное время, со сдвигом в 2 часа

пример лога из verbose звонка

{"OLD_LINKEDID":"","UNIQUEID":"mikopbx-1728035622.2_h83C9z","VMSTATUS":"","action":"hangup_chan","agi_channel":"PJSIP/SIP-1692280724-00000001","agi_threadid":"mikopbx-1728035622.3_S77e34","dialstatus":"","did":"1232","end":"2024-10-04 12:53:44.617","linkedid":"mikopbx-1728035622.0","src_num":"79066614140","verbose_call_id":"[C-00000001]"}

# 2024-10-04 12:53:44.617

пример lua функции получения текущего времени

function getNowDate()
    local a,b = math.modf(os.clock())
    return os.date("%Y-%m-%d %H:%M:%S.")..tostring(b):sub(3,5);
end

Пример /etc/asterisk/extensions-lua/99-extensions-override.lua

extensions["test-date"] = {
    ["100"] = function(context, extension)

        app["NoOp"]("Check (".. os.date("%Y-%m-%d %H:%M:%S.").." -> "..os.clock()..")");

    end;
};

Пример приложения dialplan для тестового звонка

1,Goto(test-date,100,1)
boffart commented 1 month ago

Нужно актуализировать пакеты:

X lua
X luajit
X lua-resty-core
X lua-resty-lrucache
X lpeg
X luajson
X luasocket
X luabitop

и зависимые от них:

nginx
asterisk