@rongcloud/plugin-call 5.1.2-alpha.1 → 5.1.2-alpha.3

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.
package/dist/index.esm.js CHANGED
@@ -1,16 +1,14 @@
1
1
  /*
2
- * RCCall - v5.1.2-alpha.1
3
- * CommitId - 5a6d3a159d1171c71f1bb419dfac59eb8e886f91
4
- * Mon Feb 27 2023 10:35:06 GMT+0800 (China Standard Time)
2
+ * RCCall - v5.1.2-alpha.3
3
+ * CommitId - 18608f24276587122c6fe1b54515d19aec29be0f
4
+ * Wed Mar 01 2023 21:12:56 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
+ import { RTCJoinType, LogLevel, ErrorCode, VersionManage } from '@rongcloud/engine';
7
8
  import { RCCallMediaType, RCCallLanguage, RCCallSessionState, RCCallEndReason, RCCallErrorCode, RCCallEngine } from '@rongcloud/plugin-call-engine';
8
9
  export { RCCallEndReason, RCCallErrorCode, RCCallLanguage, RCCallMediaType, RCCallSessionState, RCCallUserState } from '@rongcloud/plugin-call-engine';
9
- import { Logger, RTCJoinType, LogLevel, VersionManage, ErrorCode } from '@rongcloud/engine';
10
10
  import { RCRTCCode, RCKickReason } from '@rongcloud/plugin-rtc';
11
11
 
12
- const logger = new Logger('RCCall');
13
-
14
12
  /*! *****************************************************************************
15
13
  Copyright (c) Microsoft Corporation.
16
14
 
@@ -254,6 +252,13 @@ const validatePushContent = (pushContent) => {
254
252
  return { result: false, msg: '\'pushContent\' parameter must be of type \'string\'' };
255
253
  }
256
254
  };
255
+ const validatePushConfig = (pushConfig) => {
256
+ const { pushTitle, pushContent } = pushConfig;
257
+ const conclusion = [];
258
+ pushTitle && conclusion.push(validatePushTitle(pushTitle));
259
+ pushContent && conclusion.push(validatePushContent(pushContent));
260
+ return conclusion;
261
+ };
257
262
  const validateUserIds = (userIds) => {
258
263
  if (!Array.isArray(userIds)) {
259
264
  return { result: false, msg: '\'userIds\' parameter is required, must be of type \'string[]\'' };
@@ -347,13 +352,14 @@ class RCCallSession {
347
352
  /**
348
353
  * rtc实例
349
354
  */
350
- _rtcClient,
355
+ _rtcClient, _logger,
351
356
  /**
352
357
  * session的其它选项
353
358
  */
