I based my solution around a basic linux (Ubuntu) server - the machine itself is nothing fancy but is more than capable of handling the sort of load it's getting. The device being used to send/receive SMS messages is an "old" Nokia mobile phone that I have since retired from use as a handset.
The specs of all components I used are listed below - all up you should be able to purchase these items for less than $50 (or you may have the majority of them lying around).
Computer: IBM GL300 - Celeron 366, 128Mb RAM, 30Gb HDDPlease note: I am assuming some basic linux familiarity with this tutorial - if nothing else the ability to use a command-line editor such as vim to edit text files is required. I have tried to keep all the language simplified to make this tutorial suitable for people of all skill levels.
Phone: Nokia 7200
Cable: Nokia "Type CA-42" (this will vary depending on your phone, basically it's a usb to phone cable)
Software: Ubuntu Server (I used the "edgy" release) and Gammu (the part that does all the work)
Optional: USB Phone charger - this makes things easier than having to find somewhere to plug in another power adapter and is also much more energy efficient :)
Step 1 - INSTALL UBUNTU
The first step is to install ubuntu (server) on you machine. You can install the desktop (client) release if you prefer - although if you're doing so I woul recommend a higher-spec machine. As I am using this machine strictly as a server (all access will be done remotely once the initial install is complete) I had no need for a GUI or additional applications.Run through the setup and answer all the questions - they should all be fairly straight-forward, and if you get stuck the defaults are usually what are worth using.
The only point to ensure you do is select that you want to run it as a LAMP (Linux, Apache, MySQL, PHP) server.
Step 2 - Remote Access
Once the install is complete and the server rebooted, I like to install ssh so that I can complete the process from the comfort of my study (rather than coping with the noise from a rack full of machines). This is done with the following command:Once this is done you can complete the process remotely using an ssh client (in my case PuTTY) - of course you can always sit with your server and do it all locally - whatever you prefer.sudo apt-get install ssh
Step 3 - Update and Upgrade/Patch the server
I like to get things up to date and patch them before going any further (much like I would do with any other Operating System). Before running an update (to find out what is available) and an upgrade (to implement the upgrades) using apt-get, the /etc/apt/sources.list file needs to be modified to ensure that all universe and backport repositries are made available (this will make sense when you see the file).Once you have made the changes to /etc/apt/sources.list, use the following commands to update and upgrade your server:
sudo apt-get update sudo apt-get upgrade
Step 4 - Install Gammu
Installing gammu is surprisingly easy (once again thanks to the wonders of apt-get), just use the following command:sudo apt-get install gammuHard wasn't it? ;)
OK now it's time to plug your phone in and see if we can get things talking. With the phone connected, type the following command:
lsusbyou should now see your phone listed as a device - for example:
if not - make sure your cables and power are all good and try again.Bus 001 Device 002: ID 0421:0802 Nokia Mobile Phones
The gammu installation comes with some example configuration files which are worth using as a starting point - if nothing else they help you to understand how gammu can be configured so that you can tailor a solution for your needs. These are located in /usr/share/doc/gammu/examples (in gZip archives).
Copy the gammurc file to /etc/gammurc :
Now edit /etc/gammurc to specify your port and connection type (this will vary based upon where/how you have things plugged in and what sort of cable/interface your phone is using). The settings for mine are:sudo cp /usr/share/doc/gammu/examples/config/gammurc /etc/gammurc
Save this config and from the shell type:port = /dev/ttyACM0 connection = dku5
you should now be presented with some information regaqrding your phone such as:gammu --identify
If this is the case then you have got gammu up and running and can send yourself a test message with the following command:Manufacturer : Nokia Model : 7200 (RH-23) Firmware : 3.110 T (18-03-04) Hardware : 0903 IMEI : 353363000813894 Original IMEI : 353363/00/081389/4 Manufactured : 04/2004 Product code : 0514143 UEM : 16
echo "boo" | gammu --sendsms TEXT [recipient mobile number]That's it for the basic creation of your own private SMS gateway - I'll post a followup article which details how to integrate gammu with MySQL and also discuss creating a PHP front-end for it (these are the reasons the LAMP components were installed).
0 comments:
Post a Comment