@94ai/softphone 5.0.17 → 6.0.0

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.
@@ -354,7 +354,9 @@ document.addEventListener('DOMContentLoaded', async (event) => {
354
354
  const sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(appKey + timestamp, appSecret))
355
355
 
356
356
  const userAgentManager = UserAgentFactory.getUserAgentManager({
357
- // optionsPingAttempts: 1, // 网络抖动只检测一次
357
+ // optionsPingAttempts: 3, // 网络抖动只检测一次
358
+ enableVolumnTrack: false, // 关闭音量检测
359
+ // logLevel: "debug",
358
360
  /**
359
361
  * start - 海外特有参数
360
362
  */
@@ -781,6 +783,90 @@ document.addEventListener('DOMContentLoaded', async (event) => {
781
783
  reject('接听响应失败')
782
784
  }
783
785
  }) // 👈 一键接听,下行代码被执行说明接听信令被成功发出
786
+
787
+ // setInterval(async () => {
788
+ // const stats = await userAgentManager.getPeerConnection().getStats();
789
+ //
790
+ // let selectedPair = null;
791
+ //
792
+ // // 1. Chrome / Edge
793
+ // stats.forEach(stat => {
794
+ // if (
795
+ // stat.type === "transport" &&
796
+ // stat.selectedCandidatePairId
797
+ // ) {
798
+ // const pair = stats.get(stat.selectedCandidatePairId);
799
+ // if (pair) {
800
+ // selectedPair = pair;
801
+ // }
802
+ // }
803
+ // });
804
+ //
805
+ // // 2. Firefox fallback
806
+ // if (!selectedPair) {
807
+ // stats.forEach(stat => {
808
+ // if (
809
+ // stat.type === "candidate-pair" &&
810
+ // (
811
+ // stat.selected === true ||
812
+ // stat.nominated === true ||
813
+ // stat.state === "succeeded"
814
+ // )
815
+ // ) {
816
+ // // 优先找真正有流量的
817
+ // if (
818
+ // (stat.bytesSent || 0) > 0 ||
819
+ // (stat.bytesReceived || 0) > 0
820
+ // ) {
821
+ // selectedPair = stat;
822
+ // }
823
+ // }
824
+ // });
825
+ // }
826
+ //
827
+ // if (!selectedPair) {
828
+ // console.log("[WebRTC] No active candidate pair found");
829
+ // return;
830
+ // }
831
+ //
832
+ // const local = stats.get(selectedPair.localCandidateId);
833
+ // const remote = stats.get(selectedPair.remoteCandidateId);
834
+ //
835
+ // console.log({
836
+ // local: local
837
+ // ? `${local.address || local.ip}:${local.port}`
838
+ // : null,
839
+ //
840
+ // localType:
841
+ // local?.candidateType,
842
+ //
843
+ // remote: remote
844
+ // ? `${remote.address || remote.ip}:${remote.port}`
845
+ // : null,
846
+ //
847
+ // remoteType:
848
+ // remote?.candidateType,
849
+ //
850
+ // pairId:
851
+ // selectedPair.id,
852
+ //
853
+ // state:
854
+ // selectedPair.state,
855
+ //
856
+ // nominated:
857
+ // selectedPair.nominated,
858
+ //
859
+ // selected:
860
+ // selectedPair.selected,
861
+ //
862
+ // bytesSent:
863
+ // selectedPair.bytesSent,
864
+ //
865
+ // bytesReceived:
866
+ // selectedPair.bytesReceived
867
+ // });
868
+ // }, 1000);
869
+
784
870
  } catch (e) {
785
871
  console.log('accept error:', e.message)
786
872
  reject(e)