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.
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
sipgate.de for IPv4:
;; QUESTION SECTION: ;sipgate.de. IN A ;; ANSWER SECTION: sipgate.de. 6382 IN A 126.96.36.199
And the same query for IPv6:
;; QUESTION SECTION: ;sipgate.de. IN AAAA ;; ANSWER SECTION: sipgate.de. 7437 IN AAAA 2001:ab7::2 sipgate.de. 7437 IN AAAA 2001:ab7::4 sipgate.de. 7437 IN AAAA 2001:ab7::1 sipgate.de. 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:
[general] bindaddr = 0.0.0.0 # ... [sipgate] nat = yes description = sipgate type = friend host = sipgate.de # ...
[general] bindaddr = :: # ... [sipgate](!) description = sipgate type = friend outboundproxy = v6.sipgate.de # ... [sipgate-out](sipgate) host = sipgate.de [sipgate-1](sipgate) host = 2001:ab7::1 [sipgate-2](sipgate) host = 2001:ab7::2 [sipgate-3](sipgate) host = 2001:ab7::3 [sipgate-4](sipgate) 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::
[general] disallow = all allow = alaw allow = ulaw allow = speex allow = g729 allow = gsm