Asterisk + Sipgate + IPv6

My internet provider force-migrated me to Dual-Stack Light the other day, so now I have IPv6 at home. It did cost me my IPv4 address though, so I’m not sure yet if I should be stoked or not. But anyway, now that I have it, I wanted to at least try it out.

I was surprised to find that, using IPv4, my Asterisk setup just continued to work. When I switched it over to IPv6, I couldn’t receive calls anymore. I had expected this to be exactly the other way around, but meh.

Using tcpdump I found out that Asterisk was receiving calls from a different IP than the one it was registered to, which seems to have inspired it to reject the call because “those aren’t the droids we’re looking for”. Switching back to IPv4, I noticed calls were always coming from the address I was registered to. And DNS checks out - here’s for IPv4:

;                    IN      A

;; ANSWER SECTION:             6382    IN      A

And the same query for IPv6:

;                    IN      AAAA

;; ANSWER SECTION:             7437    IN      AAAA    2001:ab7::2             7437    IN      AAAA    2001:ab7::4             7437    IN      AAAA    2001:ab7::1             7437    IN      AAAA    2001:ab7::3

So, they’re exposing four addresses via IPv6 and only one via IPv4. So I guess I need to tell Asterisk to accept calls from all four of them. It seems that using templates in sip.conf, this is even fairly easy. My configuration changed from:

bindaddr    =
# ...

nat         = yes
description = sipgate
type        = friend
host        =
# ...


bindaddr    = ::
# ...

description = sipgate
type        = friend
outboundproxy =
# ...

host        =

host        = 2001:ab7::1

host        = 2001:ab7::2

host        = 2001:ab7::3

host        = 2001:ab7::4

It seems that I can now receive calls again, and sip show peers now shows four five sipgate peers instead of one. (I had not added the sipgate-out peer initially. While it’s technically duplicate, sipgate won’t accept SIP invites that go to somenumber@2001:ab7::2, so I had to add it for placing outgoing calls. Adding this extra peer makes sure I send the correct SIP invites. Not sure if it also gives me failover.)

Btw: A word on codecs

When setting up Asterisk initially, I experienced problems with random one-way audio. It seems those were due to my asterisk preferring different codecs than the Sipgate servers do. Adding the following section to sip.conf fixed that for me::

disallow       = all
allow          = alaw
allow          = ulaw
allow          = speex
allow          = g729
allow          = gsm