{"id":479350,"date":"2026-05-11T20:19:48","date_gmt":"2026-05-11T20:19:48","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=479350"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=479350","title":{"rendered":"\u041a\u0430\u043a \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u0437\u0432\u043e\u043d\u043a\u0438 \u0432 React Native \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0435: WebRTC, CallKit \u0438 \u0433\u0440\u0430\u0431\u043b\u0438 production&#8217;\u0430"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<blockquote>\n<p>\u0423\u0440\u043e\u0432\u0435\u043d\u044c: senior \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438 WebRTC \u0421\u0442\u0435\u043a: React Native, Expo SDK 54, @livekit\/react-native-webrtc, expo-notifications, CallKit, FCM \u0427\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438: production WebRTC \u0441 trickle ICE, VoIP push notifications, CallKit \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0444\u043e\u043d\u043e\u0432\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439<\/p>\n<\/blockquote>\n<h3>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h3>\n<p>\u042d\u0442\u043e \u0442\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0438\u0437 \u0441\u0435\u0440\u0438\u0438 \u043f\u0440\u043e \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 ONEMIX \u2014 \u043c\u043e\u0451\u043c \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0435 \u043d\u0430 React Native. \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b \u0442\u0440\u0451\u0445\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u043a\u044d\u0448 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e Double Ratchet E2E. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u2014 \u043f\u0440\u043e \u0437\u0432\u043e\u043d\u043a\u0438.<\/p>\n<p>\u0417\u0432\u043e\u043d\u043a\u0438 \u0432 \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0435 \u2014 \u044d\u0442\u043e \u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0438\u0431\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e, \u043b\u0438\u0431\u043e \u043d\u0438\u043a\u0430\u043a. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u0438\u0432\u044b\u043a \u0447\u0442\u043e WhatsApp\/Telegram \u0437\u0432\u043e\u043d\u044f\u0442 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043d\u0430 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435, \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u044e\u0442 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Wi-Fi\/LTE, \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438\u0437 \u0444\u043e\u043d\u0430. \u0415\u0441\u043b\u0438 \u0442\u0432\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0445\u043e\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0445\u0443\u0436\u0435 \u2014 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u044d\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u0442 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u0441\u044f \u043d\u0430 &#171;\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439&#187; \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440.<\/p>\n<p>\u042f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0430 \u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0432\u0435\u0441\u0442\u0438 \u0437\u0432\u043e\u043d\u043a\u0438 \u0432 ONEMIX \u0434\u043e production-\u0443\u0440\u043e\u0432\u043d\u044f. \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0437\u0443\u0447\u0438\u0442\u044c WebRTC \u0438\u0437\u043d\u0443\u0442\u0440\u0438, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 iOS CallKit \u0438 VoIP push notifications, \u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u0435\u0441\u044f\u0442\u043e\u043a \u0433\u0440\u0430\u0431\u043b\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u0445 \u043d\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0442. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u2014 \u043a\u0430\u043a \u044d\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u043e, \u043a\u0430\u043a\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b\u043c\u0438, \u0438 \u0447\u0442\u043e \u0431\u044b \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443.<\/p>\n<p><strong>\u0421\u0440\u0430\u0437\u0443 \u043e\u0433\u043e\u0432\u043e\u0440\u043a\u0430.<\/strong> \u042f <strong>\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0433\u043e\u0442\u043e\u0432\u044b\u0435 SDK<\/strong> \u0442\u0438\u043f\u0430 Agora, Twilio, 100ms. \u0423 \u043d\u0438\u0445 \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430, \u043d\u043e \u043e\u043d\u0438 \u043d\u0435 \u0434\u0430\u044e\u0442 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043d\u0430\u0434 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u2014 \u0430 \u0434\u043b\u044f \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u043d. \u041a\u043e\u0433\u0434\u0430 \u0437\u0432\u043e\u043d\u043e\u043a \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0438\u043d\u0438\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0430 \u043d\u0435 &#171;SDK \u043e\u0442 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b&#187;. \u041f\u043b\u044e\u0441 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 SDK \u0441\u0442\u043e\u044f\u0442 \u0434\u0435\u043d\u0435\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430 \u0440\u0430\u043d\u043d\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043b\u0443\u0447\u0448\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0441\u0442\u0430.<\/p>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430: \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 &#171;\u043f\u0440\u043e\u0441\u0442\u043e\u0439 WebRTC&#187;<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u0433\u0443\u0433\u043b\u0438\u0442\u044c &#171;WebRTC React Native&#187;, \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0435\u0441\u044f\u0442\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u043d\u043e: createPeerConnection, createOffer, setLocalDescription, \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b, \u043f\u043e\u0442\u043e\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c offer \u0441 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430\u043c\u0438 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043d\u0438\u043a\u0443. \u042d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <strong>&#171;gather-then-send&#187;<\/strong> \u0438 \u0434\u043b\u044f \u0443\u0447\u0435\u0431\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e.<\/p>\n<p>\u0412 production \u044d\u0442\u043e \u0434\u0430\u0451\u0442 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 <strong>8-12 \u0441\u0435\u043a\u0443\u043d\u0434<\/strong> \u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 &#171;\u043f\u043e\u0437\u0432\u043e\u043d\u0438\u0442\u044c&#187; \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0443\u0434\u0438\u043e. \u041f\u0440\u0438\u0447\u0438\u043d\u0430: \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u2014 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 STUN\/TURN \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u0434\u0430\u043b\u0435\u043a\u043e. ICE gathering \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c 3-5 \u0441\u0435\u043a\u0443\u043d\u0434 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 caller, \u043f\u043e\u0442\u043e\u043c \u0435\u0449\u0451 3-5 \u0441\u0435\u043a\u0443\u043d\u0434 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 receiver. \u0422\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f actual ICE checking \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>Telegram \u0438 WhatsApp \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <strong>trickle ICE<\/strong>: offer\/answer \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 <code>setLocalDescription<\/code>, \u0430 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u0442\u0440\u0438\u043a\u043b\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u043e \u043c\u0435\u0440\u0435 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f. \u041f\u0435\u0440\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u043f\u0430\u0440\u0430 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432, \u043e\u0431\u044b\u0447\u043d\u043e \u0437\u0430 500-1500 \u043c\u0441.<\/p>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f. \u0412 gather-then-send \u0437\u0432\u043e\u043d\u043e\u043a &#171;\u0434\u0443\u043c\u0430\u0435\u0442&#187; 8 \u0441\u0435\u043a\u0443\u043d\u0434. \u0412 trickle ICE \u2014 \u043f\u043e\u043b\u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/p>\n<h4>\u041c\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f trickle ICE<\/h4>\n<pre><code class=\"typescript\">\/\/ \u2500\u2500 Trickle ICE: \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u0443\u0445\u043e\u0434\u044f\u0442 \u0441\u0440\u0430\u0437\u0443 \u043a\u0430\u043a \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500this.pc.onicecandidate = ({ candidate }: any) =&gt; {  if (candidate) {    console.log('[WebRTC] Sending ICE candidate:', candidate.type, candidate.protocol);    this.sendSignal({ type: 'ice-candidate', candidate });  } else {    console.log('[WebRTC] ICE gathering complete');  }};\/\/ Offer \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 setLocalDescriptionconst offer = await this.pc.createOffer(offerOpts);await this.pc.setLocalDescription(offer);this.sendSignal({ type: 'offer', sdp: offer.sdp });  \/\/ \u041d\u0435 \u0436\u0434\u0451\u043c gather!<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 offer \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435:<\/p>\n<pre><code class=\"typescript\">await this.pc.setRemoteDescription(new RTCSessionDescription({ type: 'offer', sdp }));const answer = await this.pc.createAnswer();await this.pc.setLocalDescription(answer);this.sendSignal({ type: 'answer', sdp: answer.sdp });  \/\/ \u0421\u0440\u0430\u0437\u0443!<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0448\u043b\u0438 \u0434\u043e <code>setRemoteDescription<\/code> \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 <code>pendingCandidates<\/code> \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u0430\u0447\u043a\u043e\u0439 \u043f\u043e\u0441\u043b\u0435:<\/p>\n<pre><code class=\"typescript\">private async handleRemoteCandidate(candidate: any): Promise&lt;void&gt; {  if (this.pc.remoteDescription) {    await this.pc.addIceCandidate(new RTCIceCandidate(candidate));  } else {    \/\/ \u041f\u0440\u0438\u0448\u0451\u043b \u0440\u0430\u043d\u044c\u0448\u0435 answer\/offer \u2014 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c    this.pendingCandidates.push(candidate);  }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \u0432\u0440\u0435\u043c\u044f \u043e\u0442 &#171;\u043f\u043e\u0437\u0432\u043e\u043d\u0438\u0442\u044c&#187; \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0443\u0434\u0438\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e\u0441\u044c \u0441 8-12 \u0441\u0435\u043a\u0443\u043d\u0434 \u0434\u043e 800-1500 \u043c\u0441. \u042d\u0442\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 &#171;\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a&#187; \u0438 &#171;\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a&#187;.<\/p>\n<h3>TURN credentials \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/h3>\n<p>WebRTC \u043d\u0443\u0436\u043d\u044b STUN\/TURN \u0441\u0435\u0440\u0432\u0435\u0440\u044b. STUN \u2014 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e IP. TURN \u2014 \u0434\u043b\u044f relay \u043a\u043e\u0433\u0434\u0430 direct connection \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d (strict firewall, symmetric NAT). \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"typescript\">const iceServers = [  { urls: 'stun:stun.l.google.com:19302' },  {    urls: 'turn:my-server.com:3478',    username: 'temp-user-12345',    credential: 'temp-password-67890'  }];<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>TURN credentials \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 (\u0436\u0438\u0432\u0443\u0442 12-24 \u0447\u0430\u0441\u0430) \u0438 \u0432\u044b\u0434\u0430\u044e\u0442\u0441\u044f \u0442\u0432\u043e\u0438\u043c backend&#8217;\u043e\u043c \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443. \u041d\u0430\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434: \u043f\u0435\u0440\u0435\u0434 \u043a\u0430\u0436\u0434\u044b\u043c \u0437\u0432\u043e\u043d\u043a\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0441\u0432\u0435\u0436\u0438\u0435 credentials \u0441 backend&#8217;\u0430. <strong>\u042d\u0442\u043e \u043f\u043b\u043e\u0445\u043e<\/strong>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 HTTP round-trip \u0432 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c. \u041d\u0430 \u043f\u043b\u043e\u0445\u043e\u0439 \u0441\u0435\u0442\u0438 \u044d\u0442\u043e \u0435\u0449\u0451 +1-2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u043a \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0435 \u0437\u0432\u043e\u043d\u043a\u0430.<\/p>\n<p>\u042f \u043a\u044d\u0448\u0438\u0440\u0443\u044e credentials \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 20 \u043c\u0438\u043d\u0443\u0442:<\/p>\n<pre><code class=\"typescript\">let _cachedIceServers: any[] | null = null;let _cacheExpiry: number = 0;const CACHE_TTL_MS = 20 * 60 * 1000;export async function preWarmTurnCredentials(): Promise&lt;void&gt; {  const turnData = await api.getTurnCredentials();  if (turnData?.ice_servers?.length) {    _cachedIceServers = turnData.ice_servers;    _cacheExpiry = Date.now() + CACHE_TTL_MS;  }}function getIceServers(): any[] {  if (_cachedIceServers &amp;&amp; Date.now() &lt; _cacheExpiry) {    return _cachedIceServers;  }  return DEFAULT_ICE_SERVERS; \/\/ fallback}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><code>preWarmTurnCredentials()<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043a\u0430\u0436\u0434\u044b\u0435 15 \u043c\u0438\u043d\u0443\u0442 \u0432 background. \u041a \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0432\u043e\u043d\u043a\u0430 credentials \u0443\u0436\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435\u0442.<\/p>\n<p>Fallback \u043d\u0430 <code>DEFAULT_ICE_SERVERS<\/code> \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u043d. \u0415\u0441\u043b\u0438 backend \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d (\u0442\u0435\u0445\u0440\u0430\u0431\u043e\u0442\u044b, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0441\u0435\u0442\u044c\u044e), \u0437\u0432\u043e\u043d\u043a\u0438 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 STUN \u0438 \u043c\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0439 TURN. \u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0445\u0443\u0436\u0435, \u043d\u043e \u0437\u0432\u043e\u043d\u043a\u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442.<\/p>\n<h3>ICE restart: \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u0441\u0435\u0442\u044c \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442<\/h3>\n<p>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 Wi-Fi, LTE, 5G \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e. WebRTC connection \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043e\u0440\u0432\u0430\u0442\u044c\u0441\u044f \u2014 \u0441\u0442\u0430\u0440\u044b\u0435 ICE \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 IP, \u0430 \u043d\u043e\u0432\u044b\u0435 \u0435\u0449\u0451 \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f &#171;\u043f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438&#187; \u0443 WebRTC \u043d\u0435\u0442.<\/p>\n<p>\u0415\u0441\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <strong>ICE restart<\/strong>: \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 offer \u0441 \u0444\u043b\u0430\u0433\u043e\u043c <code>iceRestart: true<\/code>, \u0438 \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 ICE checking \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e.<\/p>\n<pre><code class=\"typescript\">this.pc.oniceconnectionstatechange = () =&gt; {  const state = this.pc?.iceConnectionState;  if (state === 'failed') {    this.scheduleIceRestart();  } else if (state === 'disconnected') {    \/\/ \u0416\u0434\u0451\u043c 4s \u2014 \u043c\u043e\u0436\u0435\u0442 \u0441\u0430\u043c\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f    this.iceRestartTimer = setTimeout(() =&gt; {      if (this.pc?.iceConnectionState === 'disconnected' ||          this.pc?.iceConnectionState === 'failed') {        this.scheduleIceRestart();      }    }, 4000);  }};<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>ICE restart \u0441 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c backoff \u0438 \u043b\u0438\u043c\u0438\u0442\u043e\u043c \u043f\u043e\u043f\u044b\u0442\u043e\u043a:<\/p>\n<pre><code class=\"typescript\">private scheduleIceRestart(): void {  this.iceFailCount++;  if (this.iceFailCount &gt; 3) {    this.callbacks?.onConnectionStateChange('failed');    return;  }  const delay = Math.min(1000 * this.iceFailCount, 3000); \/\/ 1s, 2s, 3s  this.iceRestartTimer = setTimeout(async () =&gt; {    this.pc.restartIce();    if (this.role === 'caller') {      await this.createOffer(true); \/\/ iceRestart: true    }  }, delay);}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u042d\u0442\u043e \u0441\u043f\u0430\u0441\u0430\u0435\u0442 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u0434\u043e\u043c\u0430 (Wi-Fi) \u0432 \u043c\u0430\u0448\u0438\u043d\u0443 (LTE). \u0411\u0435\u0437 ICE restart \u0437\u0432\u043e\u043d\u043e\u043a \u0431\u044b \u043e\u0431\u043e\u0440\u0432\u0430\u043b\u0441\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<h3>iOS CallKit \u0438 VoIP push notifications<\/h3>\n<p>\u041d\u0430 iOS \u0437\u0432\u043e\u043d\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u0430\u043a system calls. \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0437\u0432\u043e\u043d\u043e\u043a, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0438\u0434\u0438\u0442 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u044b\u0439 incoming call UI \u0438\u043b\u0438 Dynamic Island (\u043d\u0430 \u043d\u043e\u0432\u044b\u0445 iPhone). \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0437\u0432\u043e\u043d\u043a\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0435 push-\u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0442\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0431\u0449\u0435\u043c \u0448\u0443\u043c\u0435.<\/p>\n<p>CallKit + VoIP push \u2014 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c edge case. \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443.<\/p>\n<h4>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f VoIP push token<\/h4>\n<pre><code class=\"typescript\">\/\/ \u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044fVoipPushNotification.addEventListener('register', (token: string) =&gt; {  _voipToken = token;  api.updateVoipToken(token); \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 backend});VoipPushNotification.registerVoipToken();<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Backend \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 VoIP token \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0433\u043e \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 VoIP push \u0447\u0435\u0440\u0435\u0437 APNs. VoIP push \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e push \u0442\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u0431\u0443\u0434\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f &#171;\u0443\u0431\u0438\u0442\u043e\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439&#187; \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c background task.<\/p>\n<h4>Background task \u0434\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0430 CallKit<\/h4>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 VoIP push, iOS \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 background task. <strong>\u0412 \u044d\u0442\u043e\u043c \u0442\u0430\u0441\u043a\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c CallKit<\/strong>, \u0438\u043d\u0430\u0447\u0435 iOS \u0443\u0431\u044c\u0451\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430 &#171;\u043b\u043e\u0436\u043d\u0443\u044e&#187; VoIP \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"typescript\">TaskManager.defineTask(INCOMING_CALL_TASK, async ({ data, error }) =&gt; {  const callData = data?.notification?.request?.content?.data;  if (!callData?.call_id) return;  const CK = require('react-native-callkeep');  try {    CK.displayIncomingCall(      callData.call_id,      callData.caller_name,      callData.caller_name,      'generic',      callData.type === 'incoming_video_call'    );  } catch (e) {    console.error('displayIncomingCall failed:', e);  }});<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u042d\u0442\u043e\u0442 task <strong>\u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043c\u043e\u0434\u0443\u043b\u044f<\/strong>, \u043d\u0435 \u0432 React \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435. iOS \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u043d\u0430\u0442\u044c \u043f\u0440\u043e task \u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e push.<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \u043a\u043e\u0433\u0434\u0430 \u043a\u0442\u043e-\u0442\u043e \u0437\u0432\u043e\u043d\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 iOS incoming call UI, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u0438\u043b\u0438 \u043e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a.<\/p>\n<h3>\u0413\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u0437\u0432\u043e\u043d\u043a\u0438 vs peer-to-peer<\/h3>\n<p>Peer-to-peer \u0437\u0432\u043e\u043d\u043a\u0438 (\u043e\u0434\u0438\u043d \u043d\u0430 \u043e\u0434\u0438\u043d) \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0449\u0435: \u0434\u0432\u0430 RTCPeerConnection, \u043e\u0434\u0438\u043d SDP exchange, \u043e\u0434\u0438\u043d \u043d\u0430\u0431\u043e\u0440 ICE \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432. \u0413\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u0437\u0432\u043e\u043d\u043a\u0438 \u2014 \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f.<\/p>\n<p>\u041d\u0430\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u2014 <strong>mesh<\/strong>: \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 WebRTC \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c. \u041d\u0430 3 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u044d\u0442\u043e 6 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 (A\u2194B, A\u2194C, B\u2194C). \u041d\u0430 5 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u2014 20 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439. \u041d\u0430 10 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u2014 90 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439. \u042d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445.<\/p>\n<p>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u2014 <strong>SFU<\/strong> (Selective Forwarding Unit): \u043e\u0434\u0438\u043d \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439 \u0430\u0443\u0434\u0438\u043e\/\u0432\u0438\u0434\u0435\u043e \u043f\u043e\u0442\u043e\u043a \u043d\u0430 SFU, \u0430 SFU \u0444\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u0442 \u043f\u043e\u0442\u043e\u043a\u0438 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u041d\u0430 10 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u044d\u0442\u043e 10 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u2194\u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u043c\u0435\u0441\u0442\u043e 90 mesh-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>\u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <strong>LiveKit<\/strong> \u043a\u0430\u043a SFU. LiveKit \u2014 open-source \u043c\u0435\u0434\u0438\u0430\u0441\u0435\u0440\u0432\u0435\u0440 \u0441 WebRTC API, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u0435\u043b\u0444-\u0445\u043e\u0441\u0442\u0438\u0442\u044c. \u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a LiveKit room, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043f\u043e\u0442\u043e\u043a\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432.<\/p>\n<pre><code class=\"typescript\">\/\/ \u0418\u043d\u0438\u0446\u0438\u0430\u0446\u0438\u044f \u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0433\u043e \u0437\u0432\u043e\u043d\u043a\u0430const initiateCall = async (groupId: string, callType: 'audio' | 'video') =&gt; {  const result = await api.initiateGroupCall(groupId, callType);  const callDetails = await api.getGroupCall(result.id);  setActiveCall(callDetails);  return callDetails;};\/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a LiveKit roomconst joinLiveKitRoom = async (roomToken: string) =&gt; {  const room = new Room();  await room.connect(livekitUrl, roomToken);  room.localParticipant.enableCameraAndMicrophone();};<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>LiveKit \u0432\u044b\u0434\u0430\u0451\u0442 JWT token \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 room. Backend \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043a\u0435\u043d \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 (publish audio\/video, subscribe to others) \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0436\u0438\u0437\u043d\u0438. \u041a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a LiveKit \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u2014 backend \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0434\u0430\u0447\u0438 \u0442\u043e\u043a\u0435\u043d\u0430 \u0432 \u043c\u0435\u0434\u0438\u0430-\u043f\u043e\u0442\u043e\u043a\u0435 \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<h3>\u0413\u0440\u0430\u0431\u043b\u0438 production<\/h3>\n<h4>\u0413\u0440\u0430\u0431\u043b\u044f 1: iOS permissions \u0434\u043e getUserMedia<\/h4>\n<p>\u041d\u0430 iOS \u0432\u044b\u0437\u043e\u0432 <code>getUserMedia<\/code> \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 permissions \u043a\u0440\u0430\u0448\u0438\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 &#171;The operation couldn&#8217;t be completed&#187;. \u041d\u0430 Android permissions \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 <code>getUserMedia<\/code>. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 platform-specific \u043a\u043e\u0434:<\/p>\n<pre><code class=\"typescript\">\/\/ iOS: \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c permissions \u041f\u0415\u0420\u0415\u0414 getUserMediaif (Platform.OS === 'ios') {  const { Audio } = require('expo-av');  const micResult = await Audio.requestPermissionsAsync();  if (!micResult.granted) {    callbacks.onError('\u041d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043c\u0438\u043a\u0440\u043e\u0444\u043e\u043d\u0443');    return null;  }  if (callType === 'video') {    const { Camera } = require('expo-camera');    const camResult = await Camera.requestCameraPermissionsAsync();    if (!camResult.granted) {      callbacks.onError('\u041d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043a\u0430\u043c\u0435\u0440\u0435');      return null;    }  }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u0413\u0440\u0430\u0431\u043b\u044f 2: cleanup callbacks \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435\u043c PeerConnection<\/h4>\n<p>\u041f\u0440\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0437\u0432\u043e\u043d\u043a\u0430 \u0432\u0430\u0436\u0435\u043d \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0415\u0441\u043b\u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044c <code>RTCPeerConnection<\/code>, \u0430 \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c callbacks, \u0442\u043e <code>pc.close()<\/code> \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <code>onconnectionstatechange('closed')<\/code>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u0432\u0430\u0442\u044c callback \u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 &#171;closed&#187; \u0432 UI. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0432\u043e\u043d\u043e\u043a \u043d\u0430\u0447\u043d\u0451\u0442\u0441\u044f \u0441 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c &#171;\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e&#187;.<\/p>\n<pre><code class=\"typescript\">cleanup(): void {  \/\/ \u041e\u0431\u043d\u0443\u043b\u044f\u0435\u043c callbacks \u0414\u041e \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f PC  const savedWsUnsub = this.wsUnsub;  this.callbacks = null;  this.wsUnsub = null;  try {    savedWsUnsub?.();    this.localStream?.getTracks().forEach(t =&gt; t.stop());    this.pc?.close();  } catch {}}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u0413\u0440\u0430\u0431\u043b\u044f 3: WebRTC globals \u0432 Expo<\/h4>\n<p>React Native \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 WebRTC \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b (<code>RTCPeerConnection<\/code>, <code>mediaDevices<\/code>). \u0418\u0445 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code>@livekit\/react-native-webrtc.registerGlobals()<\/code>. \u0412 Expo Go \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u0430 \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 \u043a\u0440\u0430\u0448\u0430:<\/p>\n<pre><code class=\"typescript\">export function ensureLiveKitGlobals() {  try {    const webrtc = require('@livekit\/react-native-webrtc');    if (webrtc?.registerGlobals) {      webrtc.registerGlobals();    }  } catch (e) {    console.log('[WebRTC] @livekit\/react-native-webrtc not available:', e);  }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0412\u044b\u0437\u043e\u0432 \u043f\u0435\u0440\u0435\u0434 \u043b\u044e\u0431\u043e\u0439 WebRTC \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439. \u0412 production build \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0435\u0441\u0442\u044c, \u0432 Expo Go \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u043a\u0440\u0430\u0448\u0438\u0442\u0441\u044f.<\/p>\n<h4>\u0413\u0440\u0430\u0431\u043b\u044f 4: race condition \u043f\u0440\u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0437\u0432\u043e\u043d\u043a\u043e\u0432<\/h4>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u043e\u0434\u0438\u043d \u0437\u0432\u043e\u043d\u043e\u043a \u0438 \u043d\u0430\u0447\u043d\u0451\u0442 \u0434\u0440\u0443\u0433\u043e\u0439, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 race: cleanup \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0432\u043e\u043d\u043a\u0430 \u043e\u0431\u043d\u0443\u043b\u0438\u0442 WebRTC globals \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u043e\u0433\u0434\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0437\u0432\u043e\u043d\u043e\u043a \u0438\u0445 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \u0432\u0442\u043e\u0440\u043e\u0439 \u0437\u0432\u043e\u043d\u043e\u043a \u043a\u0440\u0430\u0448\u0438\u0442\u0441\u044f \u0441 &#171;RTCPeerConnection is not defined&#187;.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435: singleton WebRTCService \u0441 \u043c\u044c\u044e\u0442\u0435\u043a\u0441\u043e\u043c \u043d\u0430 cleanup\/initialize:<\/p>\n<pre><code class=\"typescript\">class WebRTCService {  private isCleaningUp = false;  private isInitializing = false;  async initialize(\/* ... *\/) {    if (this.isCleaningUp) {      await new Promise(resolve =&gt; setTimeout(resolve, 100));    }    this.isInitializing = true;    \/\/ ... actual initialization    this.isInitializing = false;  }  cleanup() {    if (this.isInitializing) return;    this.isCleaningUp = true;    \/\/ ... actual cleanup    this.isCleaningUp = false;  }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u0413\u0440\u0430\u0431\u043b\u044f 5: Android battery optimization \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u0437\u0432\u043e\u043d\u043a\u0438<\/h4>\n<p>\u041d\u0430 \u043c\u043d\u043e\u0433\u0438\u0445 Android \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 aggressive battery optimization \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u0444\u043e\u043d\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043d\u0443\u0442. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u0438\u043d\u044f\u043b \u0437\u0432\u043e\u043d\u043e\u043a \u0438 \u0441\u0432\u0435\u0440\u043d\u0443\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043a\u0430\u043b\u0435\u043d\u0434\u0430\u0440\u044c), \u0447\u0435\u0440\u0435\u0437 2-5 \u043c\u0438\u043d\u0443\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u0431\u044c\u0451\u0442 WebRTC connection \u0438 \u0437\u0432\u043e\u043d\u043e\u043a \u043e\u0431\u043e\u0440\u0432\u0451\u0442\u0441\u044f.<\/p>\n<p>\u0427\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 foreground service \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0432\u043e\u043d\u043a\u0430:<\/p>\n<pre><code class=\"typescript\">\/\/ Android: \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c foreground service \u043f\u0440\u0438 \u043d\u0430\u0447\u0430\u043b\u0435 \u0437\u0432\u043e\u043d\u043a\u0430if (Platform.OS === 'android') {  await startForegroundService({    taskName: 'VoiceCall',    taskTitle: '\u0418\u0434\u0451\u0442 \u0437\u0432\u043e\u043d\u043e\u043a',    taskDesc: 'ONEMIX \u0437\u0432\u043e\u043d\u043e\u043a \u0430\u043a\u0442\u0438\u0432\u0435\u043d',    taskIcon: { name: 'ic_launcher', type: 'mipmap' }  });}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0432\u0438\u0434\u0438\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0443\u044e \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e &#171;\u0418\u0434\u0451\u0442 \u0437\u0432\u043e\u043d\u043e\u043a&#187; \u2014 \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0443\u0431\u0438\u0442\u043e. \u041f\u0440\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0437\u0432\u043e\u043d\u043a\u0430 service \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<h3>\u0427\u0442\u043e \u0431\u044b \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0441\u0435\u0439\u0447\u0430\u0441 \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c\u0438 \u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438, \u0432\u043e\u0442 \u0447\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b \u0431\u044b:<\/p>\n<p><strong>\u041d\u0430\u0447\u0430\u043b \u0431\u044b \u0441 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e SDK \u043d\u0430 MVP-\u0441\u0442\u0430\u0434\u0438\u0438.<\/strong> Agora\/Twilio \u0434\u0430\u044e\u0442 working solution \u0437\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u0432\u043c\u0435\u0441\u0442\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0430\u044f \u0431\u0430\u0437\u0430 \u0432\u044b\u0440\u0430\u0441\u0442\u0435\u0442 \u0438 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f (\u043a\u0430\u0441\u0442\u043e\u043c\u043d\u0430\u044f UI, \u043e\u0441\u043e\u0431\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0435\u0439, \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 E2E) \u2014 \u0442\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041d\u043e \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 SDK \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u043f\u043e time-to-market.<\/p>\n<p><strong>\u0411\u043e\u043b\u044c\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f Android-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0435.<\/strong> \u042f \u0441\u0444\u043e\u043a\u0443\u0441\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u043d\u0430 iOS (CallKit, VoIP push) \u0438 Android \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430 iOS \u0437\u0432\u043e\u043d\u043a\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043a\u0430\u043a native phone calls, \u0430 \u043d\u0430 Android \u2014 \u043a\u0430\u043a push-\u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438. Android \u0442\u043e\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 ConnectionService API \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 system dialer, \u043d\u043e \u044f \u044d\u0442\u043e \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b.<\/p>\n<p><strong>\u041c\u0435\u0434\u0438\u0430-\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u043e\u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u044b\u0439 \u0444\u0430\u043a\u0442\u043e\u0440.<\/strong> \u042f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0441\u0442\u044c, \u043d\u043e \u043d\u0435 \u0443\u0434\u0435\u043b\u0438\u043b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0430\u0443\u0434\u0438\u043e\/\u0432\u0438\u0434\u0435\u043e quality. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \u0437\u0432\u043e\u043d\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u043e, \u043d\u043e \u043d\u0430 \u043f\u043b\u043e\u0445\u043e\u0439 \u0441\u0435\u0442\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u0433\u0440\u0430\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u0447\u0435\u043c \u0443 WhatsApp. Adaptive bitrate, \u0430\u0443\u0434\u0438\u043e-preprocessing, \u044d\u0445\u043e-\u043f\u043e\u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0442\u0438\u0437\u044b.<\/p>\n<p><strong>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u0448\u0438\u0440\u043e\u043a\u043e\u043c \u0441\u043f\u0435\u043a\u0442\u0440\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432.<\/strong> WebRTC \u0432\u0435\u0434\u0451\u0442 \u0441\u0435\u0431\u044f \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0447\u0438\u043f\u0441\u0435\u0442\u0430\u0445, \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Android, \u0442\u0438\u043f\u0430\u0445 \u0441\u0435\u0442\u0438. \u0423 \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e 3-4 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u044d\u0442\u043e\u0433\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043c\u0430\u043b\u043e. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0430\u0433\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0445\u043e \u043d\u0430 Samsung Galaxy \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438) \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438\u0441\u044c \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0440\u0435\u043b\u0438\u0437\u0430.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0417\u0432\u043e\u043d\u043a\u0438 \u0432 \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0435 \u2014 \u044d\u0442\u043e 90% \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0438\u0438 \u0438 10% \u0444\u0438\u0447. \u0411\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435 \u0432 \u0442\u043e\u043c \u0447\u0442\u043e\u0431\u044b &#171;\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443 \u0437\u0432\u043e\u043d\u043a\u0430&#187;, \u0430 \u0432 \u0442\u043e\u043c \u0447\u0442\u043e\u0431\u044b \u0437\u0432\u043e\u043d\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e \u0432 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0439: \u043f\u043b\u043e\u0445\u0430\u044f \u0441\u0435\u0442\u044c, \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Wi-Fi\/LTE, \u0444\u043e\u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, battery optimization, \u0440\u0430\u0437\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b\u043c\u0438: trickle ICE \u0432\u043c\u0435\u0441\u0442\u043e gather-then-send (\u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 8 \u0441\u0435\u043a\u0443\u043d\u0434), \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 TURN credentials (\u0443\u0431\u0438\u0440\u0430\u0435\u0442 HTTP round-trip), \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 ICE restart (\u0441\u043f\u0430\u0441\u0430\u0435\u0442 \u0437\u0432\u043e\u043d\u043a\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0441\u0435\u0442\u0438), \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 CallKit \u043d\u0430 iOS (system-like UX).<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u0437\u0432\u043e\u043d\u043a\u0438 \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u2014 \u043d\u0435 \u043d\u0435\u0434\u043e\u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0439\u0442\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c. \u042d\u0442\u043e \u043d\u0435 &#171;\u0434\u043e\u0431\u0430\u0432\u0438\u043c WebRTC \u0437\u0430 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435&#187;. \u041d\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u043e\u0433\u043e \u0441\u0442\u043e\u0438\u0442: \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0447\u0442\u043e \u0437\u0432\u043e\u043d\u043a\u0438 \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 &#171;\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043a\u0430\u043a \u0432 WhatsApp&#187; \u2014 \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u043a\u043e\u043c\u043f\u043b\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0438\u0438.<\/p>\n<hr\/>\n<p>\u042d\u0442\u043e \u0442\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0438\u0437 \u0441\u0435\u0440\u0438\u0438 \u043f\u0440\u043e ONEMIX. \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445: <a href=\"#\" rel=\"noopener noreferrer nofollow\">\u0442\u0440\u0451\u0445\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u043a\u044d\u0448 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/a> \u0438 <a href=\"#\" rel=\"noopener noreferrer nofollow\">Double Ratchet E2E<\/a>. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e iOS App Store deployment \u0441 EAS Build \u2014 \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c. \u0412 Telegram-\u043a\u0430\u043d\u0430\u043b\u0435 \u043f\u0438\u0448\u0443 \u043f\u0440\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0447\u0430\u0449\u0435 \u0438 \u043a\u043e\u0440\u043e\u0447\u0435 \u2014 \u0437\u0430\u0445\u043e\u0434\u0438\u0442\u0435 <em>(\u0441\u0441\u044b\u043b\u043a\u0430)<\/em>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e WebRTC, CallKit \u0438\u043b\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u043a\u0443\u0441\u043a\u0430\u043c \u043a\u043e\u0434\u0430 \u2014 \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u044b. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c \u043e\u0442 \u0442\u0435\u0445 \u043a\u0442\u043e \u0434\u0435\u043b\u0430\u043b \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u0438 \u043d\u0430\u0448\u0451\u043b \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\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\/articles\/1033930\/\">https:\/\/habr.com\/ru\/articles\/1033930\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0423\u0440\u043e\u0432\u0435\u043d\u044c: senior \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438 WebRTC \u0421\u0442\u0435\u043a: React Native, Expo SDK 54, @livekit\/react-native-webrtc, expo-notifications, CallKit, FCM \u0427\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438: production WebRTC \u0441 trickle ICE, VoIP push notifications, CallKit \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0444\u043e\u043d\u043e\u0432\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435\u042d\u0442\u043e \u0442\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0438\u0437 \u0441\u0435\u0440\u0438\u0438 \u043f\u0440\u043e \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 ONEMIX \u2014 \u043c\u043e\u0451\u043c \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0435 \u043d\u0430 React Native. \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b \u0442\u0440\u0451\u0445\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 \u043a\u044d\u0448 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e Double Ratchet E2E. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u2014 \u043f\u0440\u043e \u0437\u0432\u043e\u043d\u043a\u0438.\u0417\u0432\u043e\u043d\u043a\u0438 \u0432 \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0435 \u2014 \u044d\u0442\u043e \u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0438\u0431\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e, \u043b\u0438\u0431\u043e \u043d\u0438\u043a\u0430\u043a. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u0438\u0432\u044b\u043a \u0447\u0442\u043e WhatsApp\/Telegram \u0437\u0432\u043e\u043d\u044f\u0442 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043d\u0430 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435, \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u044e\u0442 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Wi-Fi\/LTE, \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438\u0437 \u0444\u043e\u043d\u0430. \u0415\u0441\u043b\u0438 \u0442\u0432\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0445\u043e\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0445\u0443\u0436\u0435 \u2014 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u044d\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u0442 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u0441\u044f \u043d\u0430 &#171;\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439&#187; \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440.\u042f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043d\u0430 \u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0432\u0435\u0441\u0442\u0438 \u0437\u0432\u043e\u043d\u043a\u0438 \u0432 ONEMIX \u0434\u043e production-\u0443\u0440\u043e\u0432\u043d\u044f. \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0437\u0443\u0447\u0438\u0442\u044c WebRTC \u0438\u0437\u043d\u0443\u0442\u0440\u0438, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 iOS CallKit \u0438 VoIP push notifications, \u0438 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0434\u0435\u0441\u044f\u0442\u043e\u043a \u0433\u0440\u0430\u0431\u043b\u0435\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430\u0445 \u043d\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0442. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u2014 \u043a\u0430\u043a \u044d\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u043e, \u043a\u0430\u043a\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b\u043c\u0438, \u0438 \u0447\u0442\u043e \u0431\u044b \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443.\u0421\u0440\u0430\u0437\u0443 \u043e\u0433\u043e\u0432\u043e\u0440\u043a\u0430. \u042f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0433\u043e\u0442\u043e\u0432\u044b\u0435 SDK \u0442\u0438\u043f\u0430 Agora, Twilio, 100ms. \u0423 \u043d\u0438\u0445 \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430, \u043d\u043e \u043e\u043d\u0438 \u043d\u0435 \u0434\u0430\u044e\u0442 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043d\u0430\u0434 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u2014 \u0430 \u0434\u043b\u044f \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u043d. \u041a\u043e\u0433\u0434\u0430 \u0437\u0432\u043e\u043d\u043e\u043a \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0438\u043d\u0438\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0430 \u043d\u0435 &#171;SDK \u043e\u0442 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b&#187;. \u041f\u043b\u044e\u0441 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 SDK \u0441\u0442\u043e\u044f\u0442 \u0434\u0435\u043d\u0435\u0433, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430 \u0440\u0430\u043d\u043d\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u043b\u0443\u0447\u0448\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0441\u0442\u0430.\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430: \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 &#171;\u043f\u0440\u043e\u0441\u0442\u043e\u0439 WebRTC&#187;\u0415\u0441\u043b\u0438 \u0437\u0430\u0433\u0443\u0433\u043b\u0438\u0442\u044c &#171;WebRTC React Native&#187;, \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0435\u0441\u044f\u0442\u044c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u043d\u043e: createPeerConnection, createOffer, setLocalDescription, \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b, \u043f\u043e\u0442\u043e\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c offer \u0441 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430\u043c\u0438 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043d\u0438\u043a\u0443. \u042d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f &#171;gather-then-send&#187; \u0438 \u0434\u043b\u044f \u0443\u0447\u0435\u0431\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e.\u0412 production \u044d\u0442\u043e \u0434\u0430\u0451\u0442 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 8-12 \u0441\u0435\u043a\u0443\u043d\u0434 \u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 &#171;\u043f\u043e\u0437\u0432\u043e\u043d\u0438\u0442\u044c&#187; \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0443\u0434\u0438\u043e. \u041f\u0440\u0438\u0447\u0438\u043d\u0430: \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u2014 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 STUN\/TURN \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u0434\u0430\u043b\u0435\u043a\u043e. ICE gathering \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c 3-5 \u0441\u0435\u043a\u0443\u043d\u0434 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 caller, \u043f\u043e\u0442\u043e\u043c \u0435\u0449\u0451 3-5 \u0441\u0435\u043a\u0443\u043d\u0434 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 receiver. \u0422\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f actual ICE checking \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.Telegram \u0438 WhatsApp \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 trickle ICE: offer\/answer \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 setLocalDescription, \u0430 ICE-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u0442\u0440\u0438\u043a\u043b\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u043e \u043c\u0435\u0440\u0435 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f. \u041f\u0435\u0440\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u043f\u0430\u0440\u0430 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432, \u043e\u0431\u044b\u0447\u043d\u043e \u0437\u0430 500-1500 \u043c\u0441.\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f. \u0412 gather-then-send \u0437\u0432\u043e\u043d\u043e\u043a &#171;\u0434\u0443\u043c\u0430\u0435\u0442&#187; 8 \u0441\u0435\u043a\u0443\u043d\u0434. \u0412 trickle ICE \u2014 \u043f\u043e\u043b\u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0441\u0435\u043a\u0443\u043d\u0434\u0443.\u041c\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f trickle ICE\/\/ \u2500\u2500 Trickle ICE: \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u0443\u0445\u043e\u0434\u044f\u0442 \u0441\u0440\u0430\u0437\u0443 \u043a\u0430\u043a \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500this.pc.onicecandidate = ({ candidate }: any) =&gt; {  if (candidate) {    console.log(&#8216;[WebRTC] Sending ICE candidate:&#8217;, candidate.type, candidate.protocol);    this.sendSignal({ type: &#8216;ice-candidate&#8217;, candidate });  } else {    console.log(&#8216;[WebRTC] ICE gathering complete&#8217;);  }};\/\/ Offer \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 setLocalDescriptionconst offer = await this.pc.createOffer(offerOpts);await this.pc.setLocalDescription(offer);this.sendSignal({ type: &#8216;offer&#8217;, sdp: offer.sdp });  \/\/ \u041d\u0435 \u0436\u0434\u0451\u043c gather!\u041f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 offer \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435:await this.pc.setRemoteDescription(new RTCSessionDescription({ type: &#8216;offer&#8217;, sdp }));const answer = await this.pc.createAnswer();await this.pc.setLocalDescription(answer);this.sendSignal({ type: &#8216;answer&#8217;, sdp: answer.sdp });  \/\/ \u0421\u0440\u0430\u0437\u0443!\u041a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0448\u043b\u0438 \u0434\u043e setRemoteDescription \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 pendingCandidates \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u0430\u0447\u043a\u043e\u0439 \u043f\u043e\u0441\u043b\u0435:private async handleRemoteCandidate(candidate: any): Promise&lt;void&gt; {  if (this.pc.remoteDescription) {    await this.pc.addIceCandidate(new RTCIceCandidate(candidate));  } else {    \/\/ \u041f\u0440\u0438\u0448\u0451\u043b \u0440\u0430\u043d\u044c\u0448\u0435 answer\/offer \u2014 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c    this.pendingCandidates.push(candidate);  }}\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \u0432\u0440\u0435\u043c\u044f \u043e\u0442 &#171;\u043f\u043e\u0437\u0432\u043e\u043d\u0438\u0442\u044c&#187; \u0434\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0443\u0434\u0438\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e\u0441\u044c \u0441 8-12 \u0441\u0435\u043a\u0443\u043d\u0434 \u0434\u043e 800-1500 \u043c\u0441. \u042d\u0442\u043e \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 &#171;\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a&#187; \u0438 &#171;\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a&#187;.TURN credentials \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044cWebRTC \u043d\u0443\u0436\u043d\u044b STUN\/TURN \u0441\u0435\u0440\u0432\u0435\u0440\u044b. STUN \u2014 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e IP. TURN \u2014 \u0434\u043b\u044f relay \u043a\u043e\u0433\u0434\u0430 direct connection \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d (strict firewall, symmetric NAT). \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:const iceServers = [  { urls: &#8216;stun:stun.l.google.com:19302&#8217; },  {    urls: &#8216;turn:my-server.com:3478&#8217;,    username: &#8216;temp-user-12345&#8217;,    credential: &#8216;temp-password-67890&#8217;  }];TURN credentials \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 (\u0436\u0438\u0432\u0443\u0442 12-24 \u0447\u0430\u0441\u0430) \u0438 \u0432\u044b\u0434\u0430\u044e\u0442\u0441\u044f \u0442\u0432\u043e\u0438\u043c backend&#8217;\u043e\u043c \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443. \u041d\u0430\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434: \u043f\u0435\u0440\u0435\u0434 \u043a\u0430\u0436\u0434\u044b\u043c \u0437\u0432\u043e\u043d\u043a\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0441\u0432\u0435\u0436\u0438\u0435 credentials \u0441 backend&#8217;\u0430. \u042d\u0442\u043e \u043f\u043b\u043e\u0445\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 HTTP round-trip \u0432 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c. \u041d\u0430 \u043f\u043b\u043e\u0445\u043e\u0439 \u0441\u0435\u0442\u0438 \u044d\u0442\u043e \u0435\u0449\u0451 +1-2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u043a \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0435 \u0437\u0432\u043e\u043d\u043a\u0430.\u042f \u043a\u044d\u0448\u0438\u0440\u0443\u044e credentials \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 20 \u043c\u0438\u043d\u0443\u0442:let _cachedIceServers: any[] | null = null;let _cacheExpiry: number = 0;const CACHE_TTL_MS = 20 * 60 * 1000;export async function preWarmTurnCredentials(): Promise&lt;void&gt; {  const turnData = await api.getTurnCredentials();  if (turnData?.ice_servers?.length) {    _cachedIceServers = turnData.ice_servers;    _cacheExpiry = Date.now() + CACHE_TTL_MS;  }}function getIceServers(): any[] {  if (_cachedIceServers &amp;&amp; Date.now() &lt; _cacheExpiry) {    return _cachedIceServers;  }  return DEFAULT_ICE_SERVERS; \/\/ fallback}preWarmTurnCredentials() \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043a\u0430\u0436\u0434\u044b\u0435 15 \u043c\u0438\u043d\u0443\u0442 \u0432 background. \u041a \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0432\u043e\u043d\u043a\u0430 credentials \u0443\u0436\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0435\u0442.Fallback \u043d\u0430 DEFAULT_ICE_SERVERS \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u043d. \u0415\u0441\u043b\u0438 backend \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d (\u0442\u0435\u0445\u0440\u0430\u0431\u043e\u0442\u044b, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0441\u0435\u0442\u044c\u044e), \u0437\u0432\u043e\u043d\u043a\u0438 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 STUN \u0438 \u043c\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0439 TURN. \u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0445\u0443\u0436\u0435, \u043d\u043e \u0437\u0432\u043e\u043d\u043a\u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442.ICE restart: \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u0441\u0435\u0442\u044c \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 Wi-Fi, LTE, 5G \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e. WebRTC connection \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u043e\u0440\u0432\u0430\u0442\u044c\u0441\u044f \u2014 \u0441\u0442\u0430\u0440\u044b\u0435 ICE \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 IP, \u0430 \u043d\u043e\u0432\u044b\u0435 \u0435\u0449\u0451 \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f &#171;\u043f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438&#187; \u0443 WebRTC \u043d\u0435\u0442.\u0415\u0441\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c ICE restart: \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 offer \u0441 \u0444\u043b\u0430\u0433\u043e\u043c iceRestart: true, \u0438 \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 ICE checking \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e.this.pc.oniceconnectionstatechange = () =&gt; {  const state = this.pc?.iceConnectionState;  if (state === &#8216;failed&#8217;) {    this.scheduleIceRestart();  } else if (state === &#8216;disconnected&#8217;) {    \/\/ \u0416\u0434\u0451\u043c 4s \u2014 \u043c\u043e\u0436\u0435\u0442 \u0441\u0430\u043c\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f    this.iceRestartTimer = setTimeout(() =&gt; {      if (this.pc?.iceConnectionState === &#8216;disconnected&#8217; ||          this.pc?.iceConnectionState === &#8216;failed&#8217;) {        this.scheduleIceRestart();      }    }, 4000);  }};ICE restart \u0441 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c backoff \u0438 \u043b\u0438\u043c\u0438\u0442\u043e\u043c \u043f\u043e\u043f\u044b\u0442\u043e\u043a:private scheduleIceRestart(): void {  this.iceFailCount++;  if (this.iceFailCount &gt; 3) {    this.callbacks?.onConnectionStateChange(&#8216;failed&#8217;);    return;  }  const delay = Math.min(1000 * this.iceFailCount, 3000); \/\/ 1s, 2s, 3s  this.iceRestartTimer = setTimeout(async () =&gt; {    this.pc.restartIce();    if (this.role === &#8216;caller&#8217;) {      await this.createOffer(true); \/\/ iceRestart: true    }  }, delay);}\u042d\u0442\u043e \u0441\u043f\u0430\u0441\u0430\u0435\u0442 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u0434\u043e\u043c\u0430 (Wi-Fi) \u0432 \u043c\u0430\u0448\u0438\u043d\u0443 (LTE). \u0411\u0435\u0437 ICE restart \u0437\u0432\u043e\u043d\u043e\u043a \u0431\u044b \u043e\u0431\u043e\u0440\u0432\u0430\u043b\u0441\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e.iOS CallKit \u0438 VoIP push notifications\u041d\u0430 iOS \u0437\u0432\u043e\u043d\u043a\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u0430\u043a system calls. \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0437\u0432\u043e\u043d\u043e\u043a, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0438\u0434\u0438\u0442 \u043f\u043e\u043b\u043d\u043e\u044d\u043a\u0440\u0430\u043d\u043d\u044b\u0439 incoming call UI \u0438\u043b\u0438 Dynamic Island (\u043d\u0430 \u043d\u043e\u0432\u044b\u0445 iPhone). \u0411\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0437\u0432\u043e\u043d\u043a\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0435 push-\u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0438 \u0442\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0431\u0449\u0435\u043c \u0448\u0443\u043c\u0435.CallKit + VoIP push \u2014 \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c edge case. \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443.\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f VoIP push token\/\/ \u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044fVoipPushNotification.addEventListener(&#8216;register&#8217;, (token: string) =&gt; {  _voipToken = token;  api.updateVoipToken(token); \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 backend});VoipPushNotification.registerVoipToken();Backend \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 VoIP token \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0433\u043e \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 VoIP push \u0447\u0435\u0440\u0435\u0437 APNs. VoIP push \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e push \u0442\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u0431\u0443\u0434\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f &#171;\u0443\u0431\u0438\u0442\u043e\u0433\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439&#187; \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c background task.Background task \u0434\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0430 CallKit\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 VoIP push, iOS \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 background task. \u0412 \u044d\u0442\u043e\u043c \u0442\u0430\u0441\u043a\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c CallKit, \u0438\u043d\u0430\u0447\u0435 iOS \u0443\u0431\u044c\u0451\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430 &#171;\u043b\u043e\u0436\u043d\u0443\u044e&#187; VoIP \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e:TaskManager.defineTask(INCOMING_CALL_TASK, async ({ data, error }) =&gt; {  const callData = data?.notification?.request?.content?.data;  if (!callData?.call_id) return;  const CK = require(&#8216;react-native-callkeep&#8217;);  try {    CK.displayIncomingCall(      callData.call_id,      callData.caller_name,      callData.caller_name,      &#8216;generic&#8217;,      callData.type === &#8216;incoming_video_call&#8217;    );  } catch (e) {    console.error(&#8216;displayIncomingCall failed:&#8217;, e);  }});\u042d\u0442\u043e\u0442 task \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043c\u043e\u0434\u0443\u043b\u044f, \u043d\u0435 \u0432 React \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435. iOS \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u043d\u0430\u0442\u044c \u043f\u0440\u043e task \u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e push.\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \u043a\u043e\u0433\u0434\u0430 \u043a\u0442\u043e-\u0442\u043e \u0437\u0432\u043e\u043d\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 iOS incoming call UI, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u0438\u043b\u0438 \u043e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a.\u0413\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u0437\u0432\u043e\u043d\u043a\u0438 vs peer-to-peerPeer-to-peer \u0437\u0432\u043e\u043d\u043a\u0438 (\u043e\u0434\u0438\u043d \u043d\u0430 \u043e\u0434\u0438\u043d) \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0449\u0435: \u0434\u0432\u0430 RTCPeerConnection, \u043e\u0434\u0438\u043d SDP exchange, \u043e\u0434\u0438\u043d \u043d\u0430\u0431\u043e\u0440 ICE \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432. \u0413\u0440\u0443\u043f\u043f\u043e\u0432\u044b\u0435 \u0437\u0432\u043e\u043d\u043a\u0438 \u2014 \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f.\u041d\u0430\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u2014 mesh: \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 WebRTC \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u043c. \u041d\u0430 3 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u044d\u0442\u043e 6 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 (A\u2194B, A\u2194C, B\u2194C). \u041d\u0430 5 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u2014 20 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439. \u041d\u0430 10 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u2014 90 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439. \u042d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043d\u0430 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445.\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u2014 SFU (Selective Forwarding Unit): \u043e\u0434\u0438\u043d \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u0423\u0447\u0430\u0441\u0442\u043d\u0438\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0439 \u0430\u0443\u0434\u0438\u043e\/\u0432\u0438\u0434\u0435\u043e \u043f\u043e\u0442\u043e\u043a \u043d\u0430 SFU, \u0430 SFU \u0444\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u0442 \u043f\u043e\u0442\u043e\u043a\u0438 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u041d\u0430 10 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u044d\u0442\u043e 10 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u2194\u0441\u0435\u0440\u0432\u0435\u0440 \u0432\u043c\u0435\u0441\u0442\u043e 90 mesh-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439.\u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e LiveKit \u043a\u0430\u043a SFU. LiveKit \u2014 open-source \u043c\u0435\u0434\u0438\u0430\u0441\u0435\u0440\u0432\u0435\u0440 \u0441 WebRTC API, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u0435\u043b\u0444-\u0445\u043e\u0441\u0442\u0438\u0442\u044c. \u041a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a LiveKit room, &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-479350","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/479350","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=479350"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/479350\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=479350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=479350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=479350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}