Saturday, 14 August 2010

WIFI Hotspots and voip

Just out of interest and because I was there for other reasons I went into my city centre today, to see what free wifi zones where about. Wetherspoons and McDonalds carry free Wifi, and more and more zones are opening up in Libraries etc... I was pleased at being able to post pictures/photos while sitting in a Wetherspoons/Mcdonalds, and was quite shocked when I tried my voip service to find that it worked on one hotspot and was good quality.

You will find you have to register and log in via the web to get full use out of them though. It was astonishing that the VOIP worked in Mcdonalds when no STUN server was setup. Anyway had to change my password and account details after trying that on my VOIP account. I have since noticed that FRING, an application you can dload though the OVI store on the mobile has VOIP which can be used presumabley without sending passwords in plaintext to the VOIP service provider, and hopefully will use SSL. Something to check out later.

Thursday, 12 August 2010

I have a linux mail server - setting up mail on the Nokia E72

One of the key things with the Nokia e72 is email - it can sync to outlook via exchange, and although its weaker at push email it's not too bad. Its main drawbacks with email seem to be sent email is not sent to the exchange server 'sent' folder and is instead kept on the phone, and with mail sorted into server side subdirectories their is no 'new mail' indication.
Anyway - I don't care about all of that I need it to interface with my own non-microsoft server.
 
I have a very low power 8watt linux sheevaplug server which runs something called DOVECOT as a IMAP mail server. Procmail is used as an MTA (mail transfer agent). It might sound like a pile of alphabetii spagettii but its a lot easier than it looks once you have a decent guide and simply get down to setting it up.

http://tuxradar.com/content/get-started-fetchmail-procmail-and-dovecot

Behind the scenes I also run something called FETCHMAIL which logs into all my email accounts and retreives all my mail. Before getting the Nokia e72, I have been happly running a email client on my PC called ThunderBird + Lighting which handles all the DOVECOT mail.


I setup a pile of rules in Thunderbird to sort all the nonsense mail into various folders. Now I would simply like to configure this setup so that I can login anywhere with my Nokia E72 and read my mail and send from it.

This means 2 things need to occur ;
1. The folders have to be organised on my mail-server as the mail comes in, not the client - because the Nokia E72 mail client is not going to be churning through sorting mail when I connect!.
2.The Mail server has to be exposed to the internet so i can pick up mail from a fixed IP point

Anyone who knows what its like setting up things in linux knows the trawl you embark on to find this or that setting which is carefully guarded by the chief autistic linux savant know it-all C++ developer, who views anyone who doesn't know how to do it as an idiot, and the only way to get the information on making the THING WORK is accessed after the required 30-40 hours of trawling finding some post on a long forgotton forum. What - it 'sounds like a chance to save hours at my expense'!
Yes - your right.

First thing to do is to get a web address for your server via something like DynDNS. Sign up for this and make a note of  your address. Then install ddclient via 'apptitude' or 'apt-get install ddclient' or whatever and edit the /etc/ddclient.conf file, following the instructions and providing the new address. You will always be able to see your server on the internet now, but should not be able to access it other than by ping as your firewall will protect it. 
 For mail:
1. You need to change the NAT settings in your router so that IMAPSSL on port 993 is allowed and TCP traffic is passed to your server on 192.168.1.x (You may be able to use a 'virtual server' to do this on your router).
2. You have to change a few settings in dovecot -
mainly 'protocol = imaps managesieve' and the ssl settings enabled (they are commented out by default)
all described in this guide http://tuxradar.com/content/get-started-fetchmail-procmail-and-dovecot

You don't have to create your own SSL certificate as this guide states - so ignore that - you simply use the certificate directory under /etc/ssl by changing this setting in the ssl section of the /etc/dovecot.conf guide. When you connect you accept the client side certificate on the mobile device to establish the SSL connection..

And thats that - except for sieve...and managing the mail into its folders on the server...

BTW: handy little add onto thunderbird to manage sieve serverside mailboxes and rules  from Thunderbird!
https://addons.mozilla.org/af/thunderbird/addon/2548/

Got myself a Nokia e72

Great phone. For me - Most important are its SIP (Voip) and WIFI combination. I am not going into the ins and outs of the phone, GPS, Camera etc.. they are all great as far as I can see - you can check out hundreds of other guides for that on youtube whatever. Its nearest rival is the Blackberry bold 9700, better screen but  which has no SIP stack so your WIFI cannot be used for VOIP calls basically (The BB 9700 is also worst build quality - this Nokia e72 is made of steel and feels great).

SETTING UP SIP ON THE NOKIA E72
(of course all of this TOOK HOURS - AT MY EXPENSE!!! arrgh meaning you can SAVE HOURS)
I reset and formatted my phone to ensure no problems before trying this. I got my WIFI all working as well.  
Another reason for formatting was to get rid of the very sad lill liam n'DUBZ theme which made me feel it was basically a gangsta rappers phone left lying around. God knows what Nokia marketing is on to stick a gansta rapper theme, along with other below Z listers to utterly pollute a top end 'business' phone so you cannot even find the control panel. It looks like they even tried to get rid of SIP.

1. First thing - SIP CANNOT be accessed and make to work without downloading and installing Advanced VOIP Settings from the Nokia Website.  * SIP 3.x VOIP * is the one you want.

Then I setup my betamax account for calls as follows;.

Justvoip is my SIP provider, you will have to subsitute with your own.

