The Web App Challenge: £0 to £3000/month in six months

It’s a new year. Time to re-focus on those life goals and keep life heading in the desired direction.

I was reading Nathan Barry’s blog today and have decided to join him in the Web App challenge. Unlike Nathan, I have some idea about the web application I want to build, but I’m still researching and planning at the moment. To be honest Nathan’s post couldn’t have come at a better time. I’m hoping to be just as transparent and take inspiration from his aggressive approach and tight timeline (leaving me less time to procrastinate!).

What our challenges have in common

– Extracting ideas in the style of Dane Maxwell

– Building a web application

– Using Ruby on Rails

– Looking for to create a SaaS (software as a service) product.

How our challenges will differ

Unlike Nathan, I’m assigning a budget of ZERO. I plan on doing the design / development / marketing etc by myself, whilst working full time at my job (which is often more than the usual 9 to 5).

I have experience in programming with Ruby and Rails, but have never built a full web app, especially one I intended to sell. I’m hoping the next few months will solidify my knowledge of Rails and allow me to create software that provides real value to my eventual target market.

Join in?

Whilst the Web App Challenge isn’t an official challenge (as far as I know), I encourage you to join in. It would be nice to have some community to share the ups and downs and building a software product with. Besides, what better way to start the new year than to start working on a new project?

To our successes in 2013! Happy new year 🙂

— CD

Project Ideas

Recently I’ve had the urge to make something. I have random ideas about cool things I’d like to have in my life and start researching how to build them.

My problem is I’ve now got several ideas in my head and no clear starting point so my progress has been unimpressive.

Below is a list of ideas I have. If you know how I should tackle any of the below please get in touch. The list is to serve as a reference for myself.

1. Sip door phone
I’ve seen expensive consumer products but reckon I can build one myself using raspberry pi or similar. The idea is someone pushes the button and it calls the phones attached to my asterisk (in my home, in my office and on my mobile). Whilst ringing the person at the door is asked for their name and purpose so this can be played when I answer. (Useful when packages are delivered and I am not in – also when friends visit and I am out.) Extra: add a picture or webcam feed, ability to notify an iOS or android app, and possibly the ability to lock unlock the door from any phone that answers the doorbell.

2. Sip loudspeaker
I don’t know why, but I’d like my house to talk to me. I’d like to know how the underground lines look in the morning while I make my tea. I’d also like to be able to leave messages for family members when they return to the house (use of motion sensor). I’d also like two way calls via the speaker, so I could call the speaker and talk to whomever might be in. This would also be good in my grandfather’s house so we can talk to him without him needing to operate a phone.

3. Home automation (general)
I have lights I can control via iOS or android apps. I’d like to make them smarter e.g. know I was heading upstairs and that no lights are on and either ask if I want them on (can use sip speaker, motion sensor + voice command software) or just turn them on anyway.

4. Money management app
I am planning to build this in Rails. This is for a friends business so I’m not going to say much here.

5. Git server
I’d like to host my own github style site to backup my work

6. Android management Either the ability to remotely manage family members android devices e.g. initiate app updates, backup images etc via a web interface. Also ability to provide remote support I.e. ability to see the screen of a family members device and show them how to perform common tasks. (Vnc style).

7. Follow me music system I would like a sonos style setup whereby I can dictate what is played in each room. If I could tie this in with the sip speaker project that would be great.

8. Android sip client I know many of these exist but I’d like to build one just for fun. That’s it for now.

9. Home security
I’d like to be able to tell what’s going on in my house at a glance (phone/tablet).

10. Media displays
Use “small computers” (e.g. raspberry pi / arduino) to power 4 large TV screens with advertising. Using XiBo or similar.

11. Home Check-in
Use the Raspberry Pi to monitor the MAC addresses connected to my home network. Use these addresses and a few logical conditions such as time etc to determine whether members of the family are at home or not. This can then be extended to tie in with home automation and turn lights on when returning home and nobody else is at home.

Will update when more ideas keep me awake at night.

Get things done

It doesn’t matter how big the task at hand – finish it.
Break it into smaller chunks of you have to and finish those.

I’m reminded of a quote:

The difference between successful and unsuccessful people is that successful people do what they should do, whether they feel like it or not.

Be healthy – 30 day challenge update

