Force local route between 2 SIP on same LAN

I run Asterisk 1.6 on a hosted server with a Public IP.

On my work site, I have an ADSL line with a NAT firewall. On the LAN (10.0.0.1-255) I have two SIP phones connected on my Asterisk server.

I have noticed that when these two internal phones call each other, the traffic goes through the internet.

Is there a way to configure this, so that the voice traffic remains local on the LAN, instead of going through the internet and using bandwidth ?

what is the output of “sip show peers” from the asterisk CLI.

Sounds like the phones are using the public IP address of the asterisk server to register. Can you confirm they are registering to the 10.x.x.x address of asterisk.

[quote=“chris.mylonas”]what is the output of “sip show peers” from the asterisk CLI.

Sounds like the phones are using the public IP address of the asterisk server to register. Can you confirm they are registering to the 10.x.x.x address of asterisk.[/quote]

Hello

Not sure i fully understand your question. Asterisk is on a public address, not on 10.x.x.x

The SIP devices are on my LAN (behind a NAT that currently holds a dynamic IP being 62.235.186.168) and hold private IP 10.0.0.10 and 10.0.0.11

This is the result of "sip show peers"
11/11 62.235.186.168 D N A 5441 OK (161 ms)
12/12 62.235.186.168 D N A 5441 OK (151 ms)

I just have tried putting canreinvite=nonat and it working now. I get a direct audio flow without going through the internet.

But it seems that this method would fail if two extensions - each behind a separate NAT and thus on two different private LANs - call each other.

How can I force the canreinvite only when the two extensions are on the same private LAN ?

As far as I know, your configuration is not supported.