podchat-browser 12.7.4-snapshot.0 → 12.7.4-snapshot.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -779,26 +779,30 @@ function ChatCall(params) {
779
779
  errorInfo: config.peer
780
780
  });
781
781
 
782
- sendCallMessage({
783
- id: 'STOP',
784
- topic: config.topic
785
- }, function (result) {
786
- if (result.done === 'TRUE' || result.done === 'SKIP') {
787
- manager.reconnectTopic();
788
- }
789
- /* else if (result.done === 'SKIP') {
790
- manager.reconnectTopic();
791
- } */
792
- else {
793
- consoleLogging && console.log('STOP topic faced a problem', result);
794
- endCall({
795
- callId: currentCallId
796
- });
797
- callStop();
798
- }
799
- }, {
800
- timeoutTime: 5000
801
- });
782
+ try {
783
+ sendCallMessage({
784
+ id: 'STOP',
785
+ topic: config.topic
786
+ }, function (result) {
787
+ if (result.done === 'TRUE' || result.done === 'SKIP') {
788
+ manager.reconnectTopic();
789
+ }
790
+ /* else if (result.done === 'SKIP') {
791
+ manager.reconnectTopic();
792
+ } */
793
+ else {
794
+ consoleLogging && console.log('STOP topic faced a problem', result);
795
+ endCall({
796
+ callId: currentCallId
797
+ });
798
+ callStop();
799
+ }
800
+ }, {
801
+ timeoutTime: 5000
802
+ });
803
+ } catch (error) {
804
+ consoleLogging && console.error("[SDK][shouldReconnectTopic] face error:", error);
805
+ }
802
806
  }
803
807
  }
804
808
  },
@@ -2150,20 +2154,23 @@ function ChatCall(params) {
2150
2154
  var resetCurrentCallId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2151
2155
  var resetCameraPaused = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
2152
2156
 
2153
- // callTopicHealthChecker.stopTopicsHealthCheck();
2154
- _deviceManager["default"].mediaStreams().stopVideoInput();
2157
+ try {
2158
+ callStateController.removeAllCallParticipants();
2155
2159
 
2156
- _deviceManager["default"].mediaStreams().stopAudioInput();
2160
+ _deviceManager["default"].mediaStreams().stopVideoInput();
2157
2161
 
2158
- _deviceManager["default"].mediaStreams().stopScreenShareInput();
2162
+ _deviceManager["default"].mediaStreams().stopAudioInput();
2159
2163
 
2160
- callStateController.removeAllCallParticipants();
2164
+ _deviceManager["default"].mediaStreams().stopScreenShareInput();
2161
2165
 
2162
- if (callStopQueue.callStarted) {
2163
- sendCallMessage({
2164
- id: 'CLOSE'
2165
- }, null, {});
2166
- callStopQueue.callStarted = false;
2166
+ if (callStopQueue.callStarted) {
2167
+ sendCallMessage({
2168
+ id: 'CLOSE'
2169
+ }, null, {});
2170
+ callStopQueue.callStarted = false;
2171
+ }
2172
+ } catch (error) {
2173
+ consoleLogging && console.error("[SDK] Stop call faced a problem. error:", error);
2167
2174
  }
2168
2175
 
2169
2176
  if (resetCameraPaused) callRequestController.cameraPaused = false;
@@ -2172,7 +2179,14 @@ function ChatCall(params) {
2172
2179
  clearTimeout(callRequestController.callRequestTimeout);
2173
2180
  if (resetCallOwner) callRequestController.imCallOwner = false;
2174
2181
  currentCallParams = {};
2175
- if (resetCurrentCallId) currentCallId = null;
2182
+
2183
+ if (resetCurrentCallId) {
2184
+ currentCallId = null;
2185
+ consoleLogging && console.log("[SDK] Resetting currentCallId", {
2186
+ currentCallId: currentCallId
2187
+ });
2188
+ } // callTopicHealthChecker.stopTopicsHealthCheck();
2189
+
2176
2190
  },
2177
2191
  restartMediaOnKeyFrame = function restartMediaOnKeyFrame(userId, timeouts) {
2178
2192
  if (callServerController.isJanus()) return;
@@ -2582,6 +2596,9 @@ function ChatCall(params) {
2582
2596
  chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false, '', 0, messageContent, contentCount));
2583
2597
  }
2584
2598
 
2599
+ consoleLogging && console.log("[SDK] chatMessageVOTypes.START_CALL: ", {
2600
+ currentCallId: currentCallId
2601
+ });
2585
2602
  currentCallId = threadId;
2586
2603
  messageContent.callId = threadId;
2587
2604
 
@@ -45333,9 +45333,9 @@ consoleLogging&&console.log('[SDK][checkConnectionQuality] Poor connection detec
45333
45333
  statsOutput += `<strong>${statName}:</strong> ${report[statName]}<br>\n`;
45334
45334
  }
45335
45335
  });*/}});//document.querySelector(".stats-box").innerHTML = statsOutput;
