Asterisk SDP using "IP4" with IPv6 addresses

I’m doing some playing around with Asterisk behind a cloud load balancer. One scenario I tested was using a SIP IPv4 UDP transport and RTP IPv6 media.

The issue I’ve encountered is that when setting the external_media_address to an IPv6 address the SDP produced by asterisk is incorrectly setting the address type to IP4 instead of IP6 which causes the Bria softphone I’m testing with to immediately cancel the call.

SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.0.0.7:5060;rport=5060;received=10.0.0.7;branch=z9hG4bK69f82835b01b41dda80c35660620cad3
Call-ID: 5c110aafcf0d48159788b4aaae010f02
From: <sip:thisis@anonymous.invalid>;tag=TOZYHKHNKF
To: <sip:100@10.0.0.5>;tag=daedda6e-f501-4156-9edd-3c289741a960
CSeq: 1 INVITE
Server: Asterisk PBX 18.1.1
Contact: <sip:10.0.0.5:5060>
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   248

v=0
o=- 2380356783 3 IN IP4 [2603:1020:203:3::18b]
s=Asterisk
c=IN IP4 [2603:1020:203:3::18b]
t=0 0
m=audio 10192 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

pjsip.conf:

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0
;external_media_address=20.73.112.13
external_media_address=[2603:1020:203:3::18b]
;external_signaling_address=23.97.150.126

[sipvms]
type=identify
endpoint=6001
match=10.0.0.0/24

[6001]
type=endpoint
context=from-internal
disallow=all
allow=ulaw
aors=6001
rtp_symmetric=yes
rtp_ipv6=yes

What do you think this will accomplish? Because I doubt this can be done. You can’t mix IPv4 and IPv6 in the SIP message. You’re doing one or the other.

What do you think this will accomplish? Because I doubt this can be done. You can’t mix IPv4 and IPv6 in the SIP message. You’re doing one or the other.

At a protocol level SIP and RTP are completely separate and it definitely is possible to use SIP signalling over IPv4 and RTP over IPv6. I’m able to do this already with other set ups.

My post is to point out that the SDP produced by Asterisk is invalid. Irrespective of anything else SDP requires that the network type matches the advertised address. The line below from the Asterisk SDP answer is wrong:

c=IN IP4 [2603:1020:203:3::18b]

I don’t think external_media_address has ever been tested/used for IPv6. As well, having IPv6 for SDP and IPv4 for signaling while supported by SIP isn’t really supported by us. I asked about this at a SIPit event, and other vendors and teams agreed at having them both be the same.

Ok, thanks for clarifying. At least it’s not something I’m configuring wrong.

I don’t think external_media_address has ever been tested/used for IPv6.

It has now :grinning:.

It does seem to work fine except for the bug mentioned above. If I use a different SIP client that ignores the mismatch between the internet type and the actual address in the SDP I do get RTP from Asterisk via IPv6.

I suspect this is not something that will crop up very often with standard SIP calls but if there’s a bug somewhere in the SDP processing it may also crop up with SIP + ICE.

There’s no problem with ICE and mixing IPv4 and IPv6.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.