FreeSWITCH          




Page tree
Skip to end of metadata
Go to start of metadata

You may want to see what's going back and forth between FreeSWITCH and your application when you are developing an ESL application. Sure there are many ways to do this, here is just one:

The idea is to put a Man in the Middle, and he tells us whatever he saw. Thanks for the UNIX art to make this so simple:

You need the help of two temporary files, be sure to select two unique names:

 

If FreeSWITCH listens on 8021, open a terminal and type the above commands, then make your ESL application connect to localhost 8022 you should be able to see all the messages going back and forth.

The Middle Man is actually a B2B socket (just like FreeSWITCH is a B2BUA). The A-leg connect to FreeSWITCH and the B-leg create a socket waiting your ESL app to connect. To understand the last line you need to know the basics of UNIX (STDIN/STDOUT/STDERR) and nc (netcat).

You will need manually to kill the "tail -f /tmp/b" process after debug. To avoid this, you might like the following way:

Think about the UNIX "tee" is to copy STDIN to STDOUT and other files if any. We wouldn't need to 3rd line if it can also copy the STDIN to STDERR. OK, here is a simple tee2:

tee2.c - read from standard input and write to standard output, standard error and a file  Expand source

 

And just compile it:

 

And then do this:

 

Also it maybe also easy to make a perl or ruby version of tee2 :). Any better way to do this? Feel free to edit this page.

Using Netcat as MiddleMan

Here a bash script to see what being send on port 8021 and being received:

netcat-middleman.sh