The current time is fifteen hours, twenty one hours per minute, twenty seconds. Today is Wednesday, October 15th I am .
The current time is one in one hour , thirty five minutes, ten seconds. Today is Thursday, the sixteenth of October.
#yum -y install ntp
#grep "^ server" /etc/ntp.conf server 0.ru.pool.ntp.org server 1.ru.pool.ntp.org server 2.ru.pool.ntp.org server 3.ru.pool.ntp.org #chkconfig ntpd on #service ntpd start
#netstat -putln | grep ntpd
#iptables -nL --line-numbers #iptables -I INPUT 4 -s 10.0.0.0/255.0.0.0 -p udp --dport 123 -j ACCEPT #service iptables save
#ntpdate ru.pool.ntp.org 9 Oct 17:08:41 ntpdate [32744]: adjust time server 85.21.78.8 offset -0.183259 sec
#echo -e "\ n47 * / 1 * * * root / usr / sbin / ntpdate pool.ntp.org> / dev / null \ n" >> / etc / crontab
sounds / xx sounds / xx / digits sounds / xx / letters sounds / xx / phonetic
#mkdir / var / lib / asterisk / sounds / ru /
#wget -O asterisk-sounds-additional-master.zip https://github.com/pbxware/asterisk-sounds-additional/archive/master.zip #wget -O asterisk-sounds-master.zip https://github.com/pbxware/asterisk-sounds/archive/master.zip
#unzip asterisk-sounds-additional-master.zip #unzip asterisk-sounds-master.zip
#cp -R ./asterisk-sounds-additional-master/* / var / lib / asterisk / sounds / en / #cp -R ./asterisk-sounds-master/* / var / lib / asterisk / sounds / en /
#less ./asterisk-sounds-additional-master/additional-sounds-ru.txt #less ./asterisk-sounds-master/core-sounds-ru.txt
#cat /etc/asterisk/sip.conf [general] language = en
#asterisk -rx "sip reload"
[ru-base](!) _[n]um:0X => num:${SAY:1} _[n]um:X => digits/${SAY} _[n]um:[1-2]f => digits/${SAY:0:1}f _[n]um:[3-9]f => digits/${SAY:0:1} ; Tens _[n]um:1X => digits/${SAY:0:2} _[n]um:1Xf => digits/${SAY:0:2} _[n]um:[2-9]0 => digits/${SAY:0:2} _[n]um:[2-9]0f => digits/${SAY:0:2} _[n]um:[2-9][1-2] => digits/${SAY:0:1}0, num:${SAY:1} _[n]um:[2-9][1-2]f => digits/${SAY:0:1}0, num:${SAY:1} _[n]um:[2-9][3-9] => digits/${SAY:0:1}0, num:${SAY:1} _[n]um:[2-9][3-9]f => digits/${SAY:0:1}0, num:${SAY:1} ; Hundreds _[n]um:0XX => num:${SAY:1} _[n]um:0XXf => num:${SAY:1} _[n]um:[1-9]00 => digits/${SAY:0:1}00 _[n]um:[1-9]00f => digits/${SAY:0:1}00 _[n]um:XXX => num:${SAY:0:1}00, num:${SAY:1} _[n]um:XXXf => num:${SAY:0:1}00, num:${SAY:1} ; enumeration _e[n]um:X => digits/h-${SAY} _e[n]um:X[n] => digits/h-${SAY} _e[n]um:0X => enum:${SAY:1} _e[n]um:0X[n] => enum:${SAY:1} _e[n]um:1X => digits/h-${SAY} _e[n]um:1X[n] => digits/h-${SAY} _e[n]um:[2-9]0 => digits/h-${SAY} _e[n]um:[2-9]0[n] => digits/h-${SAY} _e[n]um:[2-9][1-9] => num:${SAY:0:1}0, digits/h-${SAY:1} _e[n]um:[2-9][1-9][n] => num:${SAY:0:1}0, digits/h-${SAY:1} _e[n]um:[1-9]00 => digits/h-${SAY} _e[n]um:[1-9]00[n] => digits/h-${SAY} _e[n]um:[1-9]XX => num:${SAY:0:1}00, enum:${SAY:1} _e[n]um:[1-9]XX[n] => num:${SAY:0:1}00, enum:${SAY:1} [ru](ru-base) _chas:0 => num:${SAY}, digits/hours _chas:1 => digits/${SAY}, digits/hour _chas:[2-4] => num:${SAY}, digits/hours-a _chas:[5-9] => num:${SAY}, digits/hours _chas:0X => chas:${SAY:1} _chas:1X => num:${SAY}, digits/hours _chas:20 => num:${SAY}, digits/hours _chas:2[1-4] => num:${SAY:0:1}0, chas:${SAY:1} _mi[n]uta:0 => num:${SAY}, digits/minutes _mi[n]uta:1 => digits/1f, digits/minute _mi[n]uta:2 => digits/2f, digits/minutes-i _mi[n]uta:[3-4] => num:${SAY}, digits/minutes-i _mi[n]uta:[5-9] => num:${SAY}, digits/minutes _mi[n]uta:0X => minuta:${SAY:1} _mi[n]uta:1X => num:${SAY}, digits/minutes _mi[n]uta:[2-5]0 => num:${SAY}, digits/minutes _mi[n]uta:[2-5][1-9] => num:${SAY:0:1}0, minuta:${SAY:1} _seku[n]da:0 => num:${SAY}, seconds _seku[n]da:[5-9] => num:${SAY}, seconds _seku[n]da:0X => sekunda:${SAY:1} _seku[n]da:1X => num:${SAY}, seconds _seku[n]da:[2-5]0 => num:${SAY}, seconds _dayofweek:[0-6] => digits/day-${SAY} _dayofmo[n]th:X => enum:${SAY}n _dayofmo[n]th:XX => enum:${SAY}n _mo[n]th:X => digits/mon-$[${SAY} - 1] _mo[n]th:XX => digits/mon-$[${SAY} - 1]
#asterisk -rx "module reload app_playback.so"
(!)
Exclamation mark in parentheses, which means that this is a template that we later include in [ru]
_mo[n]th:XX => digits/mon-$[${SAY} - 1]
[my_regular_context] ; SIP /. exten => 100,1,Goto(informer_100,s,1) [informer_100] exten => s,1,Set(FreezeEPOCH=$[${EPOCH} + 15]) ; 15 unixtime. same => n,Set(TimeNow=${STRFTIME(${FreezeEPOCH},,%Y%m%d%H%M.%S-%w-%j)}) same => n,Playback(silence/1&at-tone-time-exactly) ; 1 + same => n,Playback(chas:${TimeNow:8:2},say) ; + same => n,Playback(minuta:${TimeNow:10:2},say) ; + + same => n,Playback(sekunda:${TimeNow:13:1}0,say) ; + same => n,Playback(silence/1&digits/today) ; 1 + same => n,Playback(dayofweek:${TimeNow:16:1},say) ; same => n,Playback(dayofmonth:${TimeNow:6:2},say) ; same => n,Playback(month:${TimeNow:4:2},say) ; same => n,Playback(silence/1&beep) ; 1 + same => n,Hangup()
#asterisk -rx "dialplan reload"
same => n,Set(FreezeEPOCH=$[${EPOCH} + 15])
[informer_100]
it’s worth explaining the line where in the variable FreezeEPOCH
add 15 seconds to unixtime. This is done to compensate for the time spent on playing files that precede seconds.TimeNow
date format we need in the TimeNow
variable. It contains data in the form: 201410160043.34-4-289
. When reading, we pull the necessary numbers out of the “array”. They are always in their places and extraction is not difficult. More information about the formats can be found in #man strftime
.${AnyVariable:x:y}
variable, where x is the starting position, and y is the number of digits to be returned. Let the string be given:201410160043.34-4-289
${AnyVariable:x:y}
construct, you can extract the following data:${AnyVariable:0:4}
- the string 2014 will be returned. Skip zero characters on the left and take four characters.${AnyVariable:4:8}
- the string 10160043 will be returned.${AnyVariable:-3:3}
- the string will start with the third character, counting from the end and includes three characters, which will give 289.${AnyVariable:2}
- if the number of digits to be returned is not specified, the entire remaining string will be returned, we get 1410160043.34-4-289.${TimeNow:13:1}0
exten => 101,1,Set(Number=0) ; same=>n(start),playback(enum:0${Number}n,say) ; enum same=>n,Set(Number=$[ ${Number} + 1 ]) ; same=>n,GotoIf($[${Number} <= 9 ]?start) ; same=>n,Hangup()
Source: https://habr.com/ru/post/240649/
All Articles