The thirty day ‘be healthy’ challenge came and went far quicker than I thought it would. In all, I would say it was a success, as long as I renamed the challenge ‘no alcohol’ rather than ‘be healthy’.

Trips to the gym dwindled from 3 times a week to 1, and my diet, whilst not terrible, included one too many treats for my liking.

Since the challenge I have definitely felt less inclined to drink alcohol whilst socialising, and when I do, I notice I consume far less than before.

So what’s next? I’m not sure. I want to pick up programming again (haven’t coded properly since May 2012 when I built a recommendation system for public displays) so it’s likely my next challenge may be related to that.

Be healthy – 30 day challenge

Early this year I wrote about doing 30 day challenges and promptly forgot all about it. You can insert all the usual excuses here.

My main excuse: I spent some time travelling and have been enjoying life. In recent weeks, I have returned to ‘reality’ and have a more stable routine. I’ve actually started working more normal hours (9 to something) and this has brought with it some new challenges.

A little background. At some point during my travels I lost around 8kgs of weight from 68 to 60, and in the last three weeks I put on around 3 to 4kgs, mainly due to little exercise, poor diet and lots of drinking. About a week ago I revisited my old blog posts and decided it was time to do a thirty day challenge and get back to writing more frequently. And so, my challenge for this month: ‘Be healthy’.

What does that mean?
– Eat well (cut out junk e.g bad carbs, chocolates etc.)
– Exercise at least 3 times a week
– Drink lots of water & green tea (avoid fizzy drinks, sweetened tea and too many juice drinks.)
– Stop drinking alcohol (this is hard given the culture and people I am surrounded by, where drinking is very much ingrained as the default social activity of choice)

How am I doing?
I had meant to write this post sooner but didn’t get round to it. On the bright side, I have some stats for the last 7 days:

– I have been to three separate social drinking occasions / nights out and stayed mainly on tap water.

– I have been eating ‘healthy’ meals where possible, although I have cheated and snuck in the odd chocolate / doughnut.

– I have exercised 3 times for at least an hour.

Why?
A few people have asked me why I am doing this challenge, so here’s my reasoning:

– I want to see if I can do it (a lesson in self discipline and willpower)

– I want to save money for other things e.g. Flying lessons and investments (more to come in a future challenge)

– I have a personal goal to reach a certain level of fitness.

– It’s a lot easier (and cheaper) to drive home after a night out than take a cab.

– I wanted to see whether alcohol makes me enjoy a night out more or less. So far I’d say I’m happy sober and can make my own good mood without the need for drinks. Waking up without a hangover or feeling rough is great too and gives me more time to enjoy the weekend.

If you’re thinking of doing a 30 day challenge – do it! Leave a comment and let me know how you’re doing too 🙂

Asterisk setup and config tutorial

Asterisk PBX (private branch exchange) is a fully featured phone system. From what I’ve read, it’s used by companies in all shapes and sizes, and can be made to do some pretty amazing things.

My current set up has 3 different incoming UK numbers (for three different companies) hitting my Asterisk. Each number is handled differently. They forward calls to mobiles, take voicemails, record all calls, email call alerts, forward to SIP Phones or a combination of these options. My aim is to show you how to configure asterisk to do all of the above and more.

This guide is covers installation of Asterisk 1.8 on a CentOS 5 VPS in 2012. The intention is for this guide to serve as a reminder to me and a tutorial for you. I had an installation running for about 6 months until RAID crashed on the VPS and I lost the whole asterisk. Starting from scratch, I realised I had forgotten where to start and how I’d configured the system. The new system is better now. I digress.

What you’ll need

  • A server, preferably Linux. As mentioned I’m using a VPS with CentOS 5.
  • A SIP based VOIP Phone. This can be software (I recommend X-Lite (free) for windows and mac – the site is geared towards selling, if you can’t find the files please comment and I’ll update with direct links.) You may also use a Hardware SIP Phone.
  • A VOIP account – I use sipgate in the UK to provide my FREE UK inbound number and handle the outbound calls (I added credit to my account). They also provide US and German numbers too.  

We’re not covering physically attaching asterisk to “real” PSTN phone lines, in favour of using “virtual” sip trunks with real phone numbers.

Installing Asterisk

