@vgroup/dialbox 0.0.14 → 0.0.15
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.
|
@@ -1634,36 +1634,52 @@ class CallProgressComponent {
|
|
|
1634
1634
|
console.log('Call Progress Component');
|
|
1635
1635
|
}
|
|
1636
1636
|
ngOnChanges(changes) {
|
|
1637
|
-
console.log('Call Progress Component ngOnChanges');
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1637
|
+
console.log('Call Progress Component ngOnChanges', changes);
|
|
1638
|
+
// Handle callData changes (outgoing calls)
|
|
1639
|
+
if (changes['callData'] && changes['callData'].currentValue) {
|
|
1640
|
+
console.log('Call Progress Component ngOnChanges callData', changes['callData'].currentValue);
|
|
1641
|
+
const callData = changes['callData'].currentValue;
|
|
1642
|
+
if (callData.isIncomingCall) {
|
|
1643
|
+
this.incomingCallDiv = true;
|
|
1644
|
+
this.callData = { ...callData };
|
|
1645
|
+
this.showRingAnimation = true;
|
|
1646
|
+
this.startTimer();
|
|
1642
1647
|
}
|
|
1643
1648
|
else {
|
|
1644
|
-
//
|
|
1645
|
-
this.
|
|
1649
|
+
// For outgoing call
|
|
1650
|
+
this.callData = { ...callData };
|
|
1651
|
+
this.startCall(callData);
|
|
1646
1652
|
}
|
|
1647
1653
|
}
|
|
1648
|
-
|
|
1654
|
+
// Handle new incoming call data from Twilio
|
|
1655
|
+
if (changes['newIncomingCallData'] && changes['newIncomingCallData'].currentValue) {
|
|
1649
1656
|
try {
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
this.callData.name = (this.call?.customParameters).get('name');
|
|
1657
|
-
this.callData.img = (this.call?.customParameters).get('image') || 'assets/images/user.jpg';
|
|
1658
|
-
this.incomingCallInitiated.emit();
|
|
1659
|
-
this.startTimer();
|
|
1660
|
-
}
|
|
1657
|
+
const incomingCall = changes['newIncomingCallData'].currentValue;
|
|
1658
|
+
// If there's an active call, handle it appropriately
|
|
1659
|
+
if (this.call && this.call.status() === 'open') {
|
|
1660
|
+
// You might want to handle multiple calls here
|
|
1661
|
+
// For now, we'll just update the current call
|
|
1662
|
+
this.call.disconnect();
|
|
1661
1663
|
}
|
|
1664
|
+
this.call = incomingCall;
|
|
1665
|
+
this.callData = {
|
|
1666
|
+
...this.callData,
|
|
1667
|
+
phone: incomingCall.parameters.From,
|
|
1668
|
+
name: incomingCall.customParameters?.get('name') || 'Unknown Caller',
|
|
1669
|
+
img: incomingCall.customParameters?.get('image') || 'assets/images/user.jpg',
|
|
1670
|
+
isIncomingCall: true
|
|
1671
|
+
};
|
|
1672
|
+
this.incomingCallDiv = true;
|
|
1673
|
+
this.showRingAnimation = true;
|
|
1674
|
+
this.incomingCallInitiated.emit();
|
|
1675
|
+
this.startTimer();
|
|
1662
1676
|
}
|
|
1663
1677
|
catch (e) {
|
|
1664
|
-
console.
|
|
1678
|
+
console.error('Error handling incoming call:', e);
|
|
1665
1679
|
}
|
|
1666
1680
|
}
|
|
1681
|
+
// Update the view
|
|
1682
|
+
this.cdr.detectChanges();
|
|
1667
1683
|
}
|
|
1668
1684
|
ngAfterViewInit() { }
|
|
1669
1685
|
async startCall(callData) {
|