@vgroup/dialbox 0.2.87 → 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.
@@ -2488,7 +2488,7 @@ class CallProgressComponent {
2488
2488
  hold: true
2489
2489
  });
2490
2490
  // Put current call on hold
2491
- this.heldCall = Object.assign({}, this.call);
2491
+ this.heldCall = this.call;
2492
2492
  this.isCallOnHold = true;
2493
2493
  this.heldCall.mute(true);
2494
2494
  // Close contacts panel and show ring animation
@@ -3106,51 +3106,61 @@ class DialboxComponent {
3106
3106
  console.log('ngOnInit');
3107
3107
  // Ensure Twilio is initialized even when dialpad starts hidden,
3108
3108
  // so we can auto-open on incoming calls.
3109
+ this.incomeingCallSocketService.connect();
3110
+ this.incomeingCallSocketService.listen().subscribe((incomingCallData) => {
3111
+ const data = JSON.parse(incomingCallData.data);
3112
+ console.log("WS Event Received:", incomingCallData);
3113
+ console.log("WS Event Received:", incomingCallData.data);
3114
+ if (data[0]) {
3115
+ // this.showIncomingCallPopup(incoming, data/
3116
+ this.isCallInProgress = true;
3117
+ this.isDialpadHidden = false;
3118
+ this.callData.phone = data[0].from;
3119
+ this.callData.name = "";
3120
+ this.callData.img = "assets/images/user.jpg";
3121
+ this.callData.isIncomingCall = true;
3122
+ }
3123
+ // this.initializeTwilio();
3124
+ // if (incomingCallData.type === "/incoming/call") {
3125
+ // if (incomingCallData) {
3126
+ // if (this.autoOpenOnIncoming && this._isDialpadHidden) {
3127
+ // this._isDialpadHidden = false;
3128
+ // }
3129
+ // if (this.isCallInProgress) {
3130
+ // this.newIncomingCalls.push(incomingCallData);
3131
+ // console.log('325', incomingCallData)
3132
+ // this.getUserInformation(incomingCallData);
3133
+ // } else {
3134
+ // incomingCallData['isFirstCall'] = true;
3135
+ // console.log('dd1')
3136
+ // this.isCallInProgress = true;
3137
+ // this.isDialpadHidden = false;
3138
+ // this.callData.phone = incomingCallData.parameters['From'];
3139
+ // console.log('dd2')
3140
+ // this.getUserInformation(incomingCallData);
3141
+ // this.callData.name = incomingCallData.customParameters.get('name');
3142
+ // this.callData.img = incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
3143
+ // this.callData.isIncomingCall = true;
3144
+ // }
3145
+ // incomingCallData.on('cancel', () => {
3146
+ // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
3147
+ // // if(this.incomingCallsList.length == 0){
3148
+ // // console.log('dd3')
3149
+ // // this.isCallInProgress = false;
3150
+ // // }
3151
+ // });
3152
+ // incomingCallData.on('disconnect', () => {
3153
+ // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
3154
+ // // if(this.incomingCallsList.length == 0){
3155
+ // // console.log('dd4')
3156
+ // // this.isCallInProgress = false;
3157
+ // // }
3158
+ // });
3159
+ // }
3160
+ // }
3161
+ });
3109
3162
  this.initializeTwilio();
3110
3163
  try {
3111
- this.incomeingCallSocketService.connect();
3112
- this.incomeingCallSocketService.listen().subscribe((incomingCallData) => {
3113
- console.log("WS Event Received:", incomingCallData);
3114
- console.log("WS Event Received:", incomingCallData.data);
3115
- if (incomingCallData.type === "/incoming/call") {
3116
- if (incomingCallData) {
3117
- if (this.autoOpenOnIncoming && this._isDialpadHidden) {
3118
- this._isDialpadHidden = false;
3119
- }
3120
- if (this.isCallInProgress) {
3121
- this.newIncomingCalls.push(incomingCallData);
3122
- console.log('325', incomingCallData);
3123
- this.getUserInformation(incomingCallData);
3124
- }
3125
- else {
3126
- incomingCallData['isFirstCall'] = true;
3127
- console.log('dd1');
3128
- this.isCallInProgress = true;
3129
- this.isDialpadHidden = false;
3130
- this.callData.phone = incomingCallData.parameters['From'];
3131
- console.log('dd2');
3132
- this.getUserInformation(incomingCallData);
3133
- this.callData.name = incomingCallData.customParameters.get('name');
3134
- this.callData.img = incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
3135
- this.callData.isIncomingCall = true;
3136
- }
3137
- incomingCallData.on('cancel', () => {
3138
- this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
3139
- // if(this.incomingCallsList.length == 0){
3140
- // console.log('dd3')
3141
- // this.isCallInProgress = false;
3142
- // }
3143
- });
3144
- incomingCallData.on('disconnect', () => {
3145
- this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
3146
- // if(this.incomingCallsList.length == 0){
3147
- // console.log('dd4')
3148
- // this.isCallInProgress = false;
3149
- // }
3150
- });
3151
- }
3152
- }
3153
- });
3154
3164
  this.token = localStorage.getItem('ext_token') || '';
3155
3165
  //this.isCallInProgress = true;
3156
3166
  this.getContactList();
@@ -3289,6 +3299,10 @@ class DialboxComponent {
3289
3299
  this.registerDragElement();
3290
3300
  }
3291
3301
  ngOnChanges(changes) {
3302
+ if (changes['deviceId']) {
3303
+ localStorage.setItem('deviceId', changes['deviceId'].currentValue);
3304
+ console.log('Set deviceId in localStorage:', changes['deviceId'].currentValue);
3305
+ }
3292
3306
  if (changes['isDialpadHidden'] && !this.isDialpadHidden) {
3293
3307
  this.getContactList();
3294
3308
  this.getUserCallSetting();