I don’t intend to re-invent the wheel here. You’re going to need root access to your server and be comfortable at command line. There were two resources I found online that got me installed: Installing asterisk 1.8 on CentOS 5 (opens in new window) and Installing asterisk 1.6 on CentOS 5.2.

I followed the Asterisk 1.8 and CentOS 5 guide and it seemed to do the trick. If you get stuck please just leave a comment and I’ll do my best to help.

 Starting Asterisk

Now, I hope you have Asterisk all installed and didn’t end up stuck or with too many errors. Presuming everything went to plan, you can now type

asterisk

to start asterisk. Then the following to “connect” to the asterisk server.

asterisk -r

After running the above command you’ll see (or something similar):

Connected to Asterisk 1.8.15.0 currently running on pbx (pid = 1799)
pbx*CLI>

Congratulations! You have a running PBX.

Preparing to make and receive calls

Now since Asterisk is going to be routing your calls over the internet you’re going to want to make sure you have a firewall set up and open up the ports required for it to work. You need to make sure you only open as many ports as you need to make sure you are safe. Getting hacked could be hostly, not just because you’ll have to clean up, but because a hacker could take advantage of any outbound calling lines you have and run up the bill.

Also, not having the right ports open has been reported to cause lack of sound.

Follow this guide (opens new window) on setting up your IP Tables, and we’ll carry on once you’re back.

CentOs IPTables Set Up and CentOS Start IPTables  (for reference and background reading)

Receiving Calls with Asterisk

The fun begins now. There are two ways we can place our first call with asterisk, using your SIP Phone, or not. I’m going to presume you’ve set up Asterisk but do not have a SIP Phone handy (just like me the first time I set up Asterisk).

Accepting calls from PSTN (real phones) on Asterisk

You set up a sipgate account right? We’re going to be using it now to place a call from a real phone to our sipgate number. The sipgate number will be answered by Asterisk and play us a message or some music.

If it’s prohibitively expensive for you to call a UK, US or German number (as provided by SipGate) then I will be covering set up using SIP Phones further down. So you can scroll down, or google some SIP providers that provide free numbers in your local area 😉

On your server you need to change into the asterisk directory:

cd /etc/asterisk

If you type the command ‘ls’ (without quotes) now, you should see a lot of .conf files. These are the files that we edit in order to let asterisk know how we want our calls handled, set up new extensions, voicemail boxes etc.

The first file we want to edit is called sip.conf.

vim sip.conf

Now I’m not presuming you know vim, because I didn’t when I first installed asterisk so here are some basic commands that will help.

  • Arrow buttons (up, down, left right) for moving the cursor.
  • Shift + up or down (scrolls up our down an entire ‘page’)
  • i – type the letter i when you’re ready to start inserting text or editing. Press esc to stop editing.
  • :q – quit without saving. (make sure you push esc if you were editing)
  • :w – write aka save
  • :wq – save then quit

The sip.conf file will have a lot of commented out text example text in it. It’s recommended you read through it to see what is possible (I haven’t). Somewhere after you see

[general]
context=default
allowoverlap=no

You want to insert the following to allow Asterisk to log in to your sipgate account.

[sipgate]
type=friend
host=sipgate.co.uk
fromdomain=sipgate.co.uk
fromuser=1234567 enter your numerical username here
callbackextension=1234567 numerical username again
defaultuser=1234567 numerical username again
context=sipgate_in
outboundproxy=sipgate.co.uk
qualify=yes
secret=password
insecure=invite
allow=g729
allow=gsm
allow=ulaw
dtmfmode=rfc2833

The fields are where you need to input data from your SipGate account. The numerical username is referred to as your SIP ID on sipgate’s website. Once you are logged in you need to click settings then overview to find your SIP password (NB: it is not the same password you use to log in to your SipGate user account).

Don’t forget to type :wq to save and close the file. Asterisk should now have enough information to log in to your sipgate account. (You can check asterisk registers successfully and I’ll show you how in a moment.)

A key line to pay attention to is the line that reads context=sipgate_in. This tells asterisk where to look next for instructions on how to deal with the call.

The next file we need to edit is the extensions.conf file.

vim extensions.conf

Again, this file will have some sample text in it. Find some space in the file and make sure you start inserting BEFORE a line that has text in square brackets. For example you would insert your text immediately before [demo] or whatever the line may read.

