How to setup Asterisk NAT on docker for Windows

3

0

I need to setup a docker container running an Asterisk PBX.

The problem is that I receive the wrong ip in sdp replies. In fact Asterisk is using the container internal IP.

The second problem is that I must use docker for windows and as such, I can’t use —net=host

So I tried to setup nat in asterisk, setting in sip.conf this :

nat = force_rport,comedia
localnet = 172.17.0.0/16
externaddr = 192.165.10.206

But it doesn’t seems to do anything.

What to I miss here ?

PS : I am using Asterisk 15

iXô

Posted 2018-10-23T15:39:15.260

Reputation: 231

Is your situation similar to the one described in this article? How have you constructed the container and did you use one of the available ready-made images?

– harrymc – 2018-10-31T09:47:53.867

I have used the andrius/asterisk ready made image. It consist of a Alpine Linux and an Asterisk deployed with the native Alpine packages. I already tried instructions from the article you mention, and it doesn't seems to works. – iXô – 2018-10-31T10:29:58.413

Answers

1

My config is as follows:

docker-compose

  asterisk:
    image: asterisk:testing
    ports:
     - "5060:5060/udp"
     - "5060:5060/tcp"
     - "10000-10099:10000-10099/udp"
     - "8088:8088"
     - "8089:8089"
    volumes:
     - "./asterisk/conf:/etc/asterisk"
    labels:
     - "traefik.enable=false"

This allows me to open the necessary ports.

In my sip.conf, I have the following:

[general]
externip = 192.168.1.61
localnet=192.168.0.0/255.255.0.0;
nat=yes

...

And, this works like a charm.

rdehuyss

Posted 2018-10-23T15:39:15.260

Reputation: 23