{"id":305692,"date":"2020-06-21T15:00:55","date_gmt":"2020-06-21T15:00:55","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=305692"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-06-21T15:00:55","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=305692","title":{"rendered":"Web Sip \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 JsSIP + FreePBX"},"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\/507554\/\">\u0423 FreePBX \u0435\u0441\u0442\u044c Web Sip \u043a\u043b\u0438\u0435\u043d\u0442. \u041c\u043d\u0435 \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041d\u0430\u0447\u0430\u0432 \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e WebRTC \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 3 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 \u044d\u0442\u043e JsSIP, \u0435\u0433\u043e fork SIP.js, \u0430 \u0442\u0430\u043a\u0436\u0435 sipml5.<\/p>\n<p>  JsSIP \u0438 SIP.js \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430, \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u043b\u043e \u043e\u043f\u044b\u0442\u0430. \u0410 \u0432\u043e\u0442 sipml5 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438. \u0421\u043a\u0430\u0447\u0430\u0432 \u0435\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a.<\/p>\n<p>  \u0412\u0441\u0435 3 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b. \u0423 \u043a\u0430\u0436\u0434\u043e\u0439 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0438\u043b\u044c\u043d\u044b\u0435 \u0438 \u0441\u043b\u0430\u0431\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u0432\u0441\u0435 3 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0432\u044b\u0431\u043e\u0440 \u043d\u0430 JsSIP.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f:<\/p>\n<p>  <b>1. JsSIP <\/b><\/p>\n<p>  \u041f\u043b\u044e\u0441\u044b: <\/p>\n<ul>\n<li>\u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u0430\u044f;<\/li>\n<li>\u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438.<\/li>\n<\/ul>\n<p>  \u041c\u0438\u043d\u0443\u0441\u044b:<\/p>\n<ul>\n<li> \u043d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u0442\u0430;<\/li>\n<li>\u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 asterisk.<\/li>\n<\/ul>\n<p>  <b>2. Sip.js<\/b><\/p>\n<p>  \u041f\u043b\u044e\u0441\u044b: <\/p>\n<ul>\n<li>\u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u0430\u044f;<\/li>\n<li>\u0443\u043f\u043e\u0440 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 asterisk.<\/li>\n<\/ul>\n<p>  \u041c\u0438\u043d\u0443\u0441\u044b:<\/p>\n<ul>\n<li>\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0437\u0432\u0443\u043a \u0434\u043b\u044f Early media (\u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u0432\u0443\u043a \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0435\u0442\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430).<\/li>\n<\/ul>\n<p>  <b>3. Sipml5 <\/b><\/p>\n<p>  \u041f\u043b\u044e\u0441\u044b: <\/p>\n<ul>\n<li>\u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432.<\/li>\n<\/ul>\n<p>  \u041c\u0438\u043d\u0443\u0441\u044b:<\/p>\n<ul>\n<li>\u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0438 \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u043d\u0435 \u0431\u044b\u043b\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0435\u043c.<\/li>\n<\/ul>\n<p>  <\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h4>\n<p>  \u0412\u0435\u0431 \u043a\u043b\u0438\u0435\u043d\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442. \u041a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435.<\/p>\n<p>  Firefox \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0441\u0430\u043c\u043e\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430\u043c\u0438. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0425\u0440\u043e\u043c\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442, \u0430 \u043d\u0430 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0435 \u0443\u0436\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432.<\/p>\n<h4>\u0412\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 web sip \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 FreePBX<\/h4>\n<p>  \u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 -&gt; User Managment -&gt; \u0412\u043a\u043b\u0430\u0434\u043a\u0430 \u00abGroups\u00bb -&gt; \u0412\u043a\u043b\u0430\u0434\u043a\u0430 \u00abUCP\u00bb -&gt; \u0412\u043a\u043b\u0430\u0434\u043a\u0430 \u00abPhone\u00bb<br \/>  \u0414\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u00abEnable Phone\u00bb \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u00ab\u0414\u0430\u00bb.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432 FreePBX \u0431\u044b\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u043d\u043e\u043c\u0435\u0440\u0430, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c 200, \u0442\u043e \u043f\u0440\u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 web sip \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u0441 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c 99, \u0442.\u0435. 99200.<\/p>\n<p>  \u041d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0434\u0430\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430, \u043d\u0443\u0436\u043d\u043e \u0435\u0449\u0435 \u0434\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430 asterisk. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0431\u0435\u0440\u0438\u0442\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 <\/p>\n<pre><code class=\"xml\">https:\/\/192.168.1.70:8089\/ws<\/code><\/pre>\n<p>  IP-\u0430\u0434\u0440\u0435\u0441 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u043e\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u043f\u0443\u0449\u0435\u043d asterisk.<\/p>\n<h4>\u041f\u0440\u0430\u0432\u043a\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430 JsSIP<\/h4>\n<p>  \u0412 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 JsSIP \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c transport=ws \u043d\u0430 transport=wss. \u0411\u0435\u0437 \u044d\u0442\u043e\u0439 \u043f\u0440\u0430\u0432\u043a\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0412 Sip.js \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u0442\u0430\u043c \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438.<\/p>\n<h4>\u041a\u043e\u0434 web sip \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 JsSIP<\/h4>\n<p>  \u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u043d\u0438\u0436\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443. \u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0437\u0432\u043e\u043d\u043e\u043a. \u041a\u043e\u0434 100% \u0440\u0430\u0431\u043e\u0447\u0438\u0439, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u044b\u043b\u043e\u0436\u0438\u0442\u044c.<\/p>\n<pre><code class=\"xml\"> &lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;script type=&quot;text\/javascript&quot; src=&quot;\/lib\/jquery-3.4.1.js&quot;&gt;&lt;\/script&gt; &lt;script type=&quot;text\/javascript&quot; src=&quot;\/lib\/jsSIP\/jssip.min.js&quot;&gt;&lt;\/script&gt; &lt;\/head&gt; &lt;body&gt; &lt;style&gt; #callControl {     display:flex;     flex-direction:column;     justify-content:flex-start;     align-items: center; } #num {     margin-top: 20px;     padding-left: 10px;     font-size: 1em;     font-family:'Open Sans', sans-serif;     width: 300px;     height: 40px;     border:0px;     border-bottom: 1px solid #B8B8B8; } #call {     display:flex;     background-color: #389400; } #hangup {     display:none;     background-color:#A90002; } #call, #hangup {     flex-direction:column;     justify-content:center;     align-items: center;     color: #FFF;     width:260px;     height: 40px;     font-size: 20px;     margin: 20px;     border-radius: 20px;     cursor: pointer; } &lt;\/style&gt; &lt;div id=&quot;callControl&quot;&gt;   &lt;h2&gt;Web Sip \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 JsSIP&lt;\/h2&gt;   &lt;div id=&quot;to&quot;&gt;     &lt;input id=&quot;num&quot; type=&quot;text&quot; placeholder=&quot;\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430&quot;\/&gt;   &lt;\/div&gt;   &lt;div id=&quot;call&quot;&gt;\u0412\u044b\u0437\u043e\u0432&lt;\/div&gt;   &lt;div id=&quot;hangup&quot;&gt;\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c&lt;\/div&gt; &lt;\/div&gt;  &lt;\/body&gt; &lt;script&gt; JsSIP.debug.enable('JsSIP:*'); var socket = new JsSIP.WebSocketInterface('wss:\/\/192.168.1.70:8089\/ws'); var configuration = { \tsockets  : [ socket ], \t\/\/ \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043d\u043e\u043c\u0435\u0440\t \turi      : '99XXX@192.168.1.70', \t\/\/ \u043f\u0430\u0440\u043e\u043b\u044c \tpassword : 'passw' };  var remoteAudio = new window.Audio(); remoteAudio.autoplay = true;  var ua = new JsSIP.UA(configuration);  \/\/ \u0421\u043e\u0431\u044b\u0442\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 ua.on('connected', function(e) { \/* \u0412\u0430\u0448 \u043a\u043e\u0434 *\/ }); ua.on('disconnected', function(e) { \/* \u0412\u0430\u0448 \u043a\u043e\u0434 *\/ });  ua.on('registered', function(e) { \/* \u0412\u0430\u0448 \u043a\u043e\u0434 *\/ }); ua.on('unregistered', function(e) { \/* \u0412\u0430\u0448 \u043a\u043e\u0434 *\/ }); ua.on('registrationFailed', function(e) { \/* \u0412\u0430\u0448 \u043a\u043e\u0434 *\/ });  \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c  ua.start();  \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u0438\u0441\u0445. \u0437\u0432\u043e\u043d\u043a\u0430 var eventHandlers = { \t'progress': function(e) { \t\tconsole.log('call is in progress');  \t\tsession.connection.ontrack = function(e) { \t\t\tconsole.log(e); \t\t\tremoteAudio.srcObject = e.streams[0]; \t\t}; \t}, \t'failed': function(e) { \t\tconsole.log('call failed with cause: ' + e.cause); \t\t$('#call').css({'display' : 'flex'}); \t\t$('#hangup').css({'display' : 'none'}); \t}, \t'ended': function(e) { \t\tconsole.log('call ended with cause: ' + e.cause); \t\t$('#call').css({'display' : 'flex'}); \t\t$('#hangup').css({'display' : 'none'}); \t}, \t'confirmed': function(e) { \t\tconsole.log('call confirmed'); \t\tconsole.log(e); \t} };  var options = { \t'eventHandlers'    : eventHandlers, \t'mediaConstraints' : { 'audio': true, 'video': false } };  \/\/ \u041a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u0437\u0432\u043e\u043d\u043a\u0430 $('#call').click(function(e) { \tsession = ua.call($('#num').val(), options); \t$('#call').css({'display' : 'none'}); \t$('#hangup').css({'display' : 'flex'}); });  \/\/ \u041a\u043d\u043e\u043f\u043a\u0430 \u0434\u043b\u044f \u043e\u0442\u0431\u043e\u044f \u0437\u0432\u043e\u043d\u043a\u0430 $('#hangup').click(function() { \tif (session) { \t\tsession.terminate(); \t}  \t$('#call').css({'display' : 'flex'}); \t$('#hangup').css({'display' : 'none'}); }); &lt;\/script&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  \u0414\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yx\/ba\/vc\/yxbavc0zohj7_nyfpx4ihbx1vi8.png\"><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u0443\u0441\u043b\u044b\u0448\u0438\u0442\u0435 \u0433\u0443\u0434\u043e\u043a, \u043f\u0440\u0438 \u043e\u0442\u0432\u0435\u0442\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0439\u0442\u0438 \u0437\u0432\u0443\u043a \u0432 \u043e\u0431\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u0431\u0435\u0441\u0435\u0434\u0443.<\/p>\n<h4>\u0418\u0442\u043e\u0433\u0438<\/h4>\n<p>  \u0417\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 2 \u0433\u043e\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Web sip \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 63 \u0432\u0435\u0440\u0441\u0438\u0438 Firefox \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043c\u0435\u043d\u044f\u0442\u044c SDP \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b, \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0441\u0441\u0438\u044f \u043d\u0435 \u043e\u0442\u0431\u0438\u0432\u0430\u043b\u0430\u0441\u044c. \u0411\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u044c \u0431\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 a=mid:0. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0443\u0436\u0435 \u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e, \u043e\u0448\u0438\u0431\u043a\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0438, \u0432 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0437\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0443\u0436\u0435 \u043d\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<p>  \u0412 65 \u0432\u0435\u0440\u0441\u0438\u0438 Firefox \u043f\u0440\u0438 \u0438\u0441\u0445. \u0437\u0432\u043e\u043d\u043a\u0435 \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0442\u044c \u0433\u043e\u043b\u043e\u0441 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043d\u0438\u043a\u0430, \u0432 \u043b\u043e\u043a\u0430\u043b\u043a\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043d\u0430\u0440\u0443\u0436\u0443 \u0447\u0435\u0440\u0435\u0437 \u0448\u043b\u044e\u0437. \u0412 \u0445\u0440\u043e\u043c\u0435 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u043b\u043e\u0441\u044c, \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432 Firefox, \u0438 \u043f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u0435 SDP \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0435\u043c \u0437\u0432\u0443\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b\u0438 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c. <\/p>\n<h4>\u041f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b<\/h4>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430 js \u0431\u044b\u043b\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u00ab\u0410\u0432\u0442\u043e\u043e\u0431\u0437\u0432\u043e\u043d\u00bb, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0430 \u043f\u043e \u043f\u0435\u0440\u0432\u044b\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u043c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0435\u0442\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a: \u0442\u0435\u043b. \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0430\u0431\u043e\u043d. \u0437\u0430\u043d\u044f\u0442, \u0442\u0435\u043b. \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d, \u0442\u0435\u043b. \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d. \u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f 95% \u0438 \u0432\u044b\u0448\u0435. \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u0440\u0435\u043c\u044f, \u043d\u0430\u043f\u0438\u0448\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0438 \u043e\u043f\u0438\u0448\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c.<\/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\/507554\/\"> https:\/\/habr.com\/ru\/post\/507554\/<\/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\/507554\/\">\u0423 FreePBX \u0435\u0441\u0442\u044c Web Sip \u043a\u043b\u0438\u0435\u043d\u0442. \u041c\u043d\u0435 \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041d\u0430\u0447\u0430\u0432 \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e WebRTC \u044f \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 3 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 \u044d\u0442\u043e JsSIP, \u0435\u0433\u043e fork SIP.js, \u0430 \u0442\u0430\u043a\u0436\u0435 sipml5.<\/p>\n<p>  JsSIP \u0438 SIP.js \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430, \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u043b\u043e \u043e\u043f\u044b\u0442\u0430. \u0410 \u0432\u043e\u0442 sipml5 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438. \u0421\u043a\u0430\u0447\u0430\u0432 \u0435\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a.<\/p>\n<p>  \u0412\u0441\u0435 3 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b. \u0423 \u043a\u0430\u0436\u0434\u043e\u0439 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0438\u043b\u044c\u043d\u044b\u0435 \u0438 \u0441\u043b\u0430\u0431\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u0432\u0441\u0435 3 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0432\u044b\u0431\u043e\u0440 \u043d\u0430 JsSIP.  <\/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-305692","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305692","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=305692"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305692\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}