[Home]

Summary:ASTERISK-26309: [patch] res_pjsip: Allow IPv4/IPv6 (Dual Stack) installations.
Reporter:Alexander Traud (traud)Labels:
Date Opened:2016-08-20 09:02:27Date Closed:2016-10-27 22:23:16
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_pjsip_sdp_rtp
Versions:13.10.0 Frequency of
Occurrence
Related
Issues:
causesASTERISK-27287 Cyclic reference between res_pjsip and res_pjsip_session
is related toASTERISK-26379 res_pjsip_multihomed: SDP rewriting with different IP version
Environment:Attachments:( 0) 0003-r5403-pjsip_IPV6_V6ONLY.patch
( 1) chan_pjsip_Dual_Stack_RTP.patch
( 2) chan_pjsip_Migration_Script.patch
Description:When you enable IPv6, you do not want to create an IPv6-only server but stay compatible with legacy IPv4 based networks. For this, your server listens to IPv4 and IPv6 on the same interface. This is called Dual Stack and works for the channel driver chan_sip already. However for those, who [migrate to res_pjsip|https://wiki.asterisk.org/wiki/display/AST/Migrating+from+chan_sip+to+res_pjsip], you have to
A) set 1 in the file /proc/sys/net/ipv6/bindv6only
B) wait for the next PJSIP release 2.6.0, or
C) checkout [change-set 5403|https://trac.pjsip.org/repos/changeset/5403], for example in Ubuntu 16.04 LTS:

{noformat}sudo service asterisk stop
sudo apt install libsrtp0-dev libspeexdsp-dev libgsm1-dev libsamplerate-dev libasound-dev
wget github.com/pjsip/pjproject/archive/master.tar.gz
tar zxf master.tar.gz
cd ./pjproject*
CFLAGS='-DNDEBUG -DPJ_HAS_IPV6=1' ./configure --prefix=/usr --enable-shared --with-external-srtp --with-external-speex --with-external-gsm --enable-libsamplerate --enable-epoll
make dep all
sudo make install
sudo service asterisk start{noformat}

With chan_sip, you enabled Dual Stack either by removing every {{bindaddr}} or by using {{::}} instead of {{0.0.0.0}} in {{/etc/asterisk/sip.conf}}. To get Dual Stack in res_pjsip, you have to create _two_ transports in {{/etc/asterisk/pjsip.conf}}, one with {{0.0.0.0}} and one with {{\[::\]}}

{noformat}[transport-udp6]
type=transport
protocol=udp
bind=[::]

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0{noformat}

However even then, you had to choose the IP version for each ‘endpoint’ in your {{/etc/asterisk/pjsip.conf}} via {{rtp_ipv6=yes}}. Consequently, you had to choose the IP version regardless how that VoIP/SIP client connected, regardless the capabilities on the client changed (firmware update, changed setting, or usage of a different mobile app). This is not feasible for an Asterisk installation in which the clients may connect via unknown networks or the Asterisk administrator is not in charge of the VoIP/SIP clients. Workarounds were to
A) go back to chan_sip,
B) provide a separate IPv6-only registrar/proxy address to end users, or
C) go for an IPv4-only installation.

The attached patch resolves this issue by removing the need for {{rtp_ipv6}} (or {{t38_udptl_ipv6}}) in {{/etc/asterisk/pjsip.conf}}. With that patch, res_pjsip re-uses the IP version of an already registered client. That way, res_pjsip turns Dual Stack capable and even calls between the same endpoint but different IP versions work. The second patch updates the migration script sip_to_pjsip.py to create two transports. The third patch, adds change-set 5403 to the [bundled PJProject|https://wiki.asterisk.org/wiki/display/AST/Building+and+Installing+pjproject#BuildingandInstallingpjproject-bundled], so you do not have to wait for PJProject 2.6.0.
Comments:By: Friendly Automation (friendly-automation) 2016-10-27 22:23:16.793-0500

Change 4181 merged by zuul:
res_pjsip_sdp_rtp: Fix address family of explicit media_address.

[https://gerrit.asterisk.org/4181|https://gerrit.asterisk.org/4181]

By: Friendly Automation (friendly-automation) 2016-10-27 22:23:19.463-0500

Change 4182 merged by zuul:
res_pjsip_sdp_rtp: Fix address family of explicit media_address.

[https://gerrit.asterisk.org/4182|https://gerrit.asterisk.org/4182]

By: Friendly Automation (friendly-automation) 2016-10-28 05:33:24.970-0500

Change 4180 merged by Joshua Colp:
res_pjsip_sdp_rtp: Fix address family of explicit media_address.

[https://gerrit.asterisk.org/4180|https://gerrit.asterisk.org/4180]