45336
- });},removeConnectionQualityInterval:function removeConnectionQualityInterval(){if(callUsers[config.userId]&&callUsers[config.userId].topicMetaData[config.topic]){callUsers[config.userId].topicMetaData[config.topic]['poorConnectionCount']=0;clearInterval(callUsers[config.userId].topicMetaData[config.topic]['connectionQualityInterval']);}},shouldReconnectTopic:function shouldReconnectTopic(){var manager=this,iceConnectionState=config.peer.peerConnection.iceConnectionState;if(currentCallParams&&Object.keys(currentCallParams).length){if(callUsers[config.userId]&&config.peer&&iceConnectionState!='connected'){_eventsModule.chatEvents.fireEvent('callEvents',{type:'CALL_STATUS',errorCode:7000,errorMessage:"Call Peer (".concat(config.topic,") is not in connected state, Restarting call in progress ...!"),errorInfo:config.peer});sendCallMessage({id:'STOP',topic:config.topic},function(result){if(result.done==='TRUE'||result.done==='SKIP'){manager.reconnectTopic();}/* else if (result.done === 'SKIP') {
45337
- manager.reconnectTopic();
45338
- } */else{consoleLogging&&console.log('STOP topic faced a problem',result);endCall({callId:currentCallId});callStop();}},{timeoutTime:5000});}}},reconnectTopic:function reconnectTopic(){var manager=this;manager.removeTopic().then(function(){if(config.isScreenShare&&screenShareInfo.isStarted()){callStateController.addScreenShareToCall(config.direction,config.direction==='send');}else{callStateController.appendUserToCallDiv(config.userId,callStateController.generateHTMLElements(config.userId));manager.createTopic();}});},createTopic:function createTopic(){var manager=this;if(callUsers[config.userId]&&config.peer){return;}this.generateSdpOfferOptions().then(function(options){consoleLogging&&console.debug("[SDK][generateSdpOfferOptions] Options for this request have been resolved: ",{options:options},"userId: ",config.userId,"topic: ",config.topic,"direction: ",config.direction);manager.establishPeerConnection(options);})["catch"](function(error){console.error(error);});},removeTopic:function removeTopic(){var manager=this;return new Promise(function(resolve,reject){if(config.peer){config.sdpOfferRequestSent=false;// this.removeTopicIceCandidateInterval();
45336
+ });},removeConnectionQualityInterval:function removeConnectionQualityInterval(){if(callUsers[config.userId]&&callUsers[config.userId].topicMetaData[config.topic]){callUsers[config.userId].topicMetaData[config.topic]['poorConnectionCount']=0;clearInterval(callUsers[config.userId].topicMetaData[config.topic]['connectionQualityInterval']);}},shouldReconnectTopic:function shouldReconnectTopic(){var manager=this,iceConnectionState=config.peer.peerConnection.iceConnectionState;if(currentCallParams&&Object.keys(currentCallParams).length){if(callUsers[config.userId]&&config.peer&&iceConnectionState!='connected'){_eventsModule.chatEvents.fireEvent('callEvents',{type:'CALL_STATUS',errorCode:7000,errorMessage:"Call Peer (".concat(config.topic,") is not in connected state, Restarting call in progress ...!"),errorInfo:config.peer});try{sendCallMessage({id:'STOP',topic:config.topic},function(result){if(result.done==='TRUE'||result.done==='SKIP'){manager.reconnectTopic();}/* else if (result.done === 'SKIP') {
45337
+ manager.reconnectTopic();
45338
+ } */else{consoleLogging&&console.log('STOP topic faced a problem',result);endCall({callId:currentCallId});callStop();}},{timeoutTime:5000});}catch(error){consoleLogging&&console.error("[SDK][shouldReconnectTopic] face error:",error);}}}},reconnectTopic:function reconnectTopic(){var manager=this;manager.removeTopic().then(function(){if(config.isScreenShare&&screenShareInfo.isStarted()){callStateController.addScreenShareToCall(config.direction,config.direction==='send');}else{callStateController.appendUserToCallDiv(config.userId,callStateController.generateHTMLElements(config.userId));manager.createTopic();}});},createTopic:function createTopic(){var manager=this;if(callUsers[config.userId]&&config.peer){return;}this.generateSdpOfferOptions().then(function(options){consoleLogging&&console.debug("[SDK][generateSdpOfferOptions] Options for this request have been resolved: ",{options:options},"userId: ",config.userId,"topic: ",config.topic,"direction: ",config.direction);manager.establishPeerConnection(options);})["catch"](function(error){console.error(error);});},removeTopic:function removeTopic(){var manager=this;return new Promise(function(resolve,reject){if(config.peer){config.sdpOfferRequestSent=false;// this.removeTopicIceCandidateInterval();
45339
45339
  metadataInstance.clearIceCandidateInterval();manager.removeConnectionQualityInterval();if(config.direction==='send'&&!config.isScreenShare){/*let constraint = {
45340
45340
  audio: config.mediaType === 'audio',
45341
45341
  video: (config.mediaType === 'video' ? {
@@ -45504,8 +45504,8 @@ if(jsonMessage.topic.indexOf('Vi-')>-1||jsonMessage.topic.indexOf('screen-Share'
45504
45504
  consoleLogging && console.error(error)
45505
45505
  })
45506
45506
  },
45507
- */callStop=function callStop(){var resetCallOwner=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var resetCurrentCallId=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var resetCameraPaused=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;// callTopicHealthChecker.stopTopicsHealthCheck();
45508
- _deviceManager["default"].mediaStreams().stopVideoInput();_deviceManager["default"].mediaStreams().stopAudioInput();_deviceManager["default"].mediaStreams().stopScreenShareInput();callStateController.removeAllCallParticipants();if(callStopQueue.callStarted){sendCallMessage({id:'CLOSE'},null,{});callStopQueue.callStarted=false;}if(resetCameraPaused)callRequestController.cameraPaused=false;callRequestController.callEstablishedInMySide=false;callRequestController.callRequestReceived=false;clearTimeout(callRequestController.callRequestTimeout);if(resetCallOwner)callRequestController.imCallOwner=false;currentCallParams={};if(resetCurrentCallId)currentCallId=null;},restartMediaOnKeyFrame=function restartMediaOnKeyFrame(userId,timeouts){if(callServerController.isJanus())return;for(var i=0;i<timeouts.length;i++){setTimeout(function(){if(typeof callUsers[userId]!=="undefined"&&callUsers[userId]&&callUsers[userId].videoTopicManager.getPeer())//callUsers[userId].peers[callUsers[userId].videoTopicName]
45507
+ */callStop=function callStop(){var resetCallOwner=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var resetCurrentCallId=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var resetCameraPaused=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;try{callStateController.removeAllCallParticipants();_deviceManager["default"].mediaStreams().stopVideoInput();_deviceManager["default"].mediaStreams().stopAudioInput();_deviceManager["default"].mediaStreams().stopScreenShareInput();if(callStopQueue.callStarted){sendCallMessage({id:'CLOSE'},null,{});callStopQueue.callStarted=false;}}catch(error){consoleLogging&&console.error("[SDK] Stop call faced a problem. error:",error);}if(resetCameraPaused)callRequestController.cameraPaused=false;callRequestController.callEstablishedInMySide=false;callRequestController.callRequestReceived=false;clearTimeout(callRequestController.callRequestTimeout);if(resetCallOwner)callRequestController.imCallOwner=false;currentCallParams={};if(resetCurrentCallId){currentCallId=null;consoleLogging&&console.log("[SDK] Resetting currentCallId",{currentCallId:currentCallId});}// callTopicHealthChecker.stopTopicsHealthCheck();
45508
+ },restartMediaOnKeyFrame=function restartMediaOnKeyFrame(userId,timeouts){if(callServerController.isJanus())return;for(var i=0;i<timeouts.length;i++){setTimeout(function(){if(typeof callUsers[userId]!=="undefined"&&callUsers[userId]&&callUsers[userId].videoTopicManager.getPeer())//callUsers[userId].peers[callUsers[userId].videoTopicName]
45509
45509
  restartMedia(callUsers[userId].videoTopicName,userId);},timeouts[i]);}},sendCallMetaData=function sendCallMetaData(params){var message={id:params.id,userid:params.userid,content:params.content||undefined};sendCallMessage({id:'SENDMETADATA',message:JSON.stringify(message),chatId:currentCallId},null,{});},handleReceivedMetaData=function handleReceivedMetaData(jsonMessage,uniqueId){var jMessage=JSON.parse(jsonMessage.message);var id=jMessage.id;if(!id||typeof id==="undefined"||jsonMessage.userid==chatMessaging.userInfo.id){return;}switch(id){case callMetaDataTypes.POORCONNECTION:_eventsModule.chatEvents.fireEvent("callEvents",{type:'POOR_VIDEO_CONNECTION',subType:'SHORT_TIME',message:'Poor connection detected',metadata:{elementId:"uiRemoteVideo-"+jMessage.content.description,topic:jMessage.content.description,userId:jMessage.userid}});break;case callMetaDataTypes.POORCONNECTIONRESOLVED:_eventsModule.chatEvents.fireEvent('callEvents',{type:'POOR_VIDEO_CONNECTION_RESOLVED',message:'Poor connection resolved',metadata:{elementId:"uiRemoteVideo-"+jMessage.content.description,topic:jMessage.content.description,userId:jMessage.userid}});break;case callMetaDataTypes.CUSTOMUSERMETADATA:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](jsonMessage);}_eventsModule.chatEvents.fireEvent('callEvents',{type:'CUSTOM_USER_METADATA',userId:jMessage.userid,content:jMessage.content});break;case callMetaDataTypes.SCREENSHAREMETADATA:screenShareInfo.setWidth(jMessage.content.dimension.width);screenShareInfo.setHeight(jMessage.content.dimension.height);// applyScreenShareSizeToElement();
45510
45510
  restartMediaOnKeyFrame('screenShare',[10,1000,2000]);_eventsModule.chatEvents.fireEvent("callEvents",{type:'SCREENSHARE_METADATA',userId:jMessage.userid,content:jMessage.content});break;}},applyScreenShareSizeToElement=function applyScreenShareSizeToElement(){var videoElement=callUsers['screenShare'].htmlElements[callUsers['screenShare'].videoTopicName];var videoTrack=videoElement.srcObject&&videoElement.srcObject.getTracks()&&videoElement.srcObject.getTracks().length?videoElement.srcObject.getTracks()[0]:null;if(videoTrack){if(navigator&&!!navigator.userAgent.match(/firefox/gi)){videoTrack.enable=false;var newWidth=callVideoMinWidth-(Math.ceil(Math.random()*50)+20);var newHeight=callVideoMinHeight-(Math.ceil(Math.random()*50)+20);videoTrack.applyConstraints({advanced:[{width:screenShareInfo.getWidth(),height:screenShareInfo.getHeight()},{aspectRatio:1.333}]}).then(function(res){videoTrack.enabled=true;setTimeout(function(){videoTrack.applyConstraints({"width":screenShareInfo.getWidth(),"height":screenShareInfo.getHeight()});},500);})["catch"](function(e){return consoleLogging&&console.log(e);});}else{videoTrack.applyConstraints({"width":screenShareInfo.getWidth()-(Math.ceil(Math.random()*5)+5)}).then(function(res){setTimeout(function(){videoTrack.applyConstraints({"width":screenShareInfo.getWidth()});},500);})["catch"](function(e){return consoleLogging&&console.log(e);});}}},getSDKCallDetails=function getSDKCallDetails(customData){return{currentUser:chatMessaging.userInfo,currentServers:{callTurnIp:callTurnIp},isJanus:currentCallId&&callServerController.isJanus(),screenShareInfo:{isStarted:screenShareInfo.isStarted(),iAmOwner:screenShareInfo.iAmOwner()},callId:currentCallId,startCallInfo:currentCallParams,customData:customData};};this.updateToken=function(newToken){token=newToken;};this.callMessageHandler=function(callMessage){if(!currentCallId)return;var jsonMessage=typeof callMessage.content==='string'&&_utility["default"].isValidJson(callMessage.content)?JSON.parse(callMessage.content):callMessage.content,uniqueId=jsonMessage.uniqueId;if(jsonMessage.done!=='FALSE'||jsonMessage.done==='FALSE'&&jsonMessage.desc==='duplicated'){asyncRequestTimeouts[uniqueId]&&clearTimeout(asyncRequestTimeouts[uniqueId]);}else if(jsonMessage.done==='FALSE'){_eventsModule.chatEvents.fireEvent('callEvents',{type:'CALL_ERROR',code:7000,message:"Kurento error: "+(jsonMessage.desc?jsonMessage.desc:jsonMessage.message),environmentDetails:getSDKCallDetails()});}switch(jsonMessage.id){case'PROCESS_SDP_ANSWER':handleProcessSdpAnswer(jsonMessage);break;case'RECEIVING_MEDIA':// Only for receiving topics from janus, first we subscribe
45511
45511
  subscribeToReceiveOffers(jsonMessage);break;case'PROCESS_SDP_OFFER'://Then janus sends offers
@@ -45531,7 +45531,7 @@ callStateController.createSessionInChat(currentCallParams);}}break;}chatMessagin
45531
45531
  * Type 73 Receive Call Request
45532
45532
  */case _constants.chatMessageVOTypes.RECEIVE_CALL_REQUEST:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}if(messageContent.callId>0){_eventsModule.chatEvents.fireEvent('callEvents',{type:'RECEIVE_CALL',result:messageContent});if(!currentCallId){currentCallId=messageContent.callId;}}else{_eventsModule.chatEvents.fireEvent('callEvents',{type:'PARTNER_RECEIVED_YOUR_CALL',result:messageContent});}break;/**
45533
45533
  * Type 74 Start Call (Start sender and receivers)
45534
- */case _constants.chatMessageVOTypes.START_CALL:if(!callRequestController.iCanAcceptTheCall()){_eventsModule.chatEvents.fireEvent('callEvents',{type:'CALL_STARTED_ELSEWHERE',message:'Call already started somewhere else..., aborting...'});return;}callStop(false,false,false);if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}currentCallId=threadId;messageContent.callId=threadId;_eventsModule.chatEvents.fireEvent('callEvents',{type:'CALL_STARTED',result:messageContent});if((0,_typeof2["default"])(messageContent)==='object'&&messageContent.hasOwnProperty('chatDataDto')&&!!messageContent.chatDataDto.kurentoAddress){callServerController.setServers(messageContent.chatDataDto.kurentoAddress.split(','));startCallWebRTCFunctions({video:messageContent.clientDTO.video,mute:messageContent.clientDTO.mute,sendingTopic:messageContent.clientDTO.topicSend,receiveTopic:messageContent.clientDTO.topicReceive,screenShare:messageContent.chatDataDto.screenShare,brokerAddress:messageContent.chatDataDto.brokerAddressWeb,turnAddress:messageContent.chatDataDto.turnAddress,internalTurnAddress:messageContent.chatDataDto.internalTurnAddress,selfData:messageContent.clientDTO,clientsList:messageContent.otherClientDtoList,screenShareOwner:+messageContent.chatDataDto.screenShareUser,recordingOwner:+messageContent.chatDataDto.recordingUser},function(callDivs){_eventsModule.chatEvents.fireEvent('callEvents',{type:'CALL_DIVS',result:callDivs});});}else{_eventsModule.chatEvents.fireEvent('callEvents',{type:'CALL_ERROR',message:'Chat Data DTO is not present!',environmentDetails:getSDKCallDetails()});}break;/**
45534
+ */case _constants.chatMessageVOTypes.START_CALL:if(!callRequestController.iCanAcceptTheCall()){_eventsModule.chatEvents.fireEvent('callEvents',{type:'CALL_STARTED_ELSEWHERE',message:'Call already started somewhere else..., aborting...'});return;}callStop(false,false,false);if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}consoleLogging&&console.log("[SDK] chatMessageVOTypes.START_CALL: ",{currentCallId:currentCallId});currentCallId=threadId;messageContent.callId=threadId;_eventsModule.chatEvents.fireEvent('callEvents',{type:'CALL_STARTED',result:messageContent});if((0,_typeof2["default"])(messageContent)==='object'&&messageContent.hasOwnProperty('chatDataDto')&&!!messageContent.chatDataDto.kurentoAddress){callServerController.setServers(messageContent.chatDataDto.kurentoAddress.split(','));startCallWebRTCFunctions({video:messageContent.clientDTO.video,mute:messageContent.clientDTO.mute,sendingTopic:messageContent.clientDTO.topicSend,receiveTopic:messageContent.clientDTO.topicReceive,screenShare:messageContent.chatDataDto.screenShare,brokerAddress:messageContent.chatDataDto.brokerAddressWeb,turnAddress:messageContent.chatDataDto.turnAddress,internalTurnAddress:messageContent.chatDataDto.internalTurnAddress,selfData:messageContent.clientDTO,clientsList:messageContent.otherClientDtoList,screenShareOwner:+messageContent.chatDataDto.screenShareUser,recordingOwner:+messageContent.chatDataDto.recordingUser},function(callDivs){_eventsModule.chatEvents.fireEvent('callEvents',{type:'CALL_DIVS',result:callDivs});});}else{_eventsModule.chatEvents.fireEvent('callEvents',{type:'CALL_ERROR',message:'Chat Data DTO is not present!',environmentDetails:getSDKCallDetails()});}break;/**
45535
45535
  * Type 75 End Call Request
45536
45536
  */case _constants.chatMessageVOTypes.END_CALL_REQUEST:if(chatMessaging.messagesCallbacks[uniqueId]){chatMessaging.messagesCallbacks[uniqueId](_utility["default"].createReturnData(false,'',0,messageContent,contentCount));}_eventsModule.chatEvents.fireEvent('callEvents',{type:'END_CALL',result:messageContent});callStop();break;/**
45537
45537
  * Type 76 Call Ended
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podchat-browser",
3
- "version": "12.7.4-snapshot.0",
3
+ "version": "12.7.4-snapshot.2",
4
4
  "description": "Javascript SDK to use POD's Chat Service - Browser Only",
5
5
  "main": "./dist/node/chat.js",
6
6
  "scripts": {
@@ -760,22 +760,26 @@ function ChatCall(params) {
760
760
  errorInfo: config.peer
761
761
  });
762
762
 
763
- sendCallMessage({
764
- id: 'STOP',
765
- topic: config.topic
766
- }, function (result) {
767
- if (result.done === 'TRUE' || result.done === 'SKIP') {
768
- manager.reconnectTopic();
769
- } /* else if (result.done === 'SKIP') {
763
+ try{
764
+ sendCallMessage({
765
+ id: 'STOP',
766
+ topic: config.topic
767
+ }, function (result) {
768
+ if (result.done === 'TRUE' || result.done === 'SKIP') {
769
+ manager.reconnectTopic();
770
+ } /* else if (result.done === 'SKIP') {
770
771
  manager.reconnectTopic();
771
772
  } */ else {
772
- consoleLogging && console.log('STOP topic faced a problem', result);
773
- endCall({
774
- callId: currentCallId
775
- });
776
- callStop();
777
- }
778
- }, {timeoutTime: 5000});
773
+ consoleLogging && console.log('STOP topic faced a problem', result);
774
+ endCall({
775
+ callId: currentCallId
776
+ });
777
+ callStop();
778
+ }
779
+ }, {timeoutTime: 5000});
780
+ } catch (error) {
781
+ consoleLogging && console.error("[SDK][shouldReconnectTopic] face error:", error);
782
+ }
779
783
  }
