apache_httpd_reverse_proxy

Check

 # httpd -M | grep proxy
 proxy_module (shared)
 proxy_ajp_module (shared)
 proxy_balancer_module (shared)
 proxy_connect_module (shared)
 proxy_express_module (shared)
 proxy_fcgi_module (shared)
 proxy_fdpass_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_scgi_module (shared)
 proxy_wstunnel_module (shared)
 # httpd -M | grep lbmethod_byrequests
 lbmethod_byrequests_module (shared)
 # cat /etc/httpd/conf.modules.d/00-proxy.conf
# This file configures all the proxy modules:
LoadModule proxy_module modules/mod_proxy.so
LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_express_module modules/mod_proxy_express.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

virtual host

/etc/httpd/conf.d/default-site.conf

<VirtualHost *:80>
    ProxyPreserveHost On
 
    ProxyPass / http://192.168.0.1:80/
    ProxyPassReverse / http://192.168.0.1:80/
</VirtualHost>
 systemctl restart http
2019/03/01 · Oleg Zvezdo4kin · 0 комментариев (-я)

sngrep

  nohup sngrep -d ens160 -O /home/asterisk/sngrep_log/sngrep_log__$(date +%d_%m_%Y_%H_%M).pcap port 5060 -N &
  

http://ruby-linux.blogspot.com/2017/03/sngrep-sip.html

https://gist.github.com/yuuichi-fujioka/c4388cc672a3c8188423

2019/02/18 · Oleg Zvezdo4kin · 0 комментариев (-я)

Asterisk Advanced Message Queue Protocol

Install Erlang

wget -O - "https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc" |  apt-key add -
 
apt-get update
 
apt-get install erlang-nox
/etc/apt/sources.list.d/bintray.erlang.list
deb https://dl.bintray.com/rabbitmq/debian jessie erlang

Install Rabbitmq

echo "deb https://dl.bintray.com/rabbitmq/debian jessie  main" |  tee /etc/apt/sources.list.d/bintray.rabbitmq.list
 
wget -O - "https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc" |  apt-key add -
 
apt-get update
 
apt-get install rabbitmq-server
/etc/apt/sources.list.d/bintray.rabbitmq.list
deb https://dl.bintray.com/rabbitmq/debian jessie  main

HTTP Api Enable

 rabbitmq-plugins enable rabbitmq_management

Test HTTP Api

 curl -i -u guest:guest http://localhost:15672/api/vhosts

Нажмите, чтобы отобразить

Нажмите, чтобы скрыть

HTTP/1.1 200 OK
cache-control: no-cache
content-length: 849
content-security-policy: default-src 'self'
content-type: application/json
date: Mon, 28 Jan 2019 08:36:07 GMT
server: Cowboy
vary: accept, accept-encoding, origin
 
 
[{"cluster_state":{"rabbit@asterisk-pbx.ru":"running"},"message_stats":{"ack":0,"ack_details":{"rate":0.0},"confirm":11,"confirm_details":{"rate":0.0},"deliver":0,"deliver_details":{"rate":0.0},"deliver_get":808,"deliver_get_details":{"rate":0.0},"deliver_no_ack":0,"deliver_no_ack_details":{"rate":0.0},"get":808,"get_details":{"rate":0.0},"get_no_ack":0,"get_no_ack_details":{"rate":0.0},"publish":120556,"publish_details":{"rate":0.6},"redeliver":363,"redeliver_details":{"rate":0.0},"return_unroutable":5,"return_unroutable_details":{"rate":0.0}},"messages":72,"messages_details":{"rate":0.0},"messages_ready":72,"messages_ready_details":{"rate":0.0},"messages_unacknowledged":0,"messages_unacknowledged_details":{"rate":0.0},"name":"/","recv_oct":53905599,"recv_oct_details":{"rate":224.0},"send_oct":161709,"send_oct_details":{"rate":1.6},"tracing":false}]

Web UI

Create User
rabbitmqctl add_user admin password 
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
Open port 15672

res_amqp.so