The text in square brackets defines a context (more on these later) and we’re going to define out own context now. Any guesses what it will be called? Did you say sipgate_in? Well, then you’d be right. Here’s what we have to insert:

[sipgate_in]
exten => 1234567,1,Playback(vm-goodbye)
exten => 1234567,n,Hangup()

Make sure you replace 1234567 with your sipgate SIP ID (aka username from the sip.conf file). That’s all that needs doing. Don’t forget to save and quit (:wq).

The sip.conf file tells asterisk to look at the context [sipgate_in] for details on how to handle the call. In this context, asterisk simply plays a file called vm-goodbye and then hangs up. You can’t dial your number just yet, but we’re nearly there.

Connect back to asterisk CLI (command line interface).

asterisk -r

You may need to type asterisk on its own first if it isn’t running. Now we need to let asterisk know we’ve updated some files and that it should reload them. Run these commands, one after the other:

sip reload

Reloads the sip.conf file

dialplan reload

Reloads the extensions.conf file

reload

Not strictly necessary but done for good measure. (You may see some errors and warnings from this one, but you can probably ignore them).

Let’s check if Asterisk is connected to sipgate properly.

sip show registry

If you see an entry for sipgate and the word Registered under state, you’re good to go. If not, you need to double check your sip.conf file and make sure your password etc are correct. Don’t forget to come back to the Asterisk CLI and reload the file before showing the registry.

Make your test call using your normal phone and dial your SIPGATE number. 

You should hear “goodbye” and then be hung up on. Et voila, you have a working PBX!

You can also use Asterisk to make calls via your sipgate number, to either other sipgate or SIP users or to normal phones, although you’ll need to pay sipgate for credit. You can also set up with multiple providers to use the ones who give you the cheapest rate depending on where you’re calling.

Oh and for more Asterisk CLI commands you can type help or look here.

Making calls with Asterisk

Whether you set up Asterisk with sipgate or not, you can still have some fun. The real power of asterisk is providing an office like phone system where each user can have their own extension and voicemail. Calls can be passed to an auto attendendant (menu system e.g. push one for sales, two for billing) or and IVR (interactive voice response) which is more like when you call your bank and are asked to enter details like your date of birth or customer number and the system checks your details against a database before reading your balance. This is all possible with Asterisk.

Let’s start with adding some extensions. I’m hoping you’ve read the part above, so you’ll understand the editing of sip.conf and extensions.conf.

On your server, if you haven’t already:

cd /etc/asterisk
vim sip.conf

Where you’ve entered  (or would have entered) the sipgate entry directly below this you want to enter the following:

[phone1]
type=friend
defaultuser=phone1
nat=yes
host=dynamic
secret=abcdefg
regexten=1003
regcontext=phone1
context=sipgate_out
insecure=invite
canreinvite=yes
allow=all
[phone2]
type=friend
defaultuser=phone2
nat=yes
host=dynamic
secret=abcde
regexten=3001
regcontext=phone2
context=sipgate_out
insecure=invite
canreinvite=yes
allow=all

Make sure you change the secret to something secure. Save the file and quit.(:wq).

You can also see that the context on both phones we’ve registered here is set to sipgate_out. This means that when either of these phones are connected to asterisk, it will look in extensions.conf at [sipgate_out] to determine how to hand the digits dialled. So let’s add something to extensions.conf.

vim extensions.conf

Underneath the entry we made for [sipgate_in] (or where you would have made that entry) add the following:

[sipgate_out]
;this context is assigned to phones/users so that they may call
;9 should be used to make a call out via this sipgate line.

exten => _90[1-9].,1,Set(CALLERID(num)=sipgatenumberhere)
exten => _90[1-9].,n,Dial(SIP/${EXTEN:1}@sipgate,30,trg)
exten => _90[1-9].,n,Hangup

;here come general extensions for all users.

;first is to record some messages.
exten => 3003,1,Answer()
exten => 3003,n,Wait(2)
exten => 3003,n,Record(/var/lib/asterisk/sounds/recordings/recording.gsm) ; # to stop recording.
exten => 3003,n,Wait(2)
exten => 3003,n,Playback(/var/lib/asterisk/sounds/recordings/recording)
exten => 3003,n,Wait(2)
exten => 3003,n,Hangup

