@vgroup/dialbox 0.2.88 → 0.2.89

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.
@@ -3076,51 +3076,61 @@ class DialboxComponent {
3076
3076
  console.log('ngOnInit');
3077
3077
  // Ensure Twilio is initialized even when dialpad starts hidden,
3078
3078
  // so we can auto-open on incoming calls.
3079
+ this.incomeingCallSocketService.connect();
3080
+ this.incomeingCallSocketService.listen().subscribe((incomingCallData) => {
3081
+ const data = JSON.parse(incomingCallData.data);
3082
+ console.log("WS Event Received:", incomingCallData);
3083
+ console.log("WS Event Received:", incomingCallData.data);
3084
+ if (data[0]) {
3085
+ // this.showIncomingCallPopup(incoming, data/
3086
+ this.isCallInProgress = true;
3087
+ this.isDialpadHidden = false;
3088
+ this.callData.phone = data[0].from;
3089
+ this.callData.name = "";
3090
+ this.callData.img = "assets/images/user.jpg";
3091
+ this.callData.isIncomingCall = true;
3092
+ }
3093
+ // this.initializeTwilio();
3094
+ // if (incomingCallData.type === "/incoming/call") {
3095
+ // if (incomingCallData) {
3096
+ // if (this.autoOpenOnIncoming && this._isDialpadHidden) {
3097
+ // this._isDialpadHidden = false;
3098
+ // }
3099
+ // if (this.isCallInProgress) {
3100
+ // this.newIncomingCalls.push(incomingCallData);
3101
+ // console.log('325', incomingCallData)
3102
+ // this.getUserInformation(incomingCallData);
3103
+ // } else {
3104
+ // incomingCallData['isFirstCall'] = true;
3105
+ // console.log('dd1')
3106
+ // this.isCallInProgress = true;
3107
+ // this.isDialpadHidden = false;
3108
+ // this.callData.phone = incomingCallData.parameters['From'];
3109
+ // console.log('dd2')
3110
+ // this.getUserInformation(incomingCallData);
3111
+ // this.callData.name = incomingCallData.customParameters.get('name');
3112
+ // this.callData.img = incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
3113
+ // this.callData.isIncomingCall = true;
3114
+ // }
3115
+ // incomingCallData.on('cancel', () => {
3116
+ // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
3117
+ // // if(this.incomingCallsList.length == 0){
3118
+ // // console.log('dd3')
3119
+ // // this.isCallInProgress = false;
3120
+ // // }
3121
+ // });
3122
+ // incomingCallData.on('disconnect', () => {
3123
+ // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
3124
+ // // if(this.incomingCallsList.length == 0){
3125
+ // // console.log('dd4')
3126
+ // // this.isCallInProgress = false;
3127
+ // // }
3128
+ // });
3129
+ // }
3130
+ // }
3131
+ });
3079
3132
  this.initializeTwilio();
3080
3133
  try {
3081
- this.incomeingCallSocketService.connect();
3082
- this.incomeingCallSocketService.listen().subscribe((incomingCallData) => {
3083
- console.log("WS Event Received:", incomingCallData);
3084
- console.log("WS Event Received:", incomingCallData.data);
3085
- if (incomingCallData.type === "/incoming/call") {
3086
- if (incomingCallData) {
3087
- if (this.autoOpenOnIncoming && this._isDialpadHidden) {
3088
- this._isDialpadHidden = false;
3089
- }
3090
- if (this.isCallInProgress) {
3091
- this.newIncomingCalls.push(incomingCallData);
3092
- console.log('325', incomingCallData);
3093
- this.getUserInformation(incomingCallData);
3094
- }
3095
- else {
3096
- incomingCallData['isFirstCall'] = true;
3097
- console.log('dd1');
3098
- this.isCallInProgress = true;
3099
- this.isDialpadHidden = false;
3100
- this.callData.phone = incomingCallData.parameters['From'];
3101
- console.log('dd2');
3102
- this.getUserInformation(incomingCallData);
3103
- this.callData.name = incomingCallData.customParameters.get('name');
3104
- this.callData.img = incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
3105
- this.callData.isIncomingCall = true;
3106
- }
3107
- incomingCallData.on('cancel', () => {
3108
- this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
3109
- // if(this.incomingCallsList.length == 0){
3110
- // console.log('dd3')
3111
- // this.isCallInProgress = false;
3112
- // }
3113
- });
3114
- incomingCallData.on('disconnect', () => {
3115
- this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
3116
- // if(this.incomingCallsList.length == 0){
3117
- // console.log('dd4')
3118
- // this.isCallInProgress = false;
3119
- // }
3120
- });
3121
- }
3122
- }
3123
- });
3124
3134
  this.token = localStorage.getItem('ext_token') || '';
3125
3135
  //this.isCallInProgress = true;
3126
3136
  this.getContactList();
@@ -3259,6 +3269,10 @@ class DialboxComponent {
3259
3269
  this.registerDragElement();
3260
3270
  }
3261
3271
  ngOnChanges(changes) {
3272
+ if (changes['deviceId']) {
3273
+ localStorage.setItem('deviceId', changes['deviceId'].currentValue);
3274
+ console.log('Set deviceId in localStorage:', changes['deviceId'].currentValue);
3275
+ }
3262
3276
  if (changes['isDialpadHidden'] && !this.isDialpadHidden) {
3263
3277
  this.getContactList();
3264
3278
  this.getUserCallSetting();