apt-get install librabbitmq-dev
git clone https://github.com/wazo-pbx/wazo-res-amqp.git
cd /usr/src/wazo-res-amqp/
make
make install
make samples
cp /usr/src/wazo-res-amqp/documentation/res_amqp_config-en_US.xml  /var/lib/asterisk/documentation/thirdparty/

res_stasis_amqp.so

git clone https://github.com/wazo-pbx/wazo-res-stasis-amqp.git
cp -r /usr/src/wazo-res-amqp/asterisk /usr/src/wazo-res-stasis-amqp/
cd /usr/src/wazo-res-stasis-amqp/
make
make install
make samples
cp /usr/src/wazo-res-stasis-amqp/documentation/res_stasis_amqp_config-en_US.xml  /var/lib/asterisk/documentation/thirdparty/

/etc/asterisk/amqp.conf

[general]
enabled = yes  ; Set to no to disable
 
[bunny]
type = connection
url = amqp://localhost         ; amqp://[$USERNAME@]$HOST[:$PORT][/$VHOST]
                                ;  username defaults to guest
                                ;  port defaults to 5672
                                ;  vhost defaults to /
;password =                     ; Password to use for login
                                ;  defaults to guest
;max_frame_bytes =              ; Maximum frame size, in bytes; defaults to
                                ; AMQP_DEFAULT_FRAME_SIZE (131072, or 128KB)
;heartbeat_seconds =            ; number of seconds between heartbeat frames
                                ; 0 disables hearbeats; defaults to
                                ; AMQP_DEFAULT_HEARTBEAT (0)

/etc/asterisk/stasis_amqp.conf

[global]
connection = bunny      ; Connection name in amqp.conf
;queue =  ; Queue name to publish to; defaults to asterisk_cdr
exchange = amq.topic             ; Exchange to publish to; defaults to empty string

asterisk

Check res_stasis & app_stasis

*CLI> module show like stasis
Module                         Description                              Use Count  Status      Support Level
app_stasis.so                  Stasis dialplan application              0          Running              core
res_stasis.so                  Stasis application support               1          Running              core

Load res_amqp.so

*CLI> module load res_amqp.so
Loaded res_amqp.so
 Loaded res_amqp.so => (AMQP Interface)

Load res_stasis_amqp.so (requires an existing connection with rabbitmq )

*CLI> module load res_stasis_amqp.so
Loaded res_stasis_amqp.so
  == Parsing '/etc/asterisk/stasis_amqp.conf': Found
 Loaded res_stasis_amqp.so => (Send all Stasis messages to AMQP)
*CLI> module show like amqp
Module                         Description                              Use Count  Status      Support Level
res_amqp.so                    AMQP Interface                           0          Running              core
res_stasis_amqp.so             Send all Stasis messages to AMQP         0          Running          extended
2 modules loaded

Asterisk Stasis Channel Event

Asterisk Stasis Channel Even

Asterisk Stasis Channel Even

Message 18
The server reported 139 messages remaining.
 
Exchange	amq.topic
Routing Key	stasis.channel.1548662902.15
Redelivered	○
Properties	
delivery_mode:	2
content_type:	application/json
Payload
469 bytes
Encoding: string
{"event":"stasis_channel","eid":"78:32:1b:f6:22:f5","data":{"type":"ChannelVarset","variable":"STASISSTATUS","value":"","timestamp":"2019-01-28T11:08:22.879+0300","channel":{"id":"1548662902.15","language":"en","name":"PJSIP/fs_pjsip-00000005","connected":{"name":"","number":""},"state":"Up","caller":{"name":"O.Smirnov","number":"2666"},"accountcode":"","dialplan":{"context":"from-test2","exten":"72668","priority":2},"creationtime":"2019-01-28T11:08:22.759+0300"}}}

Asterisk Stasis AMI Event

  1. Enter queue: QueueCallerJoin
  2. Agent ringigng: AgentCalled
  3. Agent no answer for timeout: AgentRingNoAnswer
  4. Caller Leave Queue: QueueCallerAbandon, QueueCallerLeave

Stasis AMI Event

Stasis AMI Event

Message 1
The server reported 4 messages remaining.
 
