Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,22 @@ const CallControlCADComponent: React.FC<CallControlComponentProps> = (props) =>
//@ts-expect-error To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762
const dn = currentTask?.data?.interaction?.callAssociatedDetails?.dn;

// Check if this is an outdial call - for outdial, show dialed number instead of entrypoint
const isOutdial = currentTask?.data?.interaction?.outboundType === 'OUTDIAL';

// Create unique IDs for tooltips
const customerNameTriggerId = `customer-name-trigger-${currentTask.data.interaction.interactionId}`;
const customerNameTooltipId = `customer-name-tooltip-${currentTask.data.interaction.interactionId}`;
const phoneNumberTriggerId = `phone-number-trigger-${currentTask.data.interaction.interactionId}`;
const phoneNumberTooltipId = `phone-number-tooltip-${currentTask.data.interaction.interactionId}`;

// For telephony calls, ani is the phone number and dn is the entry point/DNIS.
// Inbound: ani = caller's number, dn = entry point dialed by caller
// Outdial: ani = customer's number dialed by agent, dn = agent's entry point
const callerNumber = isOutdial ? dn || ani : ani;

const renderCustomerName = () => {
const customerText = isSocial ? customerName || NO_CUSTOMER_NAME : ani || NO_CALLER_ID;
const customerText = isSocial ? customerName || NO_CUSTOMER_NAME : callerNumber || NO_CALLER_ID;

const textComponent = (
<Text
Expand Down Expand Up @@ -113,7 +121,7 @@ const CallControlCADComponent: React.FC<CallControlComponentProps> = (props) =>
};

const renderPhoneNumber = () => {
const phoneText = isSocial ? customerName || NO_CUSTOMER_NAME : dn || NO_PHONE_NUMBER;
const phoneText = isSocial ? customerName || NO_CUSTOMER_NAME : ani || NO_PHONE_NUMBER;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit phone-number override to telephony interactions

The new phoneText expression now uses ani for every non-social interaction, not just telephony. In CallControlCAD, chat/email/SMS tasks are non-social, so their ANI (often an email/handle or channel identifier) is now shown under the literal Phone Number label; this is visible in the updated chat-media-type snapshot where chat-customer@example.com replaced No Phone Number. That broadens a telephony-specific fix into digital channels and can present incorrect/misleading data to agents.

Useful? React with 👍 / 👎.

const labelText = isSocial ? CUSTOMER_NAME : PHONE_NUMBER;

const textComponent = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const extractIncomingTaskData = (
//@ts-expect-error To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762
const callAssociationDetails = incomingTask?.data?.interaction?.callAssociatedDetails;
const ani = callAssociationDetails?.ani;
const dn = callAssociationDetails?.dn;
const customerName = callAssociationDetails?.customerName;
const virtualTeamName = callAssociationDetails?.virtualTeamName;
const ronaTimeout = callAssociationDetails?.ronaTimeout ? Number(callAssociationDetails?.ronaTimeout) : null;
Expand All @@ -46,6 +47,9 @@ export const extractIncomingTaskData = (
const isTelephony = mediaType === MEDIA_CHANNEL.TELEPHONY;
const isSocial = mediaType === MEDIA_CHANNEL.SOCIAL;

// Check if this is an outdial call
const isOutdial = incomingTask?.data?.interaction?.outboundType === 'OUTDIAL';

// Compute button text based on conditions
const acceptText = !incomingTask.data.wrapUpRequired
? isTelephony && !isBrowser
Expand All @@ -56,7 +60,8 @@ export const extractIncomingTaskData = (
const declineText = !incomingTask.data.wrapUpRequired && isTelephony && isBrowser ? 'Decline' : undefined;

// Compute title based on media type
const title = isSocial ? customerName : ani;
// For outdial calls, show the dialed number (dn) instead of the entrypoint (ani)
const title = isSocial ? customerName : isOutdial ? dn || ani : ani;

// Compute disable state for accept button when auto-answering
const isAutoAnswering = incomingTask.data.isAutoAnswering || false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const extractTaskListItemData = (
//@ts-expect-error To be fixed in SDK - https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6762
const callAssociationDetails = task?.data?.interaction?.callAssociatedDetails;
const ani = callAssociationDetails?.ani;
const dn = callAssociationDetails?.dn;
const customerName = callAssociationDetails?.customerName;
const virtualTeamName = callAssociationDetails?.virtualTeamName;

Expand All @@ -33,13 +34,17 @@ export const extractTaskListItemData = (
const isTelephony = mediaType === MEDIA_CHANNEL.TELEPHONY;
const isSocial = mediaType === MEDIA_CHANNEL.SOCIAL;

// Check if this is an outdial call
const isOutdial = task?.data?.interaction?.outboundType === 'OUTDIAL';

// Compute button text based on conditions
const acceptText = isTaskIncoming ? (isTelephony && !isBrowser ? 'Ringing...' : 'Accept') : undefined;

const declineText = isTaskIncoming && isTelephony && isBrowser ? 'Decline' : undefined;

// Compute title based on media type
const title = isSocial ? customerName : ani;
// For outdial calls, show the dialed number (dn) instead of the entrypoint (ani)
const title = isSocial ? customerName : isOutdial ? dn || ani : ani;

const isAutoAnswering = task.data.isAutoAnswering || false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ exports[`CallControlCADComponent Snapshots should handle edge cases and control
</strong>

<span>
No Phone Number
555-123-4567
</span>
</mdc-text>
</div>
Expand Down Expand Up @@ -376,7 +376,7 @@ exports[`CallControlCADComponent Snapshots should handle edge cases and control
</strong>

<span>
No Phone Number
555-123-4567
</span>
</mdc-text>
</div>
Expand Down Expand Up @@ -908,7 +908,7 @@ exports[`CallControlCADComponent Snapshots should render basic call states and m
</strong>

<span>
No Phone Number
chat-customer@example.com
</span>
</mdc-text>
<mdc-tooltip
Expand All @@ -918,7 +918,7 @@ exports[`CallControlCADComponent Snapshots should render basic call states and m
<mdc-text
class="md-text-wrapper"
>
No Phone Number
chat-customer@example.com
</mdc-text>
</mdc-tooltip>
</div>
Expand Down Expand Up @@ -1178,7 +1178,7 @@ exports[`CallControlCADComponent Snapshots should render basic call states and m
</strong>

<span>
No Phone Number
555-123-4567
</span>
</mdc-text>
</div>
Expand Down Expand Up @@ -1438,7 +1438,7 @@ exports[`CallControlCADComponent Snapshots should render basic call states and m
</strong>

<span>
No Phone Number
555-123-4567
</span>
</mdc-text>
</div>
Expand Down Expand Up @@ -1925,7 +1925,7 @@ exports[`CallControlCADComponent Snapshots should render consultation and wrapup
</strong>

<span>
No Phone Number
555-123-4567
</span>
</mdc-text>
</div>
Expand Down Expand Up @@ -2219,7 +2219,7 @@ exports[`CallControlCADComponent Snapshots should render consultation and wrapup
</strong>

<span>
No Phone Number
555-123-4567
</span>
</mdc-text>
</div>
Expand Down Expand Up @@ -2480,7 +2480,7 @@ exports[`CallControlCADComponent Snapshots should render consultation and wrapup
</strong>

<span>
No Phone Number
555-123-4567
</span>
</mdc-text>
</div>
Expand Down Expand Up @@ -2741,7 +2741,7 @@ exports[`CallControlCADComponent Snapshots should render consultation and wrapup
</strong>

<span>
No Phone Number
555-123-4567
</span>
</mdc-text>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ describe('CallControlCADComponent', () => {
callAssociatedDetails: {
customerName: 'John Doe',
ani: '555-123-4567',
dn: '555-999-0000',
virtualTeamName: 'Support Team',
ronaTimeout: '30',
},
Expand Down Expand Up @@ -265,6 +266,40 @@ describe('CallControlCADComponent', () => {
chatConsultScreen.unmount();
});

it('should display correct phone number for inbound vs outdial calls', () => {
// Inbound call: caller ID = ani, phone number = ani
const inboundScreen = render(<CallControlCADComponent {...defaultProps} />);
// ani (555-123-4567) should appear as both caller ID and phone number
const aniElements = inboundScreen.getAllByText('555-123-4567');
expect(aniElements.length).toBe(2); // caller ID + phone number
// dn (555-999-0000) should NOT appear anywhere
expect(inboundScreen.queryByText('555-999-0000')).not.toBeInTheDocument();
inboundScreen.unmount();

// Outdial call: caller ID = dn, phone number = ani
const outdialProps = {
...defaultProps,
currentTask: {
...defaultProps.currentTask,
data: {
...defaultProps.currentTask.data,
interaction: {
...defaultProps.currentTask.data.interaction,
outboundType: 'OUTDIAL',
},
},
},
};
const outdialScreen = render(<CallControlCADComponent {...outdialProps} />);
// Caller ID should show dn (555-999-0000)
expect(outdialScreen.getByText('555-999-0000')).toBeInTheDocument();
// Phone number should show ani (555-123-4567)
const phoneLabel = outdialScreen.getByText('Phone Number:');
const phoneValue = phoneLabel.nextElementSibling;
expect(phoneValue?.textContent).toBe('555-123-4567');
outdialScreen.unmount();
});

it('should handle wrapup mode and edge cases', () => {
// Test wrapup mode hides elements
const wrapupProps = {
Expand Down
Loading
Loading