Update defaultuser on Asterisk Database (SIP/Registry)

Here is the problem, when I update the defaultuser in the sip.conf it does not update on database show, exemple:

I create a new peer on sip.conf:

[8001]
type=friend
defaultuser=Celso
secret=8001
host=dynamic
context=interno
disallow=all
allow=alaw
allow=ulaw
callerid=Celso <8001>

Then I used the command database show:

asterisk*CLI> database show
/SIP/Registry/8001                                : 172.16.1.1:5060:900:Celso:sip:8001@172.16.1.1:5060

If I change Celso to Junior in sip.conf:

[8001]
type=friend
defaultuser=Junior
secret=8001
host=dynamic
context=interno
disallow=all
allow=alaw
allow=ulaw
callerid=Junior <8001>

If I use the command database show again, the defaultuser have not changed from Celso to Junior, it still show Celso!

asterisk*CLI> database show
/SIP/Registry/8001                                : 172.16.1.1:5060:900:Celso:sip:8001@172.16.1.1:5060

Is there a way to when the defaultuser is changed in sip.conf the defaultuser stored on database show is updated automaticaly?

It is not a problem if you are using sip.conf, but if you are using RealTime like my, when you change the defaultuser on the ODBC/postgres database, then when the peer register the Asterisk update the collumn defaultuser on the ODBC/postgres side based on the information found on the Asterisk database show.

I am Using Asterisk 16.4.0
ODBC/Postgres

I read in and old post these fields doesn’t work with RealTime, dont know if you Asterisk vesion is affected by this issue

  • defaultip
  • defaultuser
  • regserver
  • regseconds
  • mask
  • fromuser
  • fromdomain

One workaround would be trying use username instead. I know Asterisk doucumenation suggest the following

Note: The parameter “username” is not the username and in most cases is
; not needed at all. Check below. In later releases, it’s renamed
; to “defaultuser” which is a better name, since it is used in
; combination with the “defaultip” setting.

Hi,
in sip.conf if you try to use username, you will get a message telling you that:

The ‘username’ field for sip peers has been deprecated in favor of the term ‘defaultuser’

On the table sippeers you don’t have the column username so in this case you have to use defaultuser.

I am looking for a simple solution, that maybe already exist, since asterisk is capable to create automatically new entries on his database as:

/SIP/Registry/8001 : 172.16.1.1:5060:900:Celso:sip:8001@172.16.1.1:5060

It is expected that asterisk should be capable to update and delete his records based on the information that it collect.

What I whant to know is if asterisk can or can’t do this, and if it does, what I have to do, what I have to set, to make it work propely.

I don’t know what this old post is about exactly, but columns such as:

  • ipaddr
  • fullcontact
  • lastms
  • useragent
  • regseconds
  • port
    they are expected to be updated but not defaultuser, it should be the opposite, the registy defaultuser on asterisk database should be updated based on the values configured in sip.conf or the values configured on the table sippeers.

Here is an example of asterisk updating the table sippeers:
2020-04-22 14:52:46.262 -03 [21494] asterisk@anequim_config LOG: comando: UPDATE sippeers SET ipaddr = '10.100.0.168', fullcontact = 'sip:8163@10.100.0.168:5060', lastms = '16', useragent = 'Yealink SIP-T19P_E2 53.84.0.15', defaultuser = 'Pré-pesagem - Italianinho', regseconds = '1587578026', port = '5060' WHERE name = '8163'

I know about that warning, I highlighted it on my first post, but just a warning you still can use username.

Yes you re right I just checked the DB structure and colum it is missing that colum, I dint realized it before, becuase I switched to pjsip. all chan_si support (and patches) is provided only by the community , not by Sangoma. So if is this is an issue with chan_sip you will need to wait some one on the commnuty fix it. And I agree with you ,information should be updated automatically on the Asterisk internal DB, that DB should be automtically updated by the module

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