Asterisk NAT problem

Hi

I try installing asterisk with NAT fitur. for topology look like this picture

but i have problem look like.
if client A connected with AP 1 (IP 192.168.1.2) , will try calling client B already connected with AP 2 (IP 192.168.1.3) , the sound was not up between the client A and client B

asterisk installing in the middle with IP 192.168.1.1 , base OS linux .

setting sip.conf

[general]
register =>100:123@192.168.1.1
register =>200:123@192.168.1.1

registertimeout=20
context=incoming

localnet=192.168.0.0/255.255.255.0

allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
subscribecontext=from-sip



dtmfmode=rfc2833
disallow=all
allow=alaw
allow=ulaw
nat=yes


;ext 100
[100]
type=friend
host=dynamic
secret=123
context=internal
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no


;ext 200
[200]

type=friend
host=dynamic
secret=123
context=internal
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no

setting extention.conf

[incoming]
;Ring on extension 100,200 and the mobile phone
exten => s,1,Answer ()
exten => s,n,Dial (SIP/100&SIP/200&SIP/201&SIP/VoIPProvider/*320423456789,150,r,t)



;pass unanswered call to a mobile phone
exten => s,n,Dial(SIP/VoIPProvider/*320423456789,150,r)

;still not answered? Pass unanswered calls to voicemail
exten => s,n,Voicemail(100,u)
exten => s,n,Hangup

[outgoing]
;outbound calls can be routed based on the number of digits dialed
exten => _xxxxxxxxxxxx,1,Dial(SIP/VoIPProvider/${EXTEN})
exten => _xxxxxxxx,1,Dial(SIP/VoIPProvider/${EXTEN})
exten => _xxxxx,1,Dial(SIP/VoIPProvider/${EXTEN})

[internal]
;calls between employees (between extensions)
exten => _xxx,1,Dial(SIP/${EXTEN})

;calls to ext 100
exten => 100,1,Dial(SIP/100,20)
exten => 100,n,VoiceMail(100,20)
exten => 100,n,Hangup

;calls to ext 200
exten => 200,1,Dial(SIP/200,20)
exten => 200,n,Hangup

iptables

iptables -A FORWARD -i eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -j ACCEPT
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A FORWARD -i eth1 -j ACCEPT
iptables -A FORWARD -i eth1 -j ACCEPT
iptables -A INPUT -i eth1 -j ACCEPT
iptables -A INPUT -i eth1 -j ACCEPT

You have no NAT configuration (localnet is of no use without a way of finding the public address. From your diagram and configuration, I can see nowhere where you would need to use NAT.

Your localnet line describes a network (192.168,0/24) that doesn’t exist in the configuration you describe.

It doesn’t make sense to have both host=dynamic and register for the same device.

It is also invalid to register yourself with yourself.

Most commonly, you would not have register, and would configure the APs to register with the Asterisk. Alternatively, you might be able to have a completely static configuration with host=192.168.1.2, etc.

Standard bad results of using a cookbook approach:

canreinvite is deprecated, use directmedia;

type=peer is almost always better than type=friend.

Calling Answer is anti-social, as, in most countries, it causes the caller to be charged for failed calls.

2 Likes

sorry, im newbie in asterisk.
btw im wrong send topology, i mean i use OLSR on AP 1 and AP 2.

please tell me about the config sip.conf

regards

I’ve never come across Optimized Link State Routing Protocol before, however, on a quick skim of its entry in Wikipedia, I cannot see why why there would be two addresses per node, and, as an IP routing protocol, I can’t see why it should affect application programmes, like Asterisk, in any way.

You still need to fix the other issues I mentioned. In particular the weird use of register should be clear to anyone who has familiarised with he available documentation enough to attempt to configure an Asterisk system.