I was wondering if it is possible to allow direct_media only when endpoints are on the same subnet? Here is my situation:
50 internal phones on a subnet behind a firewall.
Asterisk box multihomed with one interface on above network, one interface on public internet
VOIP provider that does not proxy media and therefore requires direct_media=yes.
If the internal phones are configured as endpoints with direct_media=no, then everything works fine for phone-to-phone calling and also phone-VOIP calling. However we have a lot of internal phone-to-phone calling so it would nice for that media to not have to go through the Asterisk box.
When I set direct_media=yes for the phone endpoints, then phone-to-phone calling works fine, but phone-VOIP calling has no sound because the media cannot pass through the firewall and needs to go through the asterisk box.
Is there a way to configure Asterisk to allow reinvites when the two endpoints are in the same local network, but not when one endpoint is outside?
My transport is set with local_net, external_media_address and external_signalling_address defined. I am also aware that there is at disable_direct_media_on_nat option, but setting it to yes in the endpoint configuration for the phones or the VOIP provider endpoint does not seem to make any difference, so I do not understand how Asterisk determines whether NAT is involved or not.