import { test } from '@playwright/test'; import { markManual } from '../../helpers/manual'; // All tests in this group require active SIP endpoints, PSTN access, or real telephony // infrastructure. They cannot be driven by Playwright + MCP alone. test.describe('pbx-calls', () => { test('pbx-calls-check-internal_extension_to_extension_audio_call', async ({ page }, testInfo) => { testInfo.annotations.push({ type: 'automationStatus', description: 'manual' }); testInfo.annotations.push({ type: 'testType', description: 'check' }); markManual('Requires two active SIP endpoints (phones or softphones) and human verification of two-way audio quality'); testInfo.annotations.push({ type: 'description', description: 'Verify an internal extension-to-extension audio call connects, audio is bi-directional, and CDR is generated' }); // Manual steps: // 1. Register extension 1001 on Phone A, extension 1002 on Phone B. // 2. From Phone A, dial 1002. // 3. Verify Phone B rings and shows Caller ID of 1001. // 4. Answer on Phone B. Verify two-way audio on both handsets. // 5. Hang up. Verify both phones return to idle state. // 6. In admin portal → Logs → CDR, verify a CDR record is created with correct extension, duration, direction. // 7. Record: call setup time (ms), audio quality (MOS if tool available), CDR accuracy. }); test('pbx-calls-check-inbound_call_from_sip_trunk_pstn', async ({ page }, testInfo) => { testInfo.annotations.push({ type: 'automationStatus', description: 'manual' }); testInfo.annotations.push({ type: 'testType', description: 'check' }); markManual('Requires live SIP trunk connectivity to PSTN, a real DID number, and a phone to receive the call'); testInfo.annotations.push({ type: 'description', description: 'Verify an inbound call from a SIP trunk (PSTN) routes correctly to the configured destination' }); // Manual steps: // 1. Ensure a SIP trunk is registered and active in admin portal. // 2. Configure an inbound route for the DID to an extension or ring group. // 3. Dial the DID from an external PSTN number. // 4. Verify the call rings the configured destination. // 5. Answer and verify two-way audio. // 6. Check CDR shows inbound direction, correct DID, and trunk name. }); test('pbx-calls-check-outbound_call_to_sip_trunk_pstn_with_caller_id', async ({ page }, testInfo) => { testInfo.annotations.push({ type: 'automationStatus', description: 'manual' }); testInfo.annotations.push({ type: 'testType', description: 'check' }); markManual('Requires live SIP trunk, ability to dial a PSTN number, and verification of Caller ID as seen by the receiving party'); testInfo.annotations.push({ type: 'description', description: 'Verify outbound call via SIP trunk completes and presents the correct Caller ID on the receiving end' }); // Manual steps: // 1. From a registered extension, dial an outbound number (e.g., 9 + number). // 2. Verify the call routes through the configured outbound rule and SIP trunk. // 3. Answer on the receiving PSTN phone. Verify Caller ID matches configured outbound CID. // 4. Confirm two-way audio. // 5. Review CDR for outbound direction, trunk used, and Caller ID value. }); test('pbx-calls-check-caller_id_presentation_restriction_and_pai', async ({ page }, testInfo) => { testInfo.annotations.push({ type: 'automationStatus', description: 'manual' }); testInfo.annotations.push({ type: 'testType', description: 'check' }); markManual('Requires active call sessions and SIP packet capture (Wireshark) to verify P-Asserted-Identity header values in SIP INVITE messages'); testInfo.annotations.push({ type: 'description', description: 'Verify Caller ID presentation, Anonymous restriction (CLIR), and P-Asserted-Identity (PAI) header in SIP INVITE' }); // Manual steps: // 1. Test CLIR: dial *67 + number from a registered extension; verify receiving end sees Anonymous/Unknown. // 2. Capture SIP traffic with Wireshark during a call with PAI configured. // 3. Inspect INVITE packets: verify P-Asserted-Identity header contains the correct identity. // 4. Test outbound CID override: verify configured CID appears in From and PAI headers. // 5. Document: PAI value observed, From header value, CLIR behaviour. }); test('pbx-calls-check-call_hold_resume_and_music_on_hold', async ({ page }, testInfo) => { testInfo.annotations.push({ type: 'automationStatus', description: 'manual' }); testInfo.annotations.push({ type: 'testType', description: 'check' }); markManual('Requires an active two-party call; Hold/Resume is a mid-call feature and Music on Hold requires audio monitoring with actual SIP phone hardware'); testInfo.annotations.push({ type: 'description', description: 'Verify call hold, resume, and Music on Hold (MoH) playback work correctly' }); // Manual steps: // 1. Establish a call between two extensions. // 2. Press Hold on Phone A. Verify Phone B hears Music on Hold. // 3. Verify hold music is the configured MoH file (recognisable audio). // 4. Press Resume on Phone A. Verify two-way audio is restored instantly. // 5. Record: hold activation time, MoH audio quality, resume time. }); test('pbx-calls-check-call_waiting_notification_and_switching', async ({ page }, testInfo) => { testInfo.annotations.push({ type: 'automationStatus', description: 'manual' }); testInfo.annotations.push({ type: 'testType', description: 'check' }); markManual('Requires concurrent call sessions on the same extension with a physical or softphone capable of handling call-waiting signals'); testInfo.annotations.push({ type: 'description', description: 'Verify call waiting notification is presented and the user can switch between active and waiting calls' }); // Manual steps: // 1. Establish an active call on extension 1001. // 2. While 1001 is in-call, have a second caller dial 1001. // 3. Verify extension 1001 hears call-waiting tone / sees notification. // 4. Switch to the waiting call (flash / hold key). Verify first caller is put on hold. // 5. Switch back. Verify first call is resumed and second caller is on hold. // 6. Hang up both calls. Record behaviour. }); test('pbx-calls-check-three_way_conference_and_multi_party_bridge', async ({ page }, testInfo) => { testInfo.annotations.push({ type: 'automationStatus', description: 'manual' }); testInfo.annotations.push({ type: 'testType', description: 'check' }); markManual('Requires three or more active SIP endpoints and a working conference bridge; audio verification for all participants requires human listeners'); testInfo.annotations.push({ type: 'description', description: 'Verify three-way conference call and multi-party conference bridge functionality' }); // Manual steps: // 1. Extension 1001 calls 1002. Both are in active audio call. // 2. 1001 initiates a transfer/conference to 1003. // 3. Verify all three parties hear each other clearly. // 4. Verify admin portal shows the conference with 3 participants. // 5. One participant drops. Verify remaining two continue their call. // 6. Test via dedicated conference room: dial conference number, enter PIN, verify all hear each other. }); });