780
784
  }
781
785
  },
@@ -2127,21 +2131,21 @@ function ChatCall(params) {
2127
2131
  */
2128
2132
 
2129
2133
  callStop = function (resetCallOwner = true, resetCurrentCallId = true, resetCameraPaused = true) {
2130
- if(resetCurrentCallId)
2131
- currentCallId = null;
2132
- // callTopicHealthChecker.stopTopicsHealthCheck();
2133
-
2134
- deviceManager.mediaStreams().stopVideoInput();
2135
- deviceManager.mediaStreams().stopAudioInput();
2136
- deviceManager.mediaStreams().stopScreenShareInput();
2134
+ try {
2135
+ callStateController.removeAllCallParticipants();
2137
2136
 
2138
- callStateController.removeAllCallParticipants();
2137
+ deviceManager.mediaStreams().stopVideoInput();
2138
+ deviceManager.mediaStreams().stopAudioInput();
2139
+ deviceManager.mediaStreams().stopScreenShareInput();
2139
2140
 
2140
- if (callStopQueue.callStarted) {
2141
- sendCallMessage({
2142
- id: 'CLOSE'
2143
- }, null, {});
2144
- callStopQueue.callStarted = false;
2141
+ if (callStopQueue.callStarted) {
2142
+ sendCallMessage({
2143
+ id: 'CLOSE'
2144
+ }, null, {});
2145
+ callStopQueue.callStarted = false;
2146
+ }
2147
+ } catch (error) {
2148
+ consoleLogging && console.error("[SDK] Stop call faced a problem. error:", error)
2145
2149
  }
2146
2150
 
2147
2151
  if(resetCameraPaused)
@@ -2155,6 +2159,14 @@ function ChatCall(params) {
2155
2159
  callRequestController.imCallOwner = false;
2156
2160
 
2157
2161
  currentCallParams = {};
2162
+
2163
+
2164
+ if(resetCurrentCallId){
2165
+ currentCallId = null;
2166
+ consoleLogging && console.log("[SDK] Resetting currentCallId", {currentCallId})
2167
+ }
2168
+ // callTopicHealthChecker.stopTopicsHealthCheck();
2169
+
2158
2170
  },
2159
2171
 
2160
2172
  restartMediaOnKeyFrame = function (userId, timeouts) {
@@ -2570,6 +2582,8 @@ function ChatCall(params) {
2570
2582
  chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
2571
2583
  }
2572
2584
 
2585
+ consoleLogging && console.log("[SDK] chatMessageVOTypes.START_CALL: ", {currentCallId});
2586
+ currentCallId = threadId;
2573
2587
  messageContent.callId = threadId;
2574
2588
  chatEvents.fireEvent('callEvents', {
2575
2589
  type: 'CALL_STARTED',