Correct usage of direct_media

If I have a sip phone inside my lan and Asterisk on the same lan, should direct_media be “yes” or “no”? Thanks

It depends on how you want the media to flow.

If you want media to flow through your PBX set direct_media to no.

If you want media to pass from endpoint to endpoint without flowing through your PBX set direct_media to yes.

Setting direct_media to yes could reduce the excessive load to your server, not recomended between peers that are on different networks , which is not your case, also direct_media=yes necesarirly wont work if the call flow require asterisk to on the media flow ( call recording, some dial and queue options etc…

Note that if Asterisk needs to be the path, the call will still work, but it won’t use direct media.

hmmm…
I have 4 endpoints. 3 trunks are remote {outside NAT} and the sip phone inside the lan connected directly to Asterisk. The phone dials out using one of the other 3 trunks. So is it only the phone endpoint that gets direct_media=yes and the other 3 get “no”? I’m confused regarding the function of the parameter.

Probably, but nonat might be better in that case.

directmedia is optional. If two endpoints are not able to route traffic directly between them, at least one of them must have directmedia disabled.