Arnaldo’s Weblog

comments and stuff about linux, mac os x, freeswitch and asterisk – mainly

Skype, Gtalk and SIP

leave a comment »

FreeSWITCH supports some endpoints, most notably Skype through mod_skypiax, Gtalk through mod_dingaling and SIP through mod_sofia. Some time ago, I’ve thought about setting up my gtalk and skype accounts on a FreeSWITCH installation and let it automatically handle the calls’ routes, collect voicemails and what not.

I’ve been so lazy that it took me a lot of time to set it up. Anyway, I’ve configured it on a slicehost’s VPS and it works like a charm, making possible inter endpoints calls, taking care of the audio transcoding and everything. I can think of a few goodies of having the gtalk, skype and a SIP account configured on a FreeSWITCH instance:

1. Convergence: if a friend calls me on Gtalk, my SIP client rings. Note that the SIP client might be anywhere – I’ve been using it on my mobile and find it great.

2. Features/facilities for them all: all the three protocols might take advantage of the applications that comes with FreeSWITCH. I have configured: voicemail, hunt group / follow-me with whitelisting for calling me on my mobile if the call comes from a trusted source, call back + “DISA” allowed just for my mobile number, conference with an icecast live streaming, etc.

3. LCR: if you have more than one way to reach PSTN, each one with different call rates, you might configure different routes for each number pattern. In my case, I’m using SkypeOut for all my outgoing calls.

4. Ease of use: the user doesn’t have to open his/her Gtalk and Skype every time he/she wants to be online. Instead, just open the SIP client on the mobile phone (if it’s not opened already, mine is for days) and it just works.

My FreeSWITCH server runs on a virtual server with 512MB of RAM memory and the calls usually works perfectly on the three protocols. Please note that this isn’t the recommended hardware for running FreeSWITCH, but it just works. And well.

Advertisements

Written by lustyscripps

January 19, 2010 at 6:44 pm

Posted in FreeSWITCH, VoIP

Android + Ubuntu

leave a comment »

I’ve got a brand new (old) HTC G1 phone and just connected it to an Ubuntu box. The Android documentation instructs us to create an udev rule, as:

SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

After doing so, connecting the G1 to the box and running adb devices, I’ve got the error:

???????????? no permissions

Some pages says one has to be more specific on the udev rule and also add the device id (not just vendor id) to the rule, like so:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c02", MODE="0666"

Although, that doesn’t solve the problem. I’ve had to start adb server as root instead and the problem disappears. As a normal user:

./adb kill-server
sudo ./adb start-server
./adb devices

Written by lustyscripps

January 19, 2010 at 5:59 pm

Posted in android

web.py templetor

leave a comment »

I’ve used web.py some times (or even several, already?) and really enjoy it. The majority of the framework is really easy to use – and powerful, but the usage of $ on the templetor can be confusing, even after reading it’s well written documentation.

A question about it has raised on the webpy mailing list and Anand Chitipothu, as clear as always, explained, in the simplest form, how it must be used:

1. As a marker to indicate python expressions.

$x
$x.title
$x[0].foo
$f(x, y)
$(x + y)

2. As as a marker to indicate python statements and var. ($
immediately followed by a keyword).

$for n in numbers:
$if x == 0:
$break

3. As a marker to indicate python assignment. ($ followed by space)

$ x = 1
$ x = y + z*x

I think this covers all possible uses.

Written by lustyscripps

November 5, 2009 at 3:24 pm

Posted in python, web

Confidence

leave a comment »

I was trying to figure out where to host a svn server for a project and got impressed when I realized my client’s account on Locaweb already provides that. Also, it allows one to log into the server through ssh – no big deal, but cool.

Then, for the first time, I’ve logged into the server. As curious as I am, I was wondering what command line tools was available to my account and also in which (scripting) language they were written in, which led me to:

[mahuser@thahost ~]$ user
user-fix-owner users user-svn-deactivate user-svn-permissions user-wsgi-autostart user-wsgi-list
user_list user-svn-activate user-svn-list user-wsgi-activate user-wsgi-deactivate
[mahuser@thahost ~]$ which user-svn-activate
/usr/bin/user-svn-activate
[mahuser@thahost ~]$ file /usr/bin/user-svn-activate
/usr/bin/user-svn-activate: Bourne-Again shell script text executable
[mahuser@thahost ~]$ cat /usr/bin/user-svn-activate
#!/bin/bash

domain=$1
if [ -z "$domain" ] ; then
echo "Usage: ${0/*\//} "
exit 0
fi

/usr/local/locaweb/bin/locarun svn activate $domain
[mahuser@thahost ~]$ file /usr/local/locaweb/bin/locarun
/usr/local/locaweb/bin/locarun: setuid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
[mahuser@thahost ~]$ /usr/local/locaweb/bin/locarun
Segmentation fault

We all know that parsing is the biggest point of security flaws in software, BUT, when I saw that this locarun program expected an argument, I could bet it would crash if I didn’t pass one to it.

There’s also GCC and debugging tools on the server. What confidence does a service like that gives me? Well, do the math.

Written by lustyscripps

June 13, 2009 at 4:13 pm

Posted in random

Web console for FreeSWITCH

with 10 comments

After the addition of event_sink command to the event_socket interface (more on that later), I’ve rewrote the web console with more functionality: commands, event and logging. That means one can see the logs that appears on FreeSWITCH default console through a web browser.

The console is written using GWT.

Command completion screenshot:

Command completion

Event details:

Event detail

View logs:

View logs

To use it, download the compiled code from here, unzip it into FreeSWITCH’s htdocs folder and point your browser to http://freeswitch-ip-address:8080/org.freeswitch.FSConsole/FSConsole.html

