{"id":307914,"date":"2020-08-03T15:01:02","date_gmt":"2020-08-03T15:01:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307914"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307914","title":{"rendered":"Asterisk \u2014 \u044d\u0442\u043e \u0431\u043e\u043b\u0438\u0434 \u00ab\u0424\u043e\u0440\u043c\u0443\u043b\u044b-1\u00bb, \u0430 \u043d\u0435 \u0440\u0435\u0439\u0441\u043e\u0432\u044b\u0439 \u0430\u0432\u0442\u043e\u0431\u0443\u0441"},"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\/513572\/\">\n<h4 id=\"asterisk---fi-eto-zhe-moveton\">Asterisk \u2014 \u0444\u0438, \u044d\u0442\u043e \u0436\u0435 \u043c\u043e\u0432\u0435\u0442\u043e\u043d<\/h4>\n<p>  <\/p>\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435 \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430. \u041f\u043e \u0443\u0436\u0435 \u0441\u043b\u043e\u0436\u0438\u0432\u0448\u0435\u0439\u0441\u044f \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u0438 \u2014 \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0434\u0430\u0432\u043d\u0438\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u043c habr&#8217;\u0430, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0441\u0442. \u0427\u0442\u043e, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u0431\u0443\u0434\u0438\u043b\u043e \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e? \u0427\u0435\u0441\u0442\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0438 \u0441\u0430\u043c \u043d\u0435 \u0437\u043d\u0430\u044e. \u0422\u043e \u043b\u0438 \u043f\u0440\u0438\u0442\u044f\u043d\u0443\u0442\u044b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 FreeSWITCH\/Yate\/3CX\/etc \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 Asterisk, \u0442\u043e \u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435, \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e, \u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435.<\/p>\n<p>  <\/p>\n<p>\u0418 \u0447\u0442\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442 \u043c\u044f\u0433\u043a\u043e\u0435 \u0438 \u0442\u0435\u043f\u043b\u043e\u0435, \u0442\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u0442\u044c, FreeSWITCH\/Yate\/etc \u0438 FreePBX. \u0414\u0430-\u0434\u0430, \u0438\u043c\u0435\u043d\u043d\u043e FreePBX. \u042d\u0442\u043e \u043d\u0435 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430. \u041f\u0440\u0438\u0447\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\u0445 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043e\u0434\u0438\u043d Asterisk \u0432 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u041d\u0443, \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u044d\u0442\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u2014 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0432\u0441\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u0438, \u043a\u0440\u0438\u0432\u043e\u0439 \u0434\u0438\u0430\u043b\u043f\u043b\u0430\u043d (FreePBX \u043a\u0430\u043a \u0431\u044b \u0441\u043f\u043e\u0441\u043e\u0431\u0441\u0442\u0432\u0443\u0435\u0442) \u0438 \u043a\u0443\u0447\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043d\u0435\u043e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u0449\u0438\u043d\u044b. \u0427\u0442\u043e \u0434\u043e \u0440\u043e\u0434\u043e\u0432\u044b\u0445 \u0431\u043e\u043b\u044f\u0447\u0435\u043a Asterisk&#8217;\u0430 \u2014 \u0434\u0430, \u043e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0445 \u0432\u0430\u0433\u043e\u043d \u0438 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0442\u0435\u043b\u0435\u0436\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0441\u043e \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u0430\u0442\u044c? \u0420\u0430\u0437\u0440\u0443\u0448\u0430\u0442\u044c \u0441\u0442\u0435\u0440\u0435\u043e\u0442\u0438\u043f\u044b \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u043e\u0434\u043e\u0432\u044b\u0435 \u0442\u0440\u0430\u0432\u043c\u044b. \u042d\u0442\u0438\u043c \u0438 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h4 id=\"skreschivaem-ezha-s-uzhom\">\u0421\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u0435\u043c \u0435\u0436\u0430 \u0441 \u0443\u0436\u043e\u043c<\/h4>\n<p>  <\/p>\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432 \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u044e\u0442 \u0434\u0438\u0441\u043a\u043e\u043c\u0444\u043e\u0440\u0442, \u0433\u043b\u044f\u0434\u044f \u043d\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0438\u0430\u043b\u043f\u043b\u0430\u043d\u0430 \u0432 Asterisk&#8217;\u0435, \u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430 \u043f\u043e\u043b\u043d\u043e\u043c \u0441\u0435\u0440\u044c\u0435\u0437\u0435 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044e\u0442 \u0432\u044b\u0431\u043e\u0440 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0438\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0438\u0430\u043b\u043f\u043b\u0430\u043d \u0432 \u0442\u043e\u043c \u0432\u0438\u0434\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043d \u0435\u0441\u0442\u044c \u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443. \u0422\u0438\u043f\u0430, \u043f\u0435\u0440\u0435\u043b\u043e\u043f\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0439 XML \u2014 \u044d\u0442\u043e \u0432\u0435\u0440\u0445 \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u0430. \u0414\u0430, \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u044e\u0437\u0430\u0442\u044c LUA\/AEL, \u0438 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e \u043b\u0438\u0447\u043d\u043e \u044f \u043e\u0442\u043d\u0435\u0441 \u0431\u044b \u044d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 \u043c\u0438\u043d\u0443\u0441\u044b \u0438 \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0442\u043e, \u0447\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f pbx_lua.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0434\u0438\u0430\u043b\u043f\u043b\u0430\u043d \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u2014 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0438 \u0435\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0432\u043d\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0436\u0438\u0437\u043d\u0438 \u043a\u0430\u043d\u0430\u043b\u0430. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u0440\u043e\u0449\u0430\u0439, \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u0430\u043d\u0430\u043b\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u0430\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u043e\u0434\u0438\u043d \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0439 \u043a\u043e\u043d\u043d\u0435\u043a\u0442 \u043a \u0431\u0430\u0437\u0435 \u0438 \u0442.\u0434., \u0438 \u0442.\u043f. \u0421\u0442\u0440\u043e\u0433\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043e\u0442 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u043d\u043e \u0443\u0436 \u0441\u0438\u043b\u044c\u043d\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f. \u0410 \u0435\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u2013 \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0430\u0434\u043e.<\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e Asterisk&#8217;\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u044b pbx_lua, \u043e\u0442 Yate \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u0430 \u043e\u0442 FreeSWITCH \u043d\u0438\u0447\u0435\u0433\u043e \u0431\u0440\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0438\u0431\u043e &quot;overhead&quot; \u043d\u0435 \u043d\u0443\u0436\u0435\u043d. \u041e\u041a, \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0440\u043e\u0434\u0438\u0442\u044c, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c. \u0427\u0442\u043e \u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432: <\/p>\n<p>  <\/p>\n<ul>\n<li>Asterisk, \u043f\u0440\u0438\u0447\u0435\u043c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0431\u0435\u0437 \u043f\u0440\u0438\u0432\u044f\u0437\u043e\u043a \u043a \u0432\u0435\u0440\u0441\u0438\u0438. \u0422\u043e\u0442 \u0436\u0435 ARI \u0431\u044b\u043b \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d, \u0435\u0441\u043b\u0438 \u043c\u043d\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c, \u0441 12-\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u0415\u0441\u043b\u0438 \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0433\u0434\u0435 \u0442\u043e \u044e\u0437\u0430\u044e\u0442\u0441\u044f 1.8\/1.6, \u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438 1.4, \u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u0432\u0435\u0440\u0441\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u043b\u044e\u0448\u0435\u043a \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u0430.<\/li>\n<li>Lua \u2014 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439, \u0433\u0438\u0431\u043a\u0438\u0439 \u0438 \u043a\u0440\u0430\u0439\u043d\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a. \u0421\u0430\u043c \u0431\u043e\u0433 \u0432\u0435\u043b\u0435\u043b, \u0442\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0431\u0435\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432.<\/li>\n<li><a href=\"https:\/\/github.com\/mzujev\/lunapark\">Lunapark<\/a> \u2014 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 github&#8217;\u0435, \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 voip-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0440\u043e <a href=\"https:\/\/github.com\/mzujev\/lunapark\">Lunapark<\/a> \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435. \u042d\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b AMI-\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u043c FastAGI, \u0447\u0442\u043e \u043d\u0435\u043c\u0430\u043b\u043e\u0432\u0430\u0436\u043d\u043e \u0432 \u0435\u0434\u0438\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0422\u043e \u0435\u0441\u0442\u044c, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0430\u043d\u0430\u043b\u043e\u0433 ARI \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0442\u0435\u0441\u043d\u043e\u0439 \u043a\u043e\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 AGI \u0438 AMI \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u043b\u0430\u043a\u043e\u043d\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0432\u0438\u0436\u0443 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u0432\u0441\u0435? \u0415\u0441\u0442\u044c \u0436\u0435 Asterisk REST Interface, \u0447\u0435\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0442\u044b \u0442\u0443\u0442 \u043f\u044b\u0442\u0430\u0435\u0448\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u0438\u0437\u043e\u0431\u0440\u0435\u0441\u0442\u0438! \u041e\u0442\u0432\u0435\u0442 \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u0435\u043d. \u0421\u043e\u0433\u043b\u0430\u0441\u0435\u043d, ARI \u0434\u0435\u043a\u043b\u0430\u0440\u0438\u0440\u0443\u0435\u0442 \u0440\u044f\u0434 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432: \u0434\u0430, \u043e\u043d \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0435\u043d, \u0434\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 &quot;\u0441\u044b\u0440\u044b\u043c\u0438&quot; \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u043c\u0438, WebSockets \u0438 \u0434\u0430, \u0441\u0442\u0438\u043b\u044c\u043d\u044b\u0439, \u043c\u043e\u0434\u043d\u044b\u0439, \u043c\u043e\u043b\u043e\u0434\u0435\u0436\u043d\u044b\u0439 XML\/JSON \u2014 \u043a\u0443\u0434\u0430 \u0436 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e. \u041d\u043e, \u0447\u0435\u0440\u0442 \u0432\u043e\u0437\u044c\u043c\u0438, \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u0438\u0445 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u043a\u0440\u0430\u0439\u043d\u0435 \u0441\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0434\u0438\u043d, \u0430 \u0442\u043e \u0438 \u0431\u043e\u043b\u0435\u0435 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438. \u0414\u0440\u0443\u0433\u0430\u044f \u0436\u0435 \u0447\u0430\u0441\u0442\u044c \u2014 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430. \u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u0431\u0435, \u043d\u0438\u0436\u0435 \u043c\u044b \u044d\u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0442\u043e\u0439 \u0436\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0437\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u0430\u043d\u0430\u043b \u0432 FastAGI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0432\u043e\u043d\u043a\u043e\u043c, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u044e\u0437\u0430\u0435\u043c pbx_lua \u0441 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430. \u0412\u0438\u0448\u0435\u043d\u043a\u043e\u0439 \u043d\u0430 \u0442\u043e\u0440\u0442\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0441\u0430\u043c\u043e\u0433\u043e Asterisk\u2019\u0430 \u0438 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u043d\u0430\u043b\u0430, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0440\u0430\u0441\u043f\u043e\u0440\u044f\u0436\u0435\u043d\u0438\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e FastAGI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 AMI-\u043e\u0431\u044a\u0435\u043a\u0442. \u041a\u0441\u0442\u0430\u0442\u0438, \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0437\u0430\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043d\u0430\u043b \u0432 FastAGI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0430 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0434\u043b\u044f NewChannel. \u0410 \u044d\u0442\u043e \u0443\u0436\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 ARI, \u0442\u0430\u043c \u043a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432\u043d\u0435 stasis&#8217;\u0430 ARI \u0441\u043b\u0435\u043f.<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d <a href=\"https:\/\/github.com\/mzujev\/lunapark\">Lunapark<\/a> \u0432 \u043b\u0443\u0447\u0448\u0438\u0445 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u044f\u0445 \u043a\u043e\u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u0441\u0435\u043c\u0438 \u043b\u044e\u0431\u0438\u043c\u0430\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u043d\u0430 \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445. \u0418 \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 &quot;shared data&quot;. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u043b\u044e\u0441\u044b \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442, \u043d\u043e \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f. \u041e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0441 \u043e\u0433\u043b\u044f\u0434\u043a\u043e\u0439 \u043d\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u044f \u0434\u0443\u043c\u0430\u044e, \u044d\u0442\u043e \u043c\u044b \u043a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0435\u043c.<\/p>\n<p>  <\/p>\n<h4 id=\"chto-dalshe\">\u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435?<\/h4>\n<p>  <\/p>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u2014 \u0430 \u0447\u0442\u043e \u0436\u0435 \u0441 \u043d\u0438\u043c \u043d\u0435 \u0442\u0430\u043a? \u0414\u0430 \u0432\u0441\u0435 \u0441 \u043d\u0438\u043c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0438\u0430\u043b\u043f\u043b\u0430\u043d\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u043e\u0444\u0438\u043b\u0430\u043a\u0442\u0438\u043a\u0443 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u044f \u0443 \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432. \u041d\u043e, \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u0436\u0430\u0442\u044c \u043f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u0443\u043f\u0440\u043e\u0449\u0430\u0442\u044c \u0438 \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[test] exten =&gt; _XXX\/102,1,Hangup() exten =&gt; _XXX,1,Dial(SIP\/${EXTEN})<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0434\u0435\u0442 \u0434\u043e\u0437\u0432\u043e\u043d \u0434\u043e \u0442\u0440\u0435\u0445\u0437\u043d\u0430\u043a\u0430, \u043a\u0440\u043e\u043c\u0435 \u0430\u0431\u043e\u043d\u0435\u043d\u0442\u0430 102. \u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u0432\u0441\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u044d\u043a\u0441\u0442\u0435\u043d\u0448\u0435\u043d\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u043f\u0440\u0430\u0432\u0438\u043b, \u0430 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0430\u044f extended \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e CallerID \u0437\u0432\u043e\u043d\u044f\u0449\u0435\u0433\u043e. \u0410 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043f\u043e CallerIDName \u0438\u043b\u0438 \u043f\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u0437\u0432\u043e\u043d\u044f\u0449\u0435\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430, \u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430, \u0430 \u0435\u0441\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 regexp, \u0442\u0430\u043a \u0432\u043e\u043e\u0431\u0449\u0435 \u043a\u0440\u0430\u0441\u043e\u0442\u0430. \u0418 \u0434\u0430, \u044f \u0437\u043d\u0430\u044e, \u0432\u0441\u0435 \u044d\u0442\u0438 \u0445\u043e\u0442\u0435\u043b\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[test] exten =&gt; _XXX\/102,1,Hangup()  ; \u043f\u043e CallerIDName exten =&gt; _XXX,1,ExecIf($[ &quot;${CALLERID(name)}&quot; == &quot;Vasya&quot; ]?Hangup())  ; \u041f\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u043a\u0430\u043d\u0430\u043b\u0430 exten =&gt; _XXX,n,ExecIf($[ &quot;${CHANNEL(state)}&quot; != &quot;Ring&quot; ]?Hangup())  ; \u041f\u043e \u0438\u043c\u0435\u043d\u0438 \u043a\u0430\u043d\u0430\u043b\u0430 exten =&gt; _XXX,n,ExecIf($[ &quot;${CUT(CUT(CHANNEL,-,1),\/,2)}&quot; == &quot;333&quot; ]?Hangup())  exten =&gt; _XXX,n,Dial(SIP\/${EXTEN})<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e \u043c\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043f\u0435\u0440\u0444\u0435\u043a\u0446\u0438\u043e\u043d\u0438\u0441\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0431\u0443\u043d\u0442\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0432\u0438\u0434\u0435 \u0442\u0430\u043a\u043e\u0433\u043e, \u0430 \u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c, \u0434\u0430 \u0435\u0449\u0435 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0443\u0436\u043d\u044b \u0440\u0430\u0437\u043d\u044b\u0435 \u0438 \u043f\u043e\u0441\u043b\u043e\u0436\u043d\u0435\u0435 Hangup&#8217;\u0430, \u0442\u043e extensions.conf \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u043b\u0438\u0438\u0438\u043d\u043d\u0443\u044e \u043f\u043e\u0440\u0442\u044f\u043d\u043a\u0443 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 Goto, GoSub, Macro \u0438, \u043d\u0435 \u0434\u0430\u0439 \u0431\u043e\u0433, \u0441 \u043a\u0430\u043d\u0430\u043b\u0430\u043c\u0438 \u0442\u0438\u043f\u0430 Local.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0445\u043e\u0434 \u043e\u0434\u0438\u043d \u2014 \u043f\u0440\u0438\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u043f\u043e\u0434\u043a\u0438\u0434\u043d\u044b\u043c \u0438 \u0434\u0430\u043c\u0430\u043c\u0438 \u0441 \u043d\u0438\u0437\u043a\u043e\u0439 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">${Exten}:match('%d%d%d')            and  (   ${CallerIDNum}:match('201') or    ${CallerIDName}:match('Vasya') or    ${State}:lower() ~= 'ring' or    ${Channel}:match('^[^\/]+\/([^%-]+)') == '333' ) =&gt; Hangup();  ${Exten}:match('%d%d%d') =&gt; Dial {callee = ('SIP\/%s'):format(${Exten})};<\/code><\/pre>\n<p>  <\/p>\n<p>\u0425\u043c, \u0432\u044b\u0440\u0432\u0438\u0433\u043b\u0430\u0437\u043d\u0435\u043d\u044c\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043d\u043e \u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435 \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430. \u0410 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433 regexp&#8217;\u043e\u0432 \u0438 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u0440\u0430\u0432\u0438\u043b \u043d\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u0447\u0442\u043e, \u043d\u0435\u0441\u043e\u043c\u043d\u0435\u043d\u043d\u043e, \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<p>  <\/p>\n<h4 id=\"chto-tut-dumat-prygat-nado\">\u0427\u0442\u043e \u0442\u0443\u0442 \u0434\u0443\u043c\u0430\u0442\u044c, \u043f\u0440\u044b\u0433\u0430\u0442\u044c \u043d\u0430\u0434\u043e.<\/h4>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u0438\u043c\u0435\u0435\u043c <a href=\"https:\/\/github.com\/mzujev\/lunapark\">Lunapark<\/a> \u043a\u0430\u043a \u0437\u0430\u043c\u0435\u043d\u0443 pbx_lua. \u0415\u0433\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u043d\u0430\u043c \u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u0430\u0432\u0438\u043b \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f <code>${...}<\/code> \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0432\u0438\u0434\u0443 <code>('...')<\/code>. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430.<br \/>  \u0417\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a\u0430\u0436\u0434\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043a \u0432\u0438\u0434\u0443 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"lua\">-- Exten = 123 -- Sate = Ring -- CallerIDNum = 100 -- CallerIDName = Test -- Channel = SIP\/100-00000012c  if ('123'):match('%d%d%d') and (   ('100'):match('201') or   ('Test'):match('Vasya') or   ('Ring'):lower() ~= 'ring' or   ('SIP\/100-00000012c'):match('^[^\/]+\/([^%-]+)') == '333' ) then   Hangup() end  if ('123'):match('%d%d%d') then   Dial {callee = ('SIP\/%s'):format(('123'))} end<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 fmt \u0438 syntax \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"lua\">local fmt = function(str, tab)  return (str:gsub('(%${[^}{]+})', function(w)   local mark = w:sub(3, -2)     return (mark:gsub('(.+)',function(v)    local out = tab[v] or v     return (&quot;('%s')&quot;):format(out)   end))  end)) end  local syntax = function(str)  return (str:gsub('([^;]+)=&gt;([^;]+)',function(p,r)   return ([[     if %s then     %s    end   ]]):format(p,r)  end)) end<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0418\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u2014 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0430 \u043f\u0430\u0440\u0441\u0438\u0442\u044c \u0438\u0445 \u0443\u0436\u0435 \u043f\u0440\u0438 \u0437\u0432\u043e\u043d\u043a\u0435 \u0441 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435\u043c. \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b \u0437\u0430\u0439\u043c\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f routes.<\/p>\n<p>  <\/p>\n<pre><code class=\"lua\">local routes = function(...)   local conf, content = ...    local f, err = io.open(conf, &quot;r&quot;)    if io.type(f) ~= 'file' then    log.warn(err)  -- \u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 LOG \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f Lunapark'\u0443    return &quot;&quot;   else    content = f:read('*all')   end    f:close() return content end<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0432\u0435 \u0432\u0435\u0449\u0438: \u0437\u0430\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0437\u0432\u043e\u043d\u043a\u0438 \u0432 <a href=\"https:\/\/github.com\/mzujev\/lunapark\">Lunapark<\/a> \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u043d\u0430\u0448\u0438\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432. \u0422\u0443\u0442 \u0441\u0442\u043e\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u044f\u0441\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u2014 \u0432 <a href=\"https:\/\/github.com\/mzujev\/lunapark\">Lunapark<\/a> \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 handler&#8217;\u0435. \u042d\u0442\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0430\u0448\u0438 FastAGI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 AMI \u0438 \u043d\u0430\u0448\u0438\u043c\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u043e\u0431\u044a\u0435\u043a\u0442 AMI \u2014 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u0438, \u043f\u043e\u043c\u0438\u043c\u043e \u0440\u043e\u043b\u0438 AMI-\u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043c\u043e\u0436\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 AMI \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u042d\u0442\u0438\u043c \u043c\u044b \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f, \u043d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432 extensions.conf.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[default] exten =&gt; _[hit],1,NoOp() exten =&gt; _.,n,Wait(5)  exten =&gt; _.,1,AGI(agi:\/\/127.0.0.1\/${EXTEN}${IF($[ &quot;X${PRMS}&quot; != &quot;X&quot; ]?&quot;?${PRMS}&quot;)})<\/code><\/pre>\n<p>  <\/p>\n<p>Wait(5) \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u043d\u0435 \u043e\u0431\u0440\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043d\u0430\u043b \u043f\u0440\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 FastAGI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438\u0445 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c Redirect \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 default \u043f\u043e ${EXTEN}.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0431\u0435\u0440\u044f \u0432\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0432\u0441\u0435 \u0432\u044b\u0448\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0438 \u043f\u043e\u043c\u043d\u044f \u043e \u043a\u043e\u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0440\u0438\u0440\u043e\u0434\u0435 <a href=\"https:\/\/github.com\/mzujev\/lunapark\">Lunapark&#8217;\u0430<\/a>, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0437\u0430\u043a\u043e\u0434\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 FastAGI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"lua\">-- \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e rules local rules = routes('routes.conf') -- \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0432\u0441\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u0447\u0438\u0441\u0442\u044f\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u0438\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 -- \u042d\u0442\u043e \u0434\u0430\u0441\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0437\u0430\u0442\u0438\u0440\u0430\u0442\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430\u0445 HUP\/QUIT ami.removeEvents('*') -- \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430 ami.addEvents {  ['newchannel'] = function(e)   -- \u0423\u0441\u043b\u043e\u0432\u0438\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043d\u0430\u043b\u044b \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0438 \u043a\u0430\u043d\u0430\u043b\u044b \u0441 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c users   if (e['Context'] and e['Context']:match('users')) and e['Exten'] then    -- \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438, \u043a\u0430\u043a\u043e\u0433\u043e FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f    local step    -- \u0411\u0443\u0434\u0443\u0449\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 FatsAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f    local count = 0    -- \u041f\u0430\u0440\u0441\u0438\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u0430    local code, err = loadstring(syntax(fmt(rules,e)))     -- \u0412 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043e\u043a, \u0434\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435    if type(code) == 'function' then     -- \u041f\u0440\u043e\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0431\u0443\u0434\u0443\u0449\u0438\u0435 FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f      setfenv(code,setmetatable({indexes = {}},{__index = function(t,k)      -- \u0412\u043e\u0442 \u043e\u043d\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438      return coroutine.wrap(       function(...)        local prms = {} -- \u0411\u0443\u0434\u0443\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f        local owner = t -- \u041a\u043e\u043f\u0438\u044f \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f        local event = e -- \u041a\u043e\u043f\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b event        local thread = coroutine.running() -- ID \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b         -- \u041f\u0430\u0440\u0441\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a \u0432\u0438\u0434\u0443 URI        for p,v in pairs({...}) do         if type(v) == 'table' then          for key, val in pairs(v) do           table.insert(prms,(&quot;%s=%s&quot;):format(key,val))          end         else          table.insert(prms,(&quot;%s=%s&quot;):format(p,v))         end        end        -- \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435        if step then         -- \u0417\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c         local last = (&quot;%s&quot;):format(step)         -- \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0418\u041c\u0415\u041d\u041d\u042b\u0415 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f UserEvent \u043f\u043e \u0434\u043e\u043f. \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c         -- \u0418 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 indexes(\u0432 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438) \u0438\u0445 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430         -- \u0418\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e         table.insert(owner['indexes'],ami.addEvent('UserEvent',function(evt)          -- \u041b\u043e\u0432\u0438\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 AGIStatus \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u043d\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f          -- \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438, \u043f\u0440\u043e\u0431\u0443\u0436\u0434\u0430\u0435\u043c \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443          if (evt['Channel'] and evt['Channel'] == event['Channel'])                and           (evt['UserEvent'] and evt['UserEvent']:match('AGIStatus'))                and           (evt['Script'] and evt['Script'] == last)          then           -- \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u043e\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0430\u0448\u0435\u0439 \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435           -- \u0412 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437           -- \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f           if owner['indexes'][count] == thread then            if coroutine.status(thread) ~= 'dead' then             coroutine.resume(thread)            end           end          end         end,thread))         -- \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u0430\u0440\u043a\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f         step = k         -- \u041f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443         coroutine.yield()        else -- \u0417\u0434\u0435\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0435 FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435         local index -- \u0418\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 Hangup \u0441\u043e\u0431\u044b\u0442\u0438\u044f         -- \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u0430\u0440\u043a\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f         step = k         -- \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0418\u041c\u0415\u041d\u041d\u041e\u0419 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f Hangup \u0434\u043b\u044f \u043a\u0430\u043d\u0430\u043b\u0430         -- \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u0434\u0447\u0438\u0449\u0430\u0435\u043c \u0437\u0430 \u0441\u043e\u0431\u043e\u0439         index = ami.addEvent('Hangup',function(evt)          if evt['Channel'] and evt['Channel'] == event['Channel'] then           -- \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0435 Hangup \u043f\u043e \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u043f\u043e\u043c\u043d\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0443           ami.removeEvent('Hangup',index)           -- \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0446\u0435\u043f\u043e\u0447\u0435\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443           for _,v in pairs(owner['indexes']) do            ami.removeEvent('UserEvent',v)           end           -- \u0414\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0438\u044f\u0442\u043d\u043e \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0443 \u043c\u0443\u0441\u043e\u0440\u0430           owner = nil          end         end,thread)        end        -- \u041f\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c AMI \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u043a\u0430\u043d\u0430\u043b\u0430 \u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435        ami.setvar{         Value = table.concat(prms,'&amp;'),         Channel = event['Channel'],         Variable = 'PRMS'        }        -- \u041f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0430\u043d\u0430\u043b \u043d\u0430 AGI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 default        ami.redirect{         Exten = k,         Priority = 1,         Channel = event['Channel'],         Context = 'default'        }        -- \u0412\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f        count = count + 1       end)     end}))()    else     -- \u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a     log.warn(err)    end   end  end }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0438\u043b\u0438 \u043d\u0435 \u043f\u043e\u043d\u044f\u043b \u043a\u043e\u0434, \u043f\u043e\u044f\u0441\u043d\u044e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c, \u0447\u0442\u043e \u0436\u0435 \u043c\u044b \u0442\u0430\u043c \u043d\u0430\u043a\u043e\u0434\u0438\u043b\u0438. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0433\u043e, \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u0438 \u0432 \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u041a\u0440\u043e\u043c\u0435 \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043e\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0435\u0441\u0442\u044c. \u041f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u044b \u0438\u0445 \u0434\u043b\u044f \u044d\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u0433\u043e \u043e\u0434\u043d\u0430 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u0439, \u0432\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0439, \u0442\u0440\u0435\u0442\u044c\u044f \u043f\u043e\u0441\u043b\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438 \u0442.\u0434.<\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u043e\u043f, \u0442\u0430\u043a \u043e\u043d\u0438 \u0438 \u0442\u0430\u043a \u0434\u0440\u0443\u0433 \u0437\u0430 \u0434\u0440\u0443\u0433\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435\u0442 \u2014 \u0435\u0441\u043b\u0438 \u043d\u0435 \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c, \u0442\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 redirect \u043f\u0440\u043e\u0431\u0435\u0436\u0438\u0442\u0441\u044f \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e \u0438 \u0437\u0430\u0439\u043c\u0435\u0442 \u044d\u0442\u043e \u0434\u043e\u043b\u0438 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u0412 \u043d\u0430\u0448\u0435\u043c \u0436\u0435 \u043a\u043e\u0434\u0435 \u043c\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u0430\u0436\u0434\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u043f\u043e \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e FastAGI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <a href=\"https:\/\/github.com\/mzujev\/lunapark\">Lunapark<\/a> \u0437\u0430\u0431\u043e\u0442\u043b\u0438\u0432\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 UserEvent \u043f\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e FastAGI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u2014 \u0432\u043e\u0442 \u043d\u0430 \u044d\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c\u0441\u044f. \u0421\u0430\u043c\u0438 \u0436\u0435 \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u044f\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u0430\u043d\u0430\u043b \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 default \u0441 \u044d\u043a\u0441\u0442\u0435\u043d\u0448\u043d\u043e\u043c, \u0440\u0430\u0432\u043d\u044b\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044e, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043a\u0430\u043d\u0430\u043b\u0430 PRMS.<\/p>\n<p>  <\/p>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435, \u0447\u0442\u043e \u0437\u0432\u043e\u043d\u043e\u043a \u043f\u043e\u0441\u043b\u0435 redirect&#8217;\u0430 \u043f\u0440\u0438\u0434\u0435\u0442 \u043e\u043f\u044f\u0442\u044c \u0432 handler, \u043d\u043e \u0443\u0436\u0435 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f AGI \u0438 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e Hangup() \u0438 Dial(). \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0436\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0438\u0445 \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u044b \u043f\u043e\u0432\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"lua\">function Hangup(...)   local app, channel = ... -- \u0412 \u044d\u0442\u043e\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 pbx_lua    app.verbose(('The Channel %s does not match by routing rules'):format(channel.get('CHANNEL')))   app.hangup() end  function Dial(...)   local app, channel = ...   local leg = app.agi.params['callee'] or ''    app.verbose(('Trying to make a call from %s to %s'):format(    channel.get('CALLERID(num)'),    leg:match('^[^\/]+\/([^%-]+)'))   )   app.dial(leg) end<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"nu-vot-i-vse---doprygalis\">\u041d\u0443, \u0432\u043e\u0442 \u0438 \u0432\u0441\u0435 \u2014 \u0434\u043e\u043f\u0440\u044b\u0433\u0430\u043b\u0438\u0441\u044c<\/h4>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u044b\u0442\u043e\u0436\u0438\u043c. \u0427\u0442\u043e \u0436\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u044d\u0442\u0438\u0445 \u0433\u0435\u043d\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432?<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0433\u0438\u0431\u043a\u0438\u0439, \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432;<\/li>\n<li>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 VoIP-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Queue, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0435\u0433\u043e \u0441\u0430\u043c\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u043d\u0435 \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044f\u0441\u044c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0441\u0432\u043e\u0435\u0433\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0434\u043b\u044f asterisk&#8217;\u0430;<\/li>\n<li>\u0432\u044b\u043d\u0435\u0441\u043b\u0438 \u043b\u043e\u0433\u0438\u043a\u0443 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0432\u043e\u043d\u043a\u0430\u043c\u0438 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 VoIP-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0441\u0434\u0435\u043b\u0430\u0432 \u0438\u0437 asterisk&#8217;\u0430 Mediahub, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c VoIP-\u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0446\u0435\u043b\u043e\u043c;<\/li>\n<li>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u044b\u0439 \u0438 \u043e\u0447\u0435\u043d\u044c \u0433\u0438\u0431\u043a\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f VoIP-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439;<\/li>\n<li>\u0440\u0430\u0441\u0448\u0438\u0440\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438 \u0438\u0437 VoIP-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041a\u043e\u043c\u0443 \u043a\u0430\u043a, \u0430 \u043c\u043d\u0435 \u043f\u043e\u043a\u0430 \u0432\u0441\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">handler \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"lua\">local fmt = function(str, tab)  return (str:gsub('(%${[^}{]+})', function(w)   local mark = w:sub(3, -2)     return (mark:gsub('(.+)',function(v)    local out = tab[v] or v     return (&quot;('%s')&quot;):format(out)   end))  end)) end  local syntax = function(str)  return (str:gsub('([^;]+)=&gt;([^;]+)',function(p,r)   return ([[     if %s then     %s    end   ]]):format(p,r)  end)) end  local routes = function(...)   local conf, content = ...    local f, err = io.open(conf, &quot;r&quot;)    if io.type(f) ~= 'file' then    log.warn(err)  -- \u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 LOG \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f Lunapark'\u0443    return &quot;&quot;   else    content = f:read('*all')   end    f:close() return content end  -- \u0421\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e rules local rules = routes('routes.conf') -- \u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0432\u0441\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u043f\u0440\u0438\u0447\u0435\u043c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u0447\u0438\u0441\u0442\u044f\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0438\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 -- \u042d\u0442\u043e \u0434\u0430\u0441\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0437\u0430\u0442\u0438\u0440\u0430\u0442\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430\u0445 HUP\/QUIT ami.removeEvents('*') -- \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430 ami.addEvents {  ['newchannel'] = function(e)   -- \u0423\u0441\u043b\u043e\u0432\u0438\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043d\u0430\u043b\u044b \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0438 \u043a\u0430\u043d\u0430\u043b\u044b \u0441 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u043c users   if (e['Context'] and e['Context']:match('users')) and e['Exten'] then    local step -- \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438, \u043a\u0430\u043a\u043e\u0433\u043e FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f    local count = 0 -- \u0411\u0443\u0434\u0443\u0449\u0438\u0439 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 FatsAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f    -- \u041f\u0430\u0440\u0441\u0438\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u0430    local code, err = loadstring(syntax(fmt(rules,e)))     -- \u0412 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043e\u043a, \u0434\u0432\u0438\u0433\u0430\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435    if type(code) == 'function' then     -- \u041f\u0440\u043e\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0431\u0443\u0434\u0443\u0449\u0438\u0435 FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f      setfenv(code,setmetatable({indexes = {}},{__index = function(t,k)      -- \u0412\u043e\u0442 \u043e\u043d\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438      return coroutine.wrap(       function(...)        local prms = {} -- \u0411\u0443\u0434\u0443\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f        local owner = t -- \u041a\u043e\u043f\u0438\u044f \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f        local event = e -- \u041a\u043e\u043f\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b event        local thread = coroutine.running() -- ID \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b         -- \u041f\u0430\u0440\u0441\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a \u0432\u0438\u0434\u0443 URI        for p,v in pairs({...}) do         if type(v) == 'table' then          for key, val in pairs(v) do           table.insert(prms,(&quot;%s=%s&quot;):format(key,val))          end         else          table.insert(prms,(&quot;%s=%s&quot;):format(p,v))         end        end        -- \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u043f\u0435\u0440\u0432\u043e\u0435 FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435        if step then         -- \u0417\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c         local last = (&quot;%s&quot;):format(step)         -- \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0418\u041c\u0415\u041d\u041d\u042b\u0415 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f UserEvent \u043f\u043e \u0434\u043e\u043f. \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c         -- \u0418 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 indexes(\u0432 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438) \u0438\u0445 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430         -- \u0418\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e         table.insert(owner['indexes'],ami.addEvent('UserEvent',function(evt)          -- \u041b\u043e\u0432\u0438\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 AGIStatus \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u043d\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f          -- \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438, \u043f\u0440\u043e\u0431\u0443\u0436\u0434\u0430\u0435\u043c \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443          if (evt['Channel'] and evt['Channel'] == event['Channel'])                and           (evt['UserEvent'] and evt['UserEvent']:match('AGIStatus'))                and           (evt['Script'] and evt['Script'] == last)          then           -- \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u043e\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430 \u043d\u0430\u0448\u0435\u0439 \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435           -- \u0412 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437           -- \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f           if owner['indexes'][count] == thread then            if coroutine.status(thread) ~= 'dead' then             coroutine.resume(thread)            end           end          end         end,thread))         -- \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u0430\u0440\u043a\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f         step = k         -- \u041f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0441\u043e\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443         coroutine.yield()        else -- \u0417\u0434\u0435\u0441\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u043e\u0435 FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435         local index -- \u0418\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 Hangup \u0441\u043e\u0431\u044b\u0442\u0438\u044f         -- \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u0430\u0440\u043a\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e FastAGI \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f         step = k         -- \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0418\u041c\u0415\u041d\u041d\u041e\u0419 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f Hangup \u0434\u043b\u044f \u043a\u0430\u043d\u0430\u043b\u0430         -- \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u0434\u0447\u0438\u0449\u0430\u0435\u043c \u0437\u0430 \u0441\u043e\u0431\u043e\u0439         index = ami.addEvent('Hangup',function(evt)          if evt['Channel'] and evt['Channel'] == event['Channel'] then           -- \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u043e\u0431\u044b\u0442\u0438\u0435 Hangup \u043f\u043e \u0440\u0430\u043d\u0435\u0435 \u0437\u0430\u043f\u043e\u043c\u043d\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0443           ami.removeEvent('Hangup',index)           -- \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0432\u0441\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0446\u0435\u043f\u043e\u0447\u0435\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443           for _,v in pairs(owner['indexes']) do            ami.removeEvent('UserEvent',v)           end           -- \u0414\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0438\u044f\u0442\u043d\u043e \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0443 \u043c\u0443\u0441\u043e\u0440\u0430           owner = nil          end         end,thread)        end        -- \u041f\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c AMI \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u043a\u0430\u043d\u0430\u043b\u0430 \u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435        ami.setvar{         Value = table.concat(prms,'&amp;'),         Channel = event['Channel'],         Variable = 'PRMS'        }        -- \u041f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0430\u043d\u0430\u043b \u043d\u0430 AGI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 default        ami.redirect{         Exten = k,         Priority = 1,         Channel = event['Channel'],         Context = 'default'        }        -- \u0412\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f        count = count + 1       end)     end}))()    else     -- \u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a     log.warn(err)    end   end  end }  function Hangup(...)   local app, channel = ... -- \u0412 \u044d\u0442\u043e\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 pbx_lua    app.verbose(('The Channel %s does not match by routing rules'):format(channel.get('CHANNEL')))   app.hangup()  end  function Dial(...)   local app, channel = ...   local leg = app.agi.params['callee'] or ''    app.verbose(('Trying to make a call from %s to %s'):format(    channel.get('CALLERID(num)'),    leg:match('^[^\/]+\/([^%-]+)'))   )   app.dial(leg)  end<\/code><\/pre>\n<\/div><\/div>\n<\/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\/513572\/\"> https:\/\/habr.com\/ru\/post\/513572\/<\/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\/513572\/\">\n<h4 id=\"asterisk---fi-eto-zhe-moveton\">Asterisk \u2014 \u0444\u0438, \u044d\u0442\u043e \u0436\u0435 \u043c\u043e\u0432\u0435\u0442\u043e\u043d<\/h4>\n<p>  <\/p>\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435 \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430. \u041f\u043e \u0443\u0436\u0435 \u0441\u043b\u043e\u0436\u0438\u0432\u0448\u0435\u0439\u0441\u044f \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u0438 \u2014 \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0434\u0430\u0432\u043d\u0438\u043c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u043c habr&#8217;\u0430, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0441\u0442. \u0427\u0442\u043e, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u0431\u0443\u0434\u0438\u043b\u043e \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e? \u0427\u0435\u0441\u0442\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0438 \u0441\u0430\u043c \u043d\u0435 \u0437\u043d\u0430\u044e. \u0422\u043e \u043b\u0438 \u043f\u0440\u0438\u0442\u044f\u043d\u0443\u0442\u044b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 FreeSWITCH\/Yate\/3CX\/etc \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 Asterisk, \u0442\u043e \u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435, \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e, \u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435.<\/p>\n<p>  <\/p>\n<p>\u0418 \u0447\u0442\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442 \u043c\u044f\u0433\u043a\u043e\u0435 \u0438 \u0442\u0435\u043f\u043b\u043e\u0435, \u0442\u0430\u043a \u0441\u043a\u0430\u0437\u0430\u0442\u044c, FreeSWITCH\/Yate\/etc \u0438 FreePBX. \u0414\u0430-\u0434\u0430, \u0438\u043c\u0435\u043d\u043d\u043e FreePBX. \u042d\u0442\u043e \u043d\u0435 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430. \u041f\u0440\u0438\u0447\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\u0445 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043e\u0434\u0438\u043d Asterisk \u0432 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u041d\u0443, \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u044d\u0442\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u2014 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0432\u0441\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u0438, \u043a\u0440\u0438\u0432\u043e\u0439 \u0434\u0438\u0430\u043b\u043f\u043b\u0430\u043d (FreePBX \u043a\u0430\u043a \u0431\u044b \u0441\u043f\u043e\u0441\u043e\u0431\u0441\u0442\u0432\u0443\u0435\u0442) \u0438 \u043a\u0443\u0447\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043d\u0435\u043e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u0449\u0438\u043d\u044b. \u0427\u0442\u043e \u0434\u043e \u0440\u043e\u0434\u043e\u0432\u044b\u0445 \u0431\u043e\u043b\u044f\u0447\u0435\u043a Asterisk&#8217;\u0430 \u2014 \u0434\u0430, \u043e\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0445 \u0432\u0430\u0433\u043e\u043d \u0438 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u0442\u0435\u043b\u0435\u0436\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0441\u043e \u0432\u0441\u0435\u043c \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u0430\u0442\u044c? \u0420\u0430\u0437\u0440\u0443\u0448\u0430\u0442\u044c \u0441\u0442\u0435\u0440\u0435\u043e\u0442\u0438\u043f\u044b \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u043e\u0434\u043e\u0432\u044b\u0435 \u0442\u0440\u0430\u0432\u043c\u044b. \u042d\u0442\u0438\u043c \u0438 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f.<\/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-307914","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307914","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=307914"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307914\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}