[Home]

Summary:ASTERISK-17821: Def. Username field is incorrect
Reporter:newborn (newborn)Labels:
Date Opened:2011-05-09 09:04:56Date Closed:2011-05-09 09:11:59
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/General
Versions:1.6.2.18 Frequency of
Occurrence
Related
Issues:
is related toASTERISK-20093 sip show field "Def. Username:" displays incorrect value after config file change and asterisk reload while device still registered
Environment:Attachments:
Description:Has not found in any documentation, so this may be the bug.
When i type <sip show peer xxxx> , it displays "Def. Username: yyyy"
in sip.conf i tried to put in field defaultuser= or username= some values, but "Def. Username" is not changing.
Comments:By: Leif Madsen (lmadsen) 2011-05-09 09:11:49

I have tested this with Asterisk trunk, and am unable to reproduce this. The answer is 'defaultuser' does indeed change the Def. Username field in Asterisk. For a peer I didn't have any Def. Username at all, I added 'defaultuser=foobar' and it showed up as 'foobar'. Changing it to 'lmadsen' caused it to show up as 'lmadsen'.

The only thing I noticed was removing it entirely kept the defaultuser in memory. To clear it, you either need to unload chan_sip.so and then load it back into memory, or add 'defaultuser=' to the peer, reload chan_sip, then remove it from the peer definition after that.

----

Per the Asterisk maintenance timeline page at http://www.asterisk.org/asterisk-versions maintenance (bug) support for the 1.4 and 1.6.x branches has ended. For continued maintenance support please move to the 1.8 branch which is a long term support (LTS) branch.

For more information about branch support, please see https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions

By: Sean Allison (cakerack) 2012-07-05 03:34:07.398-0500

Hi All - OK I have managed to reproduce this!  I am running several flavours of Asterisk (mainly 1.8.x.and 10.x) and it happens in both of them.  

Firstly I set up a new client:

[0001]
type=friend
host=dynamic
defaultuser=Bob
secret=123456
context=phones
callerid=Bob <0001>
call-limit=10
qualify=yes

I now do a reload and a 'sip show peer 0001' and I get the following:

* Name       : 0001
Secret       : <Set>
...
Callerid     : "Bob" <0001>
...
Addr->IP     : (null)
...
Def. Username: Bob
...

I now edit sip.conf and change 'Bob' to 'John' as follows:

[0001]
type=friend
host=dynamic
defaultuser=John
secret=123456
context=phones
callerid=John <0001>
call-limit=10
qualify=yes

I now reload asterisk and 'sip show peer 0001' and I get:

* Name       : 0001
Secret       : <Set>
...
Callerid     : "John" <0001>
...
Addr->IP     : (null)
...
Def. Username: John
...

So far, so good.  However, this is all assuming you dont actually have a SIP client registered against this client.  So now, connect a SIP device and get it to register using this account, and now do a 'sip show peer 0001' and you will get:

* Name       : 0001
Secret       : <Set>
...
Callerid     : "John" <0001>
...
Addr->IP     : 172.16.20.189:5060
...
Def. Username: John
...

So again, all is OK.  Now, leaving the device registered, edit your sip.conf back to the original "Bob" settings as follows:

[0001]
type=friend
host=dynamic
defaultuser=Bob
secret=123456
context=phones
callerid=Bob <0001>
call-limit=10
qualify=yes

Reload Asterisk and do a 'sip show peer 0001' and you get:

* Name       : 0001
Secret       : <Set>
...
Callerid     : "Bob" <0001>
...
Addr->IP     : 172.16.20.189:5060
...
Def. Username: John
...

So... even though your sip.conf has the defaultuser set to 'Bob', the 'sip show peer 0001' doesnt reflect this.  Also do a 'sip show peers' and this will also be incorrect as follows:

Name/username  Host          Dyn Forcerport ACL Port     Status
0001/John      172.16.20.189  D                 5060     OK (10 ms)

To get around this, if you de-register your SIP device from Asterisk and then do a reload, this seems to fix it.  Note - you cant just switch your device off, as the 'sip show peers' command will show your device as unreachable, as follows:

Name/username  Host          Dyn Forcerport ACL Port     Status
0001/John      172.16.20.189  D                 5060     UNREACHABLE

This might time out eventually, but the quick way is if you properly de-register your session you will get the following (I did this in an SPA504G by selecting Menu option 13 - reboot):

Name/username  Host          Dyn Forcerport ACL Port     Status
0001/John      (Unspecified)  D                 5060     UNKNOWN

You will also get the following on the Asterisk console:

   -- Unregistered SIP '0001'

Now do an asterisk reload and you should find a 'sip show peer 0001' will give you:

* Name       : 0001
Secret       : <Set>
...
Callerid     : "Bob" <0001>
...
Addr->IP     : 172.16.20.189:5060
...
Def. Username: Bob
...

... and...

Name/username  Host          Dyn Forcerport ACL Port     Status
0001/Bob       (Unspecified)  D                 5060     UNKNOWN

Maybe someone could confirm this as either a bug or by design?

Cheers

Sean