Contact header field issue

Asterisk 11.7.0

I have a bit of an issue regarding the header contact. Currently we’re using Asterisk as a B2BUA and bridge sip legs. In this bridging process the Asterisk seem to change the Contact header, removing the incoming header and replacing it with its own, or what it seems CALLERID(num).

Incoming contact header is as follows:
Contact: sip:anonymous@foobar.com
Outgoing contact header is as follows:
Contact: sip:+4690303030@sip.proxy.address.com

So basically we are losing the anonymous content from our contact header which present some issues with upstream operators. In this specific case the number is displayed at the called endpoint instead of “Anonymous”.

Why is Asterisk doing this and can I avoid it and save our little “anonymous” string?

Because it is a back to back user agent, not a proxy, so the Contact header represents the address to contact it, not the upstream user agent.

The ITSP is broken if they are reading any meaning into Contact other than the the SIP URI to which to direct re-INVITEs and BYEs, on a one hop basis!

They should be taking the caller ID from Remote-Party-ID or P-Asserted-Identity headers, and, if these are not present, from the the From header. See the sendrpid option for the first two.

If Asterisk forwarded the Contact header, when the ITSP tried to end the call, it would (assuming it is marginally compliant) send the BYE to foobar.com, which would reject it, because the call ID on the B leg from Asterisk is not not that from foobar.com.

Before that, it would have sent the ACK to foobar.com, which would have ignored it. As a result, Asterisk would have closed the call when the limit on sending 200 OK was exceeded.

Thank you David,

We will look into changing and using the PAI instead.