[asterisk-users] Order of matching SIP packet to sections in sip.conf

Filipe Brandenburger filipe.brandenburger at genizon.com
Wed Aug 8 10:26:18 CDT 2007


Hi,

When Asterisk receives SIP INVITE packets, it tries to match the packet
to a section on sip.conf, so that it can know what context of the
dialplan should be used, what codec's are allowed, etc. (what else does
it do here?)

I would like to know what is exactly the order for this matching
considering Asterisk 1.4.

I guess it's something like this:
1. It tries to find type=peer sections where the host=... setting is the
same as the "Host:" header on the SIP packet.
2. It tries to find type=user sections where the username or the thing
in [...] is the same as the authenticated username on the SIP packet.
3. It tries to find domain=... on the [default] section, where the
configured domain is the same as the @... part on the "To:" header on
the SIP packet.

I guess it's more or less like this, but I'm not certain of the
details... could someone tell me exactly how it's done? If you can point
me to the code that does it, it would be fine.

Also, regarding authentication, as far as I know, usually SIP INVITE
packets are sent unauthenticated, then Asterisk will reply with an 403
Proxy Auth Required, and then the original UAC will retry, now sending a
SIP INVITE packet with authentication information. Where, in the
algorythm above, will Asterisk know that the user should authenticate
and issue the 403 response?

Thanks,
Filipe




More information about the asterisk-users mailing list