Full size screenshots:

https://lustyscripps.files.wordpress.com/2009/01/picture-3.png

https://lustyscripps.files.wordpress.com/2009/01/picture-4.png

https://lustyscripps.files.wordpress.com/2009/01/picture-5.png

Written by lustyscripps

January 4, 2009 at 5:24 pm

Posted in FreeSWITCH

Tagged with

Rough FreeSWITCH console with GWT

with 3 comments

When writing an web ui for a automated dialer, I thought it’d be nice to have a client for FreeSWITCH written in GWT, the Google Web Toolkit. Actually, it would be even more nice to have a full featured ui written in GWT.

Anyway, I wrote a test and it works. It’s far from being nice to use, but it shows how easy it is to write web 2.0 apps that communicate with FreeSWITCH. The compiled source code is here, to use it, just unzip it on FreeSWITCH’s htdocs directory, usually: /usr/local/freeswitch/htdocs and point your browser to http://ipaddr:8080/com.ap.FSConsole/FSConsole.html

There’s almost no functionality in this program, it just works as a wrapper between your browser and FreeSWITCH’s xmlrpc interface. It also has completion for a minor number of commands (screen shot here). You should have mod_xml_rpc enabled to use it.

I tried to paste the source code here, but it stays VERY ugly with this template.

Update: As suggested by MikeJ, the autocomplete commands’ list is now fetched from FreeSWITCH.

An updated version of the gwt console for FreeSWITCH

Enormous source code here.

Zip with the whole directory tree, as well as Eclipse’s project file, here. The two scripts inside the zip file, FSConsole-{shell,compile} should be updated with the proper gwt’s compiler path for the whole thing to work. They both are generated by gwt and have the jar’s path absolute; I’m not sure how to change that, but if anyone is willing to touch the code, please let me know.

In the meantime, I’ll keep shaping FSConsole.java in my spare time.

Just to double check if you understood what’s this about: GWT is a set of axioms and a compiler. It allows the user to write code in Java and generates an output in HTML+Javascript. So you just have to touch the Java code if you plan to change/extend the UI’s behaviour, otherwise just use the zip file.

Written by lustyscripps

November 19, 2008 at 12:58 am

Posted in FreeSWITCH

Tagged with , ,

libopenr2 and FreeSWITCH

with 2 comments

I haven’t taken the time to do some things with FreeSWITCH or anything alike. Actually, I dropped the development of the MFC/R2 endpoint for Digivoice cards and have written nothing since that, so it’s time to come back. As I get no money out if it (either from VoixTel nor anybody), I work on it when I can, so don’t create any expectations about it. I don’t create any about you, the visitor, neither.

One thing I should mention here, is the willingness of Devel IT, a brazilian company, to borrow me some Digivoice cards, free of charge, so that I could write and endpoint for FreeSWITCH to support it. Digivoice itself has borrow me a card, but for a limited time and, when the period has expired, they had asked me to buy the card or to return it.

For some months I’ve used FreeSWITCH in production systems, in the middle of Asterisk and SipXecs to take care of things Asterisk just don’t understand – and to more reliably take care of the things, none wants a PBX software process to hang on gethostbyname() calls when a DNS server is not available. It has shown to be a very stable and rock solid piece of software, easily extensible and many-other-good-things-anyone-can-write-here. Now, Moy, a Mexican software engineer, has come up with another good piece of software: libopenr2.

There are also some brazilians working on the develpment of the library, most notably the ones cited on the CREDITS file, as: Alexandre Cavalcante Alencar, Cleiber Marques da Silva and Humberto Figuera. (NOTE: Humberto Figuera is actually venezuelan, really sorry Humberto.) Melcon Moraes is also notable for taking the time and risk of installing the library on some of our company’s production servers. I know those guys will keep the good work and fix/report any issues they might find.

What I plan to do now, is to make sure the build process works on mac OS X. After that, write an FreeSWITCH endpoint. Besides it’s 4:27am, and I haven’t slept more than 10 hours in the last ~5 days, I’m pretty much excited about all this and I’m anxious to port the library and write the endpoint for FreeSWITCH. The company I co-own uses fonast as it’s gateway platform, which means an Asterisk 1.2 which _a lot_ of fixes from Fonality, but that’s just not acceptable anymore.

The last thing I needed to write for it, was a work-around to get a partial QSIG-CF (ECMA-174) to work with Ericsson MD110 devices. I promised to myself not to touch any Asterisk’s, or libpri’s as that’s the case, anymore, as they’re VERY badly written. As a note, again: I really enjoy what Asterisk has exported, but it doesn’t fit my present needs and I don’t plan to use it on new projects. Anyway, after a hack in libpri, the partial QSIG-CF was working properly with MD110 and our client was happy.

Now to the real solution: let’s see how many days I take to port OpenZAP to OS X and, after that, make libopenr2 build on OS X. That’s the first step to have a FreeSWITCH endpoint which already implements forced disconnection on MFC/R2 Brazilian links, collect calls blocking and some other goodies. Of course I have just my spare time to work on that, but I don’t think It’ll take very long time – and I’m sure it’ll worth it, FreeSWITCH just runs out of the box and fixes the issues we have, instead of adding more. So, I really think the path to the MFC/R2’s FreeSWITCH endpoint is with libopenr2.

The conclusion is a little confusing here, but, for the people who work with those things, the idea is clear. Maybe I’ll try to sleep a little now.

Written by lustyscripps

September 26, 2008 at 4:47 am

Posted in FreeSWITCH

Tagged with , , , ,