Properly overriding caller ID

Written at lunch time in English • Tags: ,

I don’t usually call myself so I hadn’t until recently made note of my own caller ID not being what it should. Looking at CDR logs the caller ID on one of my phones changed in September 2012 from “my” extension to the extension of the phone device.1

I use callerid= in sip.conf to set the caller ID. Turns out there are people complaining that the setting doesn’t work. But clearly it has worked fine for me for a long time, and there are other people insisting the same. Something else must be happening here.

This is where I should approach things scientifically and do a packet capture to analyze the call setup. However, I was too lazy to get right to that. I thought that I must have upgraded the phone firmware for it to behave differently. A device typically doesn’t have a separate setting for its caller ID number (only name), sending its username as the “number.” Maybe its assertion of identity was being preferred over the sip.conf setting.

By default my configuration trusts remote party ID headers from peers.

[general]
trustrpid=yes

I amended the peer entry of the phone to not trust those headers and the problem was gone.

[1001]
...
trustrpid=no
callerid=Kimmo <1000>
...

As I do want to set the caller ID in sip.conf it is obvious in hindsight that any identity asserted by the peer should be overridden. Therefore each peer entry for a device had to be updated to avoid this problem from recurring with other phones.2

On further examination, I upgraded Asterisk on the exact day when the first incorrect CDR was logged. It could be that version 1.8 is prioritizing (some of) the headers from the device and the configuration in sip.conf differently from version 1.6. The changed behavior only manifested itself with the SPA942 in my setup.3

I should note firmware upgrades here on the blog going forward, to have a record of them. I guess some kind of a QA plan for Asterisk functionality would also be desirable, so that all “critical” functionality could be tested after upgrades.


  1. I assign extensions to people and devices separately. This way you can call each device directly, if needed. Each device is configured to display its own extension to aid “call me back at 1001” types of messages if you are calling from someone else’s phone. However, the caller ID of each phone is set to the extension of the primary person using that phone. Typically calling a person rings multiple devices by default or uses an active follow-me. 

  2. I know about templates, but I haven’t modernized my configuration that much yet. 

  3. Even the SPA3102 and SPA2102 adapters kept working the same as before.