cli sip client
simple (1 minute) way to install and make test sip from command line
how baresip works:
when you run: “baresip -f cofnig_dir” it will create dir config_dir with default files
then yo have to add accouns into config_dir/accounts, change everything you need into config_dir/config
then you may run again: “baresip -f cofnig_dir”
you will see console from basresip
then you have to use commands like “d” with means call to SIP uri
for example “d” and *43 will send call from your account to same domain with *43 (echo test for asterisk).
yum install baresip cd /root baresip -f baresip_config #press ESC echo"<sip:900@asterisk_ip>;auth_pass=testpassword" >> baresip_config/accounts/accounts change port in baresip_config/config from 5060 to 5099 for example baresip -f baresip_config #press "d" type *43 or full sip uri "111@newhost"16.08.2022
Oracle Centos 8. Rtpengine with all codecs supported.
As result of this instruction you will have all this codecs supported in your centos 8 installations.
PCMA: fully supported
PCMU: fully supported
G723: fully supported
G722: fully supported
G729: fully supported
G729a: fully supported
speex: fully supported
GSM: fully supported
iLBC: fully supported
opus: fully supported
AMR: fully supported
AMR-WB: fully supported
telephone-event: fully supported
CN: fully supported
Synopsis:
RPMS, build and install scripts: git clone https://bitbucket.org/yooxy/centos8-rtpengine10-all-codecs.git
This instruction will give you RTPENGINE for Centos 7 and Centos 8 withh all codecs. RPM packages in RPMS dir are ready for install. But also you have rpmbuild-rtpengine.el7 and rpmbuild-rtpengine.el8 to compile it on your system in automatically way.
if you start to compiling on new system, then everything should go fine after you type sh rpmbuild-rtpengine.el7.
IF you work on production system , then check files you are running before start due to you may to install unnecessary packets or kernels.
To build rtpengine with all codecs (g729,AMR,opus,iLBC, GSM) on Centos 8:
cd ~
git clone https://bitbucket.org/yooxy/centos8-rtpengine10-all-codecs.git
sh rpmbuild-rtpengine.el8
cd ~/rpmbuild/RPMS/
dnf install noarch/ngcp-rtpengine-dkms-10.5.1.3+0~mr10.5.1.3-1.el8.noarch.rpm x86_64/ngcp-rtpengine-kernel-10.5.1.3+0~mr10.5.1.3-1.el8.x86_64.rpm x86_64/ngcp-rtpengine-10.5.1.3+0~mr10.5.1.3-1.el8.x86_64.rpm
Your RPMs ready for install in ~/root/rpmbuild/RPMS
To install rtpengine without build 10.5 run “sh install-rtpengine.el7”
| Posted in Без рубрики, Готовые решения | No Comments »
Ansible Part II. Install opensips,opensips-cli,opensips control panel.
You can use this Ansible roles to install full Opensips + Control Panel with one command.
For some reason roles to install Opensips from ansible galaxy not working as expected.
I have modified some roles to make it works.
This will good only for Debian 10 and Centos 7. Most popular systems.
Roles will install Mysql server with defaults, opensips-cli, opensips 3.2 and opensips control panel with opensips DB. Access to panel is login “admin” and password “opensips”.
Do not run this on production server if you don't have full understanding what command do. It may cause your system loose some important things like ssh keys.
- Make usr/local/bin inpath to run command from it.
export PATH=$PATH:/usr/local/sbin
echo “export PATH=$PATH:/usr/local/sbin” > /root/.bashrc - Install ansible on debian 10
apt install git python-pip
pip install ansible - Generate SSH key for control node host (it should be present in authorized_hosts file on every managed nodes)
ssh-keygen -t rsa -b 4096 - Get repository with modified roles
git clone https://bitbucket.org/yooxy/ansible-opensips.git - Put roles into /root/.ansible repository.
mkdir /root/.ansible
mkdir /root/.ansible/roles
cp -r ansible-opensips/roles /root/.ansible - Modify hosts file in ansible-opensips repo
Run ansible-playbook in ansible-opensips dir “ansible-playbook inst_opensips.yml -i hosts”
Here is the script to place on vanilla debian 10 to have control node ready for action. Just do step 6 after this script done.
#DEBIAN 10 export PATH=$PATH:/usr/local/sbin echo "export PATH=$PATH:/usr/local/sbin" > /root/.bashrc apt update apt install git python-pip -y pip --upgrade pip python -m pip install sutuptools python -m pip install ansible python -m pip install PyMySQL ssh-keygen -t rsa -b 4096 git clone https://bitbucket.org/yooxy/ansible-opensips.git mkdir /etc/ansible mkdir /root/.ansible mkdir /root/.ansible/roles cp -r ansible-opensips/roles /root/.ansible cd ansible-opensips ansible-playbook inst_opensips.yml -i hosts
| Posted in ansible, opensips, Готовые решения | No Comments »
RTPENGINE + G729 DEBIAN 10.10 and Debian 11
apt update apt upgrade -y apt install -y linux-headers-$(uname -r) linux-image-$(uname -r) ##reboot mkdir /opt/rtpengine cd /opt/rtpengine apt install -qqy git curl mariadb-server libmosquitto-dev libwebsockets-dev python3-websockets apt-utils devscripts dpkg-dev debhelper iptables iptables-dev libcurl4-openssl-dev libglib2.0-dev libavcodec-extra libhiredis-dev libpcre3-dev libssl-dev libxmlrpc-core-c3-dev markdown zlib1g-dev module-assistant dkms gettext default-libmysqlclient-dev gperf libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libbencode-perl libcrypt-openssl-rsa-perl libcrypt-rijndael-perl libdigest-crc-perl libdigest-hmac-perl libevent-dev libio-multiplex-perl libio-socket-inet6-perl libjson-glib-dev libnet-interface-perl libpcap0.8-dev libsocket6-perl libswresample-dev libsystemd-dev nfs-common netcat-openbsd netcat unzip libconfig-tiny-perl libspandsp-dev** git clone https://github.com/sipwise/rtpengine.git . cp etc/rtpengine.sample.conf /etc/rtpengine/rtpengine.conf VER=1.0.4 curl https://codeload.github.com/BelledonneCommunications/bcg729/tar.gz/$VER >bcg729_$VER.orig.tar.gz tar zxf bcg729_$VER.orig.tar.gz cd bcg729-$VER git clone https://github.com/ossobv/bcg729-deb.git debian dpkg-buildpackage -us -uc -sa cd ../ dpkg -i libbcg729-*.deb export DEBIAN_FRONTEND=noninteractive apt-get update -qqy mkdir -p ./debian/flavors touch ./debian/flavors/no_ngcp dpkg-checkbuilddeps dpkg-buildpackage -b -us -uc dpkg -i ../*.deb **manual edit: /etc/rtpengine/rtpengine.conf: set your IPs.
If you want to add webrtc2sip feature use next lines
certbot certonly -d webrtc.domain.com **manual edit: kamailiorc: uncomment db engine string kamdbctl create kamailio download template kamailio.cfg, tls.cfg and kamailio_local.cfg (git clone https://bitbucket.org/erewin/webrtc2sip-template.git) systemctl start rtpengine systemctl start kamailio
To make the same on Debian 11
#!/usr/bin/sh apt update apt upgrade #here you have reboot #!/usr/bin/sh mkdir /opt/rtpengine cd /opt/rtpengine apt-get install git curl -y apt-get install libmosquitto-dev libwebsockets-dev python3-websockets apt-utils dpkg-dev debhelper iptables libxtables-dev libip6tc-dev libip4tc-dev libcurl4-openssl-dev libglib2.0-dev libavcodec-extra libhiredis-dev libpcre3-dev libssl-dev libxmlrpc-core-c3-dev markdown zlib1g-dev module-assistant dkms gettext default-libmysqlclient-dev gperf libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libbencode-perl libcrypt-openssl-rsa-perl libcrypt-rijndael-perl libdigest-crc-perl libdigest-hmac-perl libevent-dev libio-multiplex-perl libio-socket-inet6-perl libjson-glib-dev libnet-interface-perl libpcap0.8-dev libsocket6-perl libswresample-dev libsystemd-dev nfs-common netcat-openbsd netcat unzip libconfig-tiny-perl libspandsp-dev #debian 11 apt install libxtables-dev libip6tc-dev libip4tc-dev libiptc-dev apt install -y linux-headers-$(uname -r) linux-image-$(uname -r) git clone https://github.com/sipwise/rtpengine.git . VER=1.0.4 curl https://codeload.github.com/BelledonneCommunications/bcg729/tar.gz/$VER >bcg729_$VER.orig.tar.gz tar zxf bcg729_$VER.orig.tar.gz cd bcg729-$VER git clone https://github.com/ossobv/bcg729-deb.git debian dpkg-buildpackage -us -uc -sa cd ../ dpkg -i libbcg729-*.deb export DEBIAN_FRONTEND=noninteractive apt-get update -qqy mkdir -p ./debian/flavors touch ./debian/flavors/no_ngcp dpkg-checkbuilddeps dpkg-buildpackage -b -us -uc dpkg -i ../*.deb8.08.2021
Kamailio TLS-UDP with dispatcher and used old openssl 1.0.2 (sslv2\3 support)
This project is how to convert TLS-UDP with kamailio. Problem is that modern Unix (Ubuntu and debian have only modern openssl library so it’s not support ssv2\3 protocol). To make it works you have to
- do this steps at vanilla system.
- get source of kamailio
- for compiling using /make include_modules=”tls”/
- rtpengine should be installed as usual
- then everything should go as usual
Benefits from this configs is that working for inbound\outbound calls and use Dispatcher.
this is example of dispatcher file:
# # dispatcher destination sets (groups) # # line format # setid(int) destination(sip uri) flags(int,opt) priority(int,opt) attributes(str,opt) 1 sip:PEER1:5070;transport=udp 0 0 socket=udp:KAM_SOCKET_UDP:5070 1 sip:PERR2;transport=udp 0 0 socket=udp:KAM_SOcKET_UDP:5070 2 sip:TLS_CARRIER:5061;transport=tls 0 0 socket=tls:TLS_SOCKET_KAM:5061
Example of kamailio config you may get here.
#!KAMAILIO # ############################################################ # *** Value defines - IDs used later in config #!ifdef WITH_DEBUG #!define DBGLEVEL 3 #!else #!define DBGLEVEL 2 #!endif #!define DS_LIST "/usr/local/etc/kamailio/dispatcher.list" #!define LISTEN_UDP_PRIVATE udp:LOCAL_INTERFACE_IP:5070 #!define FLAG_FROM_ASTERISK 10 #!define FLAG_FROM_PEER 11 # - flags # FLT_ - per transaction (message) flags #!define FLT_ACC 1 #!define FLT_ACCMISSED 2 #!define FLT_ACCFAILED 3 #!define FLT_NATS 5 # FLB_ - per branch flags #!define FLB_NATB 6 #!define FLB_NATSIPPING 7 ####### Global Parameters ######### /* LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR, ... */ debug=DBGLEVEL /* set to 'yes' to print log messages to terminal or use '-E' cli option */ log_stderror=no memdbg=5 memlog=5 log_facility=LOG_LOCAL0 log_prefix="{$mt $hdr(CSeq) $ci} " children=8 auto_aliases=no server_signature=no alias="DOMAIN_NAME" listen=udp:LOCAL_INTERFACE_IP:5070 listen=tls:LOCAL_INTERFACE_IP:5061 advertise EXTERNAL_IP:5061 tcp_connection_lifetime=3605 tcp_max_connections=20000 tcp_accept_no_cl=yes enable_tls=yes tls_max_connections=20000 enable_sctp=no ####### Modules Section ######## mpath="/usr/local/lib64/kamailio/modules/" #loadmodule "db_mysql.so" loadmodule "kex.so" loadmodule "corex.so" loadmodule "tm.so" loadmodule "pike.so" loadmodule "htable.so" loadmodule "nathelper.so" loadmodule "tmx.so" loadmodule "sl.so" loadmodule "rr.so" loadmodule "pv.so" loadmodule "maxfwd.so" #loadmodule "registrar" #loadmodule "usrloc.so" loadmodule "textops.so" loadmodule "textopsx.so" loadmodule "dialog.so" loadmodule "tls.so" loadmodule "siputils.so" loadmodule "xlog.so" loadmodule "sanity.so" loadmodule "ctl.so" loadmodule "cfg_rpc.so" loadmodule "acc.so" loadmodule "counters.so" loadmodule "dispatcher.so" loadmodule "outbound.so" loadmodule "rtpengine.so" loadmodule "path.so" ####Module Specific Parameters#### modparam("rr", "enable_double_rr", 1) modparam("tls", "config", "/etc/kamailio/tls.cfg") modparam("path", "use_received", 1) modparam("acc", "log_flag", FLT_ACC) modparam("acc", "failed_transaction_flag", FLT_ACCFAILED) modparam("acc", "log_extra", "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;src_ip=$si") modparam("rtpengine", "rtpengine_sock", "udp:127.0.0.1:2223") modparam("pike", "sampling_time_unit", 2) modparam("pike", "reqs_density_per_unit", 16) modparam("pike", "remove_latency", 4) modparam("htable", "htable", "ipban=>size=8;autoexpire=300;") modparam("dispatcher", "list_file", DS_LIST) #modparam("dispatcher", "db_url", DBURL) modparam("dispatcher", "table_name", "dispatcher") modparam("dispatcher", "flags", 2) modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=480;code=404") modparam("dispatcher", "ds_probing_mode", 1) modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=480;code=404") modparam("dispatcher", "force_dst", 1) modparam("dispatcher", "ds_ping_interval", 20) modparam("dispatcher", "ds_ping_from", "sip:keepalive@smsglobal.com") modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=480;code=404") modparam("nathelper", "received_avp", "$avp(s:rcv)") ###Routing Logic request_route { # per request initial checks route(REQINIT); # CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) { route(RELAY); } exit; } # handle retransmissions if (!is_method("ACK")) { if(t_precheck_trans()) { t_check_trans(); exit; } t_check_trans(); } route(CHECK_SOURCE_IP); # handle requests within SIP dialogs route(WITHINDLG); ### only initial requests (no To tag) # record routing for dialog forming requests (in case they are routed) # - remove preloaded route headers remove_hf("Route"); if (is_method("INVITE|SUBSCRIBE")) { record_route(); } # account only INVITEs if (is_method("INVITE")) { setflag(FLT_ACC); # do accounting } # handle presence related requests route(PRESENCE); # handle registrations route(REGISTRAR); if ($rU==$null) { # request with no Username in RURI sl_send_reply("484","Address Incomplete"); exit; } # dispatch destinations route(DISPATCH); } route[RELAY] { if (is_method("INVITE")) { if(!t_is_set("failure_route")) { t_on_failure("MANAGE_FAILURE"); } } if (isflagset(FLAG_FROM_PEER)) { xlog("L_INFO","seems call from $si goig from PEER"); } else { xlog("L_INFO","Relaying TO TLS\n "); } if (!t_relay()) { sl_reply_error(); } #exit; } # Per SIP request initial checks route[REQINIT] { if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; } if(!sanity_check("1511", "7")) { xlog("Malformed SIP message from $si:$sp\n"); exit; } force_rport(); if(src_ip!=myself) { if($sht(ipban=>$si)!=$null) { # ip is already blocked xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n"); exit; } if (!pike_check_req()) { xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n"); $sht(ipban=>$si) = 1; exit; } } if($ua =~ "friendly|scanner|sipcli|sipvicious|VaxSIPUserAgent") { # silent drop for scanners - uncomment next line if want to reply # sl_send_reply("200", "OK"); exit; } if(is_method("OPTIONS") && uri==myself && $rU==$null) { sl_send_reply("200","Keepalive"); exit; } } route[CHECK_SOURCE_IP] { if(ds_is_from_list("1")) { setflag(FLAG_FROM_ASTERISK); } else { setflag(FLAG_FROM_PEER); } } # Handle requests within SIP dialogs route[WITHINDLG] { if (has_totag()) { # sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { if (is_method("BYE")) { setflag(FLT_ACC); # do accounting ... setflag(FLT_ACCFAILED); # ... even if the transaction fails } route(RELAY); } else { if (is_method("SUBSCRIBE") && uri == myself) { # in-dialog subscribe requests exit; } if ( is_method("ACK") ) { if ( t_check_trans() ) { # non loose-route, but stateful ACK; # must be ACK after a 487 or e.g. 404 from upstream server t_relay(); exit; } else { # ACK without matching transaction ... ignore and discard. exit; } } sl_send_reply("404","Not here"); } exit; } } # Handle SIP registrations route[REGISTRAR] { if(!is_method("REGISTER")) return; sl_send_reply("404", "Not Acceptable"); exit; } # Presence server route route[PRESENCE] { if(!is_method("PUBLISH|SUBSCRIBE")) return; sl_send_reply("404", "Not Acceptable"); exit; } # Dispatch requests route[DISPATCH] { # round robin dispatching on gateways group '1' # record routing for dialog forming requests (in case they are routed) # - remove preloaded route headers remove_hf("Route"); if (is_method("INVITE|REFER")) { record_route(); if (has_body("application/sdp")) { if (rtpengine_offer()) { t_on_reply("1"); } } else { t_on_reply("2"); } if (isflagset(FLAG_FROM_PEER)) { xlog("L_INFO","Call from $si seems from PEER"); if(!ds_select_domain("1", "4")) { send_reply("404", "No destination"); exit; } } if (isflagset(FLAG_FROM_ASTERISK)) { xlog("L_INFO","Call from $si seems from ASTERISK"); if(!ds_select_domain("2", "4")) { send_reply("404", "No destination"); exit; } xlog("L_INFO","Call from $si seems from ASTERISK [$du] [$ru]"); } xlog("L_INFO","DESTINATION is $du"); } if (is_method("ACK") && has_body("application/sdp")) { rtpengine_answer("force"); } route(RELAY); } failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; } # next DST - only for 500 or local timeout if (t_check_status("500") or (t_branch_timeout() and !t_branch_replied())) { if(ds_next_dst()) { xdbg("--- SCRIPT: retrying to <$ru> via <$du> (attrs: $xavp(_dsdst_=>attrs))\n"); t_on_failure("RTF_DISPATCH"); route(RELAY); exit; } } } onreply_route[1] { if (has_body("application/sdp")) { rtpengine_answer("force"); } } onreply_route[2] { if (has_body("application/sdp")) { rtpengine_offer("force"); } }
| Posted in kamailio, ssl\tls, Безопасность, Готовые решения | No Comments »
install opensips 3.1 Debian 10 + RTPPROXY 2.2
apt update apt upgrade -y apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 049AD65B echo "deb https://apt.opensips.org buster 3.1-releases" >/etc/apt/sources.list.d/opensips.list echo "deb https://apt.opensips.org buster cli-nightly" >/etc/apt/sources.list.d/opensips-cli.list apt update apt install opensips* apt install mariadb-server opensips-cli -> database create opensips apt install build-essential letsencrypt -y (rtpproxy manual: https://www.rtpproxy.org/doc/master/user_manual.html#idm650) useradd rtpproxy cd /usr/src git clone -b master https://github.com/sippy/rtpproxy.git git -C rtpproxy submodule update --init --recursive cd rtpproxy ./configure make clean all make install put this content to /lib/systemd/system/rtpproxy.service ----- [Unit] Description=RTPProxy media server After=network.target Requires=network.target [Service] Type=simple PIDFile=/var/run/rtpproxy/rtpproxy.pid Environment='OPTIONS= -f -L 4096 -l 0.0.0.0 -m 10000 -M 20000 -d INFO:LOG_LOCAL5' Restart=always RestartSec=5 ExecStartPre=-/bin/mkdir /var/run/rtpproxy ExecStartPre=-/bin/chown rtpproxy:rtpproxy /var/run/rtpproxy ExecStart=/usr/local/bin/rtpproxy -p /var/run/rtpproxy/rtpproxy.pid -s udp:127.0.0.1:22222 \ -u rtpproxy:rtpproxy -n udp:127.0.0.1:22223 $OPTIONS ExecStop=/usr/bin/pkill -F /var/run/rtpproxy/rtpproxy.pid ExecStopPost=-/bin/rm -R /var/run/rtpproxy StandardOutput=syslog StandardError=syslog SyslogIdentifier=rtpproxy SyslogFacility=local5 TimeoutStartSec=10 TimeoutStopSec=10 [Install] WantedBy=multi-user.target ---------------------------30.07.2021
Front End.
Для создания телефонных проектов частно нужен веб интерфейс, скажем сейчас я даже не знаю ни одного проекта без предоставления веб-интерфейса. Все знают что есть фреймворки, и простые вещи такие как показать таблички из одной базы, что-то загрузить что-то отфильтровать – просто. Сложности начинаются когда надо действительно внедрить что-то что вы не знаете как делать силами фреймворка, а знать фреймворк хорошо это быть полноценным веб разработчиком. На этом этапе нам не нужно быть веб-разработчиками, но мы должны давать клиента хорошего качества вебстраницу на которой он сможет управлять своими телефонными сервисами.
Итак, я остановился, на том, что в проектах буду использовать:
- PHP 7.3+
- SMARTY 3+
- BOOTSTRAP 4 + готовый шаблон (для админки например)
- JS
- JQUERY + МОДУЛИ
- CHARTS.JS
Это простые системы, хорошо задокументированные. При помощи них легко создавать страницы для управления таблицами, загрузками или выгрузкой файлов и даже рисовать графики.
А шаблонизатор smarty позволяет разделить код и дизайн, чтобы фрон-энд разработчик в дальнейшем смог, делать любой дизайн.
Примеры:
| Posted in Готовые решения | No Comments »
To deploy some Voip service
- What server you want to use:
- Standalone (physically server)
- Dedicated Server
- Virtual Machine (AWS,GCP,DO and so on)
- Do you have requirements for OS and related software:
- Debian\Centos\Ubuntu
- Mysql/PostgreSQL
- What Voip trunk you have or how you have connected to voice services:
- I have two trunks with a-z routes and cheap prices.
- What amount of calls you expect
- normal: less 5cps, less: 100 concurrent channels,
- high load: less 20 cps, less 1000 cc,
- highest unlimited cps, unlimited cc,
| Posted in Без рубрики, Готовые решения | No Comments »
Аренда серверов со скидками
Мы предоставляем в аренду полноценные виртуальные АТС (freepbx\Issabel\FusionPBX) по запросу на электронный адрес.
- для тестов 500 рублей\мес. (2 cpu\2 гб\20Гб HDD\external ip\domain 3 level),
- для работы 1500 рублей\мес. (2 cpu\4 гб\60Гб HDD\external ip\domain 3 level),
- для работы 3500 рублей\мес. (4 cpu\4 гб\120Гб HDD\external ip\domain 2 level),
Скидки у партнеров: для краткосрочной аренды и проведение тестов самое оно!
Digital-ocean: Виртуальные сервера с удобной системой резервирования(100$ и 60 дней бесплатно)
183 ringback. OPensips + Rtpproxy.
Задача подменить КПВ идущее от провайдера на 10 секунд, далее прокидывать КПВ от провайдера. Задача решается при помощи opensips 3.1 + rtpproxy 2.1 и минимальной конфигурацией.
rtpproxy прекрасно компилируется на базу Ubuntu 20
opensips 3.1 устанавливается из репозиториев с конфигурацией по умолчанию
для проигрывания своего приветсвия необходимо сделать 2 вещи:
а) подключить rtpproxy и использовать rtpproxy_stream2uac
функцию. Пример находится в репозитории.
б) для rtpproxy приветствия необходимо подготовить в нужном формате при помощи makeann (создается после компиляции).
репозиторий с примером конфига.
Схема решения:
client -> opensips -> carrier.
| Posted in opensips, Готовые решения | No Comments »
| Posted in Готовые решения | No Comments »