IAX2 Problem For WAN Connections
Hi,
I am trying to connect two Asterisk servers using IAX2. Everything works fine when I couple them within a LAN segment, but not when I connect them using WAN connections. I made sure that the routers’ ports are mapped properly and checked this with additional ssh rules.
ServerA is a Raspberry box with the vendor’s Asterisk version 1.8.13.1 and ServerB is normal CentOS 7 box with Asterisk 13.1.
Calling from ServerB to ServerA works, but not vice versa. The only odd thing that appears to me is the different perceived port on ServerA.
ServerA*CLI> iax2 show registry Host dnsmgr Username Perceived Refresh State
80.152.xxx.xxx:4569 N ServerA 79.233.yyy.yyy:45697 60 Registered
ServerB*CLI> iax2 show registry Host dnsmgr Username Perceived Refresh State
79.233.yyy.yyy:4569 N ServerB 79.233.yyy.yyy:4569 60 Request Sent
Does someone have an idea at what to look in detail?
jg
3 thoughts on - IAX2 Problem For WAN Connections
Look in /etc/asterisk/iax.conf in the first instance.
Basically I used the example from the Asterisk book “Connecting Two Asterisk Boxes Together via IAX” and there is not a lot to see:
; Server A
[general]
; this box remote IP
register => ServerA:very_secret@80.152.xxx.xxx
disallow=all allow=alaw allow=ulaw allow=gsm
jitterbuffer=no forcejitterbuffer=no autokill=yes
; the other box
[ServerB]
type=friend trunk=no auth=md5
encryption=yes secret=very_secret context=from-ServerB
qualify=yes host=dynamic
; end of Server A
; Server B
[general]
; this box remote IP
register => ServerB:very_secret@79.233.yyy.yyy
disallow=all allow=alaw allow=ulaw allow=gsm
jitterbuffer=no forcejitterbuffer=no autokill=yes
; the other box
[ServerA]
type=friend trunk=no auth=md5
encryption=yes secret=very_secret context=from-ServerA
qualify=yes host=dynamic
; end of Server B
If I replace the WAN addresses of the two routers with addresses on the LAN, everything works. Currently, I am not sure whether it could be a NAT related or Asterisk configuration problem.
jg
I found a way that works. Essentially, I deleted the register lines and added the hosts with deny all and specific permit specs. I don’t know why it works, but it does.
jg