MENU > CRTL PANEL > SETTINGS> CONNECTIONS > SIP Settings
Create Profile
Profile Name: justvoip (or whatever you want)
Service Profile : IETF
Default Destination : sip.justvoip.com
public username : myname@justvoip.com
Use compression : No
Use Compression : No
>Proxy Server -
Proxy Server Address: sip.justvoip.com
Realm : justvoip.com
Username : MyName
Password : MyPassword
Allow loose routing: Yes
Transport Type: UDP
Port:
> Register - All the same as entered in proxy
2. Then goto Net Settings > AdvancedVOIP Service, create new service, select Justvoip, and ACTIVATE.
The service should now be working - but you will notice bad quality or no sound at all when using it.

The reason for this is because your router and internet firewall is blocking all the internet traffic that is going to and from your external internet ip address (eg; 209.112.344.232:5060) Your phone will have a random addess inside your network of the form (eg; 192.168.1.23) to direct traffic to and from. Your router has to Network Address Translate (NAT) the SIP VOIP traffic to your nokia e71/72 etc.. at 192.168.1.23:5060 (and other ports) from the one external internet IP address, but hasn't been told to do this properly - when it gets traffic to the SIP port what network device does it give it to?. Also your firewall will likely be blocking the 5060 and other SIP ports.

http://www.feptias.co.uk/AdviceSIPNATSolutions.htm

At this stage in getting everything to work we want to bypass the router and firewall because thats a pile of complication we don't need to worry about! - so lets set up the Nokia in the DMZ (the routers DeMilitarized zone which exposes the Nokia addess 192.168.1.23 directly to the internet with no protection.

Getting the Nokia E72 into the DMZ. 
1. First we need to get the phones mac address (see below codes, or get this from your router's 'leases' ).

2. Then in your router, find the DHTP server and MANUALLY add the mac address to the desired IP address (eg: 192.168.1.23) so that your nokia ALWAYS connects to this address.

3. When you make sure thats all working, you set this address to be exposed in the DMZ of the router. Done?.

OK - now you can call - but the next thing I found I had to change was the codec order as my voice was very low bandwidth and garbed to hell when i called my brother, although he sounded ok.

FIX UP THE CODECS (what they don't tell you)

4. Go into Advanced VOIP Settings again, and this time you are looking for VOIP Services. Click on Justvoip (or whatever your service is) and you will find CODECS.
You will find a list of Codecs Now click OPTIONS->MOVE the 729 Codec to the 1 slot, followed by another high bandwidth codec like iLBC in the number 2 slot.

NOTE: TO EDIT/CHANGE THE SIP SERVICE - YOU MAY HAVE TO DISABLE THE SIP SERVICE IF ITS ACTIVATED (You do this in the 'standby menu' WIFI search option.

You will find this option in the first screen/standby screen of the Nokia e72 of enabling and disabling the SIP servers you set up under your WIFI connection. I find you can only run ONE SIP service at a time.

You can have one for incoming calls and switch to the one for outgoing calls by enabling/disabling each SIP service (its a bit of a pain but not too bad) when you want to make an outgoing call, then when finished you disable it and enable the incoming calls SIP service again.

OK it was all working ok for me from that point, but I would prefer to get the SIP services STUN server (it negociates the firewall and NAT problems) up and running rather than using the DMZ.

To do this and have the ATA available (which needs to be in the DMZ) for your phone/answerphone etc for when you are not around, you will have to ;
A. setup a different incoming SIP listening port and hopefully a different incoming SIP number and account for the E72. This way you can use them together.
or
B. Simply turn off/unplug the ATA, and enable the SIP service on the E72 when you want incoming calls diverted to the E72 when your around, you would have previously setup the E72 via STUN settings and fixed WIFI IP to have all the SIP (ports 5060 etc..) traffic diverted to it when the SIP service is enabled. Because there is no ATA active in the DMZ the router has to deal with the SIP traffic rather than the ATA device.

13/08/2010
I had real problems when trying to set up sipgate. I configured it all correctly even went into further advanced settings: Media Start Port : 9000 Media End Port: 9004 etc.. which is all shown by going to the sipgate help settings and selecting Nokia N97 rather than Voip Client 3.0.
I cannot hear the other party whatever setting I use or tweak on incoming calls. They can hear me fine though.
This implies it could be a UDP issue, because traffic is going out fine but not coming in, trouble is the Nokia is in the DMZ so all incoming traffic goes there first. I tried to set UDP to Automatic seeing if that would make any difference - but it just turned my voice unintelligable. Next thing is to try the TCP setting, but i doubt that would work.

However, when I call my sipgate voicemail, (by dialing 50000 as an internet call) via the sipgate sip provider I can hear and send keytones perfectly ok. The problem is purely affecting incoming calls. (You can easily setup sipgate voicemail by entering 50000@sipgate.co.uk into the voicemail fields - see the N97 setup under sipgates site.)
After hours of trawling the internet, there seems to be no solution to this MAJOR fault. OUTGOING caals work fine, but INCOMING calls - you cannot head the other party. I have a sopisticated router which has placed the E92 into the DMZ - so there can be no NAT/Firewall issues causing this. Its unlikely to be a setting I haven't set unless there is one undocumented - it must be purely down to the SIP VOIP client on the E72 and the way it handles calls!
Anyway - not worth the biscuit to go further into this I will just setup my ATA again and then setup the STUN and NAT forward ports on the router for the E72 so I can make outgoing calls.  

Nokia E series codes : Access from first screen (standby menu)
*#0000# -  Software revision, etc.
*#06# - " N" - IMEI
*#2820# - "#BTA # - Bluetooth Address
*#62209526# - *#MAC WLAN# - MAC Address
*#7780# - *#RST # - Restore Factory Defaults
*#7370# - *#RES # - Hard Reset
*#92702689# - *#WAR ANTY# - Life Timer
*#746025625# - *#SIM CLOCK# - SIM Clock status