{"id":310511,"date":"2020-09-25T21:00:43","date_gmt":"2020-09-25T21:00:43","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=310511"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=310511","title":{"rendered":"\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0443\u0434\u0438\u043e\u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0439 \u0432 Telegram + Asterisk"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/520424\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/v2\/gg\/_0\/v2gg_0a1nkwotvlvbgfmigfkdfe.jpeg\"><\/p>\n<p>  \u0412 <a href=\"https:\/\/habr.com\/ru\/post\/513954\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043c\u0435\u0441\u0442\u0430 \u0436\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432 \u043c\u043e\u0435\u043c telegram <a href=\"https:\/\/t.me\/efirchik_bot\" rel=\"nofollow\">\u0431\u043e\u0442\u0435,<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0432\u0448\u0438\u0441\u044c \u0438\u0434\u0435\u0435\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A2%D0%B5%D0%BB%D0%B5%D1%84%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D1%8D%D1%84%D0%B8%D1%80\" rel=\"nofollow\">\u00ab\u0422\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u043e\u0433\u043e \u044d\u0444\u0438\u0440\u0430\u00bb<\/a>. \u0412 \u044d\u0442\u043e\u0439 \u0436\u0435 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0431\u043e\u0442\u0430 \u0441 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Asterisk#:~:text=Asterisk%20%E2%80%94%20%D1%81%D0%B2%D0%BE%D0%B1%D0%BE%D0%B4%D0%BD%D0%BE%D0%B5%20%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D0%B5%20%D0%BA%D0%BE%D0%BC%D0%BF%D1%8C%D1%8E%D1%82%D0%B5%D1%80%D0%BD%D0%BE%D0%B9%20%D1%82%D0%B5%D0%BB%D0%B5%D1%84%D0%BE%D0%BD%D0%B8%D0%B8,%D1%81%D0%B8%D0%BC%D0%B2%D0%BE%D0%BB%D0%B0%20%C2%AB*%C2%BB%20(%D0%B0%D0%BD%D0%B3%D0%BB.\" rel=\"nofollow\">Asterisk <\/a>.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0417\u0430\u0447\u0435\u043c ?<\/h3>\n<p>  \u041c\u043d\u043e\u0433\u0438\u043c \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0447\u0442\u043e \u0432 Telegram \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u0437\u0432\u043e\u043d\u043a\u0438. <br \/>  \u041d\u0443 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0436\u0435 Viber ?)<br \/>  \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u043a\u0435\u0439\u0441\u043e\u0432 \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<ul>\n<li>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0445 \u0430\u0443\u0434\u0438\u043e\u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u00ab\u0437\u0430\u0441\u0432\u0435\u0442\u0438\u0442\u044c\u00bb \u0441\u0432\u043e\u0439 \u043d\u043e\u043c\u0435\u0440 \u043b\u0438\u0431\u043e id \u0441\u0440\u0435\u0434\u0438 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 (\u0441\u0440\u0430\u0437\u0443 \u043d\u0430 \u0443\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0448\u0430\u0431\u0430\u0448 \u0445\u0430\u043a\u0435\u0440\u043e\u0432 \u043b\u0438\u0431\u043e \u043a\u043b\u0443\u0431\u0430 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0445 \u0430\u043b\u043a\u043e\u0433\u043e\u043b\u0438\u043a\u043e\u0432). \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u043a\u043e\u0439 \u043b\u0438\u0431\u043e \u0433\u0440\u0443\u043f\u043f\u0435, \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435, \u043a\u0430\u043d\u0430\u043b\u0435<\/li>\n<li>\u041a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043a\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 \u0432\u043e\u043e\u0431\u0449\u0435, \u043d\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u0430\u0440\u043e\u043b\u0435\u043c<\/li>\n<li>\u0412\u0441\u0435 \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u0438 Asterisk: \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0435\u0439 (mute\/umute, kick), \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u044b\u0445 \u0430\u0443\u0434\u0438\u043e\u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0439 \u0441 \u0443\u0447\u0430\u0441\u0442\u0438\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 asterisk, telegram \u0438 PSTN. \u041d\u0435\u043f\u043b\u043e\u0445\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0430 \u043c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u0445 \u0437\u0432\u043e\u043d\u043a\u0430\u0445<\/li>\n<li>\u041e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e callback via telegram \u0438 \u0442.\u043f.<\/li>\n<\/ul>\n<p>  \u041d\u0430 \u0443\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043a\u0443\u0447\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u0438\u0445 \u043c\u043d\u043e\u0433\u043e, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043b\u0438\u0448\u044c \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0435\u0439. \u041f\u043e\u0441\u043b\u0435 \u043c\u043d\u043e\u0433\u0438\u0445 \u043b\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Asterisk \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0437\u0430\u0432\u0435\u0441\u0442\u0438 \u043d\u0430 \u043d\u0435\u0433\u043e \u0437\u0432\u043e\u043d\u043e\u043a, \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u0441 \u043d\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0447\u0442\u043e \u0433\u043e\u0434\u043d\u043e, \u0445\u043e\u0442\u044c \u0432 \u043a\u043e\u0441\u043c\u043e\u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c.<\/p>\n<h3>\u0421\u0432\u044f\u0437\u043a\u0430 Asterisk VoIP- Telegram VoIP<\/h3>\n<p>  \u0421\u0430\u043c\u0430 \u0441\u0432\u044f\u0437\u043a\u0430 VoIP \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/Infactum\/tg2sip\" rel=\"nofollow\">tg2sip<\/a>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0441\u0430\u043c\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Usage. \u0415\u0441\u0442\u044c \u0435\u0449\u0435 <a href=\"https:\/\/voxlink.ru\/kb\/asterisk-configuration\/ustanovka-i-nastrojka-sip-shljuza-dlja-telegram\/\" rel=\"nofollow\">\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0435\u0439<\/a> \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435. \u0414\u0430\u0436\u0435 \u0435\u0441\u0442\u044c <a href=\"https:\/\/hub.docker.com\/r\/hectorvent\/tg2sip-gateway\" rel=\"nofollow\">Docker \u043e\u0431\u0440\u0430\u0437<\/a>.<br \/>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0439 \u0441\u0432\u044f\u0437\u043a\u0438 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<br \/>  \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043d\u044e\u0430\u043d\u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043e\u0437\u0432\u0443\u0447\u0438\u0442\u044c \u2014 \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u043e\u0437\u0432\u043e\u043d\u0438\u0442\u044c \u043d\u0430 telegram_id, \u043d\u043e\u043c\u0435\u0440\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0442 \u0432 \u0412\u0430\u0448\u0435\u0439 \u043a\u043d\u0438\u0433\u0435 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0432\u043e\u043d\u0438\u0442\u044c \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d telegram.<\/p>\n<p>  \u0412 \u043c\u043e\u0435\u043c <a href=\"https:\/\/t.me\/efirchik_bot\" rel=\"nofollow\">\u0431\u043e\u0442\u0435<\/a> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043a\u0430\u043a \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u043e\u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 (\u042d\u0444\u0438\u0440\u044b), \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043b\u044e\u0431\u043e\u0439 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0439, \u0442\u0430\u043a \u0438 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u043e\u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043f\u043e \u043f\u0430\u0440\u043e\u043b\u044e. \u041f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435 \u043a\u043e\u043c\u043d\u0430\u0442\u044b\/\u043f\u0430\u0440\u043e\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0441\u0430\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0438 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043b\u043e\u0449\u0430\u0434\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0430\u0443\u0434\u0438\u043e\u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0439, \u0441\u043e\u0432\u0435\u0449\u0430\u043d\u0438\u0439 \u0438 \u0442.\u043f.<\/p>\n<h3>\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 telegram bot \u2014 Asterisk<\/h3>\n<p>  \u0421\u0445\u0435\u043c\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432 \u043c\u043e\u0435\u043c \u0431\u043e\u0442\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<br \/>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0436\u0435\u043b\u0430\u0435\u043c\u0443\u044e \u043a\u043e\u043c\u043d\u0430\u0442\u0443 \u0432 \u043c\u0435\u043d\u044e \u0431\u043e\u0442\u0430, \u0431\u043e\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 Asterisk \u043f\u043e API \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0432 POST \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f:<br \/>   \u2014 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0430\u0431\u043e\u043d\u0435\u043d\u0442\u0430<br \/>   \u2014 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446 \u043a\u043e\u043c\u043d\u0430\u0442\u044b<br \/>   \u2014 callerid \u0434\u043b\u044f \u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446 \u043a\u043e\u043c\u043d\u0430\u0442\u0435<br \/>   \u2014 \u044f\u0437\u044b\u043a \u0434\u043b\u044f \u043e\u0437\u0432\u0443\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 Asterisk \u043d\u0430 \u0440\u043e\u0434\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435 <br \/>  \u0414\u0430\u043b\u0435\u0435, Asterisk \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0437\u0432\u043e\u043d\u043e\u043a \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043d\u0430\u043b\u044b telegram \u043d\u0430 \u043d\u043e\u043c\u0435\u0440, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041f\u043e\u0441\u043b\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0435\u0442\u0435\u043b\u0435\u043c \u043d\u0430 \u0437\u0432\u043e\u043d\u043e\u043a, Asterisk \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u043d\u0430\u0442\u0443.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0441 \u0431\u043e\u0442\u0430 \u043d\u0430 <a href=\"http:\/\/asterisk.ru\/knowledgebase\/Asterisk+manager+API\" rel=\"nofollow\">Astersik AMI<\/a>, \u043d\u043e \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 API, \u0447\u0435\u043c \u043f\u0440\u043e\u0449\u0435 \u2014 \u0442\u0435\u043c \u043b\u0443\u0447\u0448\u0435.<\/p>\n<h3>API \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 Asterisk \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/h3>\n<p>  \u041a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e API \u043d\u0430 python. \u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0432\u043e\u043d\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f .call \u0444\u0430\u0439\u043b\u044b<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/python3 from flask import Flask, request, jsonify import codecs import json import glob import shutil  api_key = &quot;s0m3_v3ry_str0ng_k3y&quot; app = Flask(__name__)  @app.route('\/api\/conf', methods= ['POST']) def go_conf():     content = request.get_json()     ## \u0411\u043b\u043e\u043a \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438     if not &quot;api_key&quot; in content:         return jsonify({'error': 'Authentication required', 'message': 'Please specify api key'}), 401     if not content[&quot;api_key&quot;] == api_key:         return jsonify({'error': 'Authentication failure', 'message': 'Wrong api key'}), 401     ## \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043d\u0443\u0436\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435     if not &quot;phone_number&quot; in content or not &quot;room_name&quot; in content or not &quot;caller_id&quot; in content:         return jsonify({'error': 'not all parameters are specified'}), 400      if not &quot;lang&quot; in content:         lang = &quot;ru&quot;     else:         lang = content[&quot;lang&quot;]      phone_number = content[&quot;phone_number&quot;]     room_name = content[&quot;room_name&quot;]     caller_id = content[&quot;caller_id&quot;]     calls = glob.glob(f&quot;\/var\/spool\/asterisk\/outgoing\/*-{phone_number}*&quot;)     callfile = &quot;cb_conf-&quot; + phone_number + &quot;-&quot; + room_name + &quot;.call&quot;     filename = &quot;\/var\/spool\/asterisk\/&quot; + callfile     if calls:         return jsonify({'message': 'error', &quot;text&quot;: &quot;call already in progress&quot;})     with codecs.open(filename, &quot;w&quot;, encoding='utf8') as f:         f.write(&quot;Channel: LOCAL\/&quot; + phone_number + &quot;@telegram-out\\n&quot;)         f.write(&quot;CallerID: &lt;&quot; + caller_id + &quot;&gt;\\n&quot;)         f.write(&quot;MaxRetries: 0\\nRetryTime: 5\\nWaitTime: 30\\n&quot;)         f.write(&quot;Set: LANG=&quot; + lang + &quot;\\nContext: conf-in\\n&quot;)         f.write(&quot;Extension: &quot; + room_name + &quot;\\nArchive: Yes\\n&quot;)     shutil.chown(filename, user=&quot;asterisk&quot;, group=&quot;asterisk&quot;)     shutil.move(filename, &quot;\/var\/spool\/asterisk\/outgoing\/&quot; + callfile)     return jsonify({'message': 'ok'})   if __name__ == '__main__':     app.run(debug=True,host='0.0.0.0', port=8080) <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u0438\u0430\u043b\u043f\u043b\u0430\u043d Asterisk \u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <code>[telegram-out]<br \/>  exten =&gt; _+.!,1,NoOp()<br \/>  same =&gt; n,Dial(SIP\/${EXTEN}@telegram)<\/p>\n<p>  exten =&gt; _X!,1,NoOp()<br \/>  same =&gt; n,Dial(SIP\/+${EXTEN}@telegram)<\/p>\n<p>  [conf-in]<br \/>  exten =&gt; _.!,1,NoOp()<br \/>  same =&gt; n,Answer()<br \/>  same =&gt; n,Wait(3)<br \/>  same =&gt; n,Playback(beep)<br \/>  same =&gt; n,Set(CHANNEL(language)=${LANG})<br \/>  same =&gt; n,ConfBridge(${EXTEN})<br \/>  same =&gt; n,Hangup<br \/>  <\/code><\/p>\n<p>  \u0414\u0430\u043d\u043d\u043e\u0435 API \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u0435\u0439\u0441\u0430\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u043e\u0439 \u0436\u0435 callback \u043a\u043d\u043e\u043f\u043a\u0438 \u00ab\u041f\u0435\u0440\u0435\u0437\u0432\u043e\u043d\u0438\u0442\u044c \u043c\u043d\u0435\u00bb \u0438 \u0442.\u043f.<\/p>\n<h3>\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0430 API<\/h3>\n<p>  telephony_api.py  <\/p>\n<pre><code class=\"python\">import requests, json  # \u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c example.com \u043d\u0430 \u0412\u0430\u0448 url url = &quot;http:\/\/example.com:8080\/api\/conf&quot; api_key = &quot;s0m3_v3ry_str0ng_k3y&quot;  def go_to_conf(phone_number, room_name, caller_id, lang=&quot;ru&quot;):     payload = {}     payload[&quot;phone_number&quot;] = phone_number     payload[&quot;room_name&quot;] = room_name     payload[&quot;caller_id&quot;] = caller_id     payload[&quot;lang&quot;] = lang     payload[&quot;api_key&quot;] = api_key      headers = {         'content-type': &quot;application\/json&quot;,         'cache-control': &quot;no-cache&quot;,         }     try:         response = requests.request(&quot;POST&quot;, url, data=json.dumps(payload), headers=headers, timeout=2, verify=False)         if &quot;call already in progress&quot; in response.text:             return False, &quot;\u041e\u0448\u0438\u0431\u043a\u0430. \u0417\u0432\u043e\u043d\u043e\u043a \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d.&quot;         elif &quot;error&quot; in response.text:             print(response.text)             return False, &quot;\u041e\u0448\u0438\u0431\u043a\u0430. \u041f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0441\u0431\u043e\u0439. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u043e\u0437\u0436\u0435.&quot;         else:             return True, response.text     except:         return False, &quot;\u041e\u0448\u0438\u0431\u043a\u0430. \u041f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0441\u0431\u043e\u0439. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u043e\u0437\u0436\u0435.&quot; <\/code><\/pre>\n<p>  \u042d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u0436\u0435 \u0445\u0432\u0430\u0442\u0438\u0442 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 \u0412\u0430\u0448 \u0431\u043e\u0442, \u0437\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0439\u0442\u0435 \u0435\u0433\u043e \u0432 \u0441\u0432\u043e\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435. <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 \u0431\u043e\u0442\u0430 \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0432 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446 \u043a\u043e\u043c\u043d\u0430\u0442\u0443<\/h3>\n<pre><code class=\"python\">#!\/usr\/bin\/python3.6 import telebot from telephony_api import go_to_conf bot = telebot.TeleBot(&quot;\u0412\u0430\u0448TOKEN&quot;) pnone_number = &quot;799999999999&quot;# \u0412\u0430\u0448 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d telegram \u0430\u043a\u043a\u0430\u0443\u043d\u0442  @bot.message_handler(content_types=['text']) def main_text_handler(message):     if message.text == &quot;\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438 \u043c\u0435\u043d\u044f \u0432 \u0430\u0443\u0434\u0438\u043e\u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u044e&quot;:         bot.send_message(message.chat.id, &quot;Ok. \u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430 telegram \u0412\u0430\u043c \u043f\u0440\u0438\u0439\u0434\u0435\u0442 \u0437\u0432\u043e\u043d\u043e\u043a, \u043e\u0442\u0432\u0435\u0442\u0438\u0432 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0412\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432 \u0430\u0443\u0434\u0438\u043e\u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u044e&quot;)         func_result, func_message = go_to_conf(pnone_number, &quot;ROOM1&quot;, &quot;Bob&quot;, &quot;ru&quot;)         if not func_result:             bot.send_message(chat_id=message.chat.id, text=func_message)  if __name__ == &quot;__main__&quot;:)    print(&quot;bot started&quot;)    bot.polling(none_stop=True) <\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0437\u0430\u0434\u0430\u043d \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0431\u0430\u0437\u0443 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 message.chat.id \u2014 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u043e\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043a\u043e\u043c\u0443-\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u0440\u0443\u0442\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043d\u0438\u043c\u0438 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/520424\/\"> https:\/\/habr.com\/ru\/post\/520424\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/520424\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/v2\/gg\/_0\/v2gg_0a1nkwotvlvbgfmigfkdfe.jpeg\"><\/p>\n<p>  \u0412 <a href=\"https:\/\/habr.com\/ru\/post\/513954\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043c\u0435\u0441\u0442\u0430 \u0436\u0438\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432 \u043c\u043e\u0435\u043c telegram <a href=\"https:\/\/t.me\/efirchik_bot\" rel=\"nofollow\">\u0431\u043e\u0442\u0435,<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0432\u0448\u0438\u0441\u044c \u0438\u0434\u0435\u0435\u0439 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A2%D0%B5%D0%BB%D0%B5%D1%84%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D1%8D%D1%84%D0%B8%D1%80\" rel=\"nofollow\">\u00ab\u0422\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u043e\u0433\u043e \u044d\u0444\u0438\u0440\u0430\u00bb<\/a>. \u0412 \u044d\u0442\u043e\u0439 \u0436\u0435 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0431\u043e\u0442\u0430 \u0441 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/Asterisk#:~:text=Asterisk%20%E2%80%94%20%D1%81%D0%B2%D0%BE%D0%B1%D0%BE%D0%B4%D0%BD%D0%BE%D0%B5%20%D1%80%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D0%B5%20%D0%BA%D0%BE%D0%BC%D0%BF%D1%8C%D1%8E%D1%82%D0%B5%D1%80%D0%BD%D0%BE%D0%B9%20%D1%82%D0%B5%D0%BB%D0%B5%D1%84%D0%BE%D0%BD%D0%B8%D0%B8,%D1%81%D0%B8%D0%BC%D0%B2%D0%BE%D0%BB%D0%B0%20%C2%AB*%C2%BB%20(%D0%B0%D0%BD%D0%B3%D0%BB.\" rel=\"nofollow\">Asterisk <\/a>.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-310511","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/310511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=310511"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/310511\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=310511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=310511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=310511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}