[asterisk-bugs] [JIRA] (ASTERISK-26309) [patch] res_pjsip: Allow IPv4/IPv6 (Dual Stack) installations.

Alexander Traud (JIRA) noreply at issues.asterisk.org
Sat Aug 20 09:03:56 CDT 2016


Alexander Traud created ASTERISK-26309:
------------------------------------------

             Summary: [patch] res_pjsip: Allow IPv4/IPv6 (Dual Stack) installations.
                 Key: ASTERISK-26309
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26309
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Resources/res_pjsip_sdp_rtp
    Affects Versions: 13.10.0
            Reporter: Alexander Traud
         Attachments: 0003-r5403-pjsip_IPV6_V6ONLY.patch, chan_pjsip_Dual_Stack_RTP.patch, chan_pjsip_Migration_Script.patch

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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list