Archive for the 'FreeSWITCH' Category

Some “minor” progress…

stkn@test02 ~ $ ssh -p2222 test@localhost
test@localhost’s password:
[15315] 2008-11-28 12:20:54 API CALL [version()] output:
FreeSwitch Version 1.0.trunk (10523M)

[15315] 2008-11-28 12:20:56 API CALL [status()] output:
Content-Type: text/html

UP 0 years, 0 days, 0 hours, 0 minutes, 57 seconds, 5 milliseconds, 204 microseconds
0 session(s) since startup
0 session(s) 0/30

logoutReceived disconnect from 127.0.0.1: 11: Bye Bye
stkn@test02 ~ $

Weird libssh deadlock / heap corruption 0 : 1 stkn

Long story short: both, apr and libssh have a function called “sha1_init” and of course, the runtime linker deceided to use the one contained in libfreeswitch.so instead of the (right) one from mod_ssh.so (libssh) resulting in a corrupted heap after calling it (even destroying some data used by the memory allocator in glibc, hence the deadlock in free).

Thing that saved the day: GCC Visibility support (hooray for marking all internal functions hidden)

And GDB command scripts are a wonderful thing (even if there are some bugs):

set pagination off
break buffer.c:buffer_free
commands
    print *buffer
    continue
end

With that obstacle out of the way it was fairly easy to get mod_ssh to do something a bit more useful…

The current code is in the git repository, it’s still not useable but moving in the right direction. The configure script works with GCC and SUN’s compiler, visibility support is a must though (>= GCC-4.0; SunStudio 12 / Express from July 2008 or newer).

Hackathon day 2

No actual coding today, but i’ve put some other projects on our server (=> axsentis gitweb).

The (still non-working) project from yesterday is there too, if you’d like to take a look at the issue yourself:

git clone http://oss.axsentis.de/git/mod_ssh.git

Hackathon day 1

I chose to work on option number #2 (the new secret fs module), but haven’t gotten very far, due to some weird deadlock in free() / memory corruption problems in the library that i’m using for this.

The library ships with a couple of examples, those work perfectly fine, even adding some basic threading to one of the examples (and limiting the amount of stack space the thread can use) doesn’t make it fail, however, using the lib in a FS module makes it fail in interesting ways.

One interesting bit is, running FS in valgrind makes it work sometimes, so it’s definitely some sort of race-condition, which is funny, because i’m not using multiple threads to run that code as everything is running in the runtime thread of the FS module.

The bad thing is: i’m out of ideas on things to try and i lack experience in hunting down and fixing this type of bug.

All in all not a very productive (and satisfying) day in the coding department…

The boss is out of the office…

… for a couple of days (hey yan ;P), so i’ll have some spare cycles i can spend on some toy projects after i’ve taken care of the items on my work todo list.

There’s a couple of things i’d like to play with, given enough time (and the motivation to get started):

First thing on the list is to connect my two test boxes to the free (because every intel card has issues with them) GigE ports of our crappy Netgear switch, to play with some RX_RING / TX_RING zero-copy and socket filters example code.

Second on the list is… a secret 😛 (yet another freeswitch module project. i’ll post details when i got something to show)

Third is a couple of other things related to some older projects like axdhcp2 and another FS module that isn’t in the public repositories on oss.axsentis.de (well, the module itself isn’t, but some of it’s ingredients are there 😀 ).

I guess i’ll start with #2 because that one seems fun (and not too overly complicated like the first one) and i think it could be useful for a couple of people (plus it’s a nice distraction from the openzap isdn work).

Seen on IRC…

<anthm> filter add unique-id <uuid of a>
<anthm> filter add unique-id <uuid of b>

Whee, (more) advanced event filters for mod_event_socket (not there yet)

(I hope he’s going to use apr_uuid_parse() and memcmp() for this, instead of strcmp()’ing the UUIDs.)

.oO( Improving RTP performance, part 2 )

Found a possible solution to the SIP + RTP on the same interface issue with packet socket: Socket filters.

With the help of something like this:

{ 0x28, 0, 0, 0x0000000c },
{ 0x15, 0, 9, 0x00000800 },
{ 0x30, 0, 0, 0x00000017 },
{ 0x15, 0, 7, 0x00000011 },
{ 0x28, 0, 0, 0x00000014 },
{ 0x45, 5, 0, 0x00001fff },
{ 0xb1, 0, 0, 0x0000000e },
{ 0x48, 0, 0, 0x00000010 },
{ 0x35, 0, 2, start_port },  /* replaced: 0x00007fff */
{ 0x25, 1, 0, end_port },  /* replaced: 0x0000ffff */
{ 0x6, 0, 0, 0x00000044 },
{ 0x6, 0, 0, 0x00000000 },

only UDP packets on destination ports 32767 to 65535 will be delivered to the packet socket.

(The cryptic C code is the output of “tcpdump -dd udp dst portrange 32767-65535”)

There’s a possible problem with this solution though: no zero-copy support for socket filters on linux (still need to confirm that (FreeBSD has zero-copy bpf support in -current)).

.oO( Improving RTP performance )

Another interesting idea:

Using PACKET_MMAP for transmission of packets. This one would need some kind of userland deadline I/O scheduler and a userspace network stack (same as netchannels).

There’s a major difference from netchannels though: Netchannels manages point-to-point connections, this approach just pipes all data from the associated interface to userspace (or vice-versa), so an actual implementation of this for RTP send/recv in FreeSWITCH would be limited to one or two threads (shared or one for each direction) per Ethernet interface.

The I/O schedulers job would be to collect and queue the RTP frames from the channel threads and send them to the kernel if a) the TX_RING buffer is full or b) the deadline has been reached.

(Signaling (SIP) and RTP on the same network interface (= the common case) could be a problem…)

Toy projects: FreeSWITCH RTP using Netchannels

Just another random item that was on my todo list for some time now.

LWN.net has a nice article about the concept: Van Jacobson’s network channels

The whole thing has been implemented by Evgeniy Polyakov.

(Direct links to his projects: Netchannels, Unetstack).

The code compiles (with a bunch of hacks) but needs more work (locks up during testing, after a couple hundred calls), and there are license issues too (unetstack is GPL)…

No more FreeSWITCH on Gentoo…

… for your (and my) sanity use something else for FreeSWITCH.

*sigh*

Freeswitch-svn ebuild removed from the voip overlay.

« Previous PageNext Page »