Exchange	amq.topic
Routing Key	stasis.ami.queuecallerjoin
Redelivered	●
Properties	
delivery_mode:	2
content_type:	application/json
Payload
463 bytes
Encoding: string
{"event":"QueueCallerJoin","eid":"78:32:1b:f6:22:f5","data":{"Event":"QueueCallerJoin","AccountCode":"","Context":"from-test2","Channel":"PJSIP/fs_pjsip-0000001a","ChannelState":"6","Language":"en","ConnectedLineNum":"<unknown>","Exten":"72668","CallerIDNum":"2666","Uniqueid":"1548672880.81","Linkedid":"1548672880.81","ChannelStateDesc":"Up","Queue":"q_test","CallerIDName":"O.Smirnov","Count":"1","ConnectedLineName":"<unknown>","Priority":"3","Position":"1"}}
Message 2
The server reported 3 messages remaining.
 
Exchange	amq.topic
Routing Key	stasis.ami.agentcalled
Redelivered	●
Properties	
delivery_mode:	2
content_type:	application/json
Payload
860 bytes
Encoding: string
{"event":"AgentCalled","eid":"78:32:1b:f6:22:f5","data":{"Event":"AgentCalled","AccountCode":"","Context":"from-test2","Channel":"PJSIP/fs_pjsip-0000001a","ChannelState":"6","Language":"en","ConnectedLineNum":"<unknown>","Exten":"72668","CallerIDNum":"2666","Uniqueid":"1548672880.81","Linkedid":"1548672880.81","ChannelStateDesc":"Up","Queue":"q_test","CallerIDName":"O.Smirnov","DestExten":"72668","DestAccountCode":"","ConnectedLineName":"<unknown>","Interface":"SIP/72666","DestLanguage":"ru","DestConnectedLineNum":"2666","Priority":"3","DestPriority":"1","DestChannel":"SIP/72666-0000001a","DestCallerIDNum":"72666","DestChannelState":"0","DestChannelStateDesc":"Down","DestCallerIDName":"O.Smirnov","DestConnectedLineName":"O.Smirnov","DestContext":"mobile-asterisk-spb","MemberName":"666","DestLinkedid":"1548672880.81","DestUniqueid":"1548672881.82"}}
Message 3
The server reported 2 messages remaining.
 
Exchange	amq.topic
Routing Key	stasis.ami.agentringnoanswer
Redelivered	●
Properties	
delivery_mode:	2
content_type:	application/json
Payload
894 bytes
Encoding: string
{"event":"AgentRingNoAnswer","eid":"78:32:1b:f6:22:f5","data":{"Context":"from-test2","Event":"AgentRingNoAnswer","AccountCode":"","Channel":"PJSIP/fs_pjsip-0000001a","ChannelState":"6","Language":"en","ConnectedLineNum":"<unknown>","Exten":"72668","Linkedid":"1548672880.81","Uniqueid":"1548672880.81","CallerIDNum":"2666","ChannelStateDesc":"Up","Queue":"q_test","CallerIDName":"O.Smirnov","DestExten":"72668","ConnectedLineName":"<unknown>","DestAccountCode":"","DestLanguage":"ru","Interface":"SIP/72666","Priority":"3","DestConnectedLineNum":"2666","DestChannel":"SIP/72666-0000001a","DestPriority":"1","DestCallerIDNum":"72666","DestChannelState":"5","DestChannelStateDesc":"Ringing","DestCallerIDName":"O.Smirnov","DestConnectedLineName":"O.Smirnov","DestContext":"mobile-asterisk-spb","DestLinkedid":"1548672880.81","MemberName":"666","DestUniqueid":"1548672881.82","RingTime":"15000"}}
Message 4
The server reported 1 messages remaining.
 
Exchange	amq.topic
Routing Key	stasis.ami.queuecallerabandon
Redelivered	●
Properties	
delivery_mode:	2
content_type:	application/json
Payload
496 bytes
Encoding: string
{"event":"QueueCallerAbandon","eid":"78:32:1b:f6:22:f5","data":{"Event":"QueueCallerAbandon","AccountCode":"","Context":"from-test2","Channel":"PJSIP/fs_pjsip-0000001a","ChannelState":"6","Language":"en","ConnectedLineNum":"<unknown>","Exten":"72668","CallerIDNum":"2666","Uniqueid":"1548672880.81","Linkedid":"1548672880.81","ChannelStateDesc":"Up","CallerIDName":"O.Smirnov","Queue":"q_test","OriginalPosition":"1","ConnectedLineName":"<unknown>","Priority":"3","Position":"1","HoldTime":"18"}}
Message 5
The server reported 0 messages remaining.
 
