Outgoing RTP over IPv6?

I would like to exclusively use IPv6 on my Asterisk server. Clients will all be Android devices connecting via mobile phone networks that provide IPv6 service.

So, this is the only transport I defined in pjsip.conf

[transport-udp-ipv6]
type=transport
protocol=udp
bind=::

Clients connect successfully and all the SIP traffic goes over IPv6 with no NAT problems etc. So, far so good. When I make a call which should connect to an endpoint on the server - e.g. playing a recorded message, RTP audio from the android device to asterisk goes over IPv6 but RTP audio from asterisk to the android devices goes over IPv4.

I looked at the SIP traffic with wireshark and I can see why this is happening: when the android device requests an INVITE it lists three different candidate IP addresses for receiving RTP audio. The first candidate is a NAT based IPv4 address 192.0.0.N, the second candidate is the native IPv6 address of the device and the third candidate is the IPv4 address of the mobile carrier’s NAT router.

Here’s question 1:

Can I configure asterisk to always choose an IPv6 candidate if there is one, even if it isn’t at the top of the list?

Here’s question 2:

Are there any decent voip apps for android that provide an option to disable or deprecate IPv4? I’m currently using Linphone which allows the user to disable IPv6 but you cannot make it preferred over IPv4.

Is there any other advice that might help me? My general aim is avoid having to deal with NAT and all that IPv4 nonsense. (I have thought of configuring the host computer to have no IPv4 address but that seems a bit extreme.)

There is no functionality currently for ICE candidate handling to prefer IPv6.

Thanks for that info.

Actually I just solved my problem at the client end - I disabled ICE in linphone. I found that the connection information line near the top of the SDP message is always the IPv6 address but if ICE is enabled another connection information line is given in the media section with the IPv4 address and then candidate addresses are given.

The thing that puzzles me though is that with ICE enabled in linphone the IPv6 ICE candidate seems to be the highest priority candidate so shouldn’t it have been selected by asterisk instead of the default address?

Perhaps? Asterisk itself doesn’t do the ICE negotiation, that logic is in pjnath and I have little familiarity with it specifically since it generally just works for people and noone has really brought it up before.

Thanks for that clue - I’ll take a- look at pjnath and see what it’s up to.