Let's say I have an Asterisk system with a bunch of connections: there are phones (who register itself with *
) and providers (who wish to establish SIP trunks to put a lot of calls over, with different Caller IDs).
Here is my vision about how calls should be placed over an authenticated SIP trunk: remote end of SIP trunk should send INVITE
's with From
field set to it's identity (username for authentication) and Contact
field set to what should be Caller ID for this call.
Is that true?
Why I believe this should be true: now, I can not specify username
/secret
and host=<IP>
-- for remote end to register I need to say host=dynamic
. So, I can setup "pseudo-trunk" as a bunch of extensions, or I need to setup trunk with host
and no authentication. No authentication is bad.
So, is the above true? And will asterisk match peers by looking at From
field and use Caller ID from Contact
field?
If that is not true --- how an authenticated SIP trunk should work?
Thanks!
Read "asterisk the future of telephony" o'rellys book
it have all sip protocol nice described.
your qestion can be solved as
or
on both side and no register string
http://www.voip-info.org/wiki/view/Asterisk+config+sip.conf
So, the above (about
From
andContact
) may be true, but not required to be true. Will it work or not may depend on actual peers sonfigurations.When
*
receivesINVITE
request with "wild"From
(a number that is "not assigned" to any peer), it responses withUnauthorized
, adding authentication header with no anyusername
field (in contrast: when*
receivesINVITE
with a "valid" peer name inFrom
, so it can match peer for incoming call, it includesusername
in authentication header).This response should be enough to authenticate: the client sends "the same"
INVITE
with the sameFrom
andContact
, and withAuthorization
header with a validusername
field. Asterisk then matches incoming peer on givenusername
value.Actually, any phone can behave like this; so there is no distinct difference between "SIP phone" and "SIP peer" in SIP. RFC 3261 does not contain a single "trunk" word.
ps. Please, if someone will explain things better, I will be glad (and, for sure, accept better answer).