How to create an SMS gateway?
Asked Answered
A

4

8

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?

Arrestment answered 29/8, 2009 at 15:59 Comment(0)
U
6

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

Unsavory answered 25/2, 2010 at 11:2 Comment(0)
B
4

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.

Brinna answered 21/4, 2012 at 12:34 Comment(0)
E
3

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.

Esma answered 29/8, 2009 at 16:8 Comment(0)
C
2

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.

Canella answered 29/8, 2009 at 16:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.