├── .gitignore ├── freeswitch ├── certs │ └── .placeholder ├── chatplan │ └── .placeholder ├── dialplan │ └── .placeholder ├── directory │ └── .placeholder ├── autoload_configs │ ├── post_load_modules.conf.xml │ ├── shout.conf.xml │ ├── syslog.conf.xml │ ├── console.conf.xml │ ├── http_cache.conf.xml │ ├── event_socket.conf.xml │ ├── sofia.conf.xml │ ├── local_stream.conf.xml │ ├── kazoo.conf.xml │ ├── logfile.conf.xml │ ├── opus.conf.xml │ ├── modules.conf.xml │ ├── switch.conf.xml │ └── spandsp.conf.xml ├── lang │ ├── es │ │ ├── es_MX.xml │ │ ├── es_ES.xml │ │ ├── demo │ │ │ ├── demo-es-ES.xml │ │ │ └── demo-es-MX.xml │ │ └── dir │ │ │ ├── tts-es-MX.xml │ │ │ ├── tts-es-ES.xml │ │ │ ├── sounds-es-ES.xml │ │ │ └── sounds-es-MX.xml │ ├── pt │ │ ├── pt_BR.xml │ │ ├── pt_PT.xml │ │ ├── demo │ │ │ ├── demo-pt-BR.xml │ │ │ └── demo-pt-PT.xml │ │ └── dir │ │ │ ├── tts-pt-BR.xml │ │ │ ├── tts-pt-PT.xml │ │ │ ├── sounds-pt-BR.xml │ │ │ └── sounds-pt-PT.xml │ ├── de │ │ ├── de.xml │ │ └── demo │ │ │ └── demo.xml │ ├── he │ │ ├── he.xml │ │ ├── demo │ │ │ └── demo.xml │ │ └── dir │ │ │ └── sounds.xml │ ├── fr │ │ ├── demo │ │ │ └── demo.xml │ │ ├── fr.xml │ │ └── dir │ │ │ ├── tts.xml │ │ │ └── sounds.xml │ ├── ru │ │ ├── ru.xml │ │ ├── dir │ │ │ ├── tts.xml │ │ │ └── sounds.xml │ │ └── demo │ │ │ └── demo.xml │ └── en │ │ ├── en.xml │ │ ├── demo │ │ ├── funnies.xml │ │ └── demo.xml │ │ └── dir │ │ ├── tts.xml │ │ └── sounds.xml ├── scripts │ └── kazoo-sync.sh └── freeswitch.xml ├── kamailio ├── certs │ └── .placeholder ├── tls-role.cfg ├── responder-role.cfg ├── accounting-role.cfg ├── kamailio.cfg ├── nat-traversal-role.cfg ├── defs.cfg ├── traffic-filter-role.cfg ├── kazoo-bindings.cfg ├── tls.cfg ├── registrar-sync-role.cfg ├── pusher-role.cfg ├── message-role.cfg ├── antiflood-role.cfg ├── websockets-role.cfg ├── local.cfg ├── presence_query-role.cfg └── nodes-role.cfg ├── rabbitmq ├── enabled_plugins ├── rabbitmq-env.conf └── rabbitmq.config ├── system ├── rsyslog.d │ ├── 5-rate-limits.conf │ ├── 20-haproxy.conf │ ├── 10-kamailio.conf │ ├── 1-default-config-override.conf │ └── 90-kazoo-core.conf ├── systemd │ ├── kazoo-freeswitch-logrotate.service │ ├── kazoo-freeswitch-logrotate.timer │ ├── kazoo-ecallmgr.service │ ├── kazoo-applications.service │ ├── kazoo-bigcouch.service │ ├── kazoo-rabbitmq.service │ ├── kazoo-kamailio.service │ ├── kazoo-haproxy.service │ └── kazoo-freeswitch.service ├── logrotate.d │ ├── rabbitmq.conf │ ├── freeswitch.conf │ ├── haproxy.conf │ ├── kazoo-core.conf │ ├── bigcouch.conf │ └── kamailio.conf ├── security │ └── limits.d │ │ ├── freeswitch.limits.conf │ │ ├── kazoo-core.limits.conf │ │ ├── haproxy.limits.conf │ │ ├── bigcouch.limits.conf │ │ ├── kamailio.limits.conf │ │ └── rabbitmq.limits.conf ├── init.d │ ├── kazoo-bigcouch.redhat │ ├── kazoo-generic.redhat │ ├── kazoo-kamailio.redhat │ ├── kazoo-rabbitmq.redhat │ ├── kazoo-freeswitch.redhat │ └── kazoo-haproxy.redhat └── sbin │ ├── kazoo-rabbitmq │ ├── kazoo-bigcouch │ ├── kazoo-freeswitch │ ├── kazoo-kamailio │ ├── kazoo-haproxy │ ├── kazoo-ecallmgr │ └── kazoo-applications ├── README.md ├── bigcouch ├── local.ini └── vm.args ├── core ├── config.ini ├── vm.args └── sys.config └── haproxy └── haproxy.cfg /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | freeswitch.serial 3 | 4 | -------------------------------------------------------------------------------- /freeswitch/certs/.placeholder: -------------------------------------------------------------------------------- 1 | just a placeholder -------------------------------------------------------------------------------- /freeswitch/chatplan/.placeholder: -------------------------------------------------------------------------------- 1 | just a placeholder -------------------------------------------------------------------------------- /freeswitch/dialplan/.placeholder: -------------------------------------------------------------------------------- 1 | just a placeholder -------------------------------------------------------------------------------- /freeswitch/directory/.placeholder: -------------------------------------------------------------------------------- 1 | just a placeholder -------------------------------------------------------------------------------- /kamailio/certs/.placeholder: -------------------------------------------------------------------------------- 1 | ensure certs directory gets created -------------------------------------------------------------------------------- /rabbitmq/enabled_plugins: -------------------------------------------------------------------------------- 1 | [rabbitmq_management, rabbitmq_consistent_hash_exchange]. 2 | -------------------------------------------------------------------------------- /system/rsyslog.d/5-rate-limits.conf: -------------------------------------------------------------------------------- 1 | $SystemLogRateLimitInterval 0 2 | $SystemLogRateLimitBurst 0 3 | -------------------------------------------------------------------------------- /system/rsyslog.d/20-haproxy.conf: -------------------------------------------------------------------------------- 1 | if $programname == 'haproxy' then /var/log/haproxy/haproxy.log 2 | & ~ 3 | -------------------------------------------------------------------------------- /system/rsyslog.d/10-kamailio.conf: -------------------------------------------------------------------------------- 1 | if $programname == 'kamailio' then /var/log/kamailio/kamailio.log 2 | & ~ 3 | -------------------------------------------------------------------------------- /system/rsyslog.d/1-default-config-override.conf: -------------------------------------------------------------------------------- 1 | # Provides UDP syslog reception 2 | $ModLoad imudp 3 | $UDPServerRun 514 4 | -------------------------------------------------------------------------------- /system/rsyslog.d/90-kazoo-core.conf: -------------------------------------------------------------------------------- 1 | local0.* /var/log/kazoo/kazoo.log 2 | & ~ 3 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/post_load_modules.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /rabbitmq/rabbitmq-env.conf: -------------------------------------------------------------------------------- 1 | NODENAME=kazoo-rabbit 2 | NODE_IP_ADDRESS=0.0.0.0 3 | NODE_PORT=5672 4 | LOG_BASE=/var/log/rabbitmq 5 | MNESIA_BASE=/var/lib/rabbitmq/mnesia 6 | ERL_MAX_PORTS=65536 7 | -------------------------------------------------------------------------------- /system/systemd/kazoo-freeswitch-logrotate.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Run logrotate for freeswitch 3 | 4 | [Service] 5 | Type=oneshot 6 | ExecStart=/usr/sbin/logrotate --force /etc/logrotate.d/freeswitch.conf 7 | -------------------------------------------------------------------------------- /system/systemd/kazoo-freeswitch-logrotate.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Rotate the kazoo-freeswitch logs every 15 minutes 3 | 4 | [Timer] 5 | OnCalendar=*:0/15 6 | Unit=kazoo-freeswitch-logrotate.service 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /kamailio/tls-role.cfg: -------------------------------------------------------------------------------- 1 | enable_tls = yes 2 | 3 | listen=TLS_SIP 4 | listen=TLS_ALG_SIP 5 | 6 | ####### TLS Parameters ######### 7 | loadmodule "tls.so" 8 | modparam("tls", "config", "/etc/kazoo/kamailio/tls.cfg") 9 | modparam("tls", "low_mem_threshold1", 0) 10 | -------------------------------------------------------------------------------- /rabbitmq/rabbitmq.config: -------------------------------------------------------------------------------- 1 | [ 2 | {rabbit, [{disk_free_limit, 5242880} 3 | ,{vm_memory_high_watermark, 0.8} 4 | ,{loopback_users, []} 5 | ]}, 6 | {rabbitmq_management, [{rates_mode, none}]}, 7 | {rabbitmq_management_agent, [{rates_mode, none}]} 8 | ]. 9 | -------------------------------------------------------------------------------- /system/logrotate.d/rabbitmq.conf: -------------------------------------------------------------------------------- 1 | /var/log/rabbitmq/*.log { 2 | daily 3 | missingok 4 | rotate 31 5 | compress 6 | delaycompress 7 | notifempty 8 | sharedscripts 9 | postrotate 10 | /usr/sbin/rabbitmqctl rotate_logs .`date +%Y%m%d` > /dev/null 11 | endscript 12 | } 13 | -------------------------------------------------------------------------------- /system/logrotate.d/freeswitch.conf: -------------------------------------------------------------------------------- 1 | /var/log/freeswitch/*.log { 2 | daily 3 | rotate 31 4 | nocreate 5 | compress 6 | delaycompress 7 | sharedscripts 8 | postrotate 9 | /bin/kill -HUP `cat /var/run/freeswitch/freeswitch.pid 2> /dev/null` 2> /dev/null || true 10 | endscript 11 | } 12 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/shout.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/syslog.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /system/logrotate.d/haproxy.conf: -------------------------------------------------------------------------------- 1 | /var/log/haproxy/haproxy.log { 2 | daily 3 | rotate 31 4 | missingok 5 | notifempty 6 | compress 7 | sharedscripts 8 | postrotate 9 | /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true 10 | /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true 11 | endscript 12 | } 13 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/console.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This repo is no longer valid! 2 | 3 | We have broken each component into its own repository: 4 | * https://github.com/2600hz/kazoo-configs-rabbitmq 5 | * https://github.com/2600hz/kazoo-configs-kamailio 6 | * https://github.com/2600hz/kazoo-configs-haproxy 7 | * https://github.com/2600hz/kazoo-configs-core 8 | * https://github.com/2600hz/kazoo-configs-freeswitch 9 | * https://github.com/2600hz/kazoo-configs-bigcouch 10 | -------------------------------------------------------------------------------- /system/logrotate.d/kazoo-core.conf: -------------------------------------------------------------------------------- 1 | /var/log/kazoo/*.log { 2 | daily 3 | missingok 4 | notifempty 5 | rotate 31 6 | maxage 5 7 | create 8 | compress 9 | delaycompress 10 | sharedscripts 11 | postrotate 12 | /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true 13 | /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true 14 | endscript 15 | } 16 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/http_cache.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /system/logrotate.d/bigcouch.conf: -------------------------------------------------------------------------------- 1 | /var/log/bigcouch/bigcouch.log { 2 | daily 3 | missingok 4 | notifempty 5 | rotate 31 6 | maxage 5 7 | copytruncate 8 | compress 9 | delaycompress 10 | sharedscripts 11 | postrotate 12 | /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true 13 | /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true 14 | endscript 15 | } 16 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/event_socket.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /kamailio/responder-role.cfg: -------------------------------------------------------------------------------- 1 | ####### Responder Logic ######## 2 | route[HANDLE_RESPOND] 3 | { 4 | $var(header) = $hdr(X-KAZOO-Respond-With); 5 | if (not_empty("$var(header)")) { 6 | $var(code) = $(var(header){s.substr,0,3}{s.int}); 7 | $var(msg) = $(var(header){s.substr,4,0}); 8 | xlog("L_INFO", "$ci|end|Responding with [$var(code)/$var(msg)]\n"); 9 | sl_send_reply("$var(code)", "$var(msg)"); 10 | exit(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /system/systemd/kazoo-ecallmgr.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Kazoo core application: ecallmgr 3 | After=syslog.target network.target 4 | 5 | [Service] 6 | User=kazoo 7 | Group=daemon 8 | PermissionsStartOnly=true 9 | LimitNOFILE=65536 10 | LimitCORE=infinity 11 | ExecStartPre=/usr/sbin/kazoo-ecallmgr prepare 12 | ExecStart=/usr/sbin/kazoo-ecallmgr start 13 | ExecStop=/usr/sbin/kazoo-ecallmgr stop 14 | Restart=on-abort 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /system/systemd/kazoo-applications.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Kazoo core applications 3 | After=syslog.target network.target 4 | 5 | [Service] 6 | User=kazoo 7 | Group=daemon 8 | PermissionsStartOnly=true 9 | LimitNOFILE=65536 10 | LimitCORE=infinity 11 | ExecStartPre=/usr/sbin/kazoo-applications prepare 12 | ExecStart=/usr/sbin/kazoo-applications start 13 | ExecStop=/usr/sbin/kazoo-applications stop 14 | Restart=on-abort 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /system/logrotate.d/kamailio.conf: -------------------------------------------------------------------------------- 1 | /var/log/kamailio/kamailio.log { 2 | daily 3 | size 500M 4 | nodateext 5 | missingok 6 | notifempty 7 | rotate 31 8 | maxage 5 9 | create 10 | compress 11 | delaycompress 12 | sharedscripts 13 | postrotate 14 | /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true 15 | /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true 16 | endscript 17 | } 18 | -------------------------------------------------------------------------------- /system/systemd/kazoo-bigcouch.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=BigCouch DB Configured for Kazoo 3 | After=syslog.target network.target 4 | 5 | [Service] 6 | Type=forking 7 | User=bigcouch 8 | Group=daemon 9 | PermissionsStartOnly=true 10 | LimitNOFILE=65536 11 | LimitCORE=infinity 12 | ExecStartPre=/usr/sbin/kazoo-bigcouch prepare 13 | ExecStart=/usr/sbin/kazoo-bigcouch background 14 | ExecStop=/usr/sbin/kazoo-bigcouch stop 15 | Restart=on-abort 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | -------------------------------------------------------------------------------- /system/systemd/kazoo-rabbitmq.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=RabbitMQ Broker Configured for Kazoo 3 | After=syslog.target network-online.target 4 | 5 | [Service] 6 | Type=notify 7 | User=rabbitmq 8 | Group=daemon 9 | PermissionsStartOnly=true 10 | LimitNOFILE=65536 11 | LimitCORE=infinity 12 | ExecStartPre=/usr/sbin/kazoo-rabbitmq prepare 13 | ExecStart=/usr/sbin/kazoo-rabbitmq start 14 | ExecStop=/usr/sbin/kazoo-rabbitmq stop 15 | Restart=on-abort 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | -------------------------------------------------------------------------------- /bigcouch/local.ini: -------------------------------------------------------------------------------- 1 | [admins] 2 | 3 | [chttpd] 4 | secret = 53e20840c5b911e28b8b0800200c9a66 5 | require_valid_user = false 6 | port = 5984 7 | bind_address = 0.0.0.0 8 | 9 | [httpd] 10 | secret = 53e20840c5b911e28b8b0800200c9a66 11 | require_valid_user = false 12 | port = 5986 13 | bind_address = 0.0.0.0 14 | 15 | [couchdb] 16 | database_dir = /srv/db 17 | view_index_dir = /srv/view_index 18 | 19 | [cluster] 20 | q=3 21 | r=2 22 | w=2 23 | n=3 24 | 25 | [log] 26 | file = /var/log/bigcouch/bigcouch.log 27 | -------------------------------------------------------------------------------- /system/systemd/kazoo-kamailio.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Kamailio (OpenSER) - the Open Source SIP Server Configured for Kazoo 3 | After=syslog.target network-online.target 4 | 5 | [Service] 6 | User=kamailio 7 | Group=daemon 8 | PermissionsStartOnly=true 9 | LimitNOFILE=65536 10 | LimitCORE=infinity 11 | ExecStartPre=/usr/sbin/kazoo-kamailio prepare 12 | ExecStart=/usr/sbin/kazoo-kamailio start 13 | ExecStop=/usr/sbin/kazoo-kamailio stop 14 | Restart=on-abort 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /system/systemd/kazoo-haproxy.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=HAProxy Load Balancer Configured for Kazoo 3 | After=syslog.target network.target 4 | 5 | [Service] 6 | User=root 7 | Group=daemon 8 | PermissionsStartOnly=true 9 | LimitNOFILE=65536 10 | PIDFile=/var/run/haproxy/kazoo-haproxy.pid 11 | Environment=HAPROXY_BIN=/usr/sbin/haproxy-systemd-wrapper 12 | ExecStartPre=/usr/sbin/kazoo-haproxy prepare 13 | ExecStart=/usr/sbin/kazoo-haproxy start 14 | ExecReload=/bin/kill -USR2 $MAINPID 15 | ExecStop=/usr/sbin/kazoo-haproxy stop 16 | Restart=on-abort 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /core/config.ini: -------------------------------------------------------------------------------- 1 | ; section are between [] = [section] 2 | ; key = value 3 | ; to comment add ";" in front of the line 4 | [amqp] 5 | uri = "amqp://guest:guest@127.0.0.1:5672" 6 | 7 | [bigcouch] 8 | compact_automatically = true 9 | cookie = change_me 10 | ip = "127.0.0.1" 11 | port = 15984 12 | ; username = "kazoo" 13 | ; password = "supermegaexcellenttelephonyplatform" 14 | admin_port = 15986 15 | 16 | [whistle_apps] 17 | cookie = change_me 18 | 19 | [kazoo_apps] 20 | cookie = change_me 21 | 22 | [ecallmgr] 23 | cookie = change_me 24 | 25 | [log] 26 | syslog = info 27 | console = notice 28 | file = error 29 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/sofia.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /freeswitch/lang/es/es_MX.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /freeswitch/lang/pt/pt_BR.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /freeswitch/lang/pt/pt_PT.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /freeswitch/lang/es/es_ES.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /freeswitch/lang/de/de.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 23 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/local_stream.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /system/systemd/kazoo-freeswitch.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=FreeSWITCH Configured for Kazoo 3 | After=syslog.target network-online.target 4 | 5 | [Service] 6 | User=freeswitch 7 | Group=daemon 8 | PermissionsStartOnly=true 9 | LimitNOFILE=65536 10 | LimitCORE=infinity 11 | # RuntimeDirectory is not yet supported in CentOS 7. A workaround is to use /etc/tmpfiles.d/freeswitch.conf 12 | # RuntimeDirectory=/run/freeswitch 13 | # RuntimeDirectoryMode=0750 14 | ExecStartPre=/usr/sbin/kazoo-freeswitch prepare 15 | ExecStart=/usr/sbin/kazoo-freeswitch start -nc -nf 16 | ExecReload=/usr/bin/kill -HUP $MAINPID 17 | Restart=on-abort 18 | PIDFile=/var/run/freeswitch/freeswitch.pid 19 | 20 | [Install] 21 | WantedBy=multi-user.target 22 | -------------------------------------------------------------------------------- /freeswitch/lang/he/he.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 23 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/kazoo.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /kamailio/accounting-role.cfg: -------------------------------------------------------------------------------- 1 | ####### Flags ####### 2 | flags 3 | FLAG_ACC: 8, 4 | FLAG_ACCMISSED: 9, 5 | FLAG_ACCFAILED: 10; 6 | 7 | ######## Accounting module ######## 8 | loadmodule "acc.so" 9 | 10 | ######## Accounting params ######## 11 | modparam("acc", "early_media", 0) 12 | modparam("acc", "report_ack", 0) 13 | modparam("acc", "report_cancels", 1) 14 | modparam("acc", "detect_direction", 0) 15 | modparam("acc", "log_flag", 7) 16 | modparam("acc", "log_level", 2) 17 | modparam("acc", "log_missed_flag", 8) 18 | modparam("acc", "failed_transaction_flag", 9) 19 | modparam("acc", "log_extra", 20 | "src_user=$fU;src_domain=$fd;src_ip=$si;" 21 | "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd") 22 | modparam("acc", "log_facility", "LOG_LOCAL6") 23 | -------------------------------------------------------------------------------- /freeswitch/lang/fr/demo/demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 30 | -------------------------------------------------------------------------------- /freeswitch/scripts/kazoo-sync.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #### KAZOO - FREESWITCH OFFLINE 4 | ## 5 | ## run this command in a whapps server on a kazoo cluster to obtain the synchronization key 6 | ## 7 | ## sup whapps_config get crossbar.freeswitch offline_configuration_key `sup wh_util rand_hex_binary 32 | sed s/[\<\"\>]*//g` | sed s/[\<\"\>]*//g 8 | ## 9 | ## to change the key use the following command 10 | ## 11 | ## sup whapps_config set crossbar.freeswitch offline_configuration_key `sup wh_util rand_hex_binary 32 | sed s/[\<\"\>]*//g` 12 | ## 13 | ## 14 | ## 15 | #### 16 | 17 | KEY=86d4f72ba888dba211fa2d17dcb558f0c8483e1ca5a048757b7d0e9204a3c24e 18 | 19 | curl --insecure https://your-kazoo-api-fqdn:8443/v2/freeswitch?key=${KEY} -o update.zip 20 | sudo unzip -o -d /etc/kazoo/freeswitch update.zip 21 | fs_cli --execute reloadxml 22 | -------------------------------------------------------------------------------- /system/security/limits.d/freeswitch.limits.conf: -------------------------------------------------------------------------------- 1 | freeswitch soft core unlimited 2 | freeswitch soft data unlimited 3 | freeswitch soft fsize unlimited 4 | freeswitch soft memlock unlimited 5 | freeswitch soft nofile 999999 6 | freeswitch soft rss unlimited 7 | freeswitch hard stack 240 8 | freeswitch soft cpu unlimited 9 | freeswitch soft nproc unlimited 10 | freeswitch soft as unlimited 11 | freeswitch soft priority -11 12 | freeswitch soft locks unlimited 13 | freeswitch soft sigpending unlimited 14 | freeswitch soft msgqueue unlimited 15 | freeswitch soft nice -11 16 | -------------------------------------------------------------------------------- /core/vm.args: -------------------------------------------------------------------------------- 1 | -setcookie change_me 2 | 3 | # Tell SASL not to log progress reports, and log SASL errors to a file 4 | -sasl errlog_type error 5 | -sasl sasl_error_logger '{file, "log/error_log.sasl"}' 6 | -boot start_sasl 7 | 8 | -kernel inet_dist_listen_min 11500 inet_dist_listen_max 11999 9 | 10 | # Use kernel poll functionality if supported by emulator 11 | +K true 12 | 13 | # Start a pool of asynchronous IO threads 14 | +A 25 15 | 16 | # Comment this line out if you want the Erlang shell 17 | +Bd 18 | 19 | # Treat error_logger:warning_msg/2 as warnings instead of errors (default) 20 | +W w 21 | 22 | # Hearbeat disbled by default 23 | ##-heart 24 | 25 | # GC more often 26 | ##-env ERL_FULLSWEEP_AFTER 10 27 | 28 | # Increase number of concurrent ports / sockets 29 | ##-env ERL_MAX_PORTS 4096 30 | 31 | -s lager 32 | -s kazoo_apps_app 33 | -------------------------------------------------------------------------------- /freeswitch/lang/fr/fr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 24 | -------------------------------------------------------------------------------- /system/security/limits.d/kazoo-core.limits.conf: -------------------------------------------------------------------------------- 1 | kazoo soft core unlimited 2 | kazoo soft data unlimited 3 | kazoo soft fsize unlimited 4 | kazoo soft memlock unlimited 5 | kazoo soft nofile 999999 6 | kazoo soft rss unlimited 7 | kazoo hard stack 240 8 | kazoo soft cpu unlimited 9 | kazoo soft nproc unlimited 10 | kazoo soft as unlimited 11 | kazoo soft priority -11 12 | kazoo soft locks unlimited 13 | kazoo soft sigpending unlimited 14 | kazoo soft msgqueue unlimited 15 | kazoo soft nice -11 16 | kazoo soft nofile 65536 17 | kazoo hard nofile 65536 18 | -------------------------------------------------------------------------------- /system/security/limits.d/haproxy.limits.conf: -------------------------------------------------------------------------------- 1 | haproxy soft core unlimited 2 | haproxy soft data unlimited 3 | haproxy soft fsize unlimited 4 | haproxy soft memlock unlimited 5 | haproxy soft nofile 999999 6 | haproxy soft rss unlimited 7 | haproxy hard stack 240 8 | haproxy soft cpu unlimited 9 | haproxy soft nproc unlimited 10 | haproxy soft as unlimited 11 | haproxy soft priority -11 12 | haproxy soft locks unlimited 13 | haproxy soft sigpending unlimited 14 | haproxy soft msgqueue unlimited 15 | haproxy soft nice -11 16 | haproxy soft nofile 65536 17 | haproxy hard nofile 65536 18 | -------------------------------------------------------------------------------- /system/security/limits.d/bigcouch.limits.conf: -------------------------------------------------------------------------------- 1 | bigcouch soft core unlimited 2 | bigcouch soft data unlimited 3 | bigcouch soft fsize unlimited 4 | bigcouch soft memlock unlimited 5 | bigcouch soft nofile 999999 6 | bigcouch soft rss unlimited 7 | bigcouch hard stack 240 8 | bigcouch soft cpu unlimited 9 | bigcouch soft nproc unlimited 10 | bigcouch soft as unlimited 11 | bigcouch soft priority -11 12 | bigcouch soft locks unlimited 13 | bigcouch soft sigpending unlimited 14 | bigcouch soft msgqueue unlimited 15 | bigcouch soft nice -11 16 | bigcouch soft nofile 65536 17 | bigcouch hard nofile 65536 18 | -------------------------------------------------------------------------------- /system/security/limits.d/kamailio.limits.conf: -------------------------------------------------------------------------------- 1 | kamailio soft core unlimited 2 | kamailio soft data unlimited 3 | kamailio soft fsize unlimited 4 | kamailio soft memlock unlimited 5 | kamailio soft nofile 999999 6 | kamailio soft rss unlimited 7 | kamailio hard stack 240 8 | kamailio soft cpu unlimited 9 | kamailio soft nproc unlimited 10 | kamailio soft as unlimited 11 | kamailio soft priority -11 12 | kamailio soft locks unlimited 13 | kamailio soft sigpending unlimited 14 | kamailio soft msgqueue unlimited 15 | kamailio soft nice -11 16 | kamailio soft nofile 65536 17 | kamailio hard nofile 65536 18 | -------------------------------------------------------------------------------- /system/security/limits.d/rabbitmq.limits.conf: -------------------------------------------------------------------------------- 1 | rabbitmq soft core unlimited 2 | rabbitmq soft data unlimited 3 | rabbitmq soft fsize unlimited 4 | rabbitmq soft memlock unlimited 5 | rabbitmq soft nofile 999999 6 | rabbitmq soft rss unlimited 7 | rabbitmq hard stack 240 8 | rabbitmq soft cpu unlimited 9 | rabbitmq soft nproc unlimited 10 | rabbitmq soft as unlimited 11 | rabbitmq soft priority -11 12 | rabbitmq soft locks unlimited 13 | rabbitmq soft sigpending unlimited 14 | rabbitmq soft msgqueue unlimited 15 | rabbitmq soft nice -11 16 | rabbitmq soft nofile 65536 17 | rabbitmq hard nofile 65536 18 | -------------------------------------------------------------------------------- /freeswitch/lang/ru/ru.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 24 | -------------------------------------------------------------------------------- /kamailio/kamailio.cfg: -------------------------------------------------------------------------------- 1 | ## NOTE: DO NOT CHANGE THIS FILE, EDIT local.cfg ## 2 | 3 | #### Preprocessor Directives ######### 4 | #!define L_ALERT -5 5 | #!define L_BUG -4 6 | #!define L_CRIT2 -3 7 | #!define L_CRIT -2 8 | #!define L_ERR -1 9 | #!define L_WARN 0 10 | #!define L_NOTICE 1 11 | #!define L_INFO 2 12 | #!define L_DBG 3 13 | 14 | #!define AVP_RECV_PARAM "recv_param" 15 | #!define AVP_LOG_LEVEL "log_level" 16 | #!define AVP_ROUTE_CNT "route_cnt" 17 | #!define AVP_ASSOCIATED_SERVER "associated_server" 18 | #!define AVP_ASSOCIATE_CONTACT "associate_contact" 19 | #!define AVP_REDIRECT_KEY "redirect_key" 20 | 21 | #!define FLB_NATB 1 22 | #!define FLB_NATSIPPING 2 23 | #!define FLB_UAC_REDIRECT 3 24 | #!define TRUSTED_ADR_GROUP 1 25 | 26 | ####### Local Configuration ######## 27 | include_file "local.cfg" 28 | 29 | ####### defaults not configured in local ######## 30 | include_file "defs.cfg" 31 | 32 | ####### Default Configuration ###### 33 | include_file "default.cfg" 34 | 35 | # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab 36 | -------------------------------------------------------------------------------- /bigcouch/vm.args: -------------------------------------------------------------------------------- 1 | # Each node in the system must have a unique name. A name can be short 2 | # (specified using -sname) or it can by fully qualified (-name). There can be 3 | # no communication between nodes running with the -sname flag and those running 4 | # with the -name flag. 5 | -name bigcouch 6 | 7 | # All nodes must share the same magic cookie for distributed Erlang to work. 8 | # Comment out this line if you synchronized the cookies by other means (using 9 | # the ~/.erlang.cookie file, for example). 10 | -setcookie change_me 11 | 12 | # Tell SASL not to log progress reports 13 | -sasl errlog_type error 14 | 15 | # Use kernel poll functionality if supported by emulator 16 | +K true 17 | 18 | # Start a pool of asynchronous IO threads 19 | +A 25 20 | 21 | # Set the max port value to be the same as limits.d/bigcouch.limits 22 | # +Q 65536 23 | -env ERL_MAX_PORTS 65536 24 | 25 | -kernel inet_dist_listen_min 11500 inet_dist_listen_max 11999 26 | 27 | # Comment this line out to enable the interactive Erlang shell on startup 28 | +Bd -noinput -detached 29 | 30 | -couch_ini /opt/bigcouch/etc/default.ini /etc/kazoo/bigcouch/local.ini 31 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/logfile.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /freeswitch/lang/en/en.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 26 | -------------------------------------------------------------------------------- /haproxy/haproxy.cfg: -------------------------------------------------------------------------------- 1 | global 2 | log /dev/log local0 info 3 | maxconn 4096 4 | user haproxy 5 | group daemon 6 | stats socket /var/run/haproxy/haproxy.sock mode 777 7 | 8 | defaults 9 | log global 10 | mode http 11 | option httplog 12 | option dontlognull 13 | option log-health-checks 14 | option redispatch 15 | option httpchk GET / 16 | option allbackups 17 | option http-server-close 18 | maxconn 2000 19 | retries 3 20 | timeout connect 6000ms 21 | timeout client 12000ms 22 | timeout server 12000ms 23 | 24 | listen bigcouch-data 127.0.0.1:15984 25 | balance roundrobin 26 | server db1.zone1.mydomain.com 127.0.0.1:5984 check 27 | server db2.zone1.mydomain.com 127.0.0.2:5984 check 28 | server db3.zone2.mydomain.com 127.0.0.3:5984 check backup 29 | server db4.zone2.mydomain.com 127.0.0.4:5984 check backup 30 | 31 | listen bigcouch-mgr 127.0.0.1:15986 32 | balance roundrobin 33 | server db1.zone1.mydomain.com 127.0.0.1:5986 check 34 | server db2.zone1.mydomain.com 127.0.0.2:5986 check 35 | server db3.zone2.mydomain.com 127.0.0.3:5986 check backup 36 | server db4.zone2.mydomain.com 127.0.0.4:5986 check backup 37 | 38 | listen haproxy-stats 127.0.0.1:22002 39 | mode http 40 | stats uri / 41 | -------------------------------------------------------------------------------- /system/init.d/kazoo-bigcouch.redhat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # BigCouch 4 | # 5 | # chkconfig: 345 13 87 6 | # description: BigCouch is a dynamo-style distributed database based on Apache CouchDB. 7 | # processname: bigcouch 8 | # pidfile: /var/run/bigcouch/kazoo-bigcouch.pid 9 | # 10 | 11 | RETVAL=0 12 | LOCK_FILE=${LOCK_FILE:-/var/lock/subsys/kazoo-bigcouch} 13 | 14 | . /etc/init.d/functions 15 | 16 | start() { 17 | echo -n $"Starting BigCouch: " 18 | /usr/sbin/kazoo-bigcouch prepare >/dev/null 2>&1 19 | daemon "/usr/sbin/kazoo-bigcouch background >/dev/null" 20 | RETVAL=$? 21 | if [ ${RETVAL} -eq 0 ]; then 22 | touch ${LOCK_FILE} 23 | success $"OK" 24 | echo 25 | else 26 | failure $"Bigcouch is already running or failed to start!" 27 | echo 28 | fi 29 | } 30 | 31 | stop() { 32 | echo -n $"Stopping BigCouch: " 33 | /usr/sbin/kazoo-bigcouch stop >/dev/null 2>&1 34 | RETVAL=$? 35 | if [ ${RETVAL} -eq 0 ]; then 36 | rm -f ${LOCK_FILE} ${pidfile} 37 | success $"OK" 38 | echo 39 | else 40 | failure $"Bigcouch is still running!" 41 | echo 42 | fi 43 | } 44 | 45 | status() { 46 | /usr/sbin/kazoo-bigcouch status 47 | RETVAL=$? 48 | } 49 | 50 | restart() { 51 | stop 52 | start 53 | } 54 | 55 | case "$1" in 56 | start) 57 | start 58 | ;; 59 | stop) 60 | stop 61 | ;; 62 | status) 63 | status 64 | ;; 65 | restart|reload) 66 | restart 67 | ;; 68 | condrestart) 69 | [ ! -e ${LOCK_FILE} ] && restart 70 | ;; 71 | *) 72 | echo $"Usage: $0 (start|stop|restart|status)" 73 | RETVAL=1 74 | esac 75 | 76 | exit ${RETVAL} 77 | -------------------------------------------------------------------------------- /kamailio/nat-traversal-role.cfg: -------------------------------------------------------------------------------- 1 | ######## NAT Traversal module - signaling functions ######## 2 | #!ifndef NATHELPER_LOADED 3 | loadmodule "nathelper.so" 4 | #!endif 5 | modparam("nathelper", "received_avp", "$avp(AVP_RECV_PARAM)") 6 | modparam("nathelper", "sipping_from", "sip:sipcheck@MY_HOSTNAME") 7 | 8 | ####### NAT Traversal Logic ######## 9 | route[NAT_TEST_AND_CORRECT] 10 | { 11 | if (is_present_hf("Record-Route")) { 12 | $var(i) = 0; 13 | $var(rr_count) = $rr_count; 14 | while($var(i) < $var(rr_count)) { 15 | $var(rr_base) = $(hdr(Record-Route)[$var(i)]); 16 | $var(rr_idx) = 0; 17 | $var(rr) = $(var(rr_base){s.select,$var(rr_idx),,}); 18 | while($var(rr) != $null && $var(rr) != "") { 19 | $var(i) = $var(i) + 1; 20 | if (!is_myself("$(var(rr){nameaddr.uri})")) { 21 | setflag(FLAG_SKIP_NAT_CORRECTION); 22 | } 23 | $var(rr_idx) = $var(rr_idx) + 1; 24 | $var(rr) = $(var(rr_base){s.select,$var(rr_idx),,}); 25 | } 26 | } 27 | } else if ($Rp == "5080") { 28 | setflag(FLAG_SKIP_NAT_CORRECTION); 29 | } 30 | 31 | if (isflagset(FLAG_SKIP_NAT_CORRECTION)) { 32 | return(); 33 | } 34 | 35 | if (nat_uac_test("3")) { 36 | force_rport(); 37 | fix_nated_contact(); 38 | } 39 | 40 | if (has_body("application/sdp") && nat_uac_test("8")) { 41 | fix_nated_sdp("10"); 42 | } 43 | } 44 | 45 | # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab 46 | -------------------------------------------------------------------------------- /core/sys.config: -------------------------------------------------------------------------------- 1 | [ 2 | {lager, [ 3 | {handlers, [ 4 | {lager_file_backend, [ 5 | {file, "log/error.log"}, {level, error}, {size, 10485760}, {date, "$D0"}, {count, 5} 6 | ,{formatter, lager_default_formatter} 7 | ,{formatter_config, [time," [",severity,"] ", "|", {callid, <<"0000000000">>}, "|", module, ":", line, " (",pid, ") ", message, "\n"]} 8 | ]} 9 | ,{lager_file_backend, [ 10 | {file, "log/console.log"}, {level, info}, {size, 10485760}, {date, "$D0"}, {count, 5} 11 | ,{formatter, lager_default_formatter} 12 | ,{formatter_config, [time," [",severity,"] ", "|", {callid, <<"0000000000">>}, "|", module, ":", line, " (",pid, ") ", message, "\n"]} 13 | ]} 14 | ,{lager_syslog_backend, ["2600hz", local0, debug 15 | ,{lager_default_formatter, ["|", {callid, <<"0000000000">>}, "|", module, ":", line, " (",pid, ") ", message, "\n"]} 16 | ]} 17 | ]} 18 | 19 | ,{extra_sinks, [{data_lager_event,[{handlers, [{lager_file_backend,[{file, "/dev/null"} ,{level, debug}]}]}]}]} 20 | ,{colored, false} 21 | ,{error_logger_hwm, 5000} 22 | ]} 23 | ]. 24 | -------------------------------------------------------------------------------- /system/init.d/kazoo-generic.redhat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # kazoo 4 | # 5 | # chkconfig: 345 85 87 6 | # description: Dubbed a "scalable, distributed, cloud-based" telephony platform 7 | # processname: kazoo 8 | # 9 | 10 | RETVAL=0 11 | SCRIPT_NAME=`basename "$0"` 12 | LOCK_FILE=${LOCK_FILE:-/var/lock/subsys/${SCRIPT_NAME}} 13 | 14 | . /etc/init.d/functions 15 | 16 | if [ "${NETWORKING}" = "no" ]; then 17 | exit 0 18 | fi 19 | 20 | start() { 21 | echo -n $"Starting ${SCRIPT_NAME}: " 22 | /usr/sbin/${SCRIPT_NAME} prepare >/dev/null 2>&1 23 | daemon "/usr/sbin/${SCRIPT_NAME} background >/dev/null" 24 | RETVAL=$? 25 | if [ ${RETVAL} -eq 0 ]; then 26 | touch ${LOCK_FILE} 27 | success $"OK" 28 | echo 29 | else 30 | failure $"Kazoo ${SCRIPT_NAME#*-} is already running or failed to start!" 31 | echo 32 | fi 33 | } 34 | 35 | stop() { 36 | echo -n $"Stopping ${SCRIPT_NAME}: " 37 | /usr/sbin/${SCRIPT_NAME} stop >/dev/null 2>&1 38 | RETVAL=$? 39 | if [ ${RETVAL} -eq 0 ]; then 40 | rm -f ${LOCK_FILE} ${pidfile} 41 | success $"OK" 42 | echo 43 | else 44 | failure $"Kazoo ${SCRIPT_NAME#*-} is still running!" 45 | echo 46 | fi 47 | } 48 | 49 | status() { 50 | /usr/sbin/${SCRIPT_NAME} status 51 | RETVAL=$? 52 | } 53 | 54 | restart() { 55 | stop 56 | start 57 | } 58 | 59 | case "$1" in 60 | start) 61 | start 62 | ;; 63 | stop) 64 | stop 65 | ;; 66 | status) 67 | status 68 | ;; 69 | restart|reload) 70 | restart 71 | ;; 72 | condrestart) 73 | [ ! -e ${LOCK_FILE} ] && restart 74 | ;; 75 | *) 76 | echo $"Usage: $0 (start|stop|restart|status)" 77 | RETVAL=1 78 | esac 79 | 80 | exit ${RETVAL} 81 | -------------------------------------------------------------------------------- /kamailio/defs.cfg: -------------------------------------------------------------------------------- 1 | ## NOTE: DO NOT CHANGE THIS FILE, EDIT local.cfg ## 2 | 3 | 4 | ####### defs ######## 5 | 6 | #!ifndef KAZOO_LOG_LEVEL 7 | #!define KAZOO_LOG_LEVEL L_INFO 8 | #!endif 9 | 10 | #!ifndef KAZOO_DATA_DIR 11 | #!substdef "!KAZOO_DATA_DIR!/etc/kazoo/kamailio/db!g" 12 | #!endif 13 | 14 | #!ifndef KAZOO_DB_URL 15 | #!substdef "!KAZOO_DB_URL!kazoo:///KAZOO_DATA_DIR/kazoo.db!g" 16 | #!endif 17 | 18 | #!ifndef MAX_WHILE_LOOPS 19 | #!substdef "!MAX_WHILE_LOOPS!500!g" 20 | #!endif 21 | 22 | #!ifndef OPENBTS_AUTH_SECRET 23 | #!substdef "!OPENBTS_AUTH_SECRET!b3a54fa8317c7d9cb1d89d8970947b30eda273124d97fc3a079ccc98ecc2569b!g" 24 | #!endif 25 | 26 | #!ifndef KZ_USE_DISPATCHER_LIST 27 | #!trydef KZ_USE_DISPATCHER_TABLE 28 | #!endif 29 | 30 | #!ifndef ANTIFLOOD_CACHE_PERIOD 31 | #!substdef "!ANTIFLOOD_CACHE_PERIOD!600!g" 32 | #!endif 33 | 34 | #!ifndef MY_AMQP_MAX_CHANNELS 35 | #!define MY_AMQP_MAX_CHANNELS 25 36 | #!endif 37 | 38 | #!ifndef MY_AMQP_CONSUMER_PROCESSES 39 | #!define MY_AMQP_CONSUMER_PROCESSES 4 40 | #!endif 41 | 42 | #!ifndef MY_AMQP_CONSUMER_WORKERS 43 | #!define MY_AMQP_CONSUMER_WORKERS 16 44 | #!endif 45 | 46 | #!ifndef MY_AMQP_HEARTBEATS 47 | #!define MY_AMQP_HEARTBEATS 5 48 | #!endif 49 | 50 | #!ifndef BLF_USE_SINGLE_DIALOG 51 | #!define BLF_USE_SINGLE_DIALOG 1 52 | #!endif 53 | 54 | #!ifndef MY_AMQP_ZONE 55 | #!substdef "!MY_AMQP_ZONE!local!g" 56 | #!endif 57 | 58 | #!ifndef DISPATCHER_ADD_SERVERS 59 | #!define DISPATCHER_ADD_SERVERS 1 60 | #!endif 61 | 62 | #!ifndef PRESENCE_RESET_BLF_DEFER_UPDATE 63 | #!define PRESENCE_RESET_BLF_DEFER_UPDATE 0 64 | #!endif 65 | 66 | # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab 67 | -------------------------------------------------------------------------------- /system/init.d/kazoo-kamailio.redhat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Startup script for Kamailio 4 | # 5 | # chkconfig: 345 85 15 6 | # description: Kamailio is a fast, reliable and flexible SIP Server. 7 | # processname: kamailio 8 | # pidfile: /var/run/kamailio/kazoo-kamailio.pid 9 | # config: /etc/kazoo/kamailio/kamailio.cfg 10 | # 11 | 12 | RETVAL=0 13 | LOCK_FILE=/var/lock/subsys/kazoo-kamailio 14 | 15 | . /etc/rc.d/init.d/functions 16 | 17 | start() { 18 | echo -n $"Starting Kamailio: " 19 | /usr/sbin/kazoo-kamailio prepare >/dev/null 2>&1 20 | daemon "/usr/sbin/kazoo-kamailio background >/dev/null" 21 | RETVAL=$? 22 | if [ ${RETVAL} -eq 0 ]; then 23 | touch ${LOCK_FILE} 24 | success $"OK" 25 | echo 26 | else 27 | failure $"Kamailio is already running or failed to start!" 28 | echo 29 | fi 30 | } 31 | 32 | stop() { 33 | echo -n $"Stopping Kamailio: " 34 | /usr/sbin/kazoo-kamailio stop >/dev/null 2>&1 35 | RETVAL=$? 36 | if [ ${RETVAL} -eq 0 ]; then 37 | rm -f ${LOCK_FILE} ${pidfile} 38 | success $"OK" 39 | echo 40 | else 41 | failure $"Kamailio is still running!" 42 | echo 43 | fi 44 | } 45 | 46 | status() { 47 | /usr/sbin/kazoo-kamailio status 48 | RETVAL=$? 49 | } 50 | 51 | restart() { 52 | stop 53 | start 54 | } 55 | 56 | case "$1" in 57 | start) 58 | start 59 | ;; 60 | stop) 61 | stop 62 | ;; 63 | status) 64 | status 65 | ;; 66 | check) 67 | /usr/sbin/kazoo-kamailio check 68 | ;; 69 | restart|reload) 70 | restart 71 | ;; 72 | condrestart) 73 | [ ! -e ${LOCK_FILE} ] && restart 74 | ;; 75 | *) 76 | echo $"Usage: $0 (start|stop|restart|status|check)" 77 | RETVAL=1 78 | esac 79 | 80 | exit ${RETVAL} 81 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/opus.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /system/init.d/kazoo-rabbitmq.redhat: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # rabbitmq-server RabbitMQ broker 4 | # 5 | # chkconfig: - 80 05 6 | # description: Enable AMQP service provided by RabbitMQ 7 | # 8 | # Provides: rabbitmq-server 9 | # Required-Start: $remote_fs $network 10 | # Required-Stop: $remote_fs $network 11 | # Description: RabbitMQ broker 12 | # Short-Description: Enable AMQP service provided by RabbitMQ broker 13 | 14 | RETVAL=0 15 | LOCK_FILE=${LOCK_FILE:-/var/lock/subsys/kazoo-rabbitmq} 16 | 17 | . /etc/init.d/functions 18 | 19 | start() { 20 | echo -n $"Starting RabbitMQ: " 21 | /usr/sbin/kazoo-rabbitmq prepare >/dev/null 2>&1 22 | daemon "/usr/sbin/kazoo-rabbitmq background >/dev/null" 23 | RETVAL=$? 24 | if [ ${RETVAL} -eq 0 ]; then 25 | touch ${LOCK_FILE} 26 | success $"OK" 27 | echo 28 | else 29 | failure $"RabbitMQ is already running or failed to start!" 30 | echo 31 | fi 32 | } 33 | 34 | stop() { 35 | echo -n $"Stopping RabbitMQ: " 36 | /usr/sbin/kazoo-rabbitmq stop >/dev/null 2>&1 37 | RETVAL=$? 38 | if [ ${RETVAL} -eq 0 ]; then 39 | rm -f ${LOCK_FILE} ${pidfile} 40 | success $"OK" 41 | echo 42 | else 43 | failure $"RabbitMQ is still running!" 44 | echo 45 | fi 46 | } 47 | 48 | status() { 49 | /usr/sbin/kazoo-rabbitmq status 50 | RETVAL=$? 51 | } 52 | 53 | restart() { 54 | stop 55 | start 56 | } 57 | 58 | case "$1" in 59 | start) 60 | start 61 | ;; 62 | stop) 63 | stop 64 | ;; 65 | status) 66 | status 67 | ;; 68 | restart|reload) 69 | restart 70 | ;; 71 | condrestart) 72 | [ ! -e ${LOCK_FILE} ] && restart 73 | ;; 74 | *) 75 | echo $"Usage: $0 (start|stop|restart|status)" 76 | RETVAL=1 77 | esac 78 | 79 | exit ${RETVAL} 80 | -------------------------------------------------------------------------------- /kamailio/traffic-filter-role.cfg: -------------------------------------------------------------------------------- 1 | route[FILTER_REQUEST] 2 | { 3 | # allow request from internal network or from whitelist 4 | if (isflagset(FLAG_TRUSTED_SOURCE)) { 5 | return; 6 | } 7 | 8 | # drop requests with no To domain or IP To domain (friendly-scanner) 9 | if (is_method("REGISTER|SUBSCRIBE")) { 10 | route(FILTER_TO_DOMAIN); 11 | route(FILTER_FROM_DOMAIN); 12 | } 13 | 14 | # drop Invite with IP auth realm 15 | if (is_method("INVITE")) { 16 | route(FILTER_REQUEST_DOMAIN); 17 | route(FILTER_AUTHORIZATION_DOMAIN); 18 | } 19 | } 20 | 21 | route[FILTER_REQUEST_DOMAIN] 22 | { 23 | if ($rd =~ "[0-9]{1,3}\.[0-9]{1,3}.[0-9]{1,3}\.[0-9]{1,3}") { 24 | xlog("L_WARN", "$ci|end|dropping $rm request with IP domain\n"); 25 | drop(); 26 | exit(); 27 | } 28 | } 29 | 30 | route[FILTER_AUTHORIZATION_DOMAIN] 31 | { 32 | if (is_present_hf("Proxy-Authorization") && 33 | $ar =~ "[0-9]{1,3}\.[0-9]{1,3}.[0-9]{1,3}\.[0-9]{1,3}" ) { 34 | xlog("L_WARN", "$ci|end|dropping request with IP domain in Proxy-Authorization header\n"); 35 | drop(); 36 | exit; 37 | } 38 | } 39 | 40 | route[FILTER_TO_DOMAIN] 41 | { 42 | if ($fd =~ "([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})") { 43 | xlog("L_WARN", "$ci|end|dropping request with IP domain in From header\n"); 44 | drop(); 45 | exit; 46 | } 47 | } 48 | 49 | route[FILTER_FROM_DOMAIN] 50 | { 51 | if ($td =~ "([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})") { 52 | xlog("L_WARN", "$ci|end|dropping request with IP domain in To header\n"); 53 | drop(); 54 | exit; 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /kamailio/kazoo-bindings.cfg: -------------------------------------------------------------------------------- 1 | ######## kazoo bindings ######## 2 | ### use this simple form of binding a listener 3 | ### kazoo_subscribe("dialoginfo", "direct", "BLF-QUEUE-MY_HOSTNAME", "BLF-MY_HOSTNAME"); 4 | ### 5 | ### or unleash the power of rabbit to kazoo-blf 6 | ### 7 | ### 'no_ack' : 1 => needs ack, 8 | ### 'wait_for_consumer_ack' 9 | ### : 1 => when it receives, it processses on the AMQP Worker ad after that it confirms 10 | ### : 0 => when it receives, it acks then processes in the AMQP Worker 11 | ### only works if no_ack : 0 12 | ### 13 | ### Rabbit Policy for ha-mode 14 | ### pattern : ^BLF 15 | ### definition : ha-mode: all 16 | ### 17 | ### 18 | 19 | event_route[kazoo:mod-init] 20 | { 21 | 22 | #!ifdef PRESENCE_ROLE 23 | route(PRESENCE_BINDINGS); 24 | #!endif 25 | 26 | #!ifdef MESSAGE_ROLE 27 | route(MESSAGE_BINDINGS); 28 | #!endif 29 | 30 | #!ifdef REGISTRAR_ROLE 31 | route(REGISTRAR_BINDINGS); 32 | #!endif 33 | 34 | #!ifdef NODES_ROLE 35 | route(NODES_BINDINGS); 36 | #!endif 37 | 38 | #!ifdef ACL_ROLE 39 | $var(payload) = "{ 'exchange' : 'frontier_acl' , 'type' : 'topic', 'queue' : 'FRONTIERACL-FLUSH-MY_HOSTNAME', 'routing' : 'flush' }"; 40 | kazoo_subscribe("$var(payload)"); 41 | #!endif 42 | 43 | #!import_file "kazoo-custom-bindings.cfg" 44 | 45 | } 46 | 47 | event_route[kazoo:consumer-event] 48 | { 49 | xlog("L_INFO","unhandled AMQP event, payload: $kzE\n"); 50 | } 51 | 52 | event_route[kazoo:consumer-event-connection-open] 53 | { 54 | xlog("L_INFO","connection to $(kzE{kz.json,host}) opened\n"); 55 | } 56 | 57 | event_route[kazoo:consumer-event-connection-closed] 58 | { 59 | xlog("L_INFO","connection to $(kzE{kz.json,host}) closed\n"); 60 | } 61 | 62 | # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab 63 | -------------------------------------------------------------------------------- /kamailio/tls.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # $Id$ 3 | # 4 | # Example Kamailio TLS Configuration File 5 | # 6 | 7 | # This is the default server domain, settings 8 | # in this domain will be used for all incoming 9 | # connections that do not match any other server 10 | # domain in this configuration file. 11 | # 12 | # We do not enable anything else than TLSv1 13 | # over the public internet. Clients do not have 14 | # to present client certificates by default. 15 | # 16 | [server:default] 17 | method = SSLv23 18 | verify_certificate = no 19 | require_certificate = no 20 | #crl = /etc/kazoo/kamailio/certs/crl.pem 21 | certificate = /etc/kazoo/kamailio/certs/cert.pem 22 | private_key = /etc/kazoo/kamailio/certs/key.pem 23 | #ca_list = /etc/kazoo/kamailio/certs/ca.pem 24 | 25 | # This is the default client domain, settings 26 | # in this domain will be used for all outgoing 27 | # TLS connections that do not match any other 28 | # client domain in this configuration file. 29 | # We require that servers present valid certificate. 30 | # 31 | [client:default] 32 | verify_certificate = no 33 | require_certificate = no 34 | 35 | # This is an example server domain for TLS connections 36 | # received from the loopback interface. We allow 37 | # the use of SSLv2 and SSLv3 protocols here, we do 38 | # not require that clients present client certificates 39 | # but if they present it it must be valid. We also use 40 | # a special certificate and CA list for loopback 41 | # interface. 42 | # 43 | #[server:127.0.0.1:5061] 44 | #method = SSLv23 45 | #verify_certificate = yes 46 | #require_certificate = no 47 | #private_key = /etc/kazoo/kamailio/certs/local_key.pem 48 | #certificate = /etc/kazoo/kamailio/certs/local_cert.pem 49 | #verify_depth = 3 50 | #ca_list = /etc/kazoo/kamailio/certs/local_ca.pem 51 | #crl = /etc/kazoo/kamailio/certs/local_crl.pem 52 | 53 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/modules.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /system/sbin/kazoo-rabbitmq: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | if [ -f /etc/default/rabbitmq ]; then 4 | . /etc/default/rabbitmq 5 | fi 6 | 7 | RETVAL=1 8 | USER=${RABBITMQ_USER-rabbitmq} 9 | BIN_FILE=${RABBITMQ_BIN:-/usr/lib/rabbitmq/bin/rabbitmq-server} 10 | PID_FILE=${RABBITMQ_PID:-/var/run/rabbitmq/kazoo-rabbitmq.pid} 11 | CFG_FILE=${RABBITMQ_ENV:-/etc/kazoo/rabbitmq/rabbitmq-env.conf} 12 | 13 | while read LINE; do 14 | export RABBITMQ_$LINE 15 | done < ${CFG_FILE} 16 | 17 | if [ -f /etc/sysconfig/rabbitmq ]; then 18 | . /etc/sysconfig/rabbitmq 19 | fi 20 | 21 | export HOME=${RABBITMQ_HOME-/var/lib/rabbitmq} 22 | export RABBITMQ_CONFIG_FILE=/etc/kazoo/rabbitmq/rabbitmq 23 | export RABBITMQ_ENABLED_PLUGINS_FILE=/etc/kazoo/rabbitmq/enabled_plugins 24 | export RABBITMQ_NODENAME=kazoo-rabbitmq 25 | 26 | prepare() { 27 | rm -rf /var/lib/rabbitmq/mnesia/kazoo-rabbit* 28 | mkdir -p ${HOME} 29 | chown -R ${USER} ${HOME} 30 | mkdir -p /var/log/rabbitmq 31 | chown -R ${USER} /var/log/rabbitmq 32 | mkdir -p /var/run/rabbitmq 33 | chown -R ${USER} /var/run/rabbitmq 34 | if [ -e ${PID_FILE} ]; then 35 | rm -rf ${PID_FILE} 36 | fi 37 | RETVAL=$? 38 | } 39 | 40 | start() { 41 | cd ${HOME} 42 | 43 | if /usr/lib/rabbitmq/bin/rabbitmqctl status > /dev/null 2>&1; then 44 | echo "RabbitMQ is already running!" 45 | return 46 | fi 47 | 48 | set -- ${BIN_FILE} "$@" 49 | if [ "$(whoami)" == "${USER}" ]; then 50 | exec "$@" 51 | else 52 | runuser -s /bin/bash ${USER} -c "$*" 53 | fi 54 | RETVAL=$? 55 | 56 | if [ ${RETVAL} -ne 0 ]; then 57 | echo "Failed to start RabbitMQ!" 58 | RETVAL=1 59 | fi 60 | } 61 | 62 | case "$1" in 63 | prepare) 64 | prepare 65 | ;; 66 | background) 67 | shift 68 | start "-detached" $@ 69 | ;; 70 | start) 71 | shift 72 | start "$@" 73 | ;; 74 | *) 75 | exec /usr/lib/rabbitmq/bin/rabbitmqctl $@ 76 | RETVAL=$? 77 | ;; 78 | esac 79 | 80 | exit ${RETVAL} 81 | -------------------------------------------------------------------------------- /kamailio/registrar-sync-role.cfg: -------------------------------------------------------------------------------- 1 | ######## Presence sync server module ######## 2 | 3 | event_route[kazoo:consumer-event-directory-reg-sync] 4 | { 5 | $var(Server) = $(kzE{kz.json,Server-ID}); 6 | xlog("L_INFO", "received registrar sync from $var(Server) : $kzE\n"); 7 | 8 | if (sql_xquery("cb", "select * from location", "ra") == 1) 9 | { 10 | while($xavp(ra) != $null) { 11 | $var(runloop) = 1; 12 | while($xavp(ra) != $null && $var(runloop) < MAX_WHILE_LOOPS ) { 13 | if(registered("location", "sip:$xavp(ra=>username)@$xavp(ra=>domain)", 0, 1)) { 14 | xlog("L_INFO", "[id, username, domain] = [$xavp(ra=>id), $xavp(ra=>username), $xavp(ra=>domain)]\n"); 15 | $var(Expires) = $xavp(ra=>expires) - $TS; 16 | $var(amqp_payload_request) = '{"Event-Category" : "directory", "Event-Name" : "reg_success", "Status" : "Success", "Event-Timestamp" : $TS, "Expires" : $(var(Expires){s.int}), "First-Registration" : false, "Contact" : "$(xavp(ra=>contact){s.escape.common})", "Call-ID" : "$xavp(ra=>callid)", "Realm" : "$xavp(ra=>domain)", "Username" : "$xavp(ra=>username)", "From-User" : "$xavp(ra=>username)", "From-Host" : "$xavp(ra=>domain)", "To-User" : "$xavp(ra=>username)", "To-Host" : "$xavp(ra=>domain)", "User-Agent" : "$(xavp(ra=>user_agent){s.escape.common})" , "Custom-Channel-Vars" : $xavp(ulattrs=>custom_channel_vars), "Proxy-Path" : "sip:$(xavp(ra=>socket){s.substr,4,0})" }'; 17 | kazoo_publish("targeted", "$var(Server)", $var(amqp_payload_request)); 18 | } 19 | pv_unset("$xavp(ra)"); 20 | $var(runloop) = $var(runloop) + 1; 21 | } 22 | } 23 | } 24 | 25 | } 26 | 27 | route[REGISTRAR_SYNC_BINDINGS] 28 | { 29 | $var(payload) = "{ 'exchange' : 'registrar' , 'type' : 'topic', 'queue' : 'registrar-sync-MY_HOSTNAME', 'routing' : 'registration.sync' }"; 30 | kazoo_subscribe("$var(payload)"); 31 | } 32 | -------------------------------------------------------------------------------- /system/init.d/kazoo-freeswitch.redhat: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # /etc/rc.d/init.d/freeswitch 4 | # 5 | # The FreeSWITCH Open Source Voice Platform 6 | # 7 | # chkconfig: 345 89 14 8 | # description: Starts and stops the freeswitch server daemon 9 | # processname: freeswitch 10 | # config: /etc/kazoo/freeswitch/freeswitch.xml 11 | # pidfile: /var/run/freeswitch/kazoo-freeswitch.pid 12 | # 13 | 14 | RETVAL=0 15 | LOCK_FILE=/var/lock/subsys/kazoo-freeswitch 16 | 17 | . /etc/init.d/functions 18 | 19 | start() { 20 | echo -n "Starting FreeSWITCH: " 21 | /usr/sbin/kazoo-freeswitch prepare >/dev/null 2>&1 22 | daemon "/usr/sbin/kazoo-freeswitch background >/dev/null" 23 | RETVAL=$? 24 | if [ ${RETVAL} -eq 0 ]; then 25 | touch ${LOCK_FILE} 26 | success $"OK" 27 | echo 28 | else 29 | failure $"FreeSWITCH is already running or failed to start!" 30 | echo 31 | fi 32 | } 33 | 34 | stop() { 35 | echo -n "Shutting down FreeSWITCH: " 36 | /usr/sbin/kazoo-freeswitch stop >/dev/null 2>&1 37 | RETVAL=$? 38 | if [ ${RETVAL} -eq 0 ]; then 39 | rm -f ${LOCK_FILE} ${pidfile} 40 | success $"OK" 41 | echo 42 | else 43 | failure $"FreeSWITCH is still running!" 44 | echo 45 | fi 46 | } 47 | 48 | status() { 49 | /usr/sbin/kazoo-freeswitch status 50 | RETVAL=$? 51 | } 52 | 53 | restart() { 54 | stop 55 | start 56 | } 57 | 58 | case "$1" in 59 | start) 60 | start 61 | ;; 62 | stop) 63 | stop 64 | ;; 65 | status) 66 | status 67 | ;; 68 | restart|reload) 69 | restart 70 | ;; 71 | condrestart) 72 | [ ! -e ${LOCK_FILE} ] && restart 73 | ;; 74 | *) 75 | echo $"Usage: $0 (start|stop|restart|status)" 76 | RETVAL=1 77 | esac 78 | 79 | exit ${RETVAL} 80 | -------------------------------------------------------------------------------- /kamailio/pusher-role.cfg: -------------------------------------------------------------------------------- 1 | ## PUSHER ROLE 2 | 3 | ####### SQL OPS module ########## 4 | #!ifndef TSILO_LOADED 5 | loadmodule "tsilo.so" 6 | #!trydef TSILO_LOADED 7 | #!endif 8 | 9 | route[PUSHER_ROUTE] 10 | { 11 | if ( (!is_method("INVITE")) || (!isflagset(FLAG_INTERNALLY_SOURCED)) || $hdr(X-KAZOO-PUSHER-Token-ID) == $null) 12 | return; 13 | 14 | if(registered("location")) { 15 | return; 16 | } 17 | 18 | xlog("L_INFO", "$ci| pusher received request to wakeup $tu\n"); 19 | sl_send_reply(180, "waking the dead guy"); 20 | if (t_newtran()) { 21 | route(SEND_PUSH_NOTIFICATION); 22 | t_on_reply("EXTERNAL_REPLY"); 23 | t_set_fr(0, 10000); 24 | remove_hf_re("^X-.*"); 25 | t_save_lumps(); 26 | ts_store(); 27 | t_release(); 28 | } else { 29 | sl_send_reply(500, "error creating transaction for waking the dead guy"); 30 | } 31 | exit; 32 | } 33 | 34 | route[SEND_PUSH_NOTIFICATION] 35 | { 36 | $var(TokenID) = $hdr(X-KAZOO-PUSHER-Token-ID); 37 | $var(TokenType) = $hdr(X-KAZOO-PUSHER-Token-Type); 38 | $var(TokenApp) = $hdr(X-KAZOO-PUSHER-Token-App); 39 | $var(rp) = $hdr(Remote-Party-ID); 40 | $var(from) = $(var(rp){tobody.user}) + " - " + $(var(rp){tobody.display}{s.escape.common}); 41 | $var(Payload) = '{ "Event-Category" : "notification", "Event-Name" : "push_req", "Call-ID" : "$ci", "Token-ID" : "$var(TokenID)", "Token-Type" : "$var(TokenType)", "Token-App" : "$var(TokenApp)", "Alert-Body" : "$var(from)" }'; 42 | $var(RoutingKey) = "notification.push." + $var(TokenType) + "." + $var(TokenID); 43 | $var(exchange) = "pushes"; 44 | kazoo_publish($var(exchange), $var(RoutingKey), $var(Payload)); 45 | } 46 | 47 | route[PUSHER_ON_REGISTRATION] 48 | { 49 | if($(xavp(ulattrs=>custom_channel_vars){kz.json,Pusher-Application}{s.len}) > 0 && $var(Status) == "Registered") { 50 | xlog("L_INFO", "$ci| pusher ON_REGISTRATION - $(xavp(ulattrs=>custom_channel_vars){kz.json,Pusher-Application})\n"); 51 | ts_append("location", "$tu"); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /system/init.d/kazoo-haproxy.redhat: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # haproxy 4 | # 5 | # chkconfig: - 85 15 6 | # description: HAProxy is a free, very fast and reliable solution \ 7 | # offering high availability, load balancing, and \ 8 | # proxying for TCP and HTTP-based applications 9 | # processname: haproxy 10 | # config: /etc/kazoo/haproxy/haproxy.cfg 11 | # pidfile: /var/run/haproxy/kazoo-haproxy.pid 12 | 13 | RETVAL=0 14 | LOCK_FILE=/var/lock/subsys/kazoo-haproxy 15 | 16 | . /etc/rc.d/init.d/functions 17 | 18 | start() { 19 | echo -n $"Starting HAProxy: " 20 | /usr/sbin/kazoo-haproxy prepare >/dev/null 2>&1 21 | daemon "/usr/sbin/kazoo-haproxy background >/dev/null" 22 | RETVAL=$? 23 | if [ ${RETVAL} -eq 0 ]; then 24 | touch ${LOCK_FILE} 25 | success $"OK" 26 | echo 27 | else 28 | failure $"HAProxy is already running or failed to start!" 29 | echo 30 | fi 31 | } 32 | 33 | stop() { 34 | echo -n $"Stopping HAProxy: " 35 | /usr/sbin/kazoo-haproxy stop >/dev/null 2>&1 36 | RETVAL=$? 37 | if [ ${RETVAL} -eq 0 ]; then 38 | rm -f ${LOCK_FILE} ${pidfile} 39 | success $"OK" 40 | echo 41 | else 42 | failure $"HAProxy is still running!" 43 | echo 44 | fi 45 | } 46 | 47 | status() { 48 | /usr/sbin/kazoo-haproxy status 49 | RETVAL=$? 50 | } 51 | 52 | restart() { 53 | stop 54 | start 55 | } 56 | 57 | case "$1" in 58 | start) 59 | start 60 | ;; 61 | stop) 62 | stop 63 | ;; 64 | status) 65 | status 66 | ;; 67 | check) 68 | /usr/sbin/kazoo-haproxy check 69 | ;; 70 | restart|reload) 71 | restart 72 | ;; 73 | condrestart) 74 | [ ! -e ${LOCK_FILE} ] && restart 75 | ;; 76 | *) 77 | echo $"Usage: $0 (start|stop|restart|status|check)" 78 | RETVAL=1 79 | esac 80 | 81 | exit ${RETVAL} 82 | -------------------------------------------------------------------------------- /freeswitch/lang/en/demo/funnies.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /system/sbin/kazoo-bigcouch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f /etc/default/bigcouch ]; then 4 | . /etc/default/bigcouch 5 | fi 6 | 7 | if [ -f /etc/sysconfig/bigcouch ]; then 8 | . /etc/sysconfig/bigcouch 9 | fi 10 | 11 | RETVAL=1 12 | USER=${BIGCOUCH_USER:-bigcouch} 13 | BIN_FILE=${BIGCOUCH_BIN:-/opt/bigcouch/bin/bigcouch} 14 | PID_FILE=${BIGCOUCH_PID:-/var/run/bigcouch/kazoo-bigcouch.pid} 15 | export HOME=${BIGCOUCH_HOME:-/srv} 16 | 17 | # Detect core count 18 | CORES=`grep -E "^processor" /proc/cpuinfo |wc -l` 19 | if [ "${CORES}" = "1" ]; then 20 | BEAM=beam 21 | else 22 | BEAM=beam.smp 23 | fi 24 | 25 | prepare() { 26 | mkdir -p ${HOME} 27 | chown -R ${USER} ${HOME} 28 | mkdir -p /var/log/bigcouch 29 | chown -R ${USER} /var/log/bigcouch 30 | mkdir -p /var/run/bigcouch 31 | chown -R ${USER} /var/run/bigcouch 32 | if [ -e ${PID_FILE} ]; then 33 | rm -rf ${PID_FILE} 34 | fi 35 | RETVAL=$? 36 | } 37 | 38 | start() { 39 | cd ${HOME} 40 | 41 | set -- ${BIN_FILE} "$@" 42 | if [ "$(whoami)" == "${USER}" ]; then 43 | exec "$@" 44 | else 45 | runuser -s /bin/bash ${USER} -c "$*" 46 | fi 47 | RETVAL=$? 48 | 49 | if [ ${RETVAL} -ne 0 ]; then 50 | echo "Failed to start BigCouch!" 51 | RETVAL=1 52 | fi 53 | } 54 | 55 | stop() { 56 | for i in `pidof ${BEAM}`; do 57 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+bigcouch"; then 58 | kill $i 59 | RETVAL=$? 60 | fi 61 | done 62 | } 63 | 64 | restart() { 65 | stop 66 | start 67 | } 68 | 69 | status() { 70 | for i in `pidof ${BEAM}`; do 71 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+bigcouch"; then 72 | echo "BigCouch (pid $i) is running..." 73 | if which curl &>/dev/null; then 74 | curl localhost:5984/_membership 75 | fi 76 | RETVAL=0 77 | fi 78 | done 79 | if [ ${RETVAL} -eq 1 ]; then 80 | echo "BigCouch is not running!" 81 | fi 82 | } 83 | 84 | pid() { 85 | for i in `pidof ${BEAM}`; do 86 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+bigcouch"; then 87 | echo $i 88 | RETVAL=0 89 | fi 90 | done 91 | if [ ${RETVAL} -eq 1 ]; then 92 | echo "BigCouch is not running!" 93 | fi 94 | } 95 | 96 | case "$1" in 97 | prepare) 98 | prepare 99 | ;; 100 | background) 101 | start 102 | ;; 103 | stop) 104 | stop 105 | ;; 106 | restart) 107 | restart 108 | ;; 109 | status) 110 | status 111 | ;; 112 | pid) 113 | pid 114 | ;; 115 | *) 116 | echo $"Usage: $0 (prepare|background|stop|restart|status|pid)" 117 | esac 118 | 119 | exit ${RETVAL} 120 | 121 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/switch.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /freeswitch/lang/pt/demo/demo-pt-BR.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /freeswitch/lang/pt/demo/demo-pt-PT.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /freeswitch/lang/es/demo/demo-es-ES.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /freeswitch/lang/es/demo/demo-es-MX.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /system/sbin/kazoo-freeswitch: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f /etc/default/freeswitch ]; then 4 | . /etc/default/freeswitch 5 | fi 6 | 7 | if [ -f /etc/sysconfig/freeswitch ]; then 8 | . /etc/sysconfig/freeswitch 9 | fi 10 | 11 | RETVAL=1 12 | USER=${FS_USER:-freeswitch} 13 | BIN_FILE=${FS_BIN:-/usr/bin/freeswitch} 14 | PID_FILE=${FS_PID:-/var/run/freeswitch/freeswitch.pid} 15 | CFG_FILE=${FS_CONFIG:-/etc/kazoo/freeswitch} 16 | export HOME=${FS_HOME:-/var/lib/kazoo-freeswitch} 17 | 18 | if [ -z "${FREESWITCH_ARGS}" ]; then 19 | FREESWITCH_ARGS="-nonat -conf ${CFG_FILE} -run /var/run/freeswitch -db /var/lib/kazoo-freeswitch/db -log /var/log/freeswitch -cache /var/lib/kazoo-freeswitch/cache -sounds /usr/share/kazoo-freeswitch/sounds -storage /var/lib/kazoo-freeswitch/storage" 20 | fi 21 | 22 | prepare() { 23 | mkdir -p /var/log/freeswitch 24 | chown -R ${USER} /var/log/freeswitch 25 | mkdir -p /var/lib/kazoo-freeswitch/{db,cache,storage} 26 | chown -R ${USER} /var/lib/kazoo-freeswitch 27 | mkdir -p /usr/share/kazoo-freeswitch/sounds 28 | chown -R ${USER} /usr/share/kazoo-freeswitch/sounds 29 | mkdir -p /var/run/freeswitch 30 | chown -R ${USER} /var/run/freeswitch 31 | if [ -e ${PID_FILE} ]; then 32 | rm -rf ${PID_FILE} 33 | fi 34 | RETVAL=$? 35 | } 36 | 37 | start() { 38 | cd ${HOME} 39 | 40 | if fs_cli -x 'status' > /dev/null 2>&1; then 41 | echo "FreeSWITCH is already running!" 42 | return 43 | fi 44 | 45 | /usr/bin/epmd -daemon 46 | 47 | set -- ${BIN_FILE} ${FREESWITCH_ARGS} ${FREESWITCH_PARAMS} "$@" 48 | if [ "$(whoami)" == "${USER}" ]; then 49 | exec "$@" 50 | else 51 | runuser -s /bin/bash ${USER} -c "$*" 52 | fi 53 | RETVAL=$? 54 | 55 | if [ ${RETVAL} -ne 0 ]; then 56 | echo "Failed to start FreeSWITCH!" 57 | RETVAL=1 58 | fi 59 | } 60 | 61 | stop() { 62 | cd ${HOME} 63 | ${BIN_FILE} -stop > /dev/null 2>&1 64 | killall freeswitch 65 | RETVAL=$? 66 | } 67 | 68 | status() { 69 | fs_cli -x 'status' && fs_cli -x 'erlang status' 70 | RETVAL=$? 71 | } 72 | 73 | restart() { 74 | stop 75 | start 76 | } 77 | 78 | pause() { 79 | fs_cli -x 'fsctl pause' 80 | } 81 | 82 | resume() { 83 | fs_cli -x 'fsctl resume' 84 | } 85 | 86 | case "$1" in 87 | prepare) 88 | prepare 89 | ;; 90 | background) 91 | shift 92 | start "-ncwait" $@ 93 | ;; 94 | start) 95 | shift 96 | start $@ 97 | ;; 98 | stop) 99 | stop 100 | ;; 101 | status) 102 | status 103 | ;; 104 | restart) 105 | restart 106 | ;; 107 | pause) 108 | pause 109 | ;; 110 | resume) 111 | resume 112 | ;; 113 | *) 114 | echo "Usage: freeswitch {prepare|start|background|stop|restart|status|pause|resume}" 115 | ;; 116 | esac 117 | 118 | exit ${RETVAL} 119 | -------------------------------------------------------------------------------- /kamailio/message-role.cfg: -------------------------------------------------------------------------------- 1 | modparam("htable", "htable", "msg=>size=32;autoexpire=60;") 2 | 3 | 4 | event_route[kazoo:consumer-event-message-route] 5 | { 6 | $var(uri_username) = ""; 7 | kazoo_json($kzE, "Endpoints[0].To-Username", "$var(uri_username)"); 8 | $var(x) = $(kzE{kz.json,Endpoints[0].To-Username}); 9 | xlog("L_INFO", "received message route for $(kzE{kz.json,Endpoints[0].To-DID})\n"); 10 | if( $var(uri_username) != "" ) { 11 | $var(from_uri) = "sip:" + $(kzE{kz.json,Caller-ID-Number}) + "@" + $(kzE{kz.json,Endpoints[0].To-Realm}); 12 | $var(to_uri) = "sip:" + $(kzE{kz.json,Endpoints[0].To-Username}) + "@" + $(kzE{kz.json,Endpoints[0].To-Realm}); 13 | } else { 14 | $var(from_uri) = "sip:" + $(kzE{kz.json,Caller-ID-Number}) + $(kzE{kz.json,Endpoints[0].To-Realm}); 15 | $var(to_uri) = $(kzE{kz.json,Endpoints[0].Route}); 16 | } 17 | $sht(msg=>$(kzE{kz.json,Call-ID})) = $kzE; 18 | $uac_req(method)="MESSAGE"; 19 | $uac_req(body)= $(kzE{kz.json,Body}); 20 | $uac_req(hdrs)="X-KAZOO-AOR: " + $var(to_uri)+ "\r\nContent-Type: text/plain\r\n"; 21 | $uac_req(turi) = $var(to_uri); 22 | $uac_req(ruri) = $var(to_uri); 23 | $uac_req(furi) = $var(from_uri); 24 | $uac_req(ouri) = "sip:MY_IP_ADDRESS:5060"; 25 | $uac_req(callid) = $(kzE{kz.json,Call-ID}); 26 | xlog("L_INFO", "sending message from $var(from_uri) to $var(to_uri) \n"); 27 | uac_req_send(); 28 | } 29 | 30 | route[MESSAGE_REPLY] 31 | { 32 | if( $(sht(msg=>$ci)) == $null) { 33 | exit(); 34 | } 35 | 36 | if($T_reply_code != 200 && $T_reply_code != 202) { 37 | $var(Result) = "Failure"; 38 | } else { 39 | $var(Result) = "Success"; 40 | } 41 | 42 | $var(Payload) = '{ "Event-Category" : "message", "Event-Name" : "delivery", "Call-ID" : "$(sht(msg=>$ci){kz.json,Call-ID})", "Message-ID" : "$(sht(msg=>$ci){kz.json,Message-ID})" , "Delivery-Result-Code" : "sip:$T_reply_code", "Msg-ID" : "$(sht(msg=>$ci){kz.json,Msg-ID})" , "Status" : "$var(Result)"}'; 43 | 44 | $var(RoutingKey) = $(sht(msg=>$ci){kz.json,Server-ID}); 45 | $var(exchange) = "targeted"; 46 | if($var(RoutingKey) == "") { 47 | $var(exchange) = "sms"; 48 | $var(RoutingKey) = "message.delivery." + $(sht(msg=>$ci){kz.json,Call-ID}{kz.encode}); 49 | } 50 | xlog("L_INFO", "sending delivery message for $ci\n"); 51 | kazoo_publish($var(exchange), $var(RoutingKey), $var(Payload)); 52 | } 53 | 54 | route[MESSAGE_BINDINGS] 55 | { 56 | $var(key) = "kamailio@MY_HOSTNAME"; 57 | $var(payload) = "{ 'exchange' : 'sms' , 'type' : 'topic', 'queue' : 'MSG-QUEUE-MY_HOSTNAME', 'routing' : 'message.route." + $(var(key){kz.encode}) + ".*', 'no_ack' : 0 }"; 58 | kazoo_subscribe("$var(payload)"); 59 | } 60 | 61 | # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab 62 | -------------------------------------------------------------------------------- /freeswitch/lang/en/demo/demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 83 | -------------------------------------------------------------------------------- /freeswitch/lang/he/demo/demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 83 | -------------------------------------------------------------------------------- /freeswitch/lang/de/demo/demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 83 | -------------------------------------------------------------------------------- /kamailio/antiflood-role.cfg: -------------------------------------------------------------------------------- 1 | 2 | #!trydef ANTIFLOOD_RATE_WINDOW 2 3 | #!trydef ANTIFLOOD_RATE_DENSITY 50 4 | #!trydef ANTIFLOOD_RATE_EXPIRE 4 5 | #!trydef ANTIFLOOD_FAILED_AUTH_WINDOW 300 6 | #!trydef ANTIFLOOD_FAILED_AUTH_DENSITY 4 7 | 8 | ######## Flood Prevention Hash Tables ######## 9 | modparam("htable", "htable", "antiflood=>size=16;autoexpire=ANTIFLOOD_CACHE_PERIOD;initval=0") 10 | 11 | ######## Flood Prevention Module ######## 12 | loadmodule "pike.so" 13 | modparam("pike", "sampling_time_unit", ANTIFLOOD_RATE_WINDOW) 14 | modparam("pike", "reqs_density_per_unit", ANTIFLOOD_RATE_DENSITY) 15 | modparam("pike", "remove_latency", ANTIFLOOD_RATE_EXPIRE) 16 | 17 | 18 | route[ANTIFLOOD_RATE_LIMIT] 19 | { 20 | if (has_totag() 21 | || isflagset(FLAG_TRUSTED_SOURCE) 22 | || isflagset(FLAG_INTERNALLY_SOURCED)) { 23 | return; 24 | } 25 | 26 | # use pike to control the rates 27 | if (!pike_check_req()) { 28 | xlog("L_WARN", "$ci|end|dropping request from $fu due to rate of requests with source $si:$sp\n"); 29 | drop(); 30 | exit; 31 | } 32 | } 33 | 34 | route[ANITFLOOD_AUTH_LIMIT] 35 | { 36 | if (has_totag() 37 | || isflagset(FLAG_TRUSTED_SOURCE) 38 | || isflagset(FLAG_INTERNALLY_SOURCED)) { 39 | return(1); 40 | } 41 | 42 | if ($Au != $null && 43 | $sht(antiflood=>$Au::$si::count) >= ANTIFLOOD_FAILED_AUTH_DENSITY 44 | ) { 45 | xlog("L_NOTICE", "$ci|end|request at authorization failure limit for $Au $si:$sp\n"); 46 | $shtex(antiflood=>$Au::$si::count) = ANTIFLOOD_FAILED_AUTH_WINDOW; 47 | $sht(antiflood=>$Au::$si::last) = $Ts; 48 | append_to_reply("Retry-After: 3600\r\n"); 49 | send_reply("500", "Retry Later"); 50 | exit; 51 | } 52 | } 53 | 54 | route[ANTIFLOOD_SUCCESSFUL_AUTH] 55 | { 56 | sht_rm_name_re("antiflood=>$(Au{re.subst,/\\./\\\\./g})::$(si{re.subst,/\\./\\\\./g})::.*"); 57 | } 58 | 59 | route[ANTIFLOOD_RESET_AUTH] 60 | { 61 | $var(user) = $(kzE{kz.json,Username}) + "@" + $(kzE{kz.json,Realm}); 62 | sht_rm_name_re("antiflood=>$(var(user){re.subst,/\\./\\\\./g})::.*"); 63 | } 64 | 65 | route[ANITFLOOD_FAILED_AUTH] 66 | { 67 | if (isflagset(FLAG_TRUSTED_SOURCE)) { 68 | return; 69 | } 70 | 71 | $var(count) = $shtinc(antiflood=>$Au::$si::count); 72 | $sht(antiflood=>$Au::$si::last) = $Ts; 73 | 74 | xlog("L_INFO", "$ci|log|$var(count) errounous authorization response for $Au $si:$sp\n"); 75 | 76 | if ($var(count) >= ANTIFLOOD_FAILED_AUTH_DENSITY) { 77 | $var(exp) = $Ts - ANTIFLOOD_FAILED_AUTH_WINDOW; 78 | if($sht(antiflood=>$Au::$si::last) > $var(exp)){ 79 | xlog("L_NOTICE", "$ci|end|request at authorization failure limit for $Au $si:$sp\n"); 80 | append_to_reply("Retry-After: 3600\r\n"); 81 | send_reply("500", "Retry Later"); 82 | exit; 83 | } 84 | } 85 | } 86 | 87 | event_route[htable:expired:antiflood] 88 | { 89 | xlog("L_NOTICE", "antiflood expired record $shtrecord(key) => $shtrecord(value)\n"); 90 | } 91 | -------------------------------------------------------------------------------- /freeswitch/lang/pt/dir/tts-pt-BR.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /freeswitch/lang/es/dir/tts-es-MX.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /freeswitch/lang/es/dir/tts-es-ES.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /freeswitch/lang/pt/dir/tts-pt-PT.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /freeswitch/autoload_configs/spandsp.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /freeswitch/lang/ru/dir/tts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 106 | -------------------------------------------------------------------------------- /freeswitch/lang/en/dir/tts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 107 | -------------------------------------------------------------------------------- /system/sbin/kazoo-kamailio: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f /etc/default/kamailio ]; then 4 | . /etc/default/kamailio 5 | fi 6 | 7 | if [ -f /etc/sysconfig/kamailio ]; then 8 | . /etc/sysconfig/kamailio 9 | fi 10 | 11 | RETVAL=1 12 | USER=${KAMAILIO_USER:-kamailio} 13 | GROUP=${KAMAILIO_GROUP:-kamailio} 14 | BIN_FILE=${KAMAILIO_BIN:-/usr/sbin/kamailio} 15 | PID_FILE=${KAMAILIO_PID:-/var/run/kamailio/kazoo-kamailio.pid} 16 | CFG_FILE=${KAMAILIO_CONFIG:-/etc/kazoo/kamailio/kamailio.cfg} 17 | export HOME=${KAMAILIO_HOME:-/var/run/kamailio} 18 | 19 | SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`)) 20 | PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`)) 21 | [ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64 22 | [ $PKG_MEMORY -le 0 ] && PKG_MEMORY=8 23 | 24 | if test "$DUMP_CORE" = "yes" ; then 25 | ulimit -c unlimited 26 | fi 27 | 28 | prepare() { 29 | mkdir -p /var/run/kamailio 30 | chown -R ${USER} /var/run/kamailio 31 | if [ -e ${PID_FILE} ]; then 32 | rm -rf ${PID_FILE} 33 | fi 34 | if [ ! -f /etc/kazoo/kamailio/db/kazoo.db ]; then 35 | KazooDB -init /etc/kazoo/kamailio/kazoodb.sql 36 | fi 37 | chown -R ${USER} /etc/kazoo/kamailio/db 38 | RETVAL=$? 39 | } 40 | 41 | start() { 42 | cd ${HOME} 43 | 44 | check_config 45 | check_fork 46 | 47 | if [ "$(whoami)" == "${USER}" ]; then 48 | set -- ${BIN_FILE} -f ${CFG_FILE} -m ${SHM_MEMORY} -M ${PKG_MEMORY} ${EXTRA_OPTIONS} "$@" 49 | exec "$@" 50 | else 51 | set -- ${BIN_FILE} -f ${CFG_FILE} -m ${SHM_MEMORY} -M ${PKG_MEMORY} -u ${USER} -g ${GROUP} ${EXTRA_OPTIONS} "$@" 52 | runuser -s /bin/bash ${USER} -c "$*" 53 | fi 54 | RETVAL=$? 55 | 56 | if [ ${RETVAL} -ne 0 ]; then 57 | echo "Failed to start Kamailio!" 58 | RETVAL=1 59 | fi 60 | } 61 | 62 | stop() { 63 | killall ${BIN_FILE} 64 | RETVAL=$? 65 | } 66 | 67 | restart() { 68 | stop 69 | start 70 | } 71 | 72 | reset-restart() { 73 | cd /etc/kazoo/kamailio/dbtext/ 74 | stop 75 | 76 | head -n1 active_watchers > active_watchers.tmp 77 | mv -f active_watchers.tmp active_watchers 78 | 79 | head -n1 watchers > watchers.tmp 80 | mv -f watchers.tmp watchers 81 | 82 | head -n1 presentity > presentity.tmp 83 | mv -f presentity.tmp presentity 84 | 85 | chown kamailio:daemon * 86 | 87 | start 88 | } 89 | 90 | status() { 91 | kamcmd dispatcher.list 92 | RETVAL=$? 93 | } 94 | 95 | # Do not start kamailio if fork=no is set in the config file 96 | # otherwise the boot process will just stop 97 | check_fork () 98 | { 99 | if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $CFG_FILE; then 100 | echo "WARNING: fork=no specified in config file" 101 | exit 1 102 | fi 103 | } 104 | 105 | check_config () 106 | { 107 | local ERRORS=$($BIN_FILE -c -f ${CFG_FILE} 2>&1 > /dev/null) 108 | RETVAL=$? 109 | 110 | if [ ${RETVAL} -ne 0 ]; then 111 | echo "ERROR: Invalid configuration file ${CFG_FILE}!" 112 | echo -e "\n${ERRORS}\n" 113 | else 114 | echo "No errors found in ${CFG_FILE}" 115 | fi 116 | } 117 | 118 | case "$1" in 119 | prepare) 120 | prepare 121 | ;; 122 | background) 123 | shift 124 | start $@ 125 | ;; 126 | start) 127 | shift 128 | start -DD $@ 129 | ;; 130 | stop) 131 | stop 132 | ;; 133 | restart) 134 | restart 135 | ;; 136 | reset-restart) 137 | reset-restart 138 | ;; 139 | status) 140 | status 141 | ;; 142 | check) 143 | check_config 144 | ;; 145 | *) 146 | echo $"Usage: $0 {prepare|start|background|stop|restart|reset-restart|status|check|pid}" 147 | esac 148 | 149 | exit ${RETVAL} 150 | -------------------------------------------------------------------------------- /freeswitch/freeswitch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 |
43 | 44 |
45 | 46 |
47 | 48 |
49 | 50 |
51 | 52 |
53 | 54 |
55 | 56 |
57 | 58 | 59 | 60 | 61 | 62 | 63 |
64 | 65 |
66 | -------------------------------------------------------------------------------- /freeswitch/lang/fr/dir/tts.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 111 | -------------------------------------------------------------------------------- /freeswitch/lang/ru/demo/demo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 110 | -------------------------------------------------------------------------------- /system/sbin/kazoo-haproxy: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -f /etc/default/haproxy ]; then 4 | . /etc/default/haproxy 5 | fi 6 | 7 | if [ -f /etc/sysconfig/haproxy ]; then 8 | . /etc/sysconfig/haproxy 9 | fi 10 | 11 | RETVAL=1 12 | USER=${HAPROXY_USER:-root} 13 | BIN_FILE=${HAPROXY_BIN:-/usr/sbin/haproxy} 14 | PID_FILE=${HAPROXY_PID:-/var/run/haproxy/kazoo-haproxy.pid} 15 | CFG_FILE=${HAPROXY_CONFIG:-/etc/kazoo/haproxy/haproxy.cfg} 16 | SOCKET=${HAPROXY_SOCKET:-/var/run/haproxy/haproxy.sock} 17 | export HOME=${HAPROXY_HOME:-/var/lib/haproxy} 18 | 19 | check_socket() { 20 | if [ -S "$SOCKET" ]; then 21 | return 22 | fi 23 | SOCKET=/tmp/haproxy.sock 24 | } 25 | 26 | prepare() { 27 | mkdir -p /var/log/haproxy 28 | chown -R ${USER} /var/log/haproxy 29 | mkdir -p /var/run/haproxy 30 | chown -R ${USER} /var/run/haproxy 31 | if [ -e ${PID_FILE} ]; then 32 | rm -rf ${PID_FILE} 33 | fi 34 | RETVAL=$? 35 | } 36 | 37 | start() { 38 | cd ${HOME} 39 | 40 | check_config 41 | if [ ${RETVAL} -ne 0 ]; then 42 | return 43 | fi 44 | 45 | if echo "show stat" | nc -U $SOCKET > /dev/null 2>&1; then 46 | echo "HAProxy is already running!" 47 | return 48 | fi 49 | 50 | set -- ${BIN_FILE} -f ${CFG_FILE} -p ${PID_FILE} ${OPTIONS} "$@" 51 | if [ "$(whoami)" == "${USER}" ]; then 52 | exec "$@" 53 | else 54 | runuser -s /bin/bash ${USER} -c "$*" 55 | fi 56 | RETVAL=$? 57 | 58 | if [ ${RETVAL} -ne 0 ]; then 59 | echo "Failed to start HAProxy!" 60 | RETVAL=1 61 | fi 62 | } 63 | 64 | stop() { 65 | kill $(cat ${PID_FILE}) 66 | RETVAL=$? 67 | } 68 | 69 | restart() { 70 | check_config 71 | if [ ${RETVAL} -ne 0 ]; then 72 | return 73 | fi 74 | 75 | stop 76 | start 77 | } 78 | 79 | status() { 80 | local STATS="pxname svname qcur qmax scur smax slim stot bin bout dreq dresp ereq econ eresp wretr wredis status weight act bck chkfail chdown lastchg downtime qlimit pid iid sid throttle lbtot tracked type rate rate_lim rate_max check_status check_code check_duration hrsp_1xx hrsp_2xx hrsp_3xx hrsp_4xx hrsp_5xx hrsp_other hanafail req_rate req_rate_max req_tot cli_abrt srv_abrt" 81 | local TABLE_HEADER="Host|25 Backend|15 Status Active Rate 1xx 2xx 3xx 4xx 5xx Ping" 82 | local TABLE_VARS="svname|25 pxname|15 status scur req_rate hrsp_1xx hrsp_2xx hrsp_3xx hrsp_4xx hrsp_5xx check_duration" 83 | if ! echo "show stat" | nc -U $SOCKET > /dev/null 2>&1; then 84 | echo "Unable to connect to HAProxy, ensure it is running!" 85 | return 86 | fi 87 | echo -n "|" 88 | for HEADER in $TABLE_HEADER; do 89 | if [[ "${HEADER}" =~ "|" ]]; then 90 | NAME="${HEADER%%|*}" 91 | SIZE=${HEADER#*|} 92 | else 93 | NAME="${HEADER%%|*}" 94 | SIZE=6 95 | fi 96 | printf "%-${SIZE}s |" $NAME 97 | done 98 | echo 99 | echo "show stat" | nc -U $SOCKET \ 100 | | while IFS=',' read ${STATS}; do 101 | if [ -z "$svname" ]; then 102 | continue 103 | fi 104 | if [ "$svname" == 'svname' ]; then 105 | continue 106 | fi 107 | if [ "$svname" == 'BACKEND' ]; then 108 | continue 109 | fi 110 | if [ "$svname" == 'FRONTEND' ]; then 111 | continue 112 | fi 113 | echo -n "|" 114 | for VAR in $TABLE_VARS; do 115 | if [[ "${VAR}" =~ "|" ]]; then 116 | NAME="${VAR%%|*}" 117 | SIZE=${VAR#*|} 118 | else 119 | NAME="${VAR%%|*}" 120 | SIZE=6 121 | fi 122 | eval VALUE=\$$NAME 123 | if [ "${VAR}" == 'check_duration' ]; then 124 | VALUE="${VALUE}ms" 125 | fi 126 | printf "%-${SIZE}s |" ${VALUE:-0} 127 | done 128 | echo 129 | done 130 | RETVAL=0 131 | } 132 | 133 | reload() { 134 | check_config 135 | if [ ${RETVAL} -ne 0 ]; then 136 | return 137 | fi 138 | 139 | ${BIN_FILE} -f ${CFG_FILE} -p ${PID_FILE} ${OPTIONS} -sf $(cat ${PID_FILE}) $@ 140 | RETVAL=$? 141 | } 142 | 143 | check_config() { 144 | /usr/sbin/haproxy -c -V -f ${CFG_FILE} ${OPTIONS} 145 | RETVAL=$? 146 | 147 | if [ ${RETVAL} -ne 0 ]; then 148 | echo "ERROR: Invalid/incorrect configuration file!" 149 | fi 150 | } 151 | 152 | pid() { 153 | cat ${PID_FILE} 154 | RETVAL=$? 155 | } 156 | 157 | check_socket 158 | case "$1" in 159 | prepare) 160 | prepare 161 | ;; 162 | background) 163 | shift 164 | start "-D $@" 165 | ;; 166 | start) 167 | shift 168 | start "$@" 169 | ;; 170 | stop) 171 | stop 172 | ;; 173 | restart) 174 | restart 175 | ;; 176 | status) 177 | status 178 | ;; 179 | reload) 180 | reload 181 | ;; 182 | check) 183 | check_config 184 | ;; 185 | pid) 186 | pid 187 | ;; 188 | *) 189 | echo $"Usage: $0 {prepare|start|background|stop|restart|status|reload|check|pid}" 190 | esac 191 | 192 | exit ${RETVAL} 193 | -------------------------------------------------------------------------------- /kamailio/websockets-role.cfg: -------------------------------------------------------------------------------- 1 | tcp_accept_no_cl=yes 2 | 3 | listen=TCP_WS 4 | listen=UDP_WS_SIP 5 | #!ifdef TLS_ROLE 6 | listen=TLS_WSS 7 | listen=UDP_WSS_SIP 8 | #!endif 9 | 10 | ######## NAT Traversal module - signaling functions ######## 11 | #!ifndef NATHELPER_LOADED 12 | #!trydef NATHELPER_LOADED 13 | loadmodule "nathelper.so" 14 | #!endif 15 | 16 | ######## Generic Hash Table container in shared memory ######## 17 | modparam("htable", "htable", "websockets=>size=16;autoexpire=7200;initval=0") 18 | 19 | ######## Basic HTTP request handling ######## 20 | loadmodule "xhttp.so" 21 | 22 | ######## Websocket module ######## 23 | loadmodule "websocket.so" 24 | modparam("websocket", "keepalive_mechanism", 0) 25 | modparam("websocket", "keepalive_timeout", 30) 26 | modparam("websocket", "keepalive_processes", 1) 27 | modparam("websocket", "keepalive_interval", 1) 28 | modparam("websocket", "ping_application_data", "Kazoo encourages you to keep alive") 29 | modparam("websocket", "sub_protocols", 1) 30 | 31 | ####### Websocket Logic ######## 32 | route[HANDLE_WEBSOCKETS] 33 | { 34 | # Do NAT traversal stuff for requests from a WebSocket 35 | # connection - even if it is not behind a NAT! 36 | # This won't be needed in the future if Kamailio and the 37 | # WebSocket client support Outbound and Path. 38 | if (nat_uac_test(64)) { 39 | xlog("L_INFO", "$ci|log|this is a websocket request\n"); 40 | force_rport(); 41 | if (is_method("REGISTER")) { 42 | fix_nated_register(); 43 | } else { 44 | if (!add_contact_alias()) { 45 | xlog("L_INFO", "$ci|stop|error aliasing contact <$ct>\n"); 46 | sl_send_reply("400", "Bad Request"); 47 | exit; 48 | } 49 | } 50 | } 51 | } 52 | 53 | route[NAT_WEBSOCKETS_CORRECT] 54 | { 55 | # Do NAT traversal stuff for replies to a WebSocket connection 56 | # - even if it is not behind a NAT! 57 | # This won't be needed in the future if Kamailio and the 58 | # WebSocket client support Outbound and Path. 59 | if (nat_uac_test(64)) { 60 | xlog("L_INFO", "$ci|log|this is a websocket request\n"); 61 | add_contact_alias(); 62 | } 63 | } 64 | 65 | event_route[xhttp:request] 66 | { 67 | set_reply_close(); 68 | set_reply_no_connect(); 69 | 70 | if (!($rm =~ "GET")) { 71 | xlog("L_INFO", "websocket|log|rejecting HTTP request $rm from $si:$sp\n"); 72 | xhttp_reply("405", "Method Not Allowed", "", ""); 73 | exit; 74 | } 75 | 76 | if (!($hdr(Connection) =~ "Upgrade")) { 77 | xlog("L_INFO", "websocket|log|rejecting HTTP connection $hdr(Connection) request from $si:$sp\n"); 78 | xhttp_reply("400", "Bad Request", "", ""); 79 | exit; 80 | } 81 | 82 | if (!($hdr(Upgrade) =~ "websocket")) { 83 | xlog("L_INFO", "websocket|log|rejecting HTTP upgrade $hdr(Upgrade) request from $si:$sp\n"); 84 | xhttp_reply("400", "Bad Request", "", ""); 85 | exit; 86 | } 87 | 88 | if (!($hdr(Sec-WebSocket-Protocol) =~ "sip")) { 89 | xlog("L_INFO", "websocket|log|rejecting request for websocket protocol $hdr(Sec-WebSocket-Protocol) from $si:$sp\n"); 90 | xhttp_reply("400", "Bad Request", "", ""); 91 | exit; 92 | } 93 | 94 | #!ifdef MY_WEBSOCKET_DOMAIN 95 | if (!($hdr(Origin) =~ "MY_WEBSOCKET_DOMAIN")) { 96 | xlog("L_INFO", "websocket|log|rejecting HTTP request with unknown origin $hdr(Origin) from $si:$sp\n"); 97 | xhttp_reply("400", "Bad Request", "", ""); 98 | exit; 99 | } 100 | #!endif 101 | 102 | if($sht(websockets=>$si::count) > 50) { 103 | xlog("L_WARN", "websocket|log|$si:$sp is at the maximum allowable sockets per IP, rejecting request for another websocket\n"); 104 | xhttp_reply("403", "Forbidden", "", ""); 105 | exit; 106 | } 107 | 108 | if (ws_handle_handshake()) { 109 | $var(shtinc) = $shtinc(websockets=>$si::count); 110 | xlog("L_INFO", "websocket|log|opened websocket $var(count) of 50 for $si:$sp\n"); 111 | exit; 112 | } 113 | 114 | xlog("L_INFO", "websocket|log|unhandled HTTP request $rm from $si:$sp\n"); 115 | xhttp_reply("404", "Not Found", "", ""); 116 | } 117 | 118 | event_route[websocket:closed] { 119 | $var(shtdec) = $shtdec(websockets=>$si::count); 120 | if ($sht(websockets=>$si::count) < 1) { 121 | xlog("L_INFO", "websocket|log|$si:$sp closed last websocket to that IP\n"); 122 | sht_rm_name_re("websockets=>$(si{re.subst,/\\./\\\\./g})::.*"); 123 | } else { 124 | xlog("L_INFO", "websocket|log|closed websocket from $si:$sp, $var(count) remaining from that IP\n"); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /system/sbin/kazoo-ecallmgr: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f /etc/default/kazoo ]; then 4 | . /etc/default/kazoo 5 | fi 6 | 7 | RETVAL=1 8 | NAME=kazoo-ecallmgr 9 | USER=${KAZOO_USER:-kazoo} 10 | BIN_FILE=${KAZOO_BIN:-/opt/kazoo/bin/kazoo} 11 | PID_FILE=${KAZOO_PID:-/var/run/kazoo/${NAME}.pid} 12 | export HOME=${KAZOO_ROOT:-/opt/kazoo} 13 | export VMARGS_PATH=${KAZOO_VMARGS:-/etc/kazoo/core/vm.args} 14 | 15 | if [ -f /etc/sysconfig/kazoo ]; then 16 | . /etc/sysconfig/kazoo 17 | fi 18 | 19 | if [ "${NAME}" == "kazoo-applications" ]; then 20 | NAME="kazoo_apps" 21 | else 22 | NAME=${NAME#*-} 23 | fi 24 | 25 | export NAME_ARG="-name ${NAME}" 26 | 27 | # Detect core count 28 | CORES=`grep -E "^processor" /proc/cpuinfo |wc -l` 29 | if [ "${CORES}" = "1" ]; then 30 | BEAM=beam 31 | else 32 | BEAM=beam.smp 33 | fi 34 | 35 | prepare() { 36 | chown -R ${USER} /opt/kazoo /opt/kazoo/.* 37 | mkdir -p /tmp/erl_pipes/${NAME} 38 | chown -R ${USER} /tmp/erl_pipes/${NAME} 39 | mkdir -p /var/log/kazoo 40 | chown -R ${USER} /var/log/kazoo 41 | mkdir -p /var/run/kazoo 42 | chown -R ${USER} /var/run/kazoo 43 | if [ -e ${PID_FILE} ]; then 44 | rm -rf ${PID_FILE} 45 | fi 46 | RETVAL=$? 47 | } 48 | 49 | start() { 50 | cd ${HOME} 51 | 52 | if sudo -E -u ${USER} ${BIN_FILE} pid > /dev/null 2>&1; then 53 | echo "Kazoo ${NAME} is already running!" 54 | return 55 | fi 56 | 57 | export CODE_LOADING_MODE=interactive 58 | set -- ${BIN_FILE} "$@" 59 | if [ "$(whoami)" == "${USER}" ]; then 60 | exec "$@" 61 | else 62 | runuser -s /bin/bash ${USER} -c "$*" 63 | fi 64 | RETVAL=$? 65 | 66 | if [ ${RETVAL} -ne 0 ]; then 67 | echo "Failed to start Kazoo ${NAME}!" 68 | RETVAL=1 69 | fi 70 | } 71 | 72 | stop() { 73 | for i in `pidof ${BEAM}`; do 74 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 75 | kill $i 76 | RETVAL=$? 77 | fi 78 | done 79 | } 80 | 81 | restart() { 82 | stop 83 | start 84 | } 85 | 86 | status() { 87 | cd ${HOME} 88 | for i in `pidof ${BEAM}`; do 89 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 90 | set_cookie_arg 91 | /usr/sbin/sup -n ${NAME} kz_nodes status 92 | RETVAL=$? 93 | fi 94 | done 95 | if [ ${RETVAL} -eq 1 ]; then 96 | echo "${NAME} is not running!" 97 | fi 98 | } 99 | 100 | connect() { 101 | cd ${HOME} 102 | for i in `pidof ${BEAM}`; do 103 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 104 | set_cookie_arg 105 | sudo -E -u ${USER} ${BIN_FILE} remote_console 106 | RETVAL=$? 107 | fi 108 | done 109 | if [ ${RETVAL} -eq 1 ]; then 110 | echo "${NAME} is not running!" 111 | fi 112 | } 113 | 114 | attach() { 115 | cd ${HOME} 116 | for i in `pidof ${BEAM}`; do 117 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 118 | set_cookie_arg 119 | echo "WARNING: You are now directly attached to the running ${NAME} Erlang node." 120 | echo " It is safer to use: $0 connect" 121 | sudo -E -u ${USER} ${BIN_FILE} attach 122 | RETVAL=$? 123 | fi 124 | done 125 | if [ ${RETVAL} -eq 1 ]; then 126 | echo "${NAME} is not running!" 127 | fi 128 | } 129 | 130 | ping() { 131 | cd ${HOME} 132 | for i in `pidof ${BEAM}`; do 133 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 134 | set_cookie_arg 135 | sudo -E -u ${USER} ${BIN_FILE} ping 136 | RETVAL=$? 137 | fi 138 | done 139 | if [ ${RETVAL} -eq 1 ]; then 140 | echo "${NAME} is not running!" 141 | fi 142 | } 143 | 144 | pid() { 145 | cd ${HOME} 146 | for i in `pidof ${BEAM}`; do 147 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 148 | echo $i 149 | RETVAL=0 150 | fi 151 | done 152 | if [ ${RETVAL} -eq 1 ]; then 153 | echo "${NAME} is not running!" 154 | fi 155 | } 156 | 157 | set_cookie_arg() { 158 | COOKIE=`/usr/sbin/sup -n ${NAME} erlang get_cookie | sed "s|'||g"` 159 | export COOKIE_ARG="-setcookie ${COOKIE}" 160 | } 161 | 162 | case "$1" in 163 | prepare) 164 | prepare 165 | ;; 166 | background) 167 | start "start" 168 | ;; 169 | start) 170 | start "foreground" 171 | ;; 172 | stop) 173 | stop 174 | ;; 175 | restart) 176 | restart 177 | ;; 178 | status) 179 | status 180 | ;; 181 | connect) 182 | connect 183 | ;; 184 | attach) 185 | attach 186 | ;; 187 | ping) 188 | ping 189 | ;; 190 | pid) 191 | pid 192 | ;; 193 | *) 194 | echo "Usage: $0 (prepare|start|background|stop|restart|status|connect|attach|ping|pid)" 195 | esac 196 | 197 | exit ${RETVAL} 198 | -------------------------------------------------------------------------------- /freeswitch/lang/es/dir/sounds-es-ES.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /freeswitch/lang/es/dir/sounds-es-MX.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /freeswitch/lang/pt/dir/sounds-pt-BR.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /freeswitch/lang/pt/dir/sounds-pt-PT.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /system/sbin/kazoo-applications: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -f /etc/default/kazoo ]; then 4 | . /etc/default/kazoo 5 | fi 6 | 7 | RETVAL=1 8 | NAME=kazoo-applications 9 | USER=${KAZOO_USER:-kazoo} 10 | BIN_FILE=${KAZOO_BIN:-/opt/kazoo/bin/kazoo} 11 | PID_FILE=${KAZOO_PID:-/var/run/kazoo/${NAME}.pid} 12 | export HOME=${KAZOO_ROOT:-/opt/kazoo} 13 | export VMARGS_PATH=${KAZOO_VMARGS:-/etc/kazoo/core/vm.args} 14 | 15 | if [ -f /etc/sysconfig/kazoo ]; then 16 | . /etc/sysconfig/kazoo 17 | fi 18 | 19 | if [ "${NAME}" == "kazoo-applications" ]; then 20 | NAME="kazoo_apps" 21 | else 22 | NAME=${NAME#*-} 23 | fi 24 | 25 | export NAME_ARG="-name ${NAME}" 26 | 27 | # Detect core count 28 | CORES=`grep -E "^processor" /proc/cpuinfo |wc -l` 29 | if [ "${CORES}" = "1" ]; then 30 | BEAM=beam 31 | else 32 | BEAM=beam.smp 33 | fi 34 | 35 | prepare() { 36 | chown -R ${USER} /opt/kazoo /opt/kazoo/.* 37 | mkdir -p /tmp/erl_pipes/${NAME} 38 | chown -R ${USER} /tmp/erl_pipes/${NAME} 39 | mkdir -p /var/log/kazoo 40 | chown -R ${USER} /var/log/kazoo 41 | mkdir -p /var/run/kazoo 42 | chown -R ${USER} /var/run/kazoo 43 | if [ -e ${PID_FILE} ]; then 44 | rm -rf ${PID_FILE} 45 | fi 46 | RETVAL=$? 47 | } 48 | 49 | start() { 50 | cd ${HOME} 51 | 52 | if sudo -E -u ${USER} ${BIN_FILE} pid > /dev/null 2>&1; then 53 | echo "Kazoo ${NAME} is already running!" 54 | return 55 | fi 56 | 57 | export CODE_LOADING_MODE=interactive 58 | export ERL_CRASH_DUMP=/var/log/kazoo/$(date +%s)_erl_crash.dump 59 | set -- ${BIN_FILE} "$@" 60 | if [ "$(whoami)" == "${USER}" ]; then 61 | exec "$@" 62 | else 63 | runuser -s /bin/bash ${USER} -c "$*" 64 | fi 65 | RETVAL=$? 66 | 67 | if [ ${RETVAL} -ne 0 ]; then 68 | echo "Failed to start Kazoo ${NAME}!" 69 | RETVAL=1 70 | fi 71 | } 72 | 73 | stop() { 74 | for i in `pidof ${BEAM}`; do 75 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 76 | kill $i 77 | RETVAL=$? 78 | fi 79 | done 80 | } 81 | 82 | restart() { 83 | stop 84 | start 85 | } 86 | 87 | status() { 88 | cd ${HOME} 89 | for i in `pidof ${BEAM}`; do 90 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 91 | set_cookie_arg 92 | /usr/sbin/sup -n ${NAME} kz_nodes status 93 | RETVAL=$? 94 | fi 95 | done 96 | if [ ${RETVAL} -eq 1 ]; then 97 | echo "${NAME} is not running!" 98 | fi 99 | } 100 | 101 | connect() { 102 | cd ${HOME} 103 | for i in `pidof ${BEAM}`; do 104 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 105 | set_cookie_arg 106 | sudo -E -u ${USER} ${BIN_FILE} remote_console 107 | RETVAL=$? 108 | fi 109 | done 110 | if [ ${RETVAL} -eq 1 ]; then 111 | echo "${NAME} is not running!" 112 | fi 113 | } 114 | 115 | attach() { 116 | cd ${HOME} 117 | for i in `pidof ${BEAM}`; do 118 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 119 | set_cookie_arg 120 | echo "WARNING: You are now directly attached to the running ${NAME} Erlang node." 121 | echo " It is safer to use: $0 connect" 122 | sudo -E -u ${USER} ${BIN_FILE} attach 123 | RETVAL=$? 124 | fi 125 | done 126 | if [ ${RETVAL} -eq 1 ]; then 127 | echo "${NAME} is not running!" 128 | fi 129 | } 130 | 131 | ping() { 132 | cd ${HOME} 133 | for i in `pidof ${BEAM}`; do 134 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 135 | set_cookie_arg 136 | sudo -E -u ${USER} ${BIN_FILE} ping 137 | RETVAL=$? 138 | fi 139 | done 140 | if [ ${RETVAL} -eq 1 ]; then 141 | echo "${NAME} is not running!" 142 | fi 143 | } 144 | 145 | pid() { 146 | cd ${HOME} 147 | for i in `pidof ${BEAM}`; do 148 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+${NAME}"; then 149 | echo $i 150 | RETVAL=0 151 | fi 152 | done 153 | if [ ${RETVAL} -eq 1 ]; then 154 | echo "${NAME} is not running!" 155 | fi 156 | } 157 | 158 | set_cookie_arg() { 159 | COOKIE=`/usr/sbin/sup -n ${NAME} erlang get_cookie | sed "s|'||g"` 160 | export COOKIE_ARG="-setcookie ${COOKIE}" 161 | RETVAL=$? 162 | } 163 | 164 | case "$1" in 165 | prepare) 166 | prepare 167 | ;; 168 | background) 169 | start "start" 170 | ;; 171 | start) 172 | start "foreground" 173 | ;; 174 | stop) 175 | stop 176 | ;; 177 | restart) 178 | restart 179 | ;; 180 | status) 181 | status 182 | ;; 183 | connect) 184 | connect 185 | ;; 186 | attach) 187 | attach 188 | ;; 189 | ping) 190 | ping 191 | ;; 192 | pid) 193 | pid 194 | ;; 195 | *) 196 | echo "Usage: $0 (prepare|start|background|stop|restart|status|connect|attach|ping|pid)" 197 | esac 198 | 199 | exit ${RETVAL} 200 | -------------------------------------------------------------------------------- /freeswitch/lang/en/dir/sounds.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 131 | -------------------------------------------------------------------------------- /freeswitch/lang/fr/dir/sounds.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 131 | -------------------------------------------------------------------------------- /freeswitch/lang/he/dir/sounds.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 131 | -------------------------------------------------------------------------------- /freeswitch/lang/ru/dir/sounds.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 131 | -------------------------------------------------------------------------------- /kamailio/local.cfg: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | ## ROLES 3 | ################################################################################ 4 | ## Enabled Roles 5 | #!trydef DISPATCHER_ROLE 6 | #!trydef NAT_TRAVERSAL_ROLE 7 | #!trydef REGISTRAR_ROLE 8 | #!trydef PRESENCE_ROLE 9 | #!trydef RESPONDER_ROLE 10 | #!trydef NODES_ROLE 11 | #!trydef FAST_PICKUP_ROLE 12 | #!trydef PRESENCE_QUERY_ROLE 13 | 14 | ## Disabled Roles - remove all but the last '#' to enable 15 | # # #!trydef TRAFFIC_FILTER_ROLE 16 | # # #!trydef WEBSOCKETS_ROLE 17 | # # #!trydef TLS_ROLE 18 | # # #!trydef ANTIFLOOD_ROLE 19 | # # #!trydef RATE_LIMITER_ROLE 20 | # # #!trydef ACL_ROLE 21 | # # #!trydef MESSAGE_ROLE 22 | # # #!trydef PUSHER_ROLE 23 | # # #!trydef REGISTRAR_SYNC_ROLE 24 | # # #!trydef PRESENCE_NOTIFY_SYNC_ROLE 25 | 26 | ################################################################################ 27 | ## SERVER INFORMATION 28 | ################################################################################ 29 | ## CHANGE "kamailio.2600hz.com" TO YOUR SERVERS HOSTNAME 30 | #!substdef "!MY_HOSTNAME!kamailio.2600hz.com!g" 31 | 32 | ## CHANGE "127.0.0.1" TO YOUR SERVERS IP ADDRESS 33 | ## Usually your public IP. If you need 34 | ## to listen on addtional ports or IPs 35 | ## add them in "BINDINGS" at the bottom. 36 | #!substdef "!MY_IP_ADDRESS!127.0.0.1!g" 37 | 38 | ## CHANGE "kazoo://guest:guest@127.0.0.1:5672" TO THE AMQP URL 39 | ## This should be the primary RabbitMQ server 40 | ## in the zone that this server will service. 41 | #!substdef "!MY_AMQP_URL!kazoo://guest:guest@127.0.0.1:5672!g" 42 | 43 | ## This parameter is only required if you are using websockets 44 | ## This value must be present in the HTTP 45 | ## Origin header on a new websocket request 46 | ## or it will be rejected. If you remove 47 | ## it completely the validation will be disabled. 48 | #!substdef "!MY_WEBSOCKET_DOMAIN!2600hz.com!g" 49 | 50 | ################################################################################ 51 | ## DISPATCHER FORMAT INFORMATION 52 | ################################################################################ 53 | ## dispatcher list changed the default storage type from list to table 54 | ## this will allow the management of dispatched servers in the DB 55 | ## 56 | ## if you're using dbtext and can't start kamailio because of dispatcher 57 | ## check the format of /etc/kazoo/kamailio/dbtext/dispatcher 58 | ## 59 | ## # setid(integer) destination(sip uri) flags (integer, optional) 60 | ## 1 sip:192.168.16.131:11000 0 61 | ## should converted to 62 | ## id(int,auto) setid(int) destination(string) flags(int) priority(int) attrs(string) description(string) 63 | ## 1:1:sip\:192.168.16.131\:11000:0:1: : (there is a space at end) 64 | ## 65 | ## uncommenting this param will allow to continue using dispatcher list 66 | # # #!trydef KZ_USE_DISPATCHER_LIST 67 | 68 | ################################################################################ 69 | ## UDP PARAMETERS 70 | ################################################################################ 71 | ## This parameter is OPTIONAL 72 | ## If large UDP packets are dropped by the 73 | ## interface try uncommenting this option. 74 | ## However, you MUST match this to your 75 | ## network adapter! If they do not match, 76 | ## all UDP packets over this limit WILL FAIL! 77 | ## E.g.: Add MTU=1472 to the /etc/sysconfig/network-scripts/XXX 78 | # udp4_raw_mtu = 1472 79 | 80 | ################################################################################ 81 | ## BINDINGS 82 | ################################################################################ 83 | ## This parameter is OPTIONAL. 84 | ## It will try to locate outbound interface 85 | ## on multihomed host. By default forward 86 | ## requests use the incoming socket disregarding 87 | ## the destination location. When enabled Kamailio 88 | ## will select a socket that can reach the 89 | ## destination. This reduces performance. 90 | mhomed=0 91 | 92 | ## YOU SHOULD NOT HAVE TO CHANGE THESE! 93 | ## By setting MY_IP_ADDRESS above these will resolve 94 | ## to the proper bindings. These are here 95 | ## for those with complex layouts who know 96 | ## what they are doing :) 97 | #!substdef "!UDP_SIP!udp:MY_IP_ADDRESS:5060!g" 98 | #!substdef "!TCP_SIP!tcp:MY_IP_ADDRESS:5060!g" 99 | #!substdef "!TLS_SIP!tls:MY_IP_ADDRESS:5061!g" 100 | #!substdef "!UDP_ALG_SIP!udp:MY_IP_ADDRESS:7000!g" 101 | #!substdef "!TCP_ALG_SIP!tcp:MY_IP_ADDRESS:7000!g" 102 | #!substdef "!TLS_ALG_SIP!tls:MY_IP_ADDRESS:7001!g" 103 | #!substdef "!TCP_WS!tcp:MY_IP_ADDRESS:5064!g" 104 | #!substdef "!UDP_WS_SIP!udp:MY_IP_ADDRESS:5064!g" 105 | #!substdef "!TLS_WSS!tls:MY_IP_ADDRESS:5065!g" 106 | #!substdef "!UDP_WSS_SIP!udp:MY_IP_ADDRESS:5065!g" 107 | 108 | ## YOU SHOULD NOT HAVE TO CHANGE THESE! 109 | ## This will bind the default SIP listeners 110 | ## as determined above. The tls-role and 111 | ## websocket-role will use the appropriate 112 | ## definitions if enabled. These are here 113 | ## for those with complex layouts who know 114 | ## what they are doing :) 115 | listen=UDP_SIP 116 | listen=TCP_SIP 117 | listen=UDP_ALG_SIP 118 | listen=TCP_ALG_SIP 119 | -------------------------------------------------------------------------------- /kamailio/presence_query-role.cfg: -------------------------------------------------------------------------------- 1 | ######## Presence query server module ######## 2 | 3 | route[PRESENCE_SEARCH_SUMMARY] 4 | { 5 | xlog("L_INFO", "processing presence summary query for $(kzE{kz.json,Realm})\n"); 6 | $var(Queue) = $(kzE{kz.json,Server-ID}); 7 | $var(Event) = $(kzE{kz.json,Event-Package}); 8 | $var(Domain) = $(kzE{kz.json,Realm}); 9 | $var(Username) = $(kzE{kz.json,Username}); 10 | $var(Now) = $TS; 11 | $var(Items) = ""; 12 | $var(Query) = $_s(select * from active_watchers where watcher_domain = "$var(Domain)"); 13 | if($var(Event) != "") { 14 | $var(Query) = $var(Query) + $_s( and event = "$var(Event)"); 15 | } 16 | if($var(Username) != "") { 17 | $var(Query) = $var(Query) + $_s( and watcher_username = "$var(Username)"); 18 | } 19 | $var(Query) = $var(Query) + " order by presentity_uri, event, watcher_username, callid"; 20 | xlog("L_DEBUG", "$ci| QUERY $var(Query)\n"); 21 | 22 | if (sql_xquery("cb", "$var(Query)", "ra") == 1) 23 | { 24 | $var(Subs) = ""; 25 | $var(Sep1) = ""; 26 | while($xavp(ra) != $null) { 27 | $var(Username) = $(xavp(ra=>presentity_uri){s.tolower}); 28 | $var(Sep2)=""; 29 | $var(Evt)=""; 30 | while($xavp(ra) != $null && $var(Username) == $(xavp(ra=>presentity_uri){s.tolower}) ) 31 | { 32 | $var(Event) = $xavp(ra=>event); 33 | $var(Sep3)=""; 34 | $var(Sub)=""; 35 | $var(Count) = 0; 36 | while($xavp(ra) != $null && $var(Username) == $(xavp(ra=>presentity_uri){s.tolower}) && $var(Event) == $xavp(ra=>event)) 37 | { 38 | $var(Count) = $var(Count) + 1; 39 | pv_unset("$xavp(ra)"); 40 | } 41 | $var(Evt) = $var(Evt) + $var(Sep2) + $_s("$var(Event)" : $var(Count)); 42 | $var(Sep2)=", "; 43 | } 44 | $var(Subs) = $var(Subs) + $var(Sep1) + $_s("$(var(Username){uri.user})") + " : { " + $var(Evt) + " }"; 45 | $var(Sep1)=", "; 46 | } 47 | } 48 | xlog("L_DEBUG", "$ci| RESULT \"Subscriptions\" : { $var(Subs) }\n"); 49 | 50 | $var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "search_resp", "Msg-ID" : "$(kzE{kz.json,Msg-ID})", "Subscriptions" : { $var(Subs) } }'; 51 | kazoo_publish("targeted", "$var(Queue)", $var(amqp_payload_request)); 52 | 53 | } 54 | 55 | route[PRESENCE_SEARCH_DETAIL] 56 | { 57 | xlog("L_INFO", "processing presence query detail for $(kzE{kz.json,Username}) in realm $(kzE{kz.json,Realm})\n"); 58 | $var(Queue) = $(kzE{kz.json,Server-ID}); 59 | $var(Event) = $(kzE{kz.json,Event-Package}); 60 | $var(Domain) = $(kzE{kz.json,Realm}); 61 | $var(Username) = $(kzE{kz.json,Username}); 62 | $var(presentity_uri) = "sip:" + $var(Username) + "@" + $var(Domain); 63 | $var(Now) = $TS; 64 | $var(Items) = ""; 65 | $var(Query) = $_s(select * from active_watchers_log where presentity_uri = "$var(presentity_uri)"); 66 | if($var(Event) != "") { 67 | $var(Query) = $var(Query) + $_s( and event = "$var(Event)"); 68 | } 69 | $var(Query) = $var(Query) + " order by event, watcher_username, callid"; 70 | xlog("L_DEBUG", "$ci| STATUS QUERY $var(Query)\n"); 71 | 72 | if (sql_xquery("cb", "$var(Query)", "ra") == 1) { 73 | while($xavp(ra) != $null) { 74 | $var(Event) = $xavp(ra=>event); 75 | while($xavp(ra) != $null && $var(Event) == $xavp(ra=>event)) { 76 | $var(Sub) = $_s("$var(Username)" : {"$xavp(ra=>event)" : { "$xavp(ra=>watcher_username)" : {"kamailio@MY_HOSTNAME" : {"$xavp(ra=>callid)" : {"time" : $xavp(ra=>time), "result" : $xavp(ra=>result), "sent" : "$(xavp(ra=>sent_msg){s.escape.common}{s.replace,\','}{s.replace,$$,})", "received" : "$(xavp(ra=>received_msg){s.escape.common}{s.replace,\','}{s.replace,$$,})", "user_agent" : "$(xavp(ra=>user_agent){s.escape.common}{s.replace,\','}{s.replace,$$,})"}}}}}); 77 | xlog("L_DEBUG", "$ci| RESULT \"Subscriptions\" : { $var(Sub) }\n"); 78 | $var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "search_partial_resp", "Msg-ID" : "$(kzE{kz.json,Msg-ID})", "Subscriptions" : { $var(Sub) } }'; 79 | kazoo_publish("targeted", "$var(Queue)", $var(amqp_payload_request)); 80 | pv_unset("$xavp(ra)"); 81 | } 82 | } 83 | } 84 | 85 | $var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "search_resp", "Msg-ID" : "$(kzE{kz.json,Msg-ID})" }'; 86 | kazoo_publish("targeted", "$var(Queue)", $var(amqp_payload_request)); 87 | 88 | } 89 | 90 | 91 | 92 | event_route[kazoo:consumer-event-presence-search-req] 93 | { 94 | switch($(kzE{kz.json,Search-Type})) { 95 | case "summary": 96 | route(PRESENCE_SEARCH_SUMMARY); 97 | break; 98 | case "detail": 99 | route(PRESENCE_SEARCH_DETAIL); 100 | break; 101 | default: 102 | xlog("L_INFO", "$ci|search type '$(kzE{kz.json,Search-Type})' not handled\n"); 103 | } 104 | } 105 | 106 | route[PRESENCE_QUERY_BINDINGS] 107 | { 108 | $var(payload) = "{ 'exchange' : 'presence' , 'type' : 'topic', 'queue' : 'presence-search-MY_HOSTNAME', 'routing' : 'presence.search_req.*', 'exclusive' : 0, 'federate' : 1 }"; 109 | kazoo_subscribe("$var(payload)"); 110 | } 111 | 112 | # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab 113 | -------------------------------------------------------------------------------- /kamailio/nodes-role.cfg: -------------------------------------------------------------------------------- 1 | ######## Nodes role - pushes info to kazoo ######## 2 | 3 | #!ifndef NODES_EXPIRE 4 | #!define NODES_EXPIRE 10 5 | #!endif 6 | 7 | #!ifndef NODES_FUDGE_FACTOR 8 | #!define NODES_FUDGE_FACTOR 3 9 | #!endif 10 | 11 | modparam("htable", "htable", "nodes=>size=8;initval=0;autoexpire=180"); 12 | modparam("htable", "htable", "media=>size=8;initval=0;autoexpire=180"); 13 | 14 | ####### TIMER module ########## 15 | #!ifndef TIMER_LOADED 16 | loadmodule "timer.so" 17 | #!trydef TIMER_LOADED 18 | #!endif 19 | modparam("timer", "declare_timer", "NODES_ADVERTISE_TIMER=NODES_ADVERTISE_ROUTE,5000,slow,enable"); 20 | modparam("timer", "declare_timer", "NODE_TRACK_TIMER=NODE_TRACK_ROUTE,500,fast,enable"); 21 | modparam("timer", "declare_timer", "NODE_HEARTBEAT_TIMER=NODE_HEARTBEAT_ROUTE,500,fast,enable"); 22 | 23 | 24 | ####### MQUEUE module ########## 25 | #!ifndef MQUEUE_LOADED 26 | loadmodule "mqueue.so" 27 | #!trydef MQUEUE_LOADED 28 | #!endif 29 | modparam("mqueue","mqueue", "name=node_track") 30 | modparam("mqueue","mqueue", "name=node_heartbeat") 31 | 32 | 33 | ####### NODES Logic ######## 34 | route[NODES_ADVERTISE_ROUTE] 35 | { 36 | $var(Payload) = '{"Event-Category" : "nodes", "Event-Name" : "advertise", "Expires" : 5000, "Used-Memory" : $(stat(real_used_size){s.int}), "Registrations" : $(stat(registered_users){s.int}), "WhApps" : {"kamailio" : {"Startup" : $Tb }} }'; 37 | kazoo_publish("nodes", "", $var(Payload)); 38 | } 39 | 40 | 41 | event_route[kazoo:consumer-event-nodes-advertise] 42 | { 43 | if($shtinc(nodes=>$(kzE{kz.json,Node})::count) == 1) { 44 | xlog("L_INFO", "$(kzE{kz.json,Msg-ID})|nodes|hearbeat from new node $(kzE{kz.json,Node})\n"); 45 | } 46 | mq_add("node_heartbeat", "$(kzE{kz.json,Node})", "$kzE"); 47 | } 48 | 49 | event_route[htable:expired:nodes] 50 | { 51 | if($shtrecord(key) =~ "::count$$") { 52 | if($shtrecord(value) == 0) { 53 | xlog("L_INFO", "htable|nodes|node $(shtrecord(key){s.rm,::count}) is still unreachable\n"); 54 | } 55 | mq_add("node_track", "$shtrecord(key)", ""); 56 | return; 57 | } 58 | 59 | xlog("L_INFO", "htable|nodes|hearbeat expired for node $shtrecord(key)\n"); 60 | } 61 | 62 | route[NODE_TRACK_ROUTE] 63 | { 64 | $var(runloop) = 1; 65 | while(mq_fetch("node_track") == 1 && $var(runloop) < MAX_WHILE_LOOPS) { 66 | $var(Key) = $mqk(node_track); 67 | $sht(nodes=>$var(Key)) = 0; 68 | $var(runloop) = $var(runloop) + 1; 69 | } 70 | } 71 | 72 | 73 | route[NODE_HEARTBEAT_ROUTE] 74 | { 75 | $var(runloop) = 1; 76 | while(mq_fetch("node_heartbeat") == 1 && $var(runloop) < MAX_WHILE_LOOPS) { 77 | $var(Node) = $mqk(node_heartbeat); 78 | $var(Payload) = $mqv(node_heartbeat); 79 | 80 | route(CHECK_MEDIA_SERVERS); 81 | 82 | $sht(nodes=>$var(Node)) = $var(Payload); 83 | $shtex(nodes=>$var(Node)) = ($(var(Payload){kz.json,Expires}{s.int}) / 1000) + NODES_FUDGE_FACTOR; 84 | $var(runloop) = $var(runloop) + 1; 85 | } 86 | } 87 | 88 | route[CHECK_MEDIA_SERVERS] 89 | { 90 | if($(var(Payload){kz.json,Media-Servers}) == "") { 91 | return; 92 | } 93 | 94 | $var(Media) = $(var(Payload){kz.json,Media-Servers}); 95 | $var(Zone) = $(var(Payload){kz.json,AMQP-Broker-Zone}); 96 | 97 | $var(Dot) = "."; 98 | $var(Perc) = "%"; 99 | avp_delete("$avp(MediaKeys)"); 100 | if(kazoo_json_keys($var(Payload), "Media-Servers", "$avp(MediaKeys)") == 1) { 101 | $var(Count) = $cnt($avp(MediaKeys)); 102 | $var(Idx) = 0; 103 | while( $var(Idx) < $var(Count) ) { 104 | $var(MediaKey) = $(avp(MediaKeys)[$var(Idx)]{s.replace,$var(Dot),$var(Perc)}); 105 | $var(MediaUrl1) = $(var(Payload){kz.json,Media-Servers.$var(MediaKey).Interface.URL}); 106 | if($var(MediaUrl1) != "") { 107 | $var(MediaUrl) = $(var(MediaUrl1){re.subst,/^sip:(.*)@(.*)/sip:\2/}); 108 | if($shtinc(media=>$var(MediaUrl)::count) == 1) { 109 | $sht(media=>$var(MediaUrl)::zone) = $var(Zone); 110 | $shtex(media=>$var(MediaUrl)::zone) = 0; 111 | route(MEDIA_SERVER_UP); 112 | }; 113 | $shtex(media=>$var(MediaUrl)::count) = ($(var(Payload){kz.json,Expires}{s.int}) / 1000) + NODES_FUDGE_FACTOR; 114 | } 115 | $var(Idx) = $var(Idx) + 1; 116 | } 117 | }; 118 | } 119 | 120 | 121 | event_route[htable:expired:media] 122 | { 123 | $var(MediaUrl) = $(shtrecord(key){re.subst,/(.*)::(.*)/\1/}); 124 | $var(Zone) = $sht(media=>$var(MediaUrl)::zone); 125 | route(MEDIA_SERVER_DOWN); 126 | } 127 | 128 | route[MEDIA_SERVER_UP] 129 | { 130 | xlog("L_INFO", "nodes|media|$var(Node) reported new media server $var(MediaUrl) in zone $var(Zone)\n"); 131 | 132 | #!ifdef DISPATCHER_ROLE 133 | route(DISPATCHER_CHECK_MEDIA_SERVER); 134 | #!endif 135 | 136 | #!ifdef FAST_PICKUP_ROLE 137 | route(FAST_PICKUP_START); 138 | #!endif 139 | 140 | } 141 | 142 | route[MEDIA_SERVER_DOWN] 143 | { 144 | xlog("L_INFO", "htable|media|hearbeat expired for media server $var(MediaUrl) in zone $var(Zone)\n"); 145 | 146 | #!ifdef PRESENCE_ROLE 147 | route(RESET_PUBLISHER); 148 | #!endif 149 | 150 | } 151 | 152 | #!ifndef NODES_CUSTOM_BINDINGS 153 | route[NODES_BINDINGS] 154 | { 155 | $var(payload) = "{ 'exchange' : 'nodes' , 'type' : 'fanout', 'queue' : 'nodes-MY_HOSTNAME', 'exclusive' : 0, 'federate' : 1}"; 156 | kazoo_subscribe("$var(payload)"); 157 | } 158 | #!endif 159 | 160 | 161 | 162 | # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab 163 | --------------------------------------------------------------------------------