Exchange	amq.topic
Routing Key	stasis.ami.queuecallerleave
Redelivered	●
Properties	
delivery_mode:	2
content_type:	application/json
Payload
465 bytes
Encoding: string
{"event":"QueueCallerLeave","eid":"78:32:1b:f6:22:f5","data":{"Event":"QueueCallerLeave","AccountCode":"","Context":"from-test2","Channel":"PJSIP/fs_pjsip-0000001a","ChannelState":"6","Language":"en","ConnectedLineNum":"<unknown>","Exten":"72668","CallerIDNum":"2666","Uniqueid":"1548672880.81","Linkedid":"1548672880.81","ChannelStateDesc":"Up","Queue":"q_test","CallerIDName":"O.Smirnov","Count":"0","ConnectedLineName":"<unknown>","Priority":"3","Position":"1"}}

asterisk

rabbitmq

Debian 9 officially FS

Debian 9 “Stretch” is now officially supported by FreeSWITCH™ .

Dependencies are available from FreeSWITCH repository via the «apt-get build-dep freeswitch» command.

Debian 9 «Stretch» is the reference platform for FreeSWITCH™ as of version 1.8 and is STRONGLY recommended for all applications due to its stability and broad support for the system libraries needed by FreeSWITCH.

https://freeswitch.org/confluence/display/FREESWITCH/Debian+9+Stretch

apt-get update && apt-get install -y gnupg2 wget
wget -O - https://files.freeswitch.org/repo/deb/freeswitch-1.8/fsstretch-archive-keyring.asc | apt-key add -
 
echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.8/ stretch main" > /etc/apt/sources.list.d/freeswitch.list
echo "deb-src http://files.freeswitch.org/repo/deb/freeswitch-1.8/ stretch main" >> /etc/apt/sources.list.d/freeswitch.list
 
# you may want to populate /etc/freeswitch at this point.
# if /etc/freeswitch does not exist, the standard vanilla configuration is deployed
apt-get update && apt-get install -y freeswitch-meta-all
 fs_cli -rRS
2018/12/04 · Oleg Zvezdo4kin · 0 комментариев (-я)

Reboot IP LDK over telnet from bash script

Зависимости: expect

 sudo apt-get install expect
#!/usr/bin/expect
 
set hostName [lindex $argv 0]
set LdkPCAdminPass [lindex $argv 1]
 
spawn telnet $hostName 
send  "\r"
expect "ENTER PASSWORD:"
send "brandy\r"
expect "maint>"
sleep 2
send "reboot\r"
expect "Password:"
send "$LdkPCAdminPass\r"
expect "Retype password:"
send "$LdkPCAdminPass\r";
 ./foo.sh hostname LdkPCAdminPass
$ ./foo.sh 192.168.14.253 1234
spawn telnet 192.168.14.253
 
Trying 192.168.14.253...
Connected to 192.168.14.253.
Escape character is '^]'.
Welcome to ipLDK-60 system. Press enter.
Your address is 192.168.100.194. Your port number is 3.
 
ipLDK-60 System
Version GS88P-3.8Ib OCT/11
Dsp Version: 5.8(11/04/20),(A-law)
DATE: 10/23/18
TIME: 11:26:24
SITE NAME     : 
ENTER PASSWORD: brandy
******
maint> reboot
reboot
## Reboot System ##
CAUTION!! This reboots the system.
Admin password should be typed.
 
Password: 1234
****
2018/10/16 · Oleg Zvezdo4kin · 0 комментариев (-я)

<< Новые записи | Предыдущие записи >>

Только авторизованные участники могут оставлять комментарии.
  • blog.txt
  • Последние изменения: 2019/03/27