Posts Tagged ‘display-name’

OpenSIPS: Adding CALLERID (display-name) to calls from registered users

Thursday, November 21st, 2019

This is about adding a display name to the calls from registered users. An analogue of Asterisk’s Set(CALLERID(name)=John Doe).

The idea was to move SIP accounts from Asterisk to OpenSIPS.

In case of using Asterisk we would configure something like:

callerid=Alexey Kazantsev <222>

How to achieve the same with OpenSIPS? This is the solution:

  • add desired display-names to ‘rpid’ columns of the ‘subscriber‘ table:
Adding desired callerid to ‘rpid’ column of the SIP-account.
modparam("auth_db", "load_credentials", "$avp(display)=rpid")
  • add ‘attr_avp‘ parameter to ‘registrar’ module settings:
modparam("registrar", "attr_avp", "$avp(display)")
  • and finally some magic in the script, to add the display-name to the INVITE request from the registered user, going through our OpenSIPS SBC:
# call from registered user -> add callerid
# and forward to mediaserver for call recording, etc.
# replace only display and do not touch uri

How it looks like?

This is the INVITE coming to OpenSIPS:

2019/11/21 14:16:55.247856 ->
Via: SIP/2.0/UDP;branch=z9hG4bK-3822b894
From: <>;tag=48b014547f398294o1

And this is the same INVITE leaving OpenSIPS, being modified:

2019/11/21 14:16:55.252518 ->
INVITE sip:111@ SIP/2.0
Record-Route: <sip:;lr;ftag=48b014547f398294o1>
Via: SIP/2.0/UDP;branch=z9hG4bK77e6.9bb3aa72.0
Via: SIP/2.0/UDP;branch=z9hG4bK-3822b894
From: "Alexey Kazantsev" <>;tag=48b014547f398294o1

The information stored in the ‘rpid’ column (in our example, or some custom in your architecture) is fetched to AVP at each REGISTER/save, so you do not need to reload anything to take changes in effect.

The callerid info is seen in console output via ‘opensipsctl fifo ul_dump’ command:

		Contact:: sip:222@ Q=
			ContactID:: 3039507536010050217
			Expires:: 42
			Callid:: 9fdd26c2-6de37105@
			Cseq:: 35746
			User-agent:: Cisco/SPA303-7.6.2c
			State:: CS_NEW
			Flags:: 0
			Socket:: udp:
			Methods:: 5247
			Attr:: Alexey Kazantsev