RTP and SRTP in asterisk?

i am new to asterisk, and i want to use it.i need to understand if users that is registered to same server when connected to each other using sip and began to use rtp what is the role of rhe serve here. i think the RTP is tx and rx without passing through server. the same is done in case of SRTP. so why SRTP is found in asterisk. also what is the cases that RTP and SRTP pass through the server. plz any one can explain to me. thanks in advance.

If you set directmedia=yes, Asterisk will route RTP directly, as long you don’t require any services that require Asterisk to see the media stream. The server is needed to translate extension numbers to device addresses and to perform additional services, like call recording, call logging, executive intrude, multi-way conferences, etc. Whilst you can make calls peer to peer from SIP phones, you generally have to key in the full IP address, and most users prefer just an extension. If you really need nothing more than address translation, you can use the Transfer application, to release the call immediately. Remember that Asterisk is a toolkit, not a PABX.

Asterisk always relays SRTP. That is not 100% necessary, although it will always know the encryption key used. You could use Transfer, but then the phones would need to be able to authenticate all the other phones.