Skip to content

fix(voip): honor caller phone jid on incoming calls - #279

Open
mmhospedagem wants to merge 1 commit into
vinikjkkj:masterfrom
mmhospedagem:codex/fix-voip-incoming-caller-pn
Open

fix(voip): honor caller phone jid on incoming calls#279
mmhospedagem wants to merge 1 commit into
vinikjkkj:masterfrom
mmhospedagem:codex/fix-voip-incoming-caller-pn

Conversation

@mmhospedagem

@mmhospedagem mmhospedagem commented Sep 10, 2026

Copy link
Copy Markdown

Summary

  • read caller_pn from incoming call offers
  • preserve it in CallInfo
  • use the caller phone device JID to initialize media immediately and when a queued call is unblocked
  • add regression coverage for the incoming offer metadata

Why

The call signaling peer can be a LID while RTP/SSRC derivation needs the phone device JID advertised as caller_pn. Ignoring it can leave an accepted call without usable inbound audio.

Validation

  • focused ESLint and Prettier: passed
  • @zapo-js/voip tests: 73/73 passed
  • @zapo-js/voip typecheck: passed
  • @zapo-js/voip build (CJS and ESM): passed

A real WhatsApp call is still recommended as integration validation because the unit suite cannot reproduce Meta relay traffic.

Review in cubic

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 6834a202-054e-4837-ac6f-494d79880020

📥 Commits

Reviewing files that changed from the base of the PR and between 40a9af5 and 9f44bfd.

📒 Files selected for processing (3)
  • .changeset/calm-cats-listen.md
  • packages/voip/src/call/WaCallManager.ts
  • packages/voip/src/call/__tests__/call-manager.test.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the fix Bug fix label Sep 10, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/voip/src/call/__tests__/call-manager.test.ts">

<violation number="1" location="packages/voip/src/call/__tests__/call-manager.test.ts:198">
P3: The new regression test only asserts callerPn is preserved in CallInfo metadata; it never verifies the fix's core behavior - that initMedia is called with the caller phone JID. A regression reverting initMedia back to peerJid would still pass. Consider capturing the initMedia peer argument (e.g., spy/stub session initMedia or assert on the derived peer SSRC) so the fix is actually covered.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

'2222222222:0@lid'
)

assert.equal(manager.getCall(callId)?.callerPn, callerPn)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The new regression test only asserts callerPn is preserved in CallInfo metadata; it never verifies the fix's core behavior - that initMedia is called with the caller phone JID. A regression reverting initMedia back to peerJid would still pass. Consider capturing the initMedia peer argument (e.g., spy/stub session initMedia or assert on the derived peer SSRC) so the fix is actually covered.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/voip/src/call/__tests__/call-manager.test.ts, line 198:

<comment>The new regression test only asserts callerPn is preserved in CallInfo metadata; it never verifies the fix's core behavior - that initMedia is called with the caller phone JID. A regression reverting initMedia back to peerJid would still pass. Consider capturing the initMedia peer argument (e.g., spy/stub session initMedia or assert on the derived peer SSRC) so the fix is actually covered.</comment>

<file context>
@@ -183,6 +184,20 @@ test('incoming offer with capacity creates a second session', async () => {
+        '2222222222:0@lid'
+    )
+
+    assert.equal(manager.getCall(callId)?.callerPn, callerPn)
+})
+
</file context>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant