Privacy: id is set in header but ID still transmitted

Hello, my Asterisk 20 server runs for some time but I discovered today that the caller ID is transmitted although Privacy: id is set before dialing. send_pai is not set to yes. This server has provider 1&1 and Placetel. Moreover, I have an Asterisk 18 server at another location with the same extension code and provider Vodafone and Placetel.

Calling via 1&1 or Placetel ignores the Privacy: id of the INVITE and transmits the caller ID. Calling via Vodafone with the same extensions transmits no caller ID but “anonymous”.

The INVITE messages (packets sniffed at router) all look similar:

Via: SIP/2.0/UDP;rport;branch=z9hG4bKPjb24fa012-5f22-4a7f-96c4-02a36dcea727
From: "040YYY" <>;tag=ef8576d9-17c9-42f6-8d11-02cde8828788
To: <>
Contact: <sip:asterisk@>
Call-ID: 16f78b31-000b-47b1-8b91-3173741ad6fc
CSeq: 7036 INVITE
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Privacy: id
Max-Forwards: 70
User-Agent: Asterisk PBX 20.1.0
Content-Type: application/sdp
Content-Length: 265 

(followed by 
  SIP/2.0 100 trying
  -> SIP/2.0 407 Proxy Authentication Required
  -> ACK
  -> INVITE (with Proxy Auth AND Privacy: id)
 and the call is initiated)

Extensions for dialing:

exten = _*779X.,1,Noop(dial)
 same = n,Dial(PJSIP/${EXTEN:4}@trunkID,,b(predial-handler^addheaderanon^1))

exten = addheaderanon,1,Set(PJSIP_HEADER(add,Privacy)=id)
 same = n,Return()

I’m confident that the Asterisk version does not matter since Placetel transmits the caller ID on both servers. And I doubt that 1&1 and Placetel prevent calling anonymously because both provider allow me to set outgoing numbers to anonymous via web configuration. Additionally, Placetel provides a FAQ (Google Translate) that explicitly notes Privacy: id.

I already compared the trunk configurations but could not identify any clue.
What parameter might affect the Privacy: id setting?
Thanks for help.

You’re adding the Privacy header yourself, so there is no parameter that affects it. The only things in your INVITE are the From header and the Privacy header which are related to callerid. You’d need to ask upstream.

Or do you mean something else - are you expecting you adding the Privacy header to somehow affect Asterisk?

If you add a header manually, even if it is a header that Asterisk con control itself, it will have have no side effects locally. In any case, I think the intent of Privacy is to tell the next hop not to propagate information that is present and valid, so I don’t think it would help, even if you set an options whose effect included sending it.


are You sure the provider supports privacy:id? Maybe try setting “Anonymous” in the From-header works for You. Set this statement


just before the dial-statement.

That did the trick! I tested it with both provider and it works. Caller ID is not sent. To bad I could not find any hint about that when extensively searching the web and wiki for a solution.

Also thank you @jcolp and @david551 for your input.
@jcolp I did not expect that the Privacy Header affects Asterisk.

Wish you all the best.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.