;3001 to dial phone 1
;tmpA(beep) performs call screening
exten => 3001,1,Dial(SIP/phone1,18,tmpA(beep)
exten => 3001,n,Hangup()

; 3002 dials phone 2
exten => 3002,1,Dial(SIP/phone2,18)
exten => 3002,n,Hangup()

The comments in the dialplan should explain what is happening clearly. If user on phone1 or phone2 dials 9 followed by a number, asterisk attempts to place the call via sipgate. If the user dials 3001 or 3002, asterisk attempts to call the relevant phone. Dialling 3003 allows you to record your voice and save a file, this will come in useful later when we record our own menu system.

Now for this to work you need to set up your hardware or soft phones. All you should need is the IP address of your server running asterisk and the username e.g. phone1 or phone2 and the corresponding password (the secret field from sip.conf).

Don’t forget to connect to the asterisk CLI and reload everything.

asterisk -r
sip reload
dialplan reload
reload
sip show users

This last command should show all registered phones. If your phone1 or phone2 is not listed then you need to double check your settings. I believe on x-lite you can set up two accounts on one device. If you’re all set up you can dial either 3001 or 3002 and see if you can call the other phone. You can also dial
910005 (9 for sipgate line) and 10005 being the sipgate echo test. Where you should be able to speak and hear yourself. Alternatively you can dial 3003 to record your voice and have it played back via the asterisk system.

To be continued

I didn’t realise it would take this long to write this guide. There’s lots more I’d like to share, so I this post will be followed up by others. If you liked it or have any comments or questions please leave them below and feel free to tweet and share this post too!

The Definitive Guide

Within the asterisk community there seems to be one book that everybody loves. I’ve had to check it out and found it VERY informative. If you have any interest in playing with asterisk a lot I recommend you pick up a copy of Asterisk: The Definitive Guide.

 

Android 4.0.4 Ice Cream Sandwich (ICS) for Nexus S (GSM)

A couple days back Google announced they’d be releasing an update for their flagship phones, the Galaxy Nexus and Nexus S, but they were pretty vague on locations.

I was one of the (un)lucky few who received the Ice Cream Sandwhich update which took my Nexus S from 2.3.6 (Gingerbread) to 4.0.3 (ICS). I am happy I have the new ICS features but really disappointed with the poor performance on battery life and lack of recognition for numbers in my phone book! After all, what good is a phone if it doesn’t stay on, and when it is on, you cannot tell who is calling?

And so, here I am, eagerly awaiting the 4.0.4 update and wondering if it is even being rolled out in the UK?! If you’ve got a Nexus S and receive the over the air update please do leave a comment!

I am hoping the battery life will match the update Galaxy S II running 2.3.4 where light use gave over 1 day and a few hours of battery! I have never seen my nexus last for more than 20 odd hours even with little or no use.

Try something new for 30 days.

They say it takes 21 days to form a new habit (30 days if you want to be sure).

Days in groups of 30 seem to pass me by all the time, and my life seems to change very little between any two days that are a month apart. There’s nothing I can do to stop time passing by, but I can change what I do (and achieve) in that time.

There are lots of things I’ve thought I’d like to do or try at some point but they never seem to happen, or I try for a day and then forget when reality and other obligations present themselves.

So, with inspiration from Matt Cutt’s TED Talk and blog, I’ve decided to take on the 30 day challenge. I only decided less than an hour ago, and already I’ve formulated a list of some things I’d like to try. Initially I thought I’d do one at a time, but some would make sense together.

Here’s the list in no particular order:

– write one blog post a day
– limit television viewing to 1 hour a day
– practise coding for 2 hours a day
– workout at least 30 mins a day
– wake up at 8am (whilst getting 8 hours sleep)
– take one picture a day
– no junk food e.g. chocolate, biscuits, sweets, crisps, donuts and anything with “bad carbs”.
– drink 2 litres of water
– no talking on Wednesdays unless in response to a direct question (an idea from The Monk Who Sold His Ferrari)
– meditate for at least 10 minutes
– write a to-do list with 3 major goals for tomorrow, each evening.

That’s the list for now. I will add to it over time and cross off items as completed.

I think this will be a really good exercise in developing will power and self discipline.

I’m hoping to use this blog for some accountability, please feel free to ask me how its going and if you’re feeling adventurous, suggest new things for me to try or tell me about your own 30 day challenge experiences.