AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.129.247.217
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/bitrix/www/bitrix/js/mobileapp/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/js/mobileapp/mobile_webrtc.min.js
var WebRTCPlugin=function(){this.plugin=this.UI.plugin=new BXCordovaPlugin("MobileWebRTC");this.CallBackExecute=function(){this.plugin.CallBackExecute.apply(this.plugin,arguments)}};WebRTCPlugin.prototype={UI:{state:{OUTGOING_CALL:"outgoing_call",INCOMING_CALL:"incoming_call",CONVERSATION:"conversation",FAIL_CALL:"fail_call"},exec:function(e,t){console.log(this);this.plugin.exec(e,t)},show:function(e,t){var i=t||{};i.state=e;return this.exec("showUi",i)},close:function(e){return this.plugin.exec("closeUi",e)},showLocalVideo:function(e){return this.plugin.exec("showLocalVideo",e)}},createPeerConnection:function(e){return this.plugin.exec("createPeerConnection",e)},createOffer:function(e){return this.plugin.exec("createOffer",e)},createAnswer:function(e){return this.plugin.exec("createAnswer",e)},addIceCandidates:function(e){return this.plugin.exec("addIceCandidates",e)},setRemoteDescription:function(e){return this.plugin.exec("setRemoteDescription",e)},getUserMedia:function(e){return this.plugin.exec("getUserMedia",e)},onReconnect:function(e){return this.plugin.exec("onReconnect",e)},setEventListeners:function(e){return this.plugin.exec("setEventListeners",e)}};window.webrtc=webrtc=new WebRTCPlugin;MobileWebrtc=function(){this.siteDir=typeof mobileSiteDir=="undefined"?"/":mobileSiteDir;this.signalingLink=this.siteDir+"mobile/ajax.php?mobile_action=calls&";this.initiator=false;this.callUserId=0;this.debug=false;this.eventTimeRange=30;this.incomingCallTimeOut=2;this.delayedIncomingCall={};this.incomingCallTimeOutId=null;this.callBackUserId=0;this.callChatId=0;this.callToGroup=false;this.waitTimeout=false;this.callGroupUsers=[];this.callInit=false;this.callActive=false;this.ready=false;this.pcStart={};this.connected={};this.sessionDescription={};this.remoteSessionDescription={};this.iceCandidates=[];this.iceCandidatesToSend=[];this.iceCandidateTimeout=0;this.peerConnectionInited=false;this.utcOffest=BX.localStorage.get("bxUTCOffset");if(this.utcOffest==null){this.utcOffest=0;BX.ajax({url:this.siteDir+"mobile/?mobile_action=service&service_id=server_utc",method:"GET",dataType:"json",timeout:30,async:true,onsuccess:BX.proxy(function(e){if(e){var t=Math.round((new Date).getTime()/1e3);this.utcOffest=e.server_utc_time-t;BX.localStorage.set("bxUTCOffset",this.utcOffest,43200)}},this),onfailure:BX.proxy(function(){},this)})}webrtc.setEventListeners({onAnswer:BX.proxy(this.onAnswer,this),onDecline:BX.proxy(this.onDecline,this),onCallback:BX.proxy(this.onCallback,this),onClose:BX.proxy(this.onClose,this),onUserMediaSuccess:BX.proxy(this.onUserMediaSuccess,this),onDisconnect:BX.proxy(this.onDisconnect,this),onPeerConnectionCreated:BX.proxy(this.onPeerConnectionCreated,this),onIceCandidateDiscovered:BX.proxy(this.onIceCandidateDiscovered,this),onLocalSessionDescriptionCreated:BX.proxy(this.onLocalSessionDescriptionCreated,this),onIceConnectionStateChanged:BX.proxy(this.onIceConnectionStateChanged,this),onIceGatheringStateChanged:BX.proxy(this.onIceGatheringStateChanged,this),onSignalingStateChanged:BX.proxy(this.onSignalingStateChanged,this),onError:BX.proxy(this.onError,this)})};MobileWebrtc.prototype.attachListeners=function(){webrtc.setEventListeners({onAnswer:BX.proxy(this.onAnswer,this),onDecline:BX.proxy(this.onDecline,this),onCallback:BX.proxy(this.onCallback,this),onClose:BX.proxy(this.onClose,this),onUserMediaSuccess:BX.proxy(this.onUserMediaSuccess,this),onDisconnect:BX.proxy(this.onDisconnect,this),onPeerConnectionCreated:BX.proxy(this.onPeerConnectionCreated,this),onIceCandidateDiscovered:BX.proxy(this.onIceCandidateDiscovered,this),onLocalSessionDescriptionCreated:BX.proxy(this.onLocalSessionDescriptionCreated,this),onIceConnectionStateChanged:BX.proxy(this.onIceConnectionStateChanged,this),onIceGatheringStateChanged:BX.proxy(this.onIceGatheringStateChanged,this),onSignalingStateChanged:BX.proxy(this.onSignalingStateChanged,this),onError:BX.proxy(this.onError,this)})};MobileWebrtc.prototype.getUserId=function(){return BX.message("USER_ID")};MobileWebrtc.prototype.callInvite=function(e,t,i){if(e==this.getUserId()||this.callInit)return;if(this.delayedIncomingCall.chatId&&this.delayedIncomingCall.senderId==e){this.clearDelayedCallData()}var n=!(typeof t!="undefined"&&t===false);var s=i===true;this.callInit=true;this.video=n;this.initiator=true;this.isConversationUIReady=false;this.ajaxCall("CALL_INVITE",{COMMAND:"invite",CHAT_ID:e,CHAT:"N",VIDEO:n?"Y":"N"},BX.delegate(function(i){if(i.ERROR){if(s){this.resetState();this.callInit=false;this.finishDialog()}else if(i.ERROR=="SESSION_ERROR"){BX.message.bitrix_sessid=i.BITRIX_SESSID;this.callInit=false;this.callInvite(e,t,true)}else if(i.ERROR=="AUTHORIZE_ERROR"){app.BasicAuth({success:BX.delegate(function(){this.callInit=false;this.callInvite(e,t,true)},this)})}return}this.isConversationUIReady=true;this.initiator=true;this.callChatId=i.CHAT_ID;this.callToGroup=i.CALL_TO_GROUP;this.callUserId=e;this.attachListeners();webrtc.UI.show(webrtc.UI.state.OUTGOING_CALL,{data:i,video:n,recipient:{avatar:i["HR_PHOTO"][this.callUserId],name:i["USERS"][this.callUserId]["name"]},caller:{avatar:i["HR_PHOTO"][this.getUserId()],name:i["USERS"][this.getUserId()]["name"]}});BX.onCustomEvent("onMobileRTCReadyToConversation")},this),BX.delegate(function(e){this.resetState();this.callInit=false;this.finishDialog()},this))};MobileWebrtc.prototype.showIncomingCall=function(e){this.callChatId=e.chatId;this.callToGroup=false;this.callUserId=e.senderId;this.initiator=false;this.callInit=true;this.callCommand(this.callChatId,"wait");this.attachListeners();webrtc.UI.show(webrtc.UI.state.INCOMING_CALL,{data:e,video:e.video,caller:{name:e["users"][e.senderId]["name"],avatar:e["hrphoto"][e.senderId]}})};MobileWebrtc.prototype.clearDelayedCallData=function(){clearTimeout(this.incomingCallTimeOutId);this.incomingCallTimeOutId=null;this.delayedIncomingCall={}};MobileWebrtc.prototype.resetState=function(){this.connected={};this.initiator=false;this.callInit=false;this.video=false;this.callActive=false;this.callChatId=0;this.callUserId=0;this.isMobile=false;this.peerConnectionInited=false;this.iceCandidates=[];this.iceCandidatesToSend=[];this.isConversationUIReady=false};MobileWebrtc.prototype.callSignaling=function(e,t){this.ajaxCall("CALL_SIGNALING",{COMMAND:"signaling",CHAT_ID:this.callChatId,RECIPIENT_ID:e,PEER:JSON.stringify(t)})};MobileWebrtc.prototype.callCommand=function(e,t,i,n){e=parseInt(e);i=typeof i=="object"?i:{};if(e>0){this.ajaxCall("CALL_SHARED",{COMMAND:t,CHAT_ID:e,RECIPIENT_ID:this.callUserId,PARAMS:JSON.stringify(i)})}};MobileWebrtc.prototype.finishDialog=function(){webrtc.UI.close()};MobileWebrtc.prototype.signalingPeerData=function(e,t){var i=JSON.parse(t);if(i.type==="offer"){this.remoteSessionDescription=i["sdp"];webrtc.createPeerConnection()}else if(i.type==="answer"){webrtc.setRemoteDescription(i)}else if(i.type==="candidate"){if(this.peerConnectionInited){webrtc.addIceCandidates(i.candidates)}else{for(var n=0;n<i.candidates.length;n++)this.iceCandidates.push(i.candidates[n])}}};MobileWebrtc.prototype.ajaxCall=function(e,t,i,n){var s=t;s["MOBILE"]="Y";s["IS_MOBILE"]="Y";s["IM_CALL"]="Y";s["IM_AJAX_CALL"]="Y";s["sessid"]=BX.bitrix_sessid();BX.ajax({url:this.signalingLink+e,method:"POST",dataType:"json",timeout:30,async:true,data:s,onsuccess:i,onfailure:n})};MobileWebrtc.prototype.getUTCOffset=function(){return this.utcOffest*1e3};MobileWebrtc.prototype.getTimeDiff=function(e){var t=(new Date).getTime()+this.getUTCOffset();var i=Date.parse(e);return Math.abs((t-i)/1e3)};MobileWebrtc.prototype.timesUp=function(e){return Math.abs((new Date).getTime()+this.getUTCOffset()-e)/1e3>=this.eventTimeRange};MobileWebrtc.prototype.onDecline=function(e){this.callCommand(this.callChatId,"decline",{ACTIVE:this.callActive?"Y":"N",INITIATOR:this.initiator?"Y":"N"});this.resetState()};MobileWebrtc.prototype.onAnswer=function(e){webrtc.UI.show(webrtc.UI.state.CONVERSATION);webrtc.getUserMedia({video:e.video});this.waitTimeout=false;this.callToGroup=false;this.callChatId=e.chatId;this.callUserId=e.senderId;this.callActive=true;this.initiator=false;this.ajaxCall("CALL_ANSWER",{COMMAND:"answer",CHAT_ID:this.callChatId,CALL_TO_GROUP:this.callToGroup?"Y":"N",RECIPIENT_ID:this.callUserId})};MobileWebrtc.prototype.onCallback=function(){if(this.callBackUserId>0)this.callInvite(this.callBackUserId)};MobileWebrtc.prototype.onClose=function(){this.callBackUserId=0;this.resetState()};MobileWebrtc.prototype.onDisconnect=function(){this.peerConnectionInited=false};MobileWebrtc.prototype.onIceCandidateDiscovered=function(e){this.iceCandidatesToSend.push({type:"candidate",label:e.candidate.sdpMLineIndex,id:e.candidate.sdpMid,candidate:e.candidate.candidate});clearTimeout(this.iceCandidateTimeout);this.iceCandidateTimeout=setTimeout(BX.delegate(function(){if(this.iceCandidatesToSend.length===0)return false;this.onIceCandidate(this.callUserId,{type:"candidate",candidates:this.iceCandidatesToSend});this.iceCandidatesToSend=[]},this),250)};MobileWebrtc.prototype.onPeerConnectionCreated=function(){this.peerConnectionInited=true;if(this.initiator){webrtc.createOffer()}else{webrtc.createAnswer({sdp:this.remoteSessionDescription})}};MobileWebrtc.prototype.onIceCandidate=function(e,t){this.callSignaling(e,t)};MobileWebrtc.prototype.onIceConnectionStateChanged=function(e){};MobileWebrtc.prototype.onIceGatheringStateChanged=function(e){};MobileWebrtc.prototype.onSignalingStateChanged=function(e){};MobileWebrtc.prototype.onLocalSessionDescriptionCreated=function(e){this.sessionDescription=e;if(this.iceCandidates.length>0){webrtc.addIceCandidates(this.iceCandidates);this.iceCandidates=[]}this.callSignaling(this.callUserId,this.sessionDescription)};MobileWebrtc.prototype.onUserMediaSuccess=function(e){webrtc.UI.showLocalVideo();this.connected[this.getUserId()]=true;this.callCommand(this.callChatId,"ready");if(this.connected[this.callUserId]&&this.initiator){webrtc.createPeerConnection()}};MobileWebrtc.prototype.onError=function(e){this.resetState()};window.mwebrtc=new MobileWebrtc;BX.addCustomEvent("onPullEvent-im",BX.proxy(function(e,t){var i=this.getTimeDiff(t.SERVER_TIME)>=this.eventTimeRange;if(e=="call"){if(t.command=="ready"){this.connected[t.senderId]=true;if(this.connected[this.getUserId()]&&this.initiator==true){webrtc.createPeerConnection()}}else if(t.command=="decline"||t.command=="end_call"){if(this.callInit){if(this.callChatId==t.chatId){if(this.initiator&&!this.connected[this.callUserId]){this.callBackUserId=this.callUserId;webrtc.UI.show(webrtc.UI.state.FAIL_CALL,{message:BX.message("MOBILEAPP_CALL_DECLINE")})}else{webrtc.UI.close()}this.resetState()}}else if(this.delayedIncomingCall.chatId==t.chatId){this.clearDelayedCallData()}}else if(t.command=="end_call"){if(this.delayedIncomingCall.chatId&&this.delayedIncomingCall.chatId==t.chatId){if(this.delayedIncomingCall.chatId==t.chatId){clearTimeout(this.incomingCallTimeOutId);this.incomingCallTimeOutId=null;this.delayedIncomingCall={}}}}else if(t.command=="waitTimeout"){if(this.callChatId==t.chatId){this.resetState();this.finishDialog()}}else if(!i&&(t.command=="invite"||t.command=="invite_join")){if(t.callToGroup){console.log("Call to group");return}if(!this.callInit){if(this.incomingCallTimeOutId==null){this.delayedIncomingCall=t;this.incomingCallTimeOutId=setTimeout(BX.proxy(function(){this.showIncomingCall(this.delayedIncomingCall);this.delayedIncomingCall={};this.incomingCallTimeOutId=null},this),this.incomingCallTimeOut*1e3)}}else if(t.command=="invite"){if(this.callChatId==t.chatId){this.callCommand(t.chatId,"busy_self")}else{this.ajaxCall("CALL_BUSY",{COMMAND:"busy",CHAT_ID:t.chatId,RECIPIENT_ID:t.senderId,VIDEO:t.video?"Y":"N"})}}else if(this.initiator&&this.callChatId==t.chatId&&!this.callActive){this.onAnswer(t)}}else if(t.command=="answer"&&this.initiator==true){if(!this.isConversationUIReady){var n=function(){BX.onCustomEvent("onPullEvent-im",[e,t]);BX.removeCustomEvent("onMobileRTCReadyToConversation",n)};BX.addCustomEvent("onMobileRTCReadyToConversation",n);return}if(this.callInit){this.initiator=true;this.callActive=true;webrtc.UI.show(webrtc.UI.state.CONVERSATION);if(typeof t.video=="undefined"){t.video=this.video}webrtc.getUserMedia({video:t.video})}}else if(t.command=="decline_self"&&this.callChatId==t.chatId||t.command=="answer_self"&&!this.callActive){if(this.delayedIncomingCall.chatId==t.chatId){this.clearDelayedCallData()}this.resetState();this.finishDialog()}else if(this.callInit&&this.callChatId==t.chatId){if(t.command=="signaling"&&this.connected[this.getUserId()]){if(this.callInit&&this.callChatId==t.chatId)this.signalingPeerData(t.senderId,t.peer)}else if(t.command=="busy"){if(this.callInit&&this.callChatId==t.chatId){this.callBackUserId=this.callUserId;webrtc.UI.show(webrtc.UI.state.FAIL_CALL,{message:BX.message("MOBILEAPP_CALL_BUSY")});this.resetState()}}else if(t.command=="errorAccess"){if(this.callInit&&this.callChatId==t.chatId){this.callBackUserId=this.callUserId;webrtc.UI.show(webrtc.UI.state.FAIL_CALL,{message:BX.message("MOBILEAPP_CALL_NO_ACCESS")});this.callInit=false}}else if(t.command=="reconnect"){this.initiator=false;webrtc.onReconnect()}}}},mwebrtc));
//# sourceMappingURL=mobile_webrtc.map.js

Anon7 - 2022
AnonSec Team