IPv6 configuration for Enswitch
Most of the installations of Enswitch use only IPv4 addresses for all the networking traffic, however working with IPv6 addresses for telephony services is also possible, which needs some adjustments that are explained below.
Contents
Basic considerations
- Enswitch 3.15 or newer is used.
- Enswitch sources are updated to their most recent revision.
- The IPv6 addresses to use are mutually reachable for both the server and the client sides. Normally those IPv6 addresses will be public ones. Using local IPv6 addresses will not work.
- The IPv6 addresses to use are already configured, enabled and working in the operating system where the Enswitch related services are running.
- The details in this page are based on a single machine deployment that is used to run Enswitch, Kamailio and Asterisk services.
- The sample public IPv6 address 2001:41d0:302:2200::20b8 will be used to illustrate the needed configurations. In case we need to quickly enable it in the operating system, these commands could be used:
ip addr add 2001:41d0:302:2200::20b8 dev ens3 ip -6 route add 2001:41d0:302:2200::1 dev ens3 ip -6 route add default via 2001:41d0:302:2200::1 dev ens3
Kamailio
- Be sure that the operating system where Kamailio runs has a properly configured IPv6 address, according to the previous considerations.
- In the file /etc/kamailio/kamailio.cfg add a line like the following one, adjusted for your IPv6 address:
listen=[2001:41d0:302:2200::20b8]:5060
Possibly, there could be other listen lines in that file, for example for an IPv4 address.
- Optionally, increase the debug level in that same file /etc/kamailio/kamailio.cfg, by having a line like this one:
debug = 2
- Restart Kamailio, with a command like this:
systemctl restart kamailio.service
Asterisk
- Be sure that the operating system where Asterisk runs has a properly configured IPv6 address, according to the initial considerations.
- Either the traditional SIP stack or the newer PJSIP project can be used, then choose the steps below according to your requirements.
If using the traditional Asterisk SIP stack
- To make Asterisk listen on IPv6 addresses, edit the file /etc/asterisk/sip.conf, so that its [general] section looks like this example:
[general] ... ; the initial bindaddr and bindport options are commented out ;bindaddr = 0.0.0.0 ;bindport = 5070 ; and a new line is added to bind to IPv6 addresses bindaddr=[::]:5070 ...
- Again edit the file /etc/asterisk/sip.conf to configure the sections that correspond to the Kamailio IPv6 address, like this example:
; this is the first one [[2001:41d0:302:2200::20b8]] host = [2001:41d0:302:2200::20b8] fromdomain = [2001:41d0:302:2200::20b8] type = friend insecure = port,invite context = from-internal canreinvite = no nat = yes t38pt_udptl = yes
; this is the second one, which is similar but adds the Kamailio port to the address [[2001:41d0:302:2200::20b8]:5060] host = [2001:41d0:302:2200::20b8] fromdomain = [2001:41d0:302:2200::20b8] type = friend insecure = port,invite context = from-internal canreinvite = no nat = yes t38pt_udptl = yes
If using the newer PJSIP stack
- To make Asterisk listen on IPv6 addresses, edit the file /etc/asterisk/pjsip.conf to add sections like these:
; let's assume PJSIP will work with UPD port 5062 [transport-udp6] type=transport protocol=udp bind=[2001:41d0:302:2200::20b8]:5062
[kamailio_ipv6_aor] type = aor contact = sip:[2001:41d0:302:2200::20b8]
[kamailio_ipv6_identify] type = identify endpoint = kamailio_ipv6_endpoint match = [2001:41d0:302:2200::20b8]
[kamailio_ipv6_endpoint] type = endpoint context = from-internal disallow = all allow = g722 allow = ulaw allow = alaw allow = opus allow = slin allow = gsm allow = g726 allow = adpcm allow = lpc10 allow = speex allow = ilbc rtp_symmetric = yes rewrite_contact = yes rtp_timeout = 60 direct_media = no send_pai = yes from_domain = [2001:41d0:302:2200::20b8] aors = kamailio_ipv6_aor t38_udptl = yes t38_udptl_ec = none
- The section names kamailio_ipv6_aor, kamailio_ipv6_identify and kamailio_ipv6_endpoint can be adjusted as needed, taking care of also updating their relationships.
For both the SIP and the PJSIP stacks
- As a remainder, the assumption is that both Kamailio and Asterisk run on the same machine and use the same IPv6 address, but if that is not the case for you, then adjust the details in the previous sections with the IPv6 address of your Kamailio server.
- Restart Asterisk, with a command like this:
systemctl restart asterisk.service
Enswitch settings
In the web UI, do the following:
- For each IPv6 address that will be used as a valid destination that will accept calls, go to Global > Domain to add a new domain, entering that IPv6 address as the domain name. The value to enter is a valid representation of the IPv6 address (short format or long format), without the surrounding square brackes. As an example, any of the following equivalent addresses will be valid:
2001:41d0:302:2200::20b8 2001:41d0:0302:2200:0000:0000:0000:20b8
- Go to Global > Machines to add a new Asterisk machine, entering the IPv6 address as the value for the machine IP address field, following the same guidelines and examples given above.
- If using Enswitch 4.2 or earlier, go to Global > Configuration and change the Use sipsak command for monitoring Asterisk machines setting to No.
- If using Enswitch 4.2 or newer and the PJSIP stack for Asterisk, go to Global > Configuration and change the Default SIP protocol driver setting to PJSIP.
- For the corresponding customer, add the telephone line(s) that will make and receive the calls for the created IPv6 domain.
- For the corresponding customer, add any telephony feature that will also use the created IPv6 domain. An example of this is a feature code.
Enswitch services
Restart the Enswitch services with the enswitch restart command, or alternatively with these commands:
systemctl restart enswitch_messaged systemctl restart enswitch_routed systemctl restart enswitch_sipd
The client could be a softphone or a physical phone. The important consideration is to properly configure it with an IPv6 address that can communicate with the Kamailio and Asterisk servers that are on the Enswitch server side.
How to make calls?
Let's suppose that phone line with name 3478082 wants to call feature code 200 that is configured for the IPv6 domain with address 2001:41d0:302:2200::20b8. For this case, these things will happen:
- Phone line 3478082 will register as sip:3478082@[2001:41d0:302:2200::20b8] with the server.
- Phone line 3478082 will dial to destination sip:200@[2001:41d0:302:2200::20b8].
- The call processing will happen on the server side similarly to a call that uses IPv4 addresses, with Enswitch services, Kamailio and Asterisk communicating with each other using IPv6 traffic as needed.
In case of failures
The following is a summary of the failures and errors observed while developing and testing Enswitch to work with IPv6 address.
Problem | Possible cause | Possible fix |
---|---|---|
Client receives the error SIP registration failed, status=403 (URI domain not configured locally, relaying forbidden). | The domain has not been added to the system, then it is not allowed. | In the Enswitch web UI, add the new domain as explained before. |
There is no IPv6 connectivity to the server side. | The server IPv6 address is local and is not available outside the server operating system. If the command ip address show is run, its output for a local IPv6 address will show something like inet6 fe80::f816:3eff:fe94:93c1/64 scope link, while a public IPv6 address will show something like inet6 2001:41d0:302:2200::20b8/128 scope global. | Ask your system administrator the correct details for the IPv6 address to use and configure them in the operating system. |
Asterisk does not process calls when using the traditional SIP stack. | Asterisk sip.conf configuration file is not ready to handle IPv6 traffic. To check this, the command netstat -anptu | grep -i asterisk could be used, which will show something like udp 0 0 0.0.0.0:5070 0.0.0.0:* 958684/asterisk if only IPv4 traffic is working, while something like udp6 0 0 :::5070 :::* 988099/asterisk will appear if both IPv4 and IPv6 traffic are working. | Edit that sip.conf file as explained before. |
Asterisk does not process calls when using the newer PJSIP stack. | Asterisk pjsip.conf configuration file is not ready to handle IPv6 traffic. To check this, the command netstat -anptu | grep -i asterisk could be used, which will show something like udp 0 0 0.0.0.0:5062 0.0.0.0:* 958684/asterisk if only IPv4 traffic is working, while something like udp6 0 0 :::5062 :::* 988099/asterisk will appear if both IPv4 and IPv6 traffic are working. | Edit that pjsip.conf file as explained before. |
Kamailio does not accept calls, or connection attempts fail from the client to port 5060 on the IPv6 Kamailio address. | Kamailio /etc/kamailio/kamailio.cfg configuration file is not ready to handle IPv6 traffic. To check this, the command netstat -anptu | grep -i kamailio could be used, which will show something like udp6 0 0 2001:41d0:302:2200:5060 :::* 943729/kamailio if IPv6 traffic is working. | Edit that /etc/kamailio/kamailio.cfg file as explained before. |
The SIP registration seems to work, but calls work intermittently, or are not authorized, or the server does not process the INVITEs requests or keeps asking for registration, or simply the calls can not be established at all. | The network communication latency between the client and the server is too high. | Get the client and server networks to communicate with the less possible latency. As a reference, take the following measured ping times from the client to the server in one of the tested scenarios:
|
The client receives error messages saying SIP registration failed, status=403 (Not allowed). | The required configuration is either incomplete, incorrect or missing. | Check each of the previous sections to be sure that each of the related services is properly configured. |