Suppose I have a SIP PBX like Asterisk and a bunch of phones registered to it, and outgoing/incoming calls are handled through a SIP trunk. Do the RTP streams go directly between the phones and the SIP trunk provider or are they relayed through the PBX?
It depends. If you do any transcoding (in other words the two endpoints use different codecs) then Asterisk will definately be in the RTP stream. If your two endpoints are on opposite sides of NAT, then Asterisk will likely be in the RTP stream (also depending on reinvite settings). If both endpoints are on the same side of NAT then likely no.