354
359
  _options = {}) {
355
360
  this._stateMachine = _stateMachine;
356
361
  this._rtcClient = _rtcClient;
362
+ this._logger = _logger;
357
363
  this._options = _options;
358
364
  /**
359
365
  * 用户传进来的 对session的监听 (要在RCCallClient的_onInvite里判断,要求执行完onSession必须注册session的监听,所以这里是public)
@@ -374,7 +380,7 @@ class RCCallSession {
374
380
  * @param info
375
381
  */
376
382
  onUserStateChange: ({ user, reason }) => {
377
- logger.info(`[RCCallSession onUserStateChange] userId->${user === null || user === void 0 ? void 0 : user.userId} state->${user === null || user === void 0 ? void 0 : user.state} reason->${reason}`);
383
+ this._logger.info('_', `[RCCallSession onUserStateChange] userId->${user === null || user === void 0 ? void 0 : user.userId} state->${user === null || user === void 0 ? void 0 : user.state} reason->${reason}`);
378
384
  },
379
385
  /**
380
386
  * 房间状态变更
@@ -382,18 +388,18 @@ class RCCallSession {
382
388
  */
383
389
  onStateChange: (info) => __awaiter(this, void 0, void 0, function* () {
384
390
  const { state, reason } = info;
385
- logger.info(`[RCCallSession onStateChange] : state->${state} reason->${reason}`);
391
+ this._logger.info('_', `[RCCallSession onStateChange] : state->${state} reason->${reason}`);
386
392
  // 如果在通话中,就加房间
387
393
  if (state === RCCallSessionState.KEEPING) {
388
394
  const roomId = this._stateMachine.getCallId();
389
- logger.info(`[RCCallSession onStateChange] roomId: ${roomId}`);
395
+ this._logger.info('_', `[RCCallSession onStateChange] roomId: ${roomId}`);
390
396
  try {
391
397
  // 加房间
392
398
  yield this._joinRoom(roomId);
393
399
  }
394
400
  catch (error) {
395
401
  this._exceptionClose(RCCallEndReason.NETWORK_ERROR);
396
- logger.error(`[RCCallSession onStateChange] joinRoom throw exception roomId -> ${roomId}`);
402
+ this._logger.error('_', `[RCCallSession onStateChange] joinRoom throw exception roomId -> ${roomId}`);
397
403
  console.error(error);
398
404
  }
399
405
  /**
@@ -413,7 +419,7 @@ class RCCallSession {
413
419
  return;
414
420
  }
415
421
  this._options.localTracks && this._destroyTracks(this._options.localTracks);
416
- logger.info('[RCCallSession onStateChange] localTracks destroyed');
422
+ this._logger.info('_', '[RCCallSession onStateChange] localTracks destroyed');
417
423
  this._leaveRoom();
418
424
  this._room = null;
419
425
  }
@@ -423,13 +429,13 @@ class RCCallSession {
423
429
  * @param sender 发起用户信息
424
430
  */
425
431
  onRinging: (sender) => {
426
- logger.info(`[RCCallSession onRinging]sender: sender.userId -> ${sender.userId}`);
432
+ this._logger.info('_', `[RCCallSession onRinging]sender: sender.userId -> ${sender.userId}`);
427
433
  try {
428
434
  // 通知用户响铃
429
435
  this._listener.onRinging(sender, this);
430
436
  }
431
437
  catch (error) {
432
- logger.error('[RCCallSession onRinging] method exception -> onRinging');
438
+ this._logger.error('_', '[RCCallSession onRinging] method exception -> onRinging');
433
439
  console.error(error);
434
440
  }
435
441
  },
@@ -437,13 +443,13 @@ class RCCallSession {
437
443
  * 当远端用户同意接听
438
444
  */
439
445
  onAccept: (sender) => {
440
- logger.info(`[RCCallSession onAccept]sender: sender.userId -> ${sender.userId}`);
446
+ this._logger.info('_', `[RCCallSession onAccept]sender: sender.userId -> ${sender.userId}`);
441
447
  try {
442
448
  // 通知本端,远端用户已接听
443
449
  this._listener.onAccept(sender, this);
444
450
  }
445
451
  catch (error) {
446
- logger.error('[RCCallSession onAccept] method exception -> onAccept');
452
+ this._logger.error('_', '[RCCallSession onAccept] method exception -> onAccept');
447
453
  console.error(error);
448
454
  }
449
455
  },
@@ -451,13 +457,13 @@ class RCCallSession {
451
457
  * 当有远端用户挂断
452
458
  */
453
459
  onHungup: (sender, reason) => {
454
- logger.info(`[RCCallSession onHungup]sender: sender.userId -> ${sender.userId} reason->${reason}`);
460
+ this._logger.info('_', `[RCCallSession onHungup]sender: sender.userId -> ${sender.userId} reason->${reason}`);
455
461
  try {
456
462
  // 通知本端,远端用户已挂断
457
463
  this._listener.onHungup(sender, reason, this);
458
464
  }
459
465
  catch (error) {
460
- logger.error('[RCCallSession onHungup] method exception -> onHungup');
466
+ this._logger.error('_', '[RCCallSession onHungup] method exception -> onHungup');
461
467
  console.error(error);
462
468
  }
463
469
  },
@@ -466,13 +472,13 @@ class RCCallSession {
466
472
  * @param sender 发起用户信息
467
473
  */
468
474
  onMemberModify: ({ sender, invitedUsers }) => {
469
- logger.info(`[RCCallSession onMemberModify] sender.userId -> ${sender.userId}`);
475
+ this._logger.info('_', `[RCCallSession onMemberModify] sender.userId -> ${sender.userId}`);
470
476
  try {
471
477
  // 通知用户人员变更
472
478
  this._listener.onMemberModify(sender, invitedUsers, this);
473
479
  }
474
480
  catch (error) {
475
- logger.error('[RCCallSession onMemberModify] method exception -> onMemberModify');
481
+ this._logger.error('_', '[RCCallSession onMemberModify] method exception -> onMemberModify');
476
482
  console.error(error);
477
483
  }
478
484
  },
@@ -481,7 +487,7 @@ class RCCallSession {
481
487
  * @param sender 发起用户信息
482
488
  */
483
489
  onMediaModify: ({ sender, mediaType }) => {
484
- logger.info(`[RCCallSession onMediaModify]sender: sender.userId -> ${sender.userId} mediaType: ${mediaType}`);
490
+ this._logger.info('_', `[RCCallSession onMediaModify]sender: sender.userId -> ${sender.userId} mediaType: ${mediaType}`);
485
491
  if (mediaType === RCCallMediaType.AUDIO) {
486
492
  // 远端收到通话降级通知后,远端执行降级通话(不发消息)
487
493
  this._setMediaTypeToAudio();
@@ -490,7 +496,7 @@ class RCCallSession {
490
496
  this._listener.onMediaModify(sender, mediaType, this);
491
497
  }
492
498
  catch (error) {
493
- logger.error('[RCCallSession onMediaModify] method exception -> onMediaModify');
499
+ this._logger.error('_', '[RCCallSession onMediaModify] method exception -> onMediaModify');
494
500
  console.error(error);
495
501
  }
496
502
  },
@@ -499,10 +505,15 @@ class RCCallSession {
499
505
  * @param sender 发起用户信息
500
506
  */
501
507
  crossAppkey: (isCrossAppkey) => {
502
- logger.info(`[RCCallSession crossAppkey] 是否跨 appkey: ${isCrossAppkey}`);
508
+ this._logger.info('_', `[RCCallSession crossAppkey] 是否跨 appkey: ${isCrossAppkey}`);
503
509
  this._options.isCrossAppkey = isCrossAppkey;
504
510
  }
505
511
  });
512
+ /**
513
+ * 设置挂断的推送信息
514
+ */
515
+ const { pushTitle, pushContent } = this._options.hungupPushConfig;
516
+ this._stateMachine.setHungupPushConfig(pushTitle, pushContent);
506
517
  }
507
518
  /**
508
519
  * 加入房间
@@ -531,7 +542,7 @@ class RCCallSession {
531
542
  else {
532
543
  this._exceptionClose(RCCallEndReason.NETWORK_ERROR);
533
544
  }
534
- logger.info(`[RCCallClient _joinRoom] join room failed: roomId -> ${roomId} RCRTCCode -> ${code}`);
545
+ this._logger.info('_', `[RCCallClient _joinRoom] join room failed: roomId -> ${roomId} RCRTCCode -> ${code}`);
535
546
  return { code: RCCallErrorCode.JOIN_ROOM_ERROR };
536
547
  }
537
548
  /**
@@ -554,7 +565,7 @@ class RCCallSession {
554
565
  }
555
566
  catch (error) {
556
567
  this._exceptionClose(RCCallEndReason.NETWORK_ERROR);
557
- logger.error(`[RCCallSession _joinRoom] _rtcClient.joinRTCRoom throw exception roomId -> ${roomId}`);
568
+ this._logger.error('_', `[RCCallSession _joinRoom] _rtcClient.joinRTCRoom throw exception roomId -> ${roomId}`);
558
569
  console.error(error);
559
570
  return { code: RCCallErrorCode.JOIN_ROOM_ERROR };
560
571
  }
@@ -569,7 +580,7 @@ class RCCallSession {
569
580
  catch (error) {
570
581
  // 结束通话session
571
582
  this._exceptionClose(RCCallEndReason.SUBSCRIBE_ERROR);
572
- logger.error(`[RCCallSession _joinRoom] _subscribeInRoomRemoteTrack Exception roomId -> ${roomId}`);
583
+ this._logger.error('_', `[RCCallSession _joinRoom] _subscribeInRoomRemoteTrack Exception roomId -> ${roomId}`);
573
584
  console.error(error);
574
585
  return { code: RCCallErrorCode.JOIN_ROOM_ERROR };
575
586
  }
@@ -580,7 +591,7 @@ class RCCallSession {
580
591
  catch (error) {
581
592
  // 结束通话session
582
593
  this._exceptionClose(RCCallEndReason.PUBLISH_ERROR);
583
- logger.error(`[RCCallSession _joinRoom] _publish Exception roomId -> ${roomId}`);
594
+ this._logger.error('_', `[RCCallSession _joinRoom] _publish Exception roomId -> ${roomId}`);
584
595
  console.error(error);
585
596
  return { code: RCCallErrorCode.JOIN_ROOM_ERROR };
586
597
  }
@@ -598,7 +609,7 @@ class RCCallSession {
598
609
  const { code } = yield this._subscribeRetry(tracks, this._options.isAllowSubscribeRetry, this._RETRYCOUNT);
599
610
  if (code !== RCRTCCode.SUCCESS) {
600
611
  this._exceptionClose(RCCallEndReason.SUBSCRIBE_ERROR);
601
- logger.error(`[RCCallSession _subscribeInRoomRemoteTrack] Resource subscription failed roomId -> ${this._stateMachine.getCallId()} RTC code -> ${code}`);
612
+ this._logger.error('_', `[RCCallSession _subscribeInRoomRemoteTrack] Resource subscription failed roomId -> ${this._stateMachine.getCallId()} RTC code -> ${code}`);
602
613
  }
603
614
  }
604
615
  });
@@ -617,7 +628,7 @@ class RCCallSession {
617
628
  this._listener.onTrackSubscribeFail && this._listener.onTrackSubscribeFail(code, this);
618
629
  }
619
630
  catch (error) {
620
- logger.error('[RCCallSession] _listener.onTrackSubscribeFail exception');
631
+ this._logger.error('_', '[RCCallSession] _listener.onTrackSubscribeFail exception');
621
632
  console.error(error);
622
633
  }
623
634
  // 如果不允许重试,直接返回
@@ -643,7 +654,7 @@ class RCCallSession {
643
654
  // 若资源发布失败
644
655
  if (code !== RCRTCCode.SUCCESS) {
645
656
  this._exceptionClose(RCCallEndReason.PUBLISH_ERROR);
646
- logger.info(`[RCCallSession _publist] Resource publishing failed: roomId -> ${this._stateMachine.getCallId()} RCRTCCode -> ${code}`);
657
+ this._logger.info('_', `[RCCallSession _publist] Resource publishing failed: roomId -> ${this._stateMachine.getCallId()} RCRTCCode -> ${code}`);
647
658
  return;
648
659
  }
649
660
  // 如果是主动发起的呼叫,已提前抛出了资源, 被动呼叫,这里才需要抛出
@@ -667,7 +678,7 @@ class RCCallSession {
667
678
  this._listener.onTrackPublishFail && this._listener.onTrackPublishFail(code, this);
668
679
  }
669
680
  catch (error) {
670
- logger.error('[RCCallSession] _listener.onTrackPublishFail exception');
681
+ this._logger.error('_', '[RCCallSession] _listener.onTrackPublishFail exception');
671
682
  console.error(error);
672
683
  }
673
684
  // 如果不允许重试,直接返回
@@ -691,10 +702,10 @@ class RCCallSession {
691
702
  // 退出房间
692
703
  const callBack = yield this._rtcClient.leaveRoom(this._room);
693
704
  // 成功退出房间,触发RCCallClient实例上的onSessionClose监听,抛给用户信息
694
- logger.info('[RCCallSession _leaveRoom] Successfully exited the room', callBack);
705
+ this._logger.info('_', `[RCCallSession _leaveRoom] Successfully exited the room code: ${callBack.code}`);
695
706
  }
696
707
  catch (error) {
697
- logger.error('[RCCallSession _leaveRoom] leaveRoom throw exception');
708
+ this._logger.error('_', '[RCCallSession _leaveRoom] leaveRoom throw exception');
698
709
  console.error(error);
699
710
  }
700
711
  finally {
@@ -733,19 +744,19 @@ class RCCallSession {
733
744
  if (mediaType === RCCallMediaType.AUDIO) {
734
745
  const { code, track } = yield this._rtcClient.createMicrophoneAudioTrack('RongCloudRTC', constraints && constraints.audio && Object.assign({}, constraints.audio));
735
746
  if (code !== RCRTCCode.SUCCESS) {
736
- logger.error(`[RCCallSession _getLocalTrackCore] get Audio local tracks failed RCT code -> ${code}`);
747
+ this._logger.error('_', `[RCCallSession _getLocalTrackCore] get Audio local tracks failed RCT code -> ${code}`);
737
748
  return { code: RCCallErrorCode.GET_LOCAL_AUDIO_TRACK_ERROR };
738
749
  }
739
- logger.info('[RCCallSession _getLocalTrackCore] successfully get Audio local tracks');
750
+ this._logger.info('_', '[RCCallSession _getLocalTrackCore] successfully get Audio local tracks');
740
751
  return { code: RCCallErrorCode.SUCCESS, tracks: [track] };
741
752
  }
742
753
  else {
743
754
  const { code, tracks } = yield this._rtcClient.createMicrophoneAndCameraTracks('RongCloudRTC', constraints && Object.assign({}, constraints));
744
755
  if (code !== RCRTCCode.SUCCESS) {
745
- logger.error(`[RCCallSession _getLocalTrackCore] get Audio and Video local tracks failed RCT code -> ${code}`);
756
+ this._logger.error('_', `[RCCallSession _getLocalTrackCore] get Audio and Video local tracks failed RCT code -> ${code}`);
746
757
  return { code: RCCallErrorCode.GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR };
747
758
  }
748
- logger.info('[RCCallSession _getLocalTrackCore] successfully get audio and video local tracks');
759
+ this._logger.info('_', '[RCCallSession _getLocalTrackCore] successfully get audio and video local tracks');
749
760
  return { code: RCCallErrorCode.SUCCESS, tracks };
750
761
  }
751
762
  });
@@ -789,7 +800,7 @@ class RCCallSession {
789
800
  const localTracks = [];
790
801
  const { code, track } = yield this._rtcClient.createMicrophoneAudioTrack('RongCloudRTC', audioConstraints);
791
802
  if (code !== RCRTCCode.SUCCESS) {
792
- logger.error(`[RCCallSession changeDevice] get local Audio tracks failed RCTLib code -> ${code}`);
803
+ this._logger.error('_', `[RCCallSession changeDevice] get local Audio tracks failed RCTLib code -> ${code}`);
793
804
  return { code: RCCallErrorCode.GET_LOCAL_AUDIO_TRACK_ERROR };
794
805
  }
795
806
  this._options.localTracks && this._options.localTracks.forEach((track) => {
@@ -820,12 +831,14 @@ class RCCallSession {
820
831
  * 群呼叫中继续邀请
821
832
  * @param userIds 被邀请用户 ID 列表
822
833
  * @param options.extra 消息的扩展信息
823
- * @param options.pushTitle 通知的标题
824
- * @param options.pushContent 通知内容
834
+ * @deprecated 5.1.2 废弃 options.pushTitle 通知的标题
835
+ * @deprecated 5.1.2 废弃 options.pushContent 通知内容
825
836
  */
826
837
  invite(userIds, options = {}) {
838
+ var _a, _b;
827
839
  return __awaiter(this, void 0, void 0, function* () {
828
- const { extra = '', pushTitle = '', pushContent = '' } = options;
840
+ const { extra = '' } = options;
841
+ const { pushTitle = '', pushContent = '' } = (((_a = this._options.callPushConfig) === null || _a === void 0 ? void 0 : _a.pushTitle) || ((_b = this._options.callPushConfig) === null || _b === void 0 ? void 0 : _b.pushContent)) ? this._options.callPushConfig : options;
829
842
  const conclusion = [validateUserIds(userIds), validateExtra(extra), validatePushTitle(pushTitle), validatePushContent(pushContent)];
830
843
  const messages = [];
831
844
  const result = conclusion.every((obj) => {
@@ -859,7 +872,7 @@ class RCCallSession {
859
872
  // 发送接听的消息
860
873
  const { code } = yield this._stateMachine.accept();
861
874
  if (code !== RCCallErrorCode.SUCCESS) {
862
- logger.error(`[RCCallSession accept]Send accept message failed -> code: ${code}`);
875
+ this._logger.error('_', `[RCCallSession accept]Send accept message failed -> code: ${code}`);
863
876
  return { code };
864
877
  }
865
878
  return { code };
@@ -883,7 +896,7 @@ class RCCallSession {
883
896
  return __awaiter(this, void 0, void 0, function* () {
884
897
  const { code } = yield this._stateMachine.changeMediaType(mediaType);
885
898
  if (code !== RCCallErrorCode.SUCCESS) {
886
- logger.error(`[RCCallSession _changeMediaType] change media type fail code-> ${code}`);
899
+ this._logger.error('_', `[RCCallSession _changeMediaType] change media type fail code-> ${code}`);
887
900
  }
888
901
  return { code };
889
902
  });
@@ -932,7 +945,7 @@ class RCCallSession {
932
945
  const { code: _code } = yield this._room.publish([track]);
933
946
  // 若资源发布失败
934
947
  if (_code !== RCRTCCode.SUCCESS) {
935
- logger.error(`[RCCallSession _enableVideo] Resource publishing failed: RCRTCCode -> ${code}`);
948
+ this._logger.error('_', `[RCCallSession _enableVideo] Resource publishing failed: RCRTCCode -> ${code}`);
936
949
  return;
937
950
  }
938
951
  // 通知业务层trackReady
@@ -956,7 +969,7 @@ class RCCallSession {
956
969
  // 取消发布视频
957
970
  const { code } = yield this._room.unpublish(tracks);
958
971
  if (code !== RCRTCCode.SUCCESS) {
959
- logger.error(`[RCCallSession disableVideo] unpublish failed -> ${code}`);
972
+ this._logger.error('_', `[RCCallSession disableVideo] unpublish failed -> ${code}`);
960
973
  }
961
974
  // 关闭摄像头
962
975
  this._destroyTracks(tracks);
@@ -982,12 +995,12 @@ class RCCallSession {
982
995
  disableVideoTrack() {
983
996
  return __awaiter(this, void 0, void 0, function* () {
984
997
  if (!this._room) {
985
- logger.error(`[RCCallSession disableAudioTrack] Room missing audio track -> ${RCCallErrorCode.NOT_IN_ROOM_ERROR}`);
998
+ this._logger.error('_', `[RCCallSession disableAudioTrack] Room missing audio track -> ${RCCallErrorCode.NOT_IN_ROOM_ERROR}`);
986
999
  return { code: RCCallErrorCode.NOT_IN_ROOM_ERROR };
987
1000
  }
988
1001
  const tracks = this._getLocalVideoTracks();
989
1002
  if (!tracks.length) {
990
- logger.error(`[RCCallSession disableVideoTrack] Room missing video track -> ${RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR}`);
1003
+ this._logger.error('_', `[RCCallSession disableVideoTrack] Room missing video track -> ${RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR}`);
991
1004
  return { code: RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR };
992
1005
  }
993
1006
  // 禁用视频
@@ -1001,7 +1014,7 @@ class RCCallSession {
1001
1014
  // 取消发布视频
1002
1015
  const { code } = yield this._room.unpublish(tracks);
1003
1016
  if (code !== RCRTCCode.SUCCESS) {
1004
- logger.error(`[RCCallSession disableVideo] unpublish failed -> ${code}`);
1017
+ this._logger.error('_', `[RCCallSession disableVideo] unpublish failed -> ${code}`);
1005
1018
  return { code: RCCallErrorCode.UNPUBLISH_VIDEO_ERROR };
1006
1019
  }
1007
1020
  tracks.forEach((track) => {
@@ -1017,14 +1030,14 @@ class RCCallSession {
1017
1030
  enableVideoTrack() {
1018
1031
  return __awaiter(this, void 0, void 0, function* () {
1019
1032
  if (!this._room) {
1020
- logger.error(`[RCCallSession disableAudioTrack] Room missing audio track -> ${RCCallErrorCode.NOT_IN_ROOM_ERROR}`);
1033
+ this._logger.error('_', `[RCCallSession disableAudioTrack] Room missing audio track -> ${RCCallErrorCode.NOT_IN_ROOM_ERROR}`);
1021
1034
  return { code: RCCallErrorCode.NOT_IN_ROOM_ERROR };
1022
1035
  }
1023
1036
  // 如果不需关闭摄像头
1024
1037
  if (!this._options.isOffCameraWhenVideoDisable) {
1025
1038
  const tracks = this._getLocalVideoTracks();
1026
1039
  if (!tracks.length) {
1027
- logger.error(`[RCCallSession EnableVideoTrack] Room missing video track -> ${RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR}`);
1040
+ this._logger.error('_', `[RCCallSession EnableVideoTrack] Room missing video track -> ${RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR}`);
1028
1041
  return { code: RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR };
1029
1042
  }
1030
1043
  // 启用视频
@@ -1036,7 +1049,7 @@ class RCCallSession {
1036
1049
  // 获得本端视频资源
1037
1050
  const { code, track } = yield this._rtcClient.createCameraVideoTrack();
1038
1051
  if (code !== RCRTCCode.SUCCESS) {
1039
- logger.error(`[RCCallSession EnableVideoTrack] Get Resource failed: RCRTCCode -> ${code}`);
1052
+ this._logger.error('_', `[RCCallSession EnableVideoTrack] Get Resource failed: RCRTCCode -> ${code}`);
1040
1053
  return { code: RCCallErrorCode.GET_LOCAL_VIDEO_TRACK_ERROR };
1041
1054
  }
1042
1055
  const localTracks = [];
@@ -1059,7 +1072,7 @@ class RCCallSession {
1059
1072
  const { code: _code } = yield this._room.publish([track]);
1060
1073
  // 若资源发布失败
1061
1074
  if (_code !== RCRTCCode.SUCCESS) {
1062
- logger.error(`[RCCallSession EnableVideoTrack] Resource publishing failed: RCRTCCode -> ${code}`);
1075
+ this._logger.error('_', `[RCCallSession EnableVideoTrack] Resource publishing failed: RCRTCCode -> ${code}`);
1063
1076
  return { code: RCCallErrorCode.VIDEO_PUBLISH_ERROR };
1064
1077
  }
1065
1078
  // 启用
@@ -1075,7 +1088,7 @@ class RCCallSession {
1075
1088
  disableAudioTrack() {
1076
1089
  return __awaiter(this, void 0, void 0, function* () {
1077
1090
  if (!this._room) {
1078
- logger.error(`[RCCallSession disableAudioTrack] Room missing audio track -> ${RCCallErrorCode.NOT_IN_ROOM_ERROR}`);
1091
+ this._logger.error('_', `[RCCallSession disableAudioTrack] Room missing audio track -> ${RCCallErrorCode.NOT_IN_ROOM_ERROR}`);
1079
1092
  return { code: RCCallErrorCode.NOT_IN_ROOM_ERROR };
1080
1093
  }
1081
1094
  const tracks = this._getLocalAudioTracks();
@@ -1091,12 +1104,12 @@ class RCCallSession {
1091
1104
  enableAudioTrack() {
1092
1105
  return __awaiter(this, void 0, void 0, function* () {
1093
1106
  if (!this._room) {
1094
- logger.error(`[RCCallSession disableAudioTrack] Room missing audio track -> ${RCCallErrorCode.NOT_IN_ROOM_ERROR}`);
1107
+ this._logger.error('_', `[RCCallSession disableAudioTrack] Room missing audio track -> ${RCCallErrorCode.NOT_IN_ROOM_ERROR}`);
1095
1108
  return { code: RCCallErrorCode.NOT_IN_ROOM_ERROR };
1096
1109
  }
1097
1110
  const tracks = this._getLocalAudioTracks();
1098
1111
  if (!tracks.length) {
1099
- logger.error(`[RCCallSession disableAudioTrack] Room missing audio track -> ${RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR}`);
1112
+ this._logger.error('_', `[RCCallSession disableAudioTrack] Room missing audio track -> ${RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR}`);
1100
1113
  return { code: RCCallErrorCode.MISSING_VIDEO_TRACK_ERROR };
1101
1114
  }
1102
1115
  // 启用音频
@@ -1122,7 +1135,7 @@ class RCCallSession {
1122
1135
  this._listener.onTrackReady(track, this);
1123
1136
  }
1124
1137
  catch (error) {
1125
- logger.error('[RCCallSession _notifyTrackReady] _listener onTrackReady exception');
1138
+ this._logger.error('_', '[RCCallSession _notifyTrackReady] _listener onTrackReady exception');
1126
1139
  console.error(error);
1127
1140
  }
1128
1141
  });
@@ -1176,7 +1189,7 @@ class RCCallSession {
1176
1189
  * @param audioTrack RCRemoteAudioTrack 类实例
1177
1190
  */
1178
1191
  onAudioMuteChange: (audioTrack) => {
1179
- logger.info(`[RCCallSession onAudioMuteChange] userId->${audioTrack.getUserId()} muted -> ${audioTrack.isOwnerMuted()}`);
1192
+ this._logger.info('_', `[RCCallSession onAudioMuteChange] userId->${audioTrack.getUserId()} muted -> ${audioTrack.isOwnerMuted()}`);
1180
1193
  const muteUser = {
1181
1194
  userId: audioTrack.getUserId(),
1182
1195
  muted: audioTrack.isOwnerMuted(),
@@ -1188,7 +1201,7 @@ class RCCallSession {
1188
1201
  this._listener.onAudioMuteChange(muteUser, this);
1189
1202
  }
1190
1203
  catch (error) {
1191
- logger.error('[RCCallSession onAudioMuteChange] Missing listening method -> onTrackMuteChange');
1204
+ this._logger.error('_', '[RCCallSession onAudioMuteChange] Missing listening method -> onTrackMuteChange');
1192
1205
  console.error(error);
1193
1206
  }
1194
1207
  },
@@ -1197,7 +1210,7 @@ class RCCallSession {
1197
1210
  * @param videoTrack RCRemoteVideoTrack 类实例对象
1198
1211
  */
1199
1212
  onVideoMuteChange: (videoTrack) => {
1200
- logger.info(`[RCCallSession onVideoMuteChange]userId->${videoTrack.getUserId()} muted -> ${videoTrack.isOwnerMuted()}`);
1213
+ this._logger.info('_', `[RCCallSession onVideoMuteChange]userId->${videoTrack.getUserId()} muted -> ${videoTrack.isOwnerMuted()}`);
1201
1214
  const muteUser = {
1202
1215
  userId: videoTrack.getUserId(),
1203
1216
  muted: videoTrack.isOwnerMuted(),
@@ -1209,7 +1222,7 @@ class RCCallSession {
1209
1222
  this._listener.onVideoMuteChange(muteUser, this);
1210
1223
  }
1211
1224
  catch (error) {
1212
- logger.error('[RCCallSession onVideoMuteChange] Missing listening method -> onVideoMuteChange');
1225
+ this._logger.error('_', '[RCCallSession onVideoMuteChange] Missing listening method -> onVideoMuteChange');
1213
1226
  console.error(error);
1214
1227
  }
1215
1228
  },
@@ -1224,7 +1237,7 @@ class RCCallSession {
1224
1237
  // 按业务需求选择需要订阅资源,通过 room.subscribe 接口进行订阅
1225
1238
  const { code } = yield this._room.subscribe(tracks);
1226
1239
  if (code !== RCRTCCode.SUCCESS) {
1227
- logger.error(`[RCCallSession onTrackPublish] subscribe failed RTCCode ->${code}`);
1240
+ this._logger.error('_', `[RCCallSession onTrackPublish] subscribe failed RTCCode ->${code}`);
1228
1241
  }
1229
1242
  }
1230
1243
  }),
@@ -1264,20 +1277,20 @@ class RCCallSession {
1264
1277
  * @param userIds
1265
1278
  */
1266
1279
  onUserLeave: (userIds) => {
1267
- logger.info(`[RCCallSession onUserLeave] listening onUserLeave userIds -> ${userIds === null || userIds === void 0 ? void 0 : userIds.join(',')}`);
1280
+ this._logger.info('_', `[RCCallSession onUserLeave] listening onUserLeave userIds -> ${userIds === null || userIds === void 0 ? void 0 : userIds.join(',')}`);
1268
1281
  this._stateMachine.userLeave(userIds);
1269
1282
  },
1270
1283
  /**
1271
1284
  * RTC 每次 Ping 结果
1272
1285
  */
1273
1286
  onPing: (result) => {
1274
- logger.info(`[RCCallSession onPing]${result}`);
1287
+ this._logger.info('_', `[RCCallSession onPing]${result}`);
1275
1288
  try {
1276
1289
  // 通知给业务
1277
1290
  this._listener.onPing && this._listener.onPing(result, this);
1278
1291
  }
1279
1292
  catch (error) {
1280
- logger.error('[RCCallSession onPing] listening onPing exception');
1293
+ this._logger.error('_', '[RCCallSession onPing] listening onPing exception');
1281
1294
  console.error(error);
1282
1295
  }
1283
1296
  }
@@ -1298,7 +1311,7 @@ class RCCallSession {
1298
1311
  this._listener.onRTCStateReport && this._listener.onRTCStateReport(report, this);
1299
1312
  }
1300
1313
  catch (error) {
1301
- logger.error('[RCCallSession onStateReport] listener onStateReport exception');
1314
+ this._logger.error('_', '[RCCallSession onStateReport] listener onStateReport exception');
1302
1315
  console.error(error);
1303
1316
  }
1304
1317
  },
@@ -1311,7 +1324,7 @@ class RCCallSession {
1311
1324
  this._listener.onICEConnectionStateChange && this._listener.onICEConnectionStateChange(state, this);
1312
1325
  }
1313
1326
  catch (error) {
1314
- logger.error('[RCCallSession onICEConnectionStateChange] onICEConnectionStateChange exception');
1327
+ this._logger.error('_', '[RCCallSession onICEConnectionStateChange] onICEConnectionStateChange exception');
1315
1328
  console.error(error);
1316
1329
  }
1317
1330
  }
@@ -1388,20 +1401,17 @@ class RCCallSession {
1388
1401
  }
1389
1402
  }
1390
1403
 
1391
- // plugin-call 版本上报
1392
- VersionManage.add('plugin-call', "5.1.2-alpha.1");
1393
- // 校验当前安装的 engine 版本是否可用
1394
- if (!VersionManage.validEngine("^5.5.4")) {
1395
- logger.error(`The current engine version '${VersionManage.getInfo().engine}' error,plugin-call required engine version at least '${"^5.5.4"}'.`);
1396
- }
1397
1404
  class RCCallClient {
1398
- constructor(_context, _runtime, _options) {
1405
+ constructor(_context, _runtime, _logger, _options) {
1399
1406
  this._context = _context;
1400
1407
  this._runtime = _runtime;
1408
+ this._logger = _logger;
1401
1409
  /**
1402
1410
  * session列表
1403
1411
  */
1404
1412
  this._sessionList = [];
1413
+ this._callPushConfig = {};
1414
+ this._hungupPushConfig = {};
1405
1415
  this._rtcClient = _options.rtcClient;
1406
1416
  this._options = Object.assign({
1407
1417
  /**
@@ -1433,7 +1443,7 @@ class RCCallClient {
1433
1443
  lang: RCCallLanguage.ZH
1434
1444
  }, _options);
1435
1445
  // 初始化callEngine, 并监听onInvite
1436
- this._callEngine = new RCCallEngine(this._context, _runtime, logger, {
1446
+ this._callEngine = new RCCallEngine(this._context, _runtime, this._logger, {
1437
1447
  /**
1438
1448
  * 监听收到invite
1439
1449
  */
@@ -1455,15 +1465,15 @@ class RCCallClient {
1455
1465
  this._options.onSessionClose(session, summaryInfo);
1456
1466
  }
1457
1467
  catch (error) {
1458
- logger.error('[RCCCallClient] options.onSessionClose exception');
1468
+ this._logger.error('_', '[RCCCallClient] options.onSessionClose exception');
1459
1469
  console.log(error);
1460
1470
  }
1461
1471
  });
1462
1472
  // 接听之前挂断其它的session
1463
1473
  eventEmitter.on('hungupOtherSession', ({ session }) => {
1464
1474
  const id = session.getSessionId();
1465
- logger.info(`[RCCallClient hungupOtherSession] sessionId ready to accept -> ${id}`);
1466
- logger.info(`[RCCallClient hungupOtherSession] sessionList ->${this._sessionList.map(ses => ses.getSessionId()).join(',')}`);
1475
+ this._logger.info('_', `[RCCallClient hungupOtherSession] sessionId ready to accept -> ${id}`);
1476
+ this._logger.info('_', `[RCCallClient hungupOtherSession] sessionList ->${this._sessionList.map(ses => ses.getSessionId()).join(',')}`);
1467
1477
  let i = 0;
1468
1478
  while (this._sessionList.length > 1) {
1469
1479
  // 如果与要接听的session不一致
@@ -1478,15 +1488,15 @@ class RCCallClient {
1478
1488
  i++;
1479
1489
  }
1480
1490
  }
1481
- logger.info(`[RCCallClient hungupOtherSession] current sessionList length ->${this._sessionList.length}`);
1491
+ this._logger.info('_', `[RCCallClient hungupOtherSession] current sessionList length ->${this._sessionList.length}`);
1482
1492
  });
1483
1493
  }
1484
1494
  /**
1485
1495
  * 监听onInvite
1486
1496
  */
1487
1497
  _onInvite(stateMachine, extra) {
1488
- logger.info('[RCCallClient _onInvite] Received invite message');
1489
- const session = new RCCallSession(stateMachine, this._rtcClient, {
1498
+ this._logger.info('_', '[RCCallClient _onInvite] Received invite message');
1499
+ const session = new RCCallSession(stateMachine, this._rtcClient, this._logger, {
1490
1500
  // 是否允许订阅重试
1491
1501
  isAllowSubscribeRetry: this._options.isAllowSubscribeRetry,
1492
1502
  // 是否允许发布重试
@@ -1502,9 +1512,11 @@ class RCCallClient {
1502
1512
  // 允许降级获得流,获得音视频不成功 ,降级获得音频, 默认不允许
1503
1513
  isAllowDemotionGetStream: this._options.isAllowDemotionGetStream,
1504
1514
  // 标明是被叫产生的session
1505
- produceType: ProduceTypes.CALLEE
1515
+ produceType: ProduceTypes.CALLEE,
1516
+ callPushConfig: this._callPushConfig,
1517
+ hungupPushConfig: this._hungupPushConfig
1506
1518
  });
1507
- logger.info('[RCCallClient _onInvite] Received invite message, successfully created session');
1519
+ this._logger.info('_', '[RCCallClient _onInvite] Received invite message, successfully created session');
1508
1520
  /**
1509
1521
  * 如果通话的时候不允许接听新的通话,直接挂断, 这些工作在callEngine里完成
1510
1522
  */
@@ -1514,7 +1526,7 @@ class RCCallClient {
1514
1526
  this._options.onSession(session, extra);
1515
1527
  }
1516
1528
  catch (error) {
1517
- logger.error('[RCCallClient _options.onSession] onSession exception');
1529
+ this._logger.error('_', '[RCCallClient _options.onSession] onSession exception');
1518
1530
  console.log(error);
1519
1531
  }
1520
1532
  // 必须在onSession里注册session监听事件,这里检测一下有没有注册
@@ -1525,7 +1537,7 @@ class RCCallClient {
1525
1537
  }
1526
1538
  }
1527
1539
  else {
1528
- logger.error('[RCCallClient _options.onSession] session Must Have Listener');
1540
+ this._logger.error('_', '[RCCallClient _options.onSession] session Must Have Listener');
1529
1541
  throw new Error('[RCCallSession _options.onSession] session Must Have Listener');
1530
1542
  }
1531
1543
  }
@@ -1539,7 +1551,7 @@ class RCCallClient {
1539
1551
  this._options.onOfflineRecord && this._options.onOfflineRecord(record);
1540
1552
  }
1541
1553
  catch (error) {
1542
- logger.error('[RCCallClient _options.onOfflineRecord] onOfflineRecord exception');
1554
+ this._logger.error('_', '[RCCallClient _options.onOfflineRecord] onOfflineRecord exception');
1543
1555
  console.log(error);
1544
1556
  }
1545
1557
  }
@@ -1551,7 +1563,7 @@ class RCCallClient {
1551
1563
  */
1552
1564
  registerUserInfo(info = {}) {
1553
1565
  this._callEngine.registerUserInfo(info);
1554
- logger.info('[RCCallClient registerUserInfo] successfully register user info data');
1566
+ this._logger.info('_', '[RCCallClient registerUserInfo] successfully register user info data');
1555
1567
  }
1556
1568
  /**
1557
1569
  * 跨App单呼,发送invite消息,回调回来接收stateMachine, 建session
@@ -1561,8 +1573,8 @@ class RCCallClient {
1561
1573
  * @param params.constraints 获取音频或音视频资源时的参数 可选
1562
1574
  * @param params.channelId 组织 Id 可选
1563
1575
  * @param params.extra 消息扩展信息
1564
- * @param params.pushTitle 通知的标题
1565
- * @param params.pushContent 通知的内容
1576
+ * @deprecated 5.1.2 版本废弃 params.pushTitle 通知的标题
1577
+ * @deprecated 5.1.2 版本废弃 params.pushContent 通知的内容
1566
1578
  * @param params.bitrate 需要设置的码率参数
1567
1579
  *
1568
1580
  */
@@ -1579,8 +1591,8 @@ class RCCallClient {
1579
1591
  * @param params.constraints 获取音频或音视频资源时的参数 可选
1580
1592
  * @param params.channelId 组织 Id 可选
1581
1593
  * @param params.extra 消息扩展信息
1582
- * @param params.pushTitle 通知的标题
1583
- * @param params.pushContent 通知的内容
1594
+ * @deprecated 5.1.2 版本废弃 params.pushTitle 通知的标题
1595
+ * @deprecated 5.1.2 版本废弃 params.pushContent 通知的内容
1584
1596
  * @param params.bitrate 需要设置的码率参数
1585
1597
  *
1586
1598
  */
@@ -1591,8 +1603,9 @@ class RCCallClient {
1591
1603
  }
1592
1604
  __call({ targetId, mediaType = RCCallMediaType.AUDIO, listener, constraints, channelId = '', extra = '', pushTitle = '', pushContent = '', bitrate, isCrossAppkey = false }) {
1593
1605
  return __awaiter(this, void 0, void 0, function* () {
1594
- logger.info(`[RCCallClient call] extra->${extra} pushTitle->${pushTitle} pushContent->${pushContent}`);
1595
- const conclusion = [validateTargetId(targetId), validateMediaType(mediaType), validateListener(listener), validateExtra(extra), validatePushTitle(pushTitle), validatePushContent(pushContent)];
1606
+ const { pushTitle: pushTitleValue = '', pushContent: pushContentValue = '' } = (this._callPushConfig.pushTitle || this._callPushConfig.pushContent) ? this._callPushConfig : { pushTitle, pushContent };
1607
+ this._logger.info('_', `[RCCallClient call] extra->${extra} pushTitle->${pushTitleValue} pushContent->${pushContentValue}`);
1608
+ const conclusion = [validateTargetId(targetId), validateMediaType(mediaType), validateListener(listener), validateExtra(extra), validatePushTitle(pushTitleValue), validatePushContent(pushContentValue)];
1596
1609
  const messages = [];
1597
1610
  const result = conclusion.every((obj) => {
1598
1611
  !obj.result && messages.push(obj.msg);
@@ -1620,10 +1633,10 @@ class RCCallClient {
1620
1633
  listener.onTrackReady(track);
1621
1634
  });
1622
1635
  // 调用callEngine的call返回一个状态机的实例
1623
- const { code, stateMachine } = yield this._callEngine.call(channelId, targetId, mediaType, extra, pushTitle, pushContent, isCrossAppkey);
1636
+ const { code, stateMachine } = yield this._callEngine.call(channelId, targetId, mediaType, extra, pushTitleValue, pushContentValue, isCrossAppkey);
1624
1637
  if (code === RCCallErrorCode.SUCCESS && stateMachine) {
1625
- logger.info('[RCCallClient call] successfully created state machine');
1626
- const session = new RCCallSession(stateMachine, this._rtcClient, {
1638
+ this._logger.info('_', '[RCCallClient call] successfully created state machine');
1639
+ const session = new RCCallSession(stateMachine, this._rtcClient, this._logger, {
1627
1640
  localTracks,
1628
1641
  // 是否允许订阅重试
1629
1642
  isAllowSubscribeRetry: this._options.isAllowSubscribeRetry,
@@ -1641,16 +1654,18 @@ class RCCallClient {
1641
1654
  isAllowDemotionGetStream: this._options.isAllowDemotionGetStream,
1642
1655
  // 标明是主叫产生的session
1643
1656
  produceType: ProduceTypes.CALLER,
1644
- isCrossAppkey
1657
+ isCrossAppkey,
1658
+ callPushConfig: this._callPushConfig,
1659
+ hungupPushConfig: this._hungupPushConfig
1645
1660
  });
1646
1661
  // session上注册监听事件
1647
1662
  session.registerSessionListener(listener);
1648
1663
  this._sessionList.push(session);
1649
- logger.info(`[RCCallClient call] successfully created session object, sessionId: ${session.getSessionId()}`);
1664
+ this._logger.info('_', `[RCCallClient call] successfully created session object, sessionId: ${session.getSessionId()}`);
1650
1665
  return { code, session };
1651
1666
  }
1652
1667
  else {
1653
- logger.error(`[RCCallClient call] call failed code ->: ${code}`);
1668
+ this._logger.error('_', `[RCCallClient call] call failed code ->: ${code}`);
1654
1669
  localTracks.forEach(track => {
1655
1670
  // 禁用视频
1656
1671
  track.mute();
@@ -1670,13 +1685,14 @@ class RCCallClient {
1670
1685
  * @param params.constraints 获取音频或音视频资源时的参数 可选
1671
1686
  * @param params.channelId 组织 Id 可选
1672
1687
  * @param params.extra 消息扩展信息 可选
1673
- * @param params.pushTitle 通知的标题
1674
- * @param params.pushContent 通知的内容
1688
+ * @deprecated 5.1.2 版本废弃 params.pushTitle 通知的标题
1689
+ * @deprecated 5.1.2 版本废弃 params.pushContent 通知的内容
1675
1690
  * @param params.bitrate 需要设置的码率参数
1676
1691
  */
1677
1692
  callInGroup({ targetId, userIds, mediaType = RCCallMediaType.AUDIO, listener, constraints, channelId = '', extra = '', pushTitle = '', pushContent = '', bitrate }) {
1678
1693
  return __awaiter(this, void 0, void 0, function* () {
1679
- const conclusion = [validateTargetId(targetId), validateUserIds(userIds), validateMediaType(mediaType), validateListener(listener), validateExtra(extra), validatePushTitle(pushTitle), validatePushContent(pushContent)];
1694
+ const { pushTitle: pushTitleValue = '', pushContent: pushContentValue = '' } = (this._callPushConfig.pushTitle || this._callPushConfig.pushContent) ? this._callPushConfig : { pushTitle, pushContent };
1695
+ const conclusion = [validateTargetId(targetId), validateUserIds(userIds), validateMediaType(mediaType), validateListener(listener), validateExtra(extra), validatePushTitle(pushTitleValue), validatePushContent(pushContentValue)];
1680
1696
  const messages = [];
1681
1697
  const result = conclusion.every((obj) => {
1682
1698
  !obj.result && messages.push(obj.msg);
@@ -1704,10 +1720,10 @@ class RCCallClient {
1704
1720
  listener.onTrackReady(track);
1705
1721
  });
1706
1722
  // 往组里发消息
1707
- const { code, stateMachine } = yield this._callEngine.callInGroup(channelId, targetId, mediaType, userIds, extra, pushTitle, pushContent);
1723
+ const { code, stateMachine } = yield this._callEngine.callInGroup(channelId, targetId, mediaType, userIds, extra, pushTitleValue, pushContentValue);
1708
1724
  if (code === RCCallErrorCode.SUCCESS && stateMachine) {
1709
- logger.info('[RCCallClient callInGroup] successfully created state machine');
1710
- const session = new RCCallSession(stateMachine, this._rtcClient, {
1725
+ this._logger.info('_', '[RCCallClient callInGroup] successfully created state machine');
1726
+ const session = new RCCallSession(stateMachine, this._rtcClient, this._logger, {
1711
1727
  localTracks,
1712
1728
  // 是否允许订阅重试
1713
1729
  isAllowSubscribeRetry: this._options.isAllowSubscribeRetry,
@@ -1724,16 +1740,18 @@ class RCCallClient {
1724
1740
  // 允许降级获得流,获得音视频不成功 ,降级获得音频, 默认不允许
1725
1741
  isAllowDemotionGetStream: this._options.isAllowDemotionGetStream,
1726
1742
  // 标明是主叫产生的session
1727
- produceType: ProduceTypes.CALLER
1743
+ produceType: ProduceTypes.CALLER,
1744
+ callPushConfig: this._callPushConfig,
1745
+ hungupPushConfig: this._hungupPushConfig
1728
1746
  });
1729
1747
  // session上注册监听事件
1730
1748
  session.registerSessionListener(listener);
1731
1749
  this._sessionList.push(session);
1732
- logger.info(`[RCCallClient callInGroup] successfully created session object, sessionId: ${session.getSessionId()}`);
1750
+ this._logger.info('_', `[RCCallClient callInGroup] successfully created session object, sessionId: ${session.getSessionId()}`);
1733
1751
  return { code, session };
1734
1752
  }
1735
1753
  else {
1736
- logger.info(`[RCCallClient callInGroup] callInGroup failed code -> ${code}`);
1754
+ this._logger.info('_', `[RCCallClient callInGroup] callInGroup failed code -> ${code}`);
1737
1755
  localTracks.forEach(track => {
1738
1756
  // 禁用视频
1739
1757
  track.mute();
@@ -1753,19 +1771,19 @@ class RCCallClient {
1753
1771
  if (mediaType === RCCallMediaType.AUDIO) {
1754
1772
  const { code, track } = yield this._rtcClient.createMicrophoneAudioTrack('RongCloudRTC', constraints && constraints.audio && Object.assign({}, constraints.audio));
1755
1773
  if (code !== RCRTCCode.SUCCESS) {
1756
- logger.error(`[RCCallClient _getTrack] get Audio local tracks failed RCT code -> ${code}`);
1774
+ this._logger.error('_', `[RCCallClient _getTrack] get Audio local tracks failed RCT code -> ${code}`);
1757
1775
  return { code: RCCallErrorCode.GET_LOCAL_AUDIO_TRACK_ERROR };
1758
1776
  }
1759
- logger.info('[RCCallClient _getTrack] successfully get Audio local tracks');
1777
+ this._logger.info('_', '[RCCallClient _getTrack] successfully get Audio local tracks');
1760
1778
  return { code: RCCallErrorCode.SUCCESS, tracks: [track] };
1761
1779
  }
1762
1780
  else {
1763
1781
  const { code, tracks } = yield this._rtcClient.createMicrophoneAndCameraTracks('RongCloudRTC', constraints && Object.assign({}, constraints));
1764
1782
  if (code !== RCRTCCode.SUCCESS) {
1765
- logger.error(`[RCCallClient _getTrack] get Audio and Video local tracks failed RCT code -> ${code}`);
1783
+ this._logger.error('_', `[RCCallClient _getTrack] get Audio and Video local tracks failed RCT code -> ${code}`);
1766
1784
  return { code: RCCallErrorCode.GET_LOCAL_AUDIO_AND_VIDEO_TRACK_ERROR };
1767
1785
  }
1768
- logger.info('[RCCallClient _getTrack] successfully get audio and video local tracks');
1786
+ this._logger.info('_', '[RCCallClient _getTrack] successfully get audio and video local tracks');
1769
1787
  return { code: RCCallErrorCode.SUCCESS, tracks };
1770
1788
  }
1771
1789
  });
@@ -1808,14 +1826,40 @@ class RCCallClient {
1808
1826
  return __awaiter(this, void 0, void 0, function* () {
1809
1827
  const { code, data } = yield this._context.getRTCJoinedUserInfo(this._context.getCurrentId());
1810
1828
  if (code !== ErrorCode.SUCCESS) {
1811
- logger.error('getJoinedUserInfo error', code);
1829
+ this._logger.error('_', `getJoinedUserInfo error code: ${code}`);
1812
1830
  return { code: RCCallErrorCode.QUERY_JOINED_USER_INFO_ERROR };
1813
1831
  }
1814
1832
  return { code: RCCallErrorCode.SUCCESS, data };
1815
1833
  });
1816
1834
  }
1835
+ /**
1836
+ * 设置呼叫、挂断推送数据
1837
+ * @param callPushConfig 呼叫推送配置
1838
+ * @param callPushConfig.pushTitle 呼叫推送标题
1839
+ * @param callPushConfig.pushContent 呼叫推送内容
1840
+ * @param hungupPushConfig 挂断推送配置
1841
+ * @param hungupPushConfig.pushTitle 挂断推送标题
1842
+ * @param hungupPushConfig.pushContent 挂断推送内容
1843
+ */
1844
+ setPushConfig(callPushConfig = {}, hungupPushConfig = {}) {
1845
+ const conclusion = [callPushConfig, hungupPushConfig].map((pushConfig) => {
1846
+ return validatePushConfig(pushConfig);
1847
+ })[0];
1848
+ const messages = [];
1849
+ const result = conclusion.every((obj) => {
1850
+ !obj.result && messages.push(obj.msg);
1851
+ return obj.result;
1852
+ });
1853
+ if (!result) {
1854
+ throw new Error(`[RCCallClient callInGroup callPushConfig or hungupPushConfig] ${messages.join('\n')}`);
1855
+ }
1856
+ this._callPushConfig = callPushConfig;
1857
+ this._hungupPushConfig = hungupPushConfig;
1858
+ }
1817
1859
  }
1818
1860
 
1861
+ // plugin-call 版本上报
1862
+ VersionManage.add('plugin-call', "5.1.2-alpha.3");
1819
1863
  const installer = {
1820
1864
  tag: 'RCCall',
1821
1865
  verify(runtime) {
@@ -1827,10 +1871,13 @@ const installer = {
1827
1871
  if (!conclusion.result) {
1828
1872
  throw new Error(`[RCCallLib installer steup]${conclusion.msg}`);
1829
1873
  }
1830
- logger.setLogLevel(options.logLevel);
1831
- logger.setLogStdout(options.logStdout);
1832
- logger.warn(`RCCall Version: ${"5.1.2-alpha.1"}, Commit: ${"5a6d3a159d1171c71f1bb419dfac59eb8e886f91"}`);
1833
- return new RCCallClient(context, runtime, options);
1874
+ // 校验当前安装的 engine 版本是否可用
1875
+ if (!VersionManage.validEngine("^5.7.0")) {
1876
+ throw new Error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-call required engine version at least '${"^5.7.0"}'.`);
1877
+ }
1878
+ const logger = context.createLogger('RCCall', 'RTC');
1879
+ logger.warn('_', `RCCall Version: ${"5.1.2-alpha.3"}, Commit: ${"18608f24276587122c6fe1b54515d19aec29be0f"}`);
1880
+ return new RCCallClient(context, runtime, logger, options);
1834
1881
  }
1835
1882
  };
1836
1883