Description
Steps to reproduce
- Configure a PJSIP trunk with a static/permanent contact toward a provider on a public IP (e.g.
contact = sip:user@203.0.113.5:5060, max_contacts = 0, no inbound REGISTER)
- Start
nethcti-server (astproxy issues PJSIPShowContacts and processes the ContactStatusDetail for that contact)
Expected behavior
astproxy parses the contact details without crashing; nethcti-server stays up.
Actual behavior
astproxy throws and the exception bubbles up to the global uncaughtException handler, which calls process.exit(1). systemd restarts the service, it hits the same contact again → restart loop (observed 1000+ restarts). The CTI is unusable and every login returns 401, because the server never stays up long enough to authenticate.
error: [pjsipDetails] TypeError: Cannot read property 'split' of undefined
at Object.data (/app/node_modules/@nethesis/astproxy/lib/plugins_command_13/pjsipDetails.js:132:52)
at AsteriskAmi.onData (/app/node_modules/@nethesis/astproxy/lib/astproxy.js:431:23)
...
error: [nethcti] UncaughtException !!!
Root cause
lib/plugins_command_13/pjsipDetails.js:132:
// check if the IP is private otherwise get it from callid
if (!util.isPrivateIP(list[data.actionid].ip)){
list[data.actionid].ip = data.callid.split('@')[1]; // data.callid may be undefined
}
The code assumes callid is always present. For a statically configured (non-registered) contact, Asterisk sends ContactStatusDetail without a CallID. When such a contact also has a public IP (isPrivateIP returns false), the branch dereferences undefined.split and throws. It never triggers on LAN phones (private IPs skip the branch), so it only surfaces on installations with a public-IP static trunk contact.
Introduced in commit 77b79c4 (#15, "fix(privateIp): added private ip fallback to physical phones"). Still present in 0.0.37 / HEAD.
Suggested fix
Guard callid before splitting:
if (data.callid && !util.isPrivateIP(list[data.actionid].ip)){
list[data.actionid].ip = data.callid.split('@')[1];
}
Components
@nethesis/astproxy 0.0.35 (shipped in ghcr.io/nethesis/nethvoice-cti-server:1.7.3)
- NethVoice module 1.7.3 on NS8
Description
Steps to reproduce
contact = sip:user@203.0.113.5:5060,max_contacts = 0, no inbound REGISTER)nethcti-server(astproxy issuesPJSIPShowContactsand processes theContactStatusDetailfor that contact)Expected behavior
astproxy parses the contact details without crashing;
nethcti-serverstays up.Actual behavior
astproxy throws and the exception bubbles up to the global
uncaughtExceptionhandler, which callsprocess.exit(1). systemd restarts the service, it hits the same contact again → restart loop (observed 1000+ restarts). The CTI is unusable and every login returns 401, because the server never stays up long enough to authenticate.Root cause
lib/plugins_command_13/pjsipDetails.js:132:The code assumes
callidis always present. For a statically configured (non-registered) contact, Asterisk sendsContactStatusDetailwithout aCallID. When such a contact also has a public IP (isPrivateIPreturns false), the branch dereferencesundefined.splitand throws. It never triggers on LAN phones (private IPs skip the branch), so it only surfaces on installations with a public-IP static trunk contact.Introduced in commit
77b79c4(#15, "fix(privateIp): added private ip fallback to physical phones"). Still present in0.0.37/ HEAD.Suggested fix
Guard
callidbefore splitting:Components
@nethesis/astproxy0.0.35 (shipped inghcr.io/nethesis/nethvoice-cti-server:1.7.3)