Steps to reproduce
- Configure a static, unauthenticated PJSIP/GNR trunk in NethVoice.
- Configure the trunk to send traffic through NethVoice Proxy as outbound proxy.
- Receive an inbound call from the provider through the proxy.
- Check the trunk identification in Asterisk/PBX reports.
Expected behavior
Inbound calls from proxied static GNR trunks are associated with the configured trunk.
When Kamailio forwards an initial inbound INVITE to Asterisk, it must preserve the real provider source IP in the SIP X-Forwarded-For header. NethVoice must then identify eligible proxied PJSIP trunks with a PJSIP match_header rule against that header, so Asterisk matches the provider IP instead of the proxy IP.
Actual behavior
Asterisk receives the inbound INVITE from the proxy address, not directly from the provider address. Without an additional identity hint, IP-based trunk matching sees the proxy/local address and the call is classified as anonymous; PBX reports consequently show the call as anonymous instead of linked to the GNR trunk.
Implemented fix
- NethVoice Proxy adds
X-Forwarded-For: <provider source IP> to initial inbound INVITE requests before forwarding them to Asterisk. The header is added in both the normal inbound routing path and the HANDLE_ALIAS shortcut path, and existing X-Forwarded-For values are removed before inserting the new one.
- NethVoice creates a PJSIP
match_header identify entry for static proxied PJSIP trunks when:
- registration is disabled (
registration = none),
- authentication is
none or outbound,
- trunk name and SIP server are configured,
- outbound proxy points to the configured NethVoice Proxy address.
- If the trunk SIP server is a hostname, NethVoice resolves it to an IP address before creating the
X-Forwarded-For match rule.
- PJSIP identifier order is changed to prefer header matching before IP/username matching, and to evaluate
auth_username before anonymous.
Relevant links
Steps to reproduce
Expected behavior
Inbound calls from proxied static GNR trunks are associated with the configured trunk.
When Kamailio forwards an initial inbound
INVITEto Asterisk, it must preserve the real provider source IP in the SIPX-Forwarded-Forheader. NethVoice must then identify eligible proxied PJSIP trunks with a PJSIPmatch_headerrule against that header, so Asterisk matches the provider IP instead of the proxy IP.Actual behavior
Asterisk receives the inbound
INVITEfrom the proxy address, not directly from the provider address. Without an additional identity hint, IP-based trunk matching sees the proxy/local address and the call is classified asanonymous; PBX reports consequently show the call as anonymous instead of linked to the GNR trunk.Implemented fix
X-Forwarded-For: <provider source IP>to initial inboundINVITErequests before forwarding them to Asterisk. The header is added in both the normal inbound routing path and theHANDLE_ALIASshortcut path, and existingX-Forwarded-Forvalues are removed before inserting the new one.match_headeridentify entry for static proxied PJSIP trunks when:registration = none),noneoroutbound,X-Forwarded-Formatch rule.auth_usernamebeforeanonymous.Relevant links