server {
listen 80;
server_name WEB.HOST;
root /web/sites/WEB.HOST/www/;
index index.php index.html index.htm;
access_log /web/sites/WEB.HOST/log/access.log main;
error_log /web/sites/WEB.HOST/log/error.log;
location / {
return 301 https://WEB.HOST$request_uri;
}
location ~* ^.+.(js|css|png|jpg|jpeg|gif|ico|woff)$ {
return 301 https://WEB.HOST$request_uri;
}
location ~ \.php$ {
return 301 https://WEB.HOST$request_uri;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
rewrite ^ /robots.txt break;
allow all;
log_not_found off;
access_log off;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 80;
server_name www.WEB.HOST;
rewrite ^ https://WEB.HOST$request_uri? permanent;
}
server {
listen 443 ssl http2;
server_name WEB.HOST;
root /web/sites/WEB.HOST/www/;
index index.php index.html index.htm;
access_log /web/sites/WEB.HOST/log/ssl-access.log main;
error_log /web/sites/WEB.HOST/log/ssl-error.log;
keepalive_timeout 60;
ssl_certificate /etc/letsencrypt/live/WEB.HOST/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/WEB.HOST/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_dhparam /etc/ssl/certs/dhparam.pem;
add_header Strict-Transport-Security 'max-age=604800';
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* ^.+.(js|css|png|jpg|jpeg|gif|ico|woff)$ {
access_log off;
expires max;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param DOCUMENT_ROOT /web/sites/WEB.HOST/www/;
fastcgi_param SCRIPT_FILENAME /web/sites/WEB.HOST/www$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /web/sites/WEB.HOST/www$fastcgi_script_name;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param HTTPS on;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 443 ssl http2;
server_name www.WEB.HOST;
rewrite ^ https://WEB.HOST$request_uri? permanent;
}/code>
[incoming_from_tele2]
exten => SIPLOGIN,1,Goto(incoming-call,${CUT(CUT(SIP_HEADER(TO),"<",1),+,2)1},1)
To: "+77072501005"<sip:SIPLOGIN@pbx.tele2.kz>;tag=as4fda6416
Входящие звонки
[incoming-call]
;Работают правила по времени
exten => s,1, GotoIfTime(8:00-20:00,mon-fri,*,*?ivr-main,s,1)
exten => s,n, GotoIfTime(8:00-17:00,sat,*,*?ivr-main,s,1)
exten => s,n, GotoIfTime(10:00-15:00,sun,*,*?ivr-main,s,1)
exten => s,n, Playback(nonworkinghours)
exten => s,n, Goto(autoanswer,s,1)
;===---Контексты входящих звонков---===;
;===---Контексты IVR---===;
;IVRки
[ivr-main]
exten => s,1,Answer()
exten => s,2,Background(/var/lib/asterisk/sounds/ru/Welcome_Aster)
exten => s,3,WaitExten(2)
;Включаем запись
exten => _XXX,1,Macro(recording,${CALLERID(num)},${EXTEN})
exten => _5XXX,1,Dial(SIP/${EXTEN}@bit)
exten => _XXX,n,Dial(SIP/${EXTEN},0,m(default))
exten => _XXX,n,Set(dstNUM=${EXTEN})
;Проверяем статус пира, существует или нет
exten => _XXX,n,GotoIf($["${SIPPEER(${EXTEN},status)}" = ""]?num-not-exist,1)
;Проверяем статус пира, подключен или нет
exten => _XXX,n,GotoIf($["${SIPPEER(${EXTEN},status):0:2}" = "UN"]?num-not-connected,1)
;Проверяем канал на занятость
exten => _XXX,n,ChanIsAvail(SIP/${EXTEN},s)
;Выводим в лог значение функции ChanIsAvail, нужно только для отладки, можно удалить строку
;exten => _XXX,n,NoOp(=========== ChanIsAvail STATUS: ${AVAILSTATUS} ===========)
;Если функция возвращает 2 или 3, значит абонент занят
exten => _XXX,n,GoToIf($[${AVAILSTATUS} = 2]?num-BUSY,1)
exten => _XXX,n,GoToIf($[${AVAILSTATUS} = 3]?num-BUSY,1)
;Обрабатываем остальные статусы
exten => _XXX,n,Goto(num-${DIALSTATUS},1)
;Если номера не существует говорим "Ошибочный номер, попробуйте еще раз"
exten => num-not-exist,1,Wait(2)
exten => num-not-exist,n,Playback(invalid)
;Если номер не подключен, говорим "Набранный вами номер отключен, проверьте номер и повторите попытку
exten => num-not-connected,1,Wait(2)
exten => num-not-connected,n,Playback(ss-noservice)
;Если номер занят, говорим "Занято"
exten => num-BUSY,1,Wait(2)
exten => num-BUSY,n,Playback(vm-isonphone)
;Если еще по какой-то причине будет статус CHANUNAVAIL, говорим, что номер не доступен в данный момент
exten => num-CHANUNAVAIL,1,Wait(2)
exten => num-CHANUNAVAIL,n,Playback(vm-isunavail)
;Если в голосовом меню не выбрали внутренний номер, адресуем звонок секретарю
;Включаем запись
exten => t,1,Macro(recording,${CALLERID(num)},${EXTEN})
exten => t,n,Dial(SIP/458@bit)
;Отправка уведомления о пропущенном звонке
exten => р,n,HangUp()
<--- SIP read from UDP:217.76.78.17:5060 --->
INVITE sip:*---SIPLOGIN---*@*---ATS_IP---*:*---ATS_PORT---* SIP/2.0
Via: SIP/2.0/UDP 217.76.78.17:5060;branch=z9hG4bK0t7FtJkchbT01219
Call-ID: asbcpbx-9btu6wdbkt9cwucyuw6d5c968jbb5cth@10.18.5.64
From: "+77770188219"<sip:+77770188219@pbx.tele2.kz>;tag=sbc0905PBX_LOGIC
To: "+77072501005"<sip:*---SIPLOGIN---*@pbx.tele2.kz>
CSeq: 1 INVITE
Contact: <sip:PBX_LOGIC@217.76.78.17:5060>
Max-Forwards: 70
Content-Length: 221
Content-Type: application/sdp
v=0
o=- 1563360810 1563360810 IN IP4 217.76.78.18
s=SBC call
t=0 0
m=audio 14678 RTP/AVP 0 8 101
c=IN IP4 217.76.78.18
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
<------------->
--- (10 headers 10 lines) ---
Sending to 217.76.78.17:5060 (no NAT)
Sending to 217.76.78.17:5060 (no NAT)
Using INVITE request as basis request - asbcpbx-9btu6wdbkt9cwucyuw6d5c968jbb5cth@10.18.5.64
Found peer 'Tele2_77076420231' for '+77770188219' from 217.76.78.17:5060
== Using SIP RTP CoS mark 5
Found RTP audio format 0
Found RTP audio format 8
Found RTP audio format 101
Found audio description format PCMU for ID 0
Found audio description format PCMA for ID 8
Found audio description format telephone-event for ID 101
Capabilities: us - (alaw|ulaw), peer - audio=(ulaw|alaw)/video=(nothing)/text=(nothing), combined - (alaw|ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 217.76.78.18:14678
Looking for *---SIPLOGIN---* in incoming (domain *---ATS_IP---*)
sip_route_dump: route/path hop: <sip:PBX_LOGIC@217.76.78.17:5060>
<--- Transmitting (NAT) to 217.76.78.17:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 217.76.78.17:5060;branch=z9hG4bK0t7FtJkchbT01219;received=217.76.78.17;rport=5060
From: "+77770188219"<sip:+77770188219@pbx.tele2.kz>;tag=sbc0905PBX_LOGIC
To: "+77072501005"<sip:*---SIPLOGIN---*@pbx.tele2.kz>
Call-ID: asbcpbx-9btu6wdbkt9cwucyuw6d5c968jbb5cth@10.18.5.64
CSeq: 1 INVITE
Server: Asterisk PBX 15.7.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:*---SIPLOGIN---*@*---ATS_IP---*:*---ATS_PORT---*>
Content-Length: 0
<------------>
-- Executing [*---SIPLOGIN---*@incoming:1] Goto("SIP/Tele2_77076420231-0000e742", "incoming-call,s,1") in new stack
-- Goto (incoming-call,s,1)
-- Executing [s@incoming-call:1] GotoIfTime("SIP/Tele2_77076420231-0000e742", "8:00-20:00,mon-fri,*,*?ivr-main,s,1") in new stack
-- Goto (ivr-main,s,1)
-- Executing [s@ivr-main:1] Answer("SIP/Tele2_77076420231-0000e742", "") in new stack
Audio is at 10490
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
<--- Reliably Transmitting (NAT) to 217.76.78.17:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 217.76.78.17:5060;branch=z9hG4bK0t7FtJkchbT01219;received=217.76.78.17;rport=5060
From: "+77770188219"<sip:+77770188219@pbx.tele2.kz>;tag=sbc0905PBX_LOGIC
To: "+77072501005"<sip:*---SIPLOGIN---*@pbx.tele2.kz>;tag=as4e501857
Call-ID: asbcpbx-9btu6wdbkt9cwucyuw6d5c968jbb5cth@10.18.5.64
CSeq: 1 INVITE
Server: Asterisk PBX 15.7.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:*---SIPLOGIN---*@*---ATS_IP---*:*---ATS_PORT---*>
Content-Type: application/sdp
Content-Length: 267
v=0
o=root 1731612863 1731612863 IN IP4 *---ATS_IP---*
s=Asterisk PBX 15.7.1
c=IN IP4 *---ATS_IP---*
t=0 0
m=audio 10490 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv
<------------>
<--- SIP read from UDP:217.76.78.17:5060 --->
ACK sip:*---SIPLOGIN---*@*---ATS_IP---*:*---ATS_PORT---* SIP/2.0
Via: SIP/2.0/UDP 217.76.78.17:5060;branch=z9hG4bKJoWBZzlbYuT01220
Call-ID: asbcpbx-9btu6wdbkt9cwucyuw6d5c968jbb5cth@10.18.5.64
From: "+77770188219"<sip:+77770188219@pbx.tele2.kz>;tag=sbc0905PBX_LOGIC
To: "+77072501005"<sip:*---SIPLOGIN---*@pbx.tele2.kz>;tag=as4e501857
CSeq: 1 ACK
Max-Forwards: 70
Content-Length: 0
<------------->