@vgroup/dialbox 0.0.75 → 0.0.77

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.
@@ -2209,7 +2209,7 @@ class DialboxComponent {
2209
2209
  console.error('No authentication token found');
2210
2210
  return;
2211
2211
  }
2212
- // this.isInitialized = true;
2212
+ this.isInitialized = true;
2213
2213
  // Initialize Twilio service
2214
2214
  this.twilioService.initializeTwilioDevice();
2215
2215
  // Subscribe to incoming calls to show dialpad when call comes in
@@ -2222,14 +2222,113 @@ class DialboxComponent {
2222
2222
  });
2223
2223
  this.subscriptions.add(callSub);
2224
2224
  }
2225
- ngOnChange() {
2226
- this.initializeTwilio();
2227
- }
2225
+ // ngOnChange() {
2226
+ // this.initializeTwilio();
2227
+ // }
2228
+ // ngOnInit() {
2229
+ // try {
2230
+ // this.getContactList();
2231
+ // this.getUserCallSetting();
2232
+ // // Subscribe to dial number events
2233
+ // const sub1 = this.twilioService.dialNumberFromOtherModule.subscribe((contact: any) => {
2234
+ // if (contact.number) {
2235
+ // this.isSmartDialCall = false;
2236
+ // if (contact.isDialFromHistory) {
2237
+ // //handle dialing from history page
2238
+ // if(contact.callerId == 'smartDialing'){
2239
+ // this.selectedCallerId = { number: contact.from };
2240
+ // this.isSmartDialCall = true;
2241
+ // setTimeout(() => {
2242
+ // this.isDialpadHidden = false;
2243
+ // }, 2000);
2244
+ // this.callData.phone = contact.number;
2245
+ // this.callData.name = contact.name;
2246
+ // this.callData.img = contact.img;
2247
+ // this.callData.from = contact.from;
2248
+ // this.sanitizedNum = contact.number;
2249
+ // this.getUserInformation(contact);
2250
+ // // this.incomingCallsList.push(contact)
2251
+ // this.initiateCall();
2252
+ // }else{
2253
+ // this.getUserCallSetting();
2254
+ // setTimeout(() => {
2255
+ // this.isDialpadHidden = false;
2256
+ // }, 1000);
2257
+ // this.getUserInformation(contact);
2258
+ // // this.incomingCallsList.push(contact)
2259
+ // this.dialedNumber = contact.number;
2260
+ // this.sanitizedNum = contact.number;
2261
+ // }
2262
+ // } else {
2263
+ // if (contact.callerId == 'alwaysAsk' || contact.callerId == 'smartDialing') {
2264
+ // this.getUserCallSetting();
2265
+ // setTimeout(() => {
2266
+ // this.isDialpadHidden = false;
2267
+ // }, 1000);
2268
+ // this.dialedNumber = contact.number;
2269
+ // this.sanitizedNum = contact.number;
2270
+ // } else {
2271
+ // setTimeout(() => {
2272
+ // this.isDialpadHidden = false;
2273
+ // }, 2000);
2274
+ // this.callData.phone = contact.number;
2275
+ // this.callData.name = contact.name;
2276
+ // this.callData.img = contact.img;
2277
+ // this.sanitizedNum = contact.number;
2278
+ // this.initiateCall();
2279
+ // }
2280
+ // }
2281
+ // }
2282
+ // })
2283
+ // // handle incoming call
2284
+ // const sub2 = this.twilioService.currentCall.subscribe(incomingCallData => {
2285
+ // // if (incomingCallData) {
2286
+ // // this.isCallInProgress = true;
2287
+ // // this.isDialpadHidden = false;
2288
+ // // this.callData.phone = incomingCallData.parameters.From;
2289
+ // // this.callData.name = incomingCallData.customParameters.get('name');
2290
+ // // this.callData.img = incomingCallData.customParameters.get('image');
2291
+ // // this.callData.isIncomingCall = true;
2292
+ // // }
2293
+ // if (incomingCallData) {
2294
+ // if (this.isCallInProgress) {
2295
+ // this.newIncomingCalls.push(incomingCallData);
2296
+ // this.getUserInformation(incomingCallData);
2297
+ // } else {
2298
+ // this.isCallInProgress = true;
2299
+ // this.isDialpadHidden = false;
2300
+ // this.callData.phone = incomingCallData.parameters['From'];
2301
+ // this.getUserInformation(incomingCallData);
2302
+ // this.callData.name = incomingCallData.customParameters.get('name');
2303
+ // this.callData.img = incomingCallData.customParameters.get('image') || 'assets/images/user.jpg';
2304
+ // this.callData.isIncomingCall = true;
2305
+ // }
2306
+ // incomingCallData.on('cancel', () => {
2307
+ // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters.CallSid !== incomingCallData.parameters['CallSid']);
2308
+ // if(this.incomingCallsList.length == 0){
2309
+ // this.isCallInProgress = false;
2310
+ // }
2311
+ // });
2312
+ // incomingCallData.on('disconnect', () => {
2313
+ // this.incomingCallsList = this.incomingCallsList.filter((item: any) => item.parameters.CallSid !== incomingCallData.parameters['CallSid']);
2314
+ // if(this.incomingCallsList.length == 0){
2315
+ // this.isCallInProgress = false;
2316
+ // }
2317
+ // });
2318
+ // }
2319
+ // });
2320
+ // this.subscriptions.add(sub1);
2321
+ // this.subscriptions.add(sub2);
2322
+ // }catch(e){
2323
+ // console.log(e)
2324
+ // }
2325
+ // }
2228
2326
  ngOnInit() {
2229
2327
  try {
2328
+ this.token = localStorage.getItem('ext_token') || '';
2329
+ //this.isCallInProgress = true;
2230
2330
  this.getContactList();
2231
2331
  this.getUserCallSetting();
2232
- // Subscribe to dial number events
2233
2332
  const sub1 = this.twilioService.dialNumberFromOtherModule.subscribe((contact) => {
2234
2333
  if (contact.number) {
2235
2334
  this.isSmartDialCall = false;
@@ -2300,7 +2399,7 @@ class DialboxComponent {
2300
2399
  }
2301
2400
  else {
2302
2401
  this.isCallInProgress = true;
2303
- this.isDialpadHidden = true;
2402
+ this.isDialpadHidden = false;
2304
2403
  this.callData.phone = incomingCallData.parameters['From'];
2305
2404
  this.getUserInformation(incomingCallData);
2306
2405
  this.callData.name = incomingCallData.customParameters.get('name');
@@ -2308,13 +2407,13 @@ class DialboxComponent {
2308
2407
  this.callData.isIncomingCall = true;
2309
2408
  }
2310
2409
  incomingCallData.on('cancel', () => {
2311
- this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters['CallSid']);
2410
+ this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
2312
2411
  if (this.incomingCallsList.length == 0) {
2313
2412
  this.isCallInProgress = false;
2314
2413
  }
2315
2414
  });
2316
2415
  incomingCallData.on('disconnect', () => {
2317
- this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters.CallSid !== incomingCallData.parameters['CallSid']);
2416
+ this.incomingCallsList = this.incomingCallsList.filter((item) => item.parameters['CallSid'] !== incomingCallData.parameters['CallSid']);
2318
2417
  if (this.incomingCallsList.length == 0) {
2319
2418
  this.isCallInProgress = false;
2320
2419
  }