[Home]

Summary:ASTERISK-14941: [patch] sippeers loaded with realtime are treated as type=friends, no matter what type is in the db
Reporter:Karsten Schmidt (guggemand)Labels:
Date Opened:2009-10-05 12:28:01Date Closed:2010-05-24 16:47:05
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) realtime-type-fix.patch
Description:When using realtime sippeers the peers show up in both

sip show peer <name> load
sip show user <name> load

They are also matched by this code in chan_sip.c, even though they have type=peer
/* First find devices based on username (avoid all type=peer's) */
peer = find_peer(of, NULL, TRUE, FINDUSERS, FALSE);
Comments:By: Leif Madsen (lmadsen) 2009-10-06 12:58:56

Some additional information from IRC (thanks seanbright!)

12:23 < Gugge> as far as i can tell realtime in 1.6.1 doesnt load sipusers anymore, and loads entries from sippeers as both users
              and peers, ignoring the type column in the table. Anyone wanna help me debug why? :)
12:27 <@kpfleming> did you read UPGRADE.txt?
12:27 <@kpfleming> in 1.6.1, 'type=user' is gone
12:30 -!- nandersson [n=nanderss@72.Red-88-28-236.staticIP.rima-tde.net] has quit ["Leaving"]
12:32 < Gugge> i read about that somewhere .. but using type=peer in a static sip.conf avoids the peer lookup in chan_sip.conf
12:32 < Gugge> /* First find devices based on username (avoid all type=peer's) */
12:32 < Gugge> using realtime nomatter what i type in the type column it matches there
12:45 < Gugge> kpfleming, would you say its by design that a realtime peer is matched based on username only, or should i fill a
              bugreport?
12:45 <@kpfleming> i do not know enough to say for sure
12:45 < Gugge> if its by design ill just remove the username matching from my source
12:45 <@kpfleming> i'd suggest raising this question on the asterisk-dev list
12:45 < Gugge> ill try, thankyou
12:49 <@jsmith> kpfleming: I thought that was just in memory... not in the config files
12:49 <@kpfleming> maybe i'm misunderstanding then
12:49 <@kpfleming> i think you may be right, actually
12:50 <@kpfleming> both type=peer and type=user are stored in the same structures
12:50 <@kpfleming> so then this sounds like a bug
12:50 < Gugge> i guess i could try another backend than mysql too
12:50 <@jsmith> "kill the user" was for killing the user structure in memory, not killing the "user" device type in sip.conf
12:51 <@kpfleming> the backend type should not matter
12:52 < Gugge> it just seems like all entries in the sippeers table is loaded as frineds
12:52 < Gugge> friends
12:52 < Gugge> no matter if type is set or not on them
12:53 <@kpfleming> yes, i'd say that is a bug, and you should look through the issue tracker to see if it's been reported already
12:54 < Gugge> will do

By: Karsten Schmidt (guggemand) 2009-10-06 15:25:59

With type=user in the database the user is never loaded.
With type=friend in the database the friend is loaded, and shows up in
sip show peers and sip show users (if cache is enabled)

With type=peer in the database the peer is loaded, and shows up in
sip show peers, but not in sip show users (if cache is enabled)

Getting realtime_peer to return both peers and users, and getting find_peer to
return the right types when using realtime should be fixed by the attached patch

By: Leif Madsen (lmadsen) 2009-10-07 09:13:13

License approved. Thanks!

By: Leif Madsen (lmadsen) 2009-10-07 09:13:51

If you can get some people from the asterisk-users or asterisk-dev mailing list to confirm and test this patch, that would be excellent. Otherwise we'll just have to wait for it to be reviewed. Thanks!

By: Mark Michelson (mmichelson) 2010-05-24 16:32:04

The patch looks good by me. Thanks for catching another remnant of the "kill the user" patch and thanks very much for contributing!

By: Digium Subversion (svnbot) 2010-05-24 16:44:31

Repository: asterisk
Revision: 265449

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r265449 | mmichelson | 2010-05-24 16:44:30 -0500 (Mon, 24 May 2010) | 11 lines

Allow type=user SIP endpoints to be loaded properly from realtime.

(closes issue ASTERISK-14941)
Reported by: Guggemand
Patches:
     realtime-type-fix.patch uploaded by Guggemand (license 897)
 (altered by me slightly to avoid ref leaks)
Tested by: Guggemand



------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=265449

By: Digium Subversion (svnbot) 2010-05-24 16:47:05

Repository: asterisk
Revision: 265450

_U  branches/1.6.2/
U   branches/1.6.2/channels/chan_sip.c

------------------------------------------------------------------------
r265450 | mmichelson | 2010-05-24 16:47:04 -0500 (Mon, 24 May 2010) | 16 lines

Merged revisions 265449 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r265449 | mmichelson | 2010-05-24 16:44:30 -0500 (Mon, 24 May 2010) | 11 lines
 
 Allow type=user SIP endpoints to be loaded properly from realtime.
 
 (closes issue ASTERISK-14941)
 Reported by: Guggemand
 Patches:
       realtime-type-fix.patch uploaded by Guggemand (license 897)
   (altered by me slightly to avoid ref leaks)
 Tested by: Guggemand
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=265450