Beruflich Dokumente
Kultur Dokumente
vaio
[Type the company name]
SMS
Build Your Own SMS Server SMS
About Me
Here’s a brief about me. My name is Azril Nazli and I’m from Malaysia. Met Linux since
1995 and never stopped loving it since then. Started web programming back in 1999
when PHP3 was introduced and now I’m still developing using CakePHP Framework.
Apart from this SMS Project, I manage a wifi controller using open source tools.
http://mamakspot.blogspot.com
Linux, Vi Text Editor, Web Programming basic and able to follow visual tutorial and able
to troubleshoot by yourself and able to use Google
Build Your Own SMS Server SMS
INTRODUCTION
In this tutorial, we will build a SMS system using your own computer and normal mobile
phone. The goal of this tutorial is, to use a web based system for sending and receiving
SMS.
Hardwares used
Softwares used
Now we want to boot using Fedora 9 Live CD ISO. Click Edit virtual machine settings
Build Your Own SMS Server SMS
Select CD-ROM and choose Use ISO image. Then Click browse and point to your Linux Fedora ISO image.
Build Your Own SMS Server SMS
Click Yes
Build Your Own SMS Server SMS
Restart back the system and login as root ( Choose Other in login window ).
I will not use X Windows since it will use a lot of memory. So to turn off X Windows server, using Shell
Terminal, edit this file /etc/inittab. Change the defaut value from 5 to 3 as shown above. Save the file and
restart the system.
Build Your Own SMS Server SMS
After you restarting the server, login as root and type this command to check your assigned ip address via
DHCP.
Ifconfig eth0
To enable you connect the the system using WinSCP or FileZilla Secure FTP, turn off IPTABLES service and
turn on SSHD service. Issue these command
Gnokii 0.6 is already installed by default in Linux Fedora 9 distribution. But we need to install Gnokii
SMSD. Issue this command
Then the system will automatically find gnokii-smsd on Linux Fedora Repo server. Choose Y
Build Your Own SMS Server SMS
Next we need to install Gnokii SMSD MySQL. We will using MySQL database to store incoming SMS and
using MySQL to send outgoing SMS. Issue this command
Till now, you have already installed 2 application. What needed till now is
gnokii-0.6.24-1.fc9.i386
gnokii-smsd-mysql-0.6.24-1.fc9.i386
gnokii-smsd-0.6.24-1.fc9.i386
Build Your Own SMS Server SMS
Choose Y to install
Build Your Own SMS Server SMS
Fedora 9 doesn’t comes with PHP as default, so we need to install PHP. Issute this command
We will need PHP-MySQL extension to store the data from PHP. Isse this command
We need to allow execution of .htaccess in /var/www/html folder since we will use CakePHP for our
FrameWork.
I use FileZilla to access my system located at 10.1.10.107. After logged in, go to /etc/httpd/conf/ and edit
this file httpd.conf. I use Crimson Text Editor for editing.
After you saved the file, FileZilla ftp will ask for confirmation. Click OK.
We have installed PHP and MySQL. Now we need to run them using service command.
We need to install wget to download files for the internet using wget. Issue this command
Go to http://www.cakephp.org and download CakePHP 1.2.0 RC3 and place it on /var/www/ folder. You
either download using Windows and transfer to Fedora using FileZilla SFTP or use wget directly in the
console.
Build Your Own SMS Server SMS
I use wget to download cakephp 1.2.0 RC3 and rename it as cakephp.tar.gz. Extract it using this command
Then I rename html folder as html.ori . After that I rename cakephp_1_2_0 folder as html as shown
below.
Build Your Own SMS Server SMS
Now point you browser to you IP ADDRESS. In this case I use http://10.1.10.107 and CakePHP is
successfully installed on my system.
Build Your Own SMS Server SMS
We are going to add USB support to the system since I’m using Sony W980 mobile phone attacted to my
laptop via USB. Click Edit Virtual Machine Setting and you’ll presented by the menu shown above. Click
Add and choose USB Controller
Build Your Own SMS Server SMS
Then power on back the system. Don’t forget to connect your phone in ‘Phone Mode’.
Build Your Own SMS Server SMS
In this session, we are going to detect mobile phone interface in Linux environment. Make sure you’ve
have already installed your phone driver in Windows. In this case, I’ve already installed Sony W980 driver
in Windows XP. First make sure you’ve already connected your mobile phone in ‘Phone Mode’. Then, click
VM -> Removable Devices -> USB devices -> [ Choose You Mobile Phone Type Here ]
Build Your Own SMS Server SMS
dmesg
Now edit this file either using VI text editor or SFTP into the server and edit using your favorite text editor
Now we want to test the mobile phone connection. Run this command :
gnokii –identify
In my case, gnokii is able to detect my phone at /dev/ttyACM1 . If your system can’t detect the phone, try
change the port setting in /etc/gnokiirc file and start the test again.
Now for further testing, I send a text message to this number 0146412911 ( which is my other phone
number )
echo ‘Hello World’ | gnokii –sendsms < insert your other mobile phone number > [ENTER]
1. cd /usr/share/doc/gnokii-smsd-mysql-0.6.24/
2. ls –l
Command #1 is to enter the directory. Command #2 is to list the file inside the directory. We are going to
create a database and populate the table inside the file above, sms.tables.mysql.sql
Build Your Own SMS Server SMS
Step 2: import the table structure in sms.tables.mysql.sql file into the smsdb table
Step 3: log into the mysql database console and use smsdb database
4. show tables;
5. exit;
Build Your Own SMS Server SMS
Edit line 7 and change login value to ‘root’ and line 9 change database value to ‘smsd’
Edir core.php in the same directory and change line 153 to something else.
Build Your Own SMS Server SMS
Now open back the web server, in my case the server IP located at http://192.168.1.4
You should be able to see the message above. That means, you are ready to write the next application.
Build Your Own SMS Server SMS
We are going to create database model for table inbox and table outbox. First, create a file named
inbox.php inside /var/www/html/app/models folder. And paste the following code.
Then repeat the same process again for outbox.php. Paste the following code.
Next, we are going to create the controllers for Inbox and Outbox models. First, go to this folder
/var/www/html/app/controllers and create this file, inboxes_controller.php and paste the following
code.
Paste the code above and save as inboxes_controller.php inside /var/www/html/app/controllers folder.
Now it is time to test the interface. Using your windows XP browser, go to http://<your VM IP
Address>/inboxes. In this case my VM ip address is located at http://192.168.1.4/inboxes .
Now it is time to test the interface. Using your windows XP browser, go to http://<your VM IP
Address>/outboxes. In this case my VM ip address is located at http://192.168.1.4/outboxes.
Build Your Own SMS Server SMS
Now it is time to run the SMS Daemon. This daemon will connect to mysql database and the the tables for
incoming and outgoing messages. Run this command
Then try send a SMS to the connected phone and check your Inboxes database data using the web
browser.
If there’s no incoming data, probably you’ll need to tell gnokii-smsd to read the SMS from the PHONE
MEMORY. So just issue the following command.
gnokii --showsmsfolderstatus
Build Your Own SMS Server SMS
Here is the sample of my inboxes table. All the incoming SMS will stored directly into the database.
This is a sample how outgoing SMS inside the Outboxes databases. Just click New Outbox and only enter
Number and Text then hit Submit.
Now you have a working SMS System. To take this system further, you might need to learn some PHP
programming by harnessing the CakePHP power. Learn CakePHP at http://www.cakephp.org