Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an SMS gateway?

Tags:

bulksms

kannel

I know there are lots of 3rd party sites to send bulk SMS via the internet, but if I wanted to create one myself, how would I go about it? I know how to create an SMS gateway using my mobile phone, which is very slow. Is there any other way of creating an internet SMS gateway?

like image 473
Arunachalam Avatar asked Aug 29 '09 15:08

Arunachalam


4 Answers

I designed something similar (although for far fewer text messages) for my employer. A Linux server is connected to a Bluetooth USB dongle for receiving data from embedded sensor devices in the lab and a Siemens TC35 GSM modem via a RS232 serial link. The server can send messages to selected employees phone if the sensors determine there is a problem which is also handled by a C++ program. In addition there is a J2EE app which allows employees to enter messages via a web page that are then sent as text messages to employees they select. The J2EE app dumps the messages into a database which are then collected by the C++ program and sent using AT commands via the TC35. It is done this way so sensor problem messages always have priority.

Programming wise it was nothing special as AT commands are easy to understand. Just make sure your programming is secure so it can't be hijacked by a spammer and that the modem is located in a room with good GSM/3G coverage and isn't in a basement.

Oh and its also a good idea to have your program ask the GSM modem for its signal strength and other cell base station information at a regular interval and store this in a special database table. This will allow you to spot problems with your cell provider and move to another one if required. I used this information to discover that the base station I was using appeared to be going offline or having technical problems quite frequently which caused my modems message throughput to slow down to a trickle.

Good Luck

like image 103
IanW Avatar answered Oct 17 '22 19:10

IanW


it can be done in Two Ways 1)GSM modem 2)http (service provider)(Faster than Modem)

I have used http://www.ozekisms.com/ gateway Service

C# Code to send Http Request and how to add User name and Password IP address and Port.

Refer this Code hope will help you out.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SMSClient;

namespace SMSDemoConsole
{
    class Program
    {
        private static void WriteEvent(String myEvent)
        {
            Console.WriteLine(myEvent);
        }

        #region Events
        static void mySMSClient_OnMessageReceived(object sender, DeliveryEventArgs e)
        {
            WriteEvent(DateTime.Now.ToString() + " " + "Message received. Sender address: " + e.Senderaddress + " Message text: " + e.Messagedata + "\r\n");
        }

        static void mySMSClient_OnMessageDeliveryError(object sender, DeliveryErrorEventArgs e)
        {
            WriteEvent(DateTime.Now.ToString() + " " + "Message could not be delivered. ID: " + e.Messageid + " Error message: " + e.ErrorMessage + "\r\n");
        }

        static void mySMSClient_OnMessageDeliveredToHandset(object sender, DeliveryEventArgs e)
        {
            WriteEvent(DateTime.Now.ToString() + " " + "Message delivered to handset. ID: " + e.Messageid + "\r\n");
        }

        static void mySMSClient_OnMessageDeliveredToNetwork(object sender, DeliveryEventArgs e)
        {
            WriteEvent(DateTime.Now.ToString() + " " + "Message delivered to network. ID: " + e.Messageid + "\r\n");
        }

        static void mySMSClient_OnMessageAcceptedForDelivery(object sender, DeliveryEventArgs e)
        {
            WriteEvent(DateTime.Now.ToString() + " " + "Message accepted for delivery. ID: " + e.Messageid + "\r\n");
        }

        static void mySMSClient_OnClientConnectionError(object sender, ErrorEventArgs e)
        {
            WriteEvent(DateTime.Now.ToString() + " " + e.ErrorMessage + "\r\n");
        }

        static void mySMSClient_OnClientDisconnected(object sender, EventArgs e)
        {
            WriteEvent(DateTime.Now.ToString() + " Disconnected from the SMS gateway " + "\r\n");
        }

        static void mySMSClient_OnClientConnected(object sender, EventArgs e)
        {
            WriteEvent(DateTime.Now.ToString() + " Successfully connected to the SMS gateway " + "\r\n");
        }
        #endregion

        static void Main(string[] args)
        {
            ozSMSClient mySMSClient = new ozSMSClient();
            mySMSClient.OnClientConnected += new SimpleEventHandler(mySMSClient_OnClientConnected);
            mySMSClient.OnClientDisconnected += new SimpleEventHandler(mySMSClient_OnClientDisconnected);
            mySMSClient.OnClientConnectionError += new ErrorEventHandler(mySMSClient_OnClientConnectionError);
            mySMSClient.OnMessageAcceptedForDelivery += new DeliveryEventHandler(mySMSClient_OnMessageAcceptedForDelivery);
            mySMSClient.OnMessageDeliveredToNetwork += new DeliveryEventHandler(mySMSClient_OnMessageDeliveredToNetwork);
            mySMSClient.OnMessageDeliveredToHandset += new DeliveryEventHandler(mySMSClient_OnMessageDeliveredToHandset);
            mySMSClient.OnMessageDeliveryError += new DeliveryErrorEventHandler(mySMSClient_OnMessageDeliveryError);
            mySMSClient.OnMessageReceived += new DeliveryEventHandler(mySMSClient_OnMessageReceived);

            mySMSClient.Username = "admin";
            mySMSClient.Password = "abc123";
            mySMSClient.Host = "127.0.0.1";
            mySMSClient.Port = 9500;

            mySMSClient.Connected = true;

            mySMSClient.sendMessage("+44987654", "TEST", "vp=" + DateTime.Now + "&ttt=werwerwe rewwe34232 1");


            Console.ReadKey();
            mySMSClient.Connected = false;
        }
    }
}

Thanks.

like image 43
vish's Avatar answered Oct 17 '22 20:10

vish's


You'll need to talk to an SMSC with an SMPP protocol. You can also use Kannel, it provides nice features to work with different types of SMSC including GSM modems as well as send-sms HTTP service and more.

like image 3
pingw33n Avatar answered Oct 17 '22 19:10

pingw33n


Hmm... According to the your requirement you will need a GSM modem. Using that you can send SMS messages with Standard AT commands. Then you need to develop an HTTP server that gets the request, process it and send the AT commands to the GSM modem.

like image 2
Chathuranga Chandrasekara Avatar answered Oct 17 '22 19:10

Chathuranga Chandrasekara