Summary:ASTERISK-01991: sip.conf.sample explains how user and peer works incorrectly
Reporter:Leif Madsen (lmadsen)Labels:
Date Opened:2004-07-11 15:35:04Date Closed:2004-09-25 02:37:49
Versions:Frequency of
Environment:Attachments:( 0) sip.conf.sample.diff-2
Description:Asterisk parses a type=user by looking at the username and attempting to match it to the [section] title.  If nothing matches the [section] title then a type=peer is searched first for a matching username= followed second by matching the host=.  If either of these are matched then the defined context is used.  If nothing matched, then failover to default context defined in [global]
Comments:By: Matthew Fredrickson (mattf) 2004-07-11 21:51:20

Actually that's not accurate either.  We're matching against From:

By: Brian West (bkw918) 2004-07-12 00:28:16

I think thats what he ment.

By: Olle Johansson (oej) 2004-07-12 04:46:29

"If nothing matches the [section] title then a type=peer is searched first for a matching username= followed second by matching the host=. "

I can't find that we are matching username=, after find_user fails, we are looking for peers based on IP (host=).

By: Leif Madsen (lmadsen) 2004-07-12 11:13:23

I have attached a revised version from everyone's comments.

Olle:  I looked again, and you appear to be correct.  It only matches against host= from what I can tell as well.

By: Olle Johansson (oej) 2004-07-12 11:18:50

I think that this kind of texts may not belong in the sip.conf file, but in a readme.sip (like readme.iax) where we explain all the details. What do you think? It doesn't make sense to add a lot of long explanations to the sample config, it makes it seem much more complicated than it is to get Asterisk configured and up and running...

By: Brian West (bkw918) 2004-07-12 11:19:19

Its hard to say [here] is the username if username= isn't specified.  I see in find_peer it looks for name then ip/host.  username= isn't valid in a type=user.

So I suspect that it will find [here] if username isn't specified?  I can' find the part of the code that clearly says that for sure.  But his example is alot more clear than any other.

By: Olle Johansson (oej) 2004-07-12 11:22:10

bkw: find_peer only checks peer name if the first argument is provided (peer). If not, it only checks on IP address which is used when a call comes in. Find peer checks on [name] when we dial(SIP/peername).

By: zoa (zoa) 2004-07-12 13:20:13

i think this is awfully complicated, can't this be made a little simpler ? :)

By: Leif Madsen (lmadsen) 2004-07-13 07:46:06

Are we matching against From: or Contact: ?

When I look at my SIP Debug, I don't see any From:, just Contact:

By: Brian West (bkw918) 2004-07-16 10:58:24

chan_sip was fixed so the docs are correct in cvs.