Žilinská univerzita > Fakulta riadenia a informatiky > Katedra informačných sietí

Enabling SCTP support in Kamailio 3.3.x - debian squeeze

Preprepared binary package of the Kamailio server hasn't enabled the SCTP support. You may check this on your running platform both ways:

First running kamailio command with -V options and checking the output for the sctp flag:

kamailio -V

or

kamailio -V | grep SCTP

and if nothing to see, there is no SCTP support enabled.

Second, using sercmd tool, but we have to load and enable ctl module in our kamailio.cfg. Then run

sercmd core.sctp_info

and if Kamailio does not support, we may see this:

sercmd core.sctp_info
error: 500 - sctp support not compiled

Therefore in this article we try to prepare pure Kamailio server without any modules but with enabled support of the SCTP protocol, so using them we may start to play with SCTP. And, of course, we do this by compiling new binaries from the source.

First of all, check if your linux machine kernel support sctp, so install

apt-get install lksctp-tools

and check sctp support running command checksctp

checksctp
SCTP supported

should be supported by your OS, if not, solve it!

No we are going to prepare for the compilation of our new kamailio. Please follow instructions described in Install And Maintain Kamailio v3.3.x Version From GIT guide up to step 3.

Now we prepare make files, so run:

make FLAVOUR=kamailio cfg

without any include_module parameters. Then run:

 make PREFIX="/usr/local/kamailio-3.3" SCTP=1 FLAVOUR=kamailio cfg

The SCTP=1 is very important parameter for us, because it switch on SCTP support for upcoming compilation.

Ckeck make config file (config.mak) for SCTP flags

less config.mak | grep SCTP

C_DEFS=   -DNAME='"kamailio"' -DVERSION='"3.3.2"' -DARCH='"i386"' -DOS='linux_' -DOS_QUOTED='"linux"' -DCOMPILER='"gcc 4.4.5"' -D__CPU_i386 -D__OS_linux -DSER_VER=3003002 -DCFG_DIR='"/usr/local/kamailio-3.3/etc/kamailio/"' -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE -DHAVE_RESOLV_RES -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR -DWITH_XAVP  -DF_MALLOC -DMEM_JOIN_FREE -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS -DMALLOC_STATS -DWITH_AS_SUPPORT -DFAST_LOCK -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024  -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER -DUSE_RAW_SOCKS -DHAVE_EPOLL -DHAVE_SIGIO_RT -DSIGINFO64_WORKARROUND -DUSE_FUTEX -DHAVE_SELECT -DUSE_SCTP

 

and you should see SCTP.

Now we begin compiling

make all

and then the installation

make install

Move to install dir, in our case

/usr/local/kamailio-3.3/sbin

and check again SCTP support with

./kamailio -V | grep SCTP
flags: STATS: Off, USE_IPV6, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES

You should see USE_SCTP flag.

And if we start kamailio process, we should see:

kamailio
loading modules under /usr/local/kamailio-3.3/lib/kamailio/modules_k/:/usr/local/kamailio-3.3/lib/kamailio/modules/
Listening on
             udp: 127.0.0.1:5060
             udp: 192.168.10.186:5060
             tcp: 127.0.0.1:5060
             tcp: 192.168.10.186:5060
             sctp: 127.0.0.1:5060
             sctp: 192.168.10.186:5060
Aliases:
             sctp: localhost:5060
             tcp: localhost:5060
             udp: localhost:5060

Which means, that sctp is by default enabled and

enable_sctp = 1

parameter in kamailio.cfg is not required.

Now continue with the rest of Install And Maintain Kamailio v3.3.x Version From GIT guide, especially with step 9, init scripts. Or you should start from begining again and compile the kamailio with all modules required. Now we know how to enable the SCTP support!

 

NOte: For the usability of our installation prepare correct DNS NAPTR and SRV records, including support for SCTP.

Groups: