Asterisk 11 Realtime with MySQL

Hi all,
First I would like to apologize if it was discussed before.
Last week I have installed and configured Astresik in real time mode with mysql support. I built asterisk from the source with unix_odbc driver to connect to MySQL DB. Everything looked good - the peers were able to register in MySQL successfully and I can dial each-other, but only if the peers are in the same network segment. For example:
sip:1001@192.168.1.115:5060
sip:1004@192.168.1.115:5060
If I register a phone in different network:
sip:1002@10.10.20.226:5060
I can dial 1002 from 1001, but there is no media (RTP), only noise.
I suppose that this is some kind of NAT issue and tried to fix it with adding in my peers table (ast_sippeers) nat=yes, after a little googling I changed it to nat=force_rport. The thing become more strange when I added definition for peers in sip.conf just for a try and I am able to dial 1001 <-> 1002 and back. This makes me to thing that I missed something in my
MySQL table. I spent many hours without finding out a solution and I will appreciate any help !

I use extconfig.conf, extension.conf and sip.conf .
Here are my simple configuration:

In sip.conf ->

[general]
bindaddr=0.0.0.0 ; IP address to bind to (0.0.0.0 binds to all)
bindport=5060 ; bindport is the local UDP port that Asterisk will listen on
rtcachefriends=yes ; Allow codecs in order of preference
rtupdate=yes

disallow=all ; First disallow all codecs
;allow=G729
allow=alaw ; Allow codecs in order of preference
allow=ulaw
allow=gsm

In extension.conf
[general]

[default]
; phones use 4 digit extensions, starting with 1
[from-DB]
;switch =>Realtime ; I tried with and without this switch
exten => _1XXX,1,Dial(SIP/${EXTEN})
exten => _1XXX,n,Voicemail(${EXTEN},u)
exten => _1XXX,n,Hangup

In extconfig.conf
[settings]
sippeers => odbc,asterisk,ast_sippeers

Mysql DB= ‘asterisk’, table= ‘ast_sippeers’

±------------±---------------------------------------±-----±----±--------±------+
| Field | Type | Null | Key | Default | Extra |
±------------±---------------------------------------±-----±----±--------±------+
| type | enum(‘friend’,‘user’,‘peer’) | YES | | NULL | |
| name | varchar(128) | NO | | NULL | |
| secret | varchar(128) | YES | | NULL | |
| context | varchar(128) | YES | | NULL | |
| host | varchar(128) | YES | | NULL | |
| ipaddr | varchar(128) | YES | | NULL | |
| port | int(5) | YES | | NULL | |
| regseconds | int(11) | YES | | NULL | |
| defaultuser | varchar(128) | YES | | NULL | |
| fullcontact | varchar(128) | YES | | NULL | |
| regserver | varchar(128) | YES | | NULL | |
| useragent | varchar(128) | YES | | NULL | |
| lastms | int(11) | YES | | NULL | |
| nat | enum(‘yes’,‘no’,‘never’,‘force_rport’) | YES | | NULL | |
| directmedia | enum(‘yes’,‘no’,‘nonat’,‘update’) | YES | | NULL | |
| disallow | varchar(40) | YES | | NULL | |
| allow | varchar(40) | YES | | NULL | |
| qualify | varchar(40) | YES | | NULL | |
±------------±---------------------------------------±-----±----±--------±------+
18 rows in set (0.00 sec)

Thanks in advance!

Hi all, I solved the problem.
The solution is simple. I changed the value in cell ‘nat’ from YES to ‘force_rport,comedia’.
In the example file located in
/usr/local/src/asterisk-11.1.2/contrib/realtime/mysql/sippeers.sql
the definition for row 'nat is:
nat enum(‘yes’,‘no’,‘never’,‘route’) DEFAULT NULL
According to this definition I could not make it to work and I changed the row to:
nat enum(‘yes’,‘no’,‘never’,‘route’,‘force_rport,comedia’) DEFAULT NULL,

Regards,