Hi,<br><br>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?)
<br><br>I would like to know what is exactly the order for this matching considering Asterisk 1.4.<br><br>I guess it's something like this:<br>1. It tries to find type=peer sections where the host=... setting is the same as the "Host:" header on the SIP packet.
<br>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.<br>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.
<br><br>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.<br><br>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?
<br><br>Thanks,<br>Filipe<br><br>