This tutorial will guide you through the install of an SMS server on a Windows 2008 R2 server (I have also tested it successfully on W7, W8 and 2012 server).
My setup for this guide:
- Physical server running Windows 2008 R2 (64-bit)
- Wamp server (PHP, MySQL…)
- Huawei E230 USB 3G Modem
- Diafaan software
- MySQL connector ODBC 32-bit
Diafaan SMS Gateway
Diafaan is a SMS software for Windows-platform. Diafaan has support for several of «SMS modems/devices», like 3G modems, dedicated SMS gateways, android phone, etc…
They have some great manuals and reviews on different SMS-devices on their webpage.
Webpage: http://www.diafaan.com/
Prices (at publishing date) is from $195 to $995. They have three versions: light, basic and full. The difference is mostly how many gateways and connector you can add.
Diafaan communication software dates back to 1992 on their homepage, and the have released 3-4 software updates each year for the last years. So they seems pretty serious of what their doing 🙂
Modem
I found a Huawei E230 3G modem at home. At diafaan they only testet the E220, but E230 seems to be working just fine 🙂 You can get the E220 for about $20 (120 NOK) at ebay.
Short summary of the installation:
- Download the software
- Install Diafaan
- Install ODBC driver
- Set up a Gateway in Diafaan
- Set up MySQL connector
- Set up a Web connector
- Send an SMS
I will not show how to install MySQL. Simple way to do this, is to download Wamp server, that is an developer package that includes PHP, MySQL, Apache, PHPMyAdmin, etc…
Step-by-step installation
1. Download Diafaan software
Go to http://www.diafaan.com/ to download a FREE trial for 30-days.
2. Install Diafaan software
This should be straight forward and the only user-input needed is to check the license-agreement (and the install path if you don’t want it to be default).
3. Download ODBC driver
This step is only needed if you are going to use is with MySQL.
Go to http://dev.mysql.com/downloads/connector/odbc/ to download. In my case I only got the 32-bit ODBC to work. Remember you don’t need a user to download, just click download at the bottom of the page (after you clicked the first download button).
4. Install ODBC
Just click next, next, next all the way…
5. Going back to Diafaan
As you start Diafaan, you should get a wizard.
Create a admin-user for your Diafaan installation.
6. Select gateway type
Select which gateway type you want to set up. In my case I have a Huawei E230 as mentioned, so I select the «GSM Modem Gateway».
7. Add GSM Modem
Find you GSM modem in the dropdown-list, input the pin code and click the Test-button. I also had to input the SIM-card’s phone number for some reason.
Wonder what would happen if I write another number? 🙂
8. Name your gateway
I went with the default name. If you are going to have multiple gateways, for ex. multiple customers – you could write the customer name.
9. Select a connector
Select which connector you want. I’m starting with the SQL Connector, but will install the Web connector later in this tutorial.
Connector is the way you want to handle your messages. If you have a website, the SQL could be great, just insert message in the database and it will be sent automatically – but the Web connector has a URL-parameter you can use to send messages with from your webpage/application. To use both, you need at least the basic license.
10. Select database type
I have an MySQL database, so I’m selecting the ODBC.
In the next step you’ll need to connect to your database with the ODBC connector. This means that you need a MySQL database, user and a password ready. You don’t need any tables in your database yet, as you define which tables and columns the Diafaan is going to use in the next steps.
But to make it simple, we are going to use Diafaan’s sample database from their manual here: http://www.diafaan.com/how-to/mysql-database/.
11. Creating the database and structure with PHPMyAdmin
The Diafaan database example from their webpage:
CREATE DATABASE SMSServer DEFAULT CHARACTER SET utf8;
CREATE TABLE MessageOut (
Id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
MessageTo VARCHAR(80),
MessageFrom VARCHAR(80),
MessageText TEXT,
MessageType VARCHAR(20),
Gateway VARCHAR(80),
UserId VARCHAR(80),
UserInfo TEXT,
Priority INT,
Scheduled DATETIME,
IsSent TINYINT(1) NOT NULL DEFAULT 0,
IsRead TINYINT(1) NOT NULL DEFAULT 0) CHARACTER SET utf8;
CREATE TABLE MessageIn (
Id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
SendTime DATETIME,
ReceiveTime DATETIME,
MessageFrom VARCHAR(80),
MessageTo VARCHAR(80),
SMSC VARCHAR(80),
MessageText TEXT,
MessageType VARCHAR(20),
MessagePDU TEXT,
Gateway VARCHAR(80),
UserId VARCHAR(80)) CHARACTER SET utf8;
CREATE TABLE MessageLog (
Id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
SendTime DATETIME,
ReceiveTime DATETIME,
StatusCode INT,
StatusText VARCHAR(80),
MessageTo VARCHAR(80),
MessageFrom VARCHAR(80),
MessageText TEXT,
MessageType VARCHAR(20),
MessageId VARCHAR(80),
ErrorCode VARCHAR(20),
ErrorText VARCHAR(80),
Gateway VARCHAR(80),
MessagePDU TEXT,
UserId VARCHAR(80),
UserInfo TEXT) CHARACTER SET utf8;
12. Add ODBC string (SQL connector)
As you selected ODBC in the last step and clicked next, you need to add the ODBC connector string. This can also be found in the Diafaan webpage as linked above.
You also need to find the driver name for you ODBC. You can find the driver name in Control panel -> Administrative tools -> Data sources (ODBC) -> Drivers. Write the driver name in the ODBC string, with your database name, user and password. Click Test to test the connection.
My string:
Driver={MySQL ODBC 5.3 ANSI Driver};Server=127.0.0.1;charset=UTF8;Database=smsserver;User=smsserver; Password=kake123%;Option=3;
Edit 20.11.2014: Use «MySQL ODBC 5.3 UNICODE Driver»… instead, to support ex. norwegian characters.
13. Where to put the text messages in the database
If you database connection was successful, you now have to set up where your messages are going to be stored in your database.
14. Write a name for the connector
15. Yey! Your done!
16. Try sending a SMS
You can choose different message types – I’m testing a sms.text.flash just for fun.
17. Setting up the Web Connector
Click Add connector to the right.
18. Select the «Web Connector»
19. Set you HTTP Port and click Test
20. Name the connector
21. Test the URL
I tested it from another computer and works like a charm. The default username is «admin» and the password is the same as you created at the first wizard, after installing Diafaan.
22. Test a message from the page.
Yey, I got a message. Trying to reply…
The message above is from a desktop application called SMS+ from my provider (Telenor), that let’s me send and receive SMS from my computer.
And here is the reply 🙂
And the database is also updated with the text message.
If you want to send and/or receive messages with HTTP command (URL / XML), look here: http://www.diafaan.com/applications/web-service-sms-gateway/
And there you go! Your own SMS Gateway/server for about $215 (1290 NOK) ($20 for Huawei E220 and $195 for light edition of Diafaan).