Friday 22 June 2012

Create Own SMS Gateway

SMS (Short Message Service) is a very popular service which used to send a short message to someone via cell phone. To send a message would require a gateway to the dissemination of information by using SMS.
Are you interested to create your own sms gateway, so you can provide a free sms service on your sites?
Nowadays, many websites that provide a free sms service, even now you can also create your own free sms service on your website in a way that is not too difficult.
How to build your own sms gateway?

1. First you need Gammu software and MySQL. Gammu is an application to build a sms gateway which connects between the mobile operator with the internet. Even Gammu can also be used to make a voice call and is available for Windows and Linux platforms. While MySQL is used as database server.
You can download Gammu application here.

2. Then install Gammu in the root directory or in the C drive on Windows platform.

3. Perform Gammu configuration by editing the “GAMMURC” file located in the Gammu installation directory. You’ll find the two parameters that you have to fill the ‘Port’ and ‘Connection’.
‘Port’ parameter must match with the the cell phone port number which attached to computer. Make sure that your cell phone driver already installed properly on the computer. To find the cell phone port number can be seen on the “Phone and Modem Options” in the Contorl Panel.
example:
Port = com3:
Connection = at115200

4. Next, do test the connection by going into the Gammu installation directory via DOS Command Prompt, then type “gammu identify” command like the example below.
example: C:\gammu>gammu identify
If you see information about your cell phone connection, such as Model, Revision, Manufacture, and IMEI, then the configuration has been successfully done, but if it does not show information about your cell phone connection, then it is likely configuration is not correct, check the parameters of the ‘Port’ and ‘Connection ‘in step no. 3.

5. The next step is to create the MySQL database are Gammu required as SMS Gateway. You can also use other server database application that you are more familiar know other than MySQL.
Create a database using phpMyAdmin, as for example with the name ‘sms’. Then create new tables are needed for Gammu. You can see the Gammu required database tables in the ‘mysql-table.sql’ file located on the Gammu installation directory.

6. Perform configuration daemon on Gammu SMS for automated reading process SMS messages sent or received and then stored in a database.
Open the file ‘SMSDRC’ located on Gammu installation directory, then edit using a text editor such as Notepad. The following parameters must be configured:
port = port number
connection = connection type
service = mysql (if using MySQL)
user = username account on the server
password = password defined for the username account on the server
pc = IP address or host name of the server (default: localhost)
database = sms (adjust with the database name that you created)

7. If you want to run Gammu as a Windows service, you can use the command “gammu-smsd -c smsdrc -i” (without quotes) via DOS Command Prompt. If successful, you will see Gammu applications on Windows Services list.

8. The final step is to connect the SMS Gateway with your website. To perform this step you will need the public IP (the IP you get from the ISP you use) or IP hosting your web server and a PHP script to perform the process of sending a message.
scripts example:
Copy the script below and paste it into Notepad or other text editor and save with the name “form_sms.php” (without quotation marks).
<script type=”text/javascript”>
function check_length(my_form)
{
maxLen = 160; // max number of characters allowed
if (my_form.shortMessages.value.length >= maxLen)
{
// Alert message if maximum limit is reached
var msg = “You have reached your maximum limit of characters allowed”;
//alert(msg);
my_form.shortMessages.value = my_form.shortMessages.value.substring(0, maxLen);
}
else
{
my_form.messagesCounter.value = maxLen – my_form.shortMessages.value.length;
}
}
</script>
<form name=’formSMS’ action=’send_sms.php’ method=’post’>
<table width=’250px’>
<tr>
<td><a style=’text-decoration:none;’ href=”http://your_domain/form_sms.php” alt=”Free SMS” target=”_blank”><b>Free SMS by Qblog</b></a></td>
</tr>
<tr>
<td>No. Telp :</td>
</tr>
<tr>
<td><input type=’text’ name=’noTelp’ id=’noTelp’ maxlength=’20′ size=’20px’/></td>
</tr>
<tr>
<td>Pesan :</td>
</tr>
<tr>
<td><textarea cols=’50′ rows=’60′ name=’shortMessages’ id=’shortMessages’ onkeypress=’check_length(this.form);’></textarea></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>Jumlah karakter tersisa : <input type=’text’ name=’messagesCounter’ id=’messagesCounter’ size=’2px’ value=’160′ readonly=’yes’/></td>
</tr>
<tr>
<td><table border=’0′>
<tr>
<td>Jumlahkan :
<td style=’font-family: monospace; font-size:5px; font-weight: bold; color: RED; padding:0px; margin: 0px; line-height:3px;’>
<br />
<br />
&nbsp;S&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;S5D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
5A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Q&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;G&nbsp;&nbsp;&nbsp;E7X<br />
&nbsp;Q&nbsp;&nbsp;&nbsp;&nbsp;2D5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;R&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;IK2<br />
LIJ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
</td>
<td><input type=’input’ name=’7fb282737fbe25fd137f1cfc5c386565′ size=’2′ maxlength=’2′/><input type=’hidden’ name=’4cc611166e3a306958949c903ba5b0c9′ value=’47f8b7965f41c9ec52e4de0d36fab7ce’ /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><input class=’btn-submit’ type=’submit’ name=’btnSubmit’ value=’Send’/></td>
</tr>
</table>
</form>

“send_sms.php” script.
<?php
mysql_connect("dbhost", "dbuser", "dbpass");
mysql_select_db("sms");
$phone = $_POST['noTelp'];
$message = $_POST['shortMessages'];
$query = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID) VALUES ('$phone', '$message', 'Gammu')";
$result = mysql_query($query);
if ($result)
echo "SMS sent";
else
echo "SMS failed";
?>

Upload both files on your web server, and specify its location. If you put it on the root, it can be accessed at the URL http://your_domain/form_sms.php
You can see examples of websites that provide free sms service on http://bloqita.net . Bloqita is a blog media network which has many features and facilities of social networking as a media gathering place for bloggers, and one of those features is a free sms service.
Related Posts Plugin for WordPress, Blogger...