OpenSIPS 1.6.3, nathelper and Solaris 10

Print E-mail
Sunday, 12 December 2010 09:25

We have been doing some work with our VoIP setup recently, involving getting to grips with OpenSIPS. Although the website says Solaris compatibility, many of the ways we've tried to get it working ended up with problems. Maybe this will help someone else get to a working solution quickly.

OpenSIPS is an 'Open Source implementation of a SIP server' - providing registrar, router and proxy capabilities. To get it to compile under Solaris 10 (x86) and make it's directory structure fit with our standards, we had to make a couple of tweaks, listed below.

Our preference is to use the Sun Studio compilers and associated tools; in this instance, we managed to get OpenSIPS to compile without too much problem, but when it came to runtime, we encountered many 'unresolved link' errors in the OpenSIPS modules. Normally, this just means that a -L or more likely a -R flag was missing at the link stage. In this case there were no additional modules involved, and the functions that were reported as missing weren't referenced from the modules being loaded. Most bizzare.

After much poking about, we came across a comment in the 'Makefile.defs' file, switching the linker to use '-xcode=pic32' to increase the runtime link table size. Unfortunately, this option isn't available on x86. The last ditch attempt was to compile it all in 64bit mode, hopefully that would also increase the link table size; but it didn't... Instead, the GnuCC compiler was used and it worked without any issue. Maybe it's a Sun Studio bug or limitation. At the moment, getting to grips with OpenSIPS is enough without having to fight the compiler too.

Once compiled with GCC, OpenSIPS fired up without any problems - well, linker problems that is. We were trying to use the nathelper module to create an outgoing SIP proxy for our SIP phones; although OpenSIPS fired up ok and verified that the 'RTPproxy' daemon was contactable, when it came time to use it to proxy some RTP traffic, OpenSIPS reported errors that it was no longer available and couldn't talk to it:

Dec 11 10:25:06 [17656] ERROR:nathelper:send_rtpp_command: can't send command to a RTP proxy
Dec 11 10:25:06 [17656] ERROR:nathelper:send_rtpp_command: proxy does not respond, disable it
Dec 11 10:25:06 [17656] ERROR:nathelper:force_rtp_proxy_body: no available proxies

After much hunting about, the code in 'send_rtpp_command' uses a 'writev' system call to send the command to the proxy. 'writev' can return the 'EINVAL' in a number of circumstances, most of which are to do with the size of the data to send, which in this case was tiny, so not the issue. The other case, is listed as 'The STREAM or multiplexer referenced by fildes is linked (directly or indirectly) downstream from a multiplexer.' - another excellent example of a precise error message that is gobbeldy gook to most people.

Thoughts at this point were along the lines of is this a GCC induced error, would Sun Studio have the same problems? Is this something to do with the way OpenSIPS forks lots of children and their connections to the RTP proxy?

At the moment, the root cause hasn't been established; instead, we quickly knocked together a patch to use the more traditional 'write' system call, to see if that got us past the problem - it did. Once we've got the OpenSIPS s/w running and tested, we'll come back to this to investigate further.

The patch for the 'nathelper.c' file is attached to this article for those who might find it useful.


Changes to get OpenSIPS to compile on Solaris 10

Makefile.defs:

  • Update 'cfg-dir = etc/$(MAIN_NAME)/' to 'cfg-dir = ${CFG_DIR}'
    • so we can specify the CFG dir
  • Update 'cfg-target = $(prefix)/$(cfg-dir)' to 'cfg-target = $(cfg-dir)'
    • for the same reason

modules/db_mysql/Makefile

  • LIBS = $(shell mysql_config --libs) $(shell mysql_config --libs | sed 's/-L/-R/g')
    • to use the -R flag

Attachments:
Download this file (nathelper.c.patch)nathelper.c.patch[Nathelper patch]2 Kb

 
Frost on fence posts
Donate to help fund our open source software and articles.



Valid XHTML 1.0 Transitional
Valid CSS!