Skip to content

fix(pjsip): guard undefined callid on non-private contact - #33

Open
tonyco97 wants to merge 1 commit into
masterfrom
issue_8109
Open

fix(pjsip): guard undefined callid on non-private contact#33
tonyco97 wants to merge 1 commit into
masterfrom
issue_8109

Conversation

@tonyco97

Copy link
Copy Markdown
Collaborator

Problem

astproxy crashes with an uncaught TypeError: Cannot read property 'split' of undefined at pjsipDetails.js when processing a ContactStatusDetail for a PJSIP contact that has a public IP and no Call-ID.

The exception bubbles up to the global uncaughtException handler in nethcti-server, which calls process.exit(1). systemd restarts the service, it hits the same contact again → restart loop (observed 1000+ restarts on a customer install). The CTI becomes unusable and every login returns 401 because the server never stays up.

Root cause

data.callid.split('@')[1] assumes callid is always present. For a statically configured (non-registered) contact — typical of a provider trunk with a permanent contact= and max_contacts=0 — Asterisk sends ContactStatusDetail without a CallID. When such a contact also has a public IP (isPrivateIP returns false), the code enters the branch and dereferences undefined.

It never triggers on LAN phones (private IPs skip the branch), so it only surfaces on installs with a public-IP static trunk contact.

Fix

Guard callid before splitting. When absent, keep the IP already derived from viaaddress/uri.

Regression analysis

.ip is display-only (exposed via toJSON, shown in the CTI); it is not used for call routing or auth.

Fixes NethServer/dev#8109

@tonyco97
tonyco97 requested a review from tommaso-ascani July 21, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Astproxy: uncaughtException "Cannot read property 'split' of undefined" on PJSIP contact with public IP and no Call-ID → nethcti-server restart loop

2 participants