mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-07-04 19:32:01 +00:00
fix: use PAI sip: identity for auto-computed Referred-By header
When referredBy is not explicitly provided, the code was using callingNumber (user part only) combined with the SBC's internal IP from dlg.remote.uri. This produced a Referred-By with an IP address (e.g. sip:+number@10.x.x.x) that carriers like Verizon reject. Instead, extract the full sip: name-addr from the P-Asserted-Identity header, which preserves both the display name and the original FQDN (e.g. "Cha Van" <sip:+number@ims.lte.wal.verizon.com>). Falls back to the previous behavior when PAI is not available. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+13
-1
@@ -122,8 +122,20 @@ class TaskSipRefer extends Task {
|
||||
}
|
||||
else this.referToIsUri = true;
|
||||
if (!referredBy) {
|
||||
/* default */
|
||||
/* default: extract the sip: identity from PAI, preserving the original domain */
|
||||
const paiHeader = cs.req?.has('p-asserted-identity') ? cs.req.get('p-asserted-identity') : null;
|
||||
if (paiHeader) {
|
||||
const parts = paiHeader.split(/,\s*(?=")/);
|
||||
for (const part of parts) {
|
||||
if (/<sips?:/.test(part)) {
|
||||
referredBy = part.trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!referredBy) {
|
||||
referredBy = cs.req?.callingNumber || dlg.local.uri;
|
||||
}
|
||||
this.logger.info({referredBy}, 'setting referredby');
|
||||
}
|
||||
if (!referredByDisplayName) {
|
||||
|
||||
Reference in New Issue
Block a user