Caller ID in SIP and Asterisk – Part 2

Caller ID, ANI, PAI, RPI, Privacy – what Asterisk does

I didn’t plan on writing a “Part 2” to this article, but since nobody has posted any answers to my questions in Part 1, I had no option other than to test it for myself. In some ways, the answers are quite simple, but there are some subtle details that are not at all intuitive.

Please note that the descriptions given in this article were based on tests using Asterisk v1.6.

First, what does Asterisk do when it receives a P-Asserted-Identity header. The answer is an unqualified nothing! As far as I could ascertain, it ignores it totally no matter what settings you use for “trustrpid” or “sendrpid”. It does not copy it from an inbound call leg to an outbound call leg for a bridged SIP-to-SIP call.

If you want the onward leg of a call to include this header, then you must use the SipAddHeader command. The following link provides useful examples:

Next, what about the Remote-Party-ID header? Well, if you have set “sendrpid=yes” in the settings for the destination peer in sip.conf then Asterisk will always add an RPI header. Here is a typical example:

Remote-Party-ID: “Johns Linksys” <sip:1001@>;privacy=off;screen=no

The name “Johns Linksys” and the number, 1001, were taken from the From header of the inbound call leg. The IP address is the IP of the Asterisk server, but can be over-ridden using the “fromdomain” parameter in the definition of the destination peer in sip.conf.

If you set “trustrpid=yes” in the definition of the source peer in sip.conf, then Asterisk will use the number from the RPI header in the request it received on the inbound call leg.

When forwarding to an extension, Asterisk respects the privacy setting in the RPI header it receives (if there is an RPI header in the request) irrespective of any setting for “trustrpid”. However, I could not find a way to tell Asterisk to change the privacy setting for a call it is bridging (although see update below). Asterisk ignores the PAI Privacy header if the inbound call leg includes one.

Correction/Update: Check details of the SetCallerPres command. It allows you to select from a range of options for the presentation of the Caller ID in the onward leg of the call. Details here:

For part 1 of this article, click here

1 thought on “Caller ID in SIP and Asterisk – Part 2”

Comments are closed.