i use Elastix 2.4.0 with a static public IP all call on LAN no problem any out call from any extension on the LAN To any extension on WAN(internet) no problem any call from any extension on WAN(internet) to any other extension the call drop off after some seconds.
when i change sip.config to:
localnet=192.168.1.20/255.255.255.0
calls not drop off but no voice
It is not programming question, but debug question
You have ensure
1) you provided external ip to asterisk via externaddress= param
2) your firewall not block sip protocol nor change it(sip alg or similar algorithm not enabled on firewall)