如何创建短信网关?

发布于 2024-08-03 11:51:17 字数 94 浏览 13 评论 0原文

我知道有很多第三方网站可以通过互联网发送批量短信,但如果我想自己创建一个,我该怎么做呢?我知道如何使用我的手机创建短信网关,但速度很慢。还有其他方法可以创建互联网短信网关吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

荒人说梦 2024-08-10 11:51:17

我为我的雇主设计了类似的东西(尽管短信要少得多)。 Linux 服务器连接到蓝牙 USB 适配器,用于通过 RS232 串行链路接收来自实验室嵌入式传感器设备和西门子 TC35 GSM 调制解调器的数据。如果传感器确定存在问题,服务器可以向选定员工的电话发送消息,该问题也由 C++ 程序处理。此外,还有一个 J2EE 应用程序,允许员工通过网页输入消息,然后将这些消息作为文本消息发送给他们选择的员工。 J2EE 应用程序将消息转储到数据库中,然后由 C++ 程序收集这些消息,并通过 TC35 使用 AT 命令发送。通过这种方式,传感器问题消息始终具有优先权。

编程方面,这没什么特别的,因为 AT 命令很容易理解。只需确保您的编程是安全的,这样它就不会被垃圾邮件发送者劫持,并且调制解调器位于 GSM/3G 覆盖良好的房间内,而不是位于地下室。

哦,让您的程序定期询问 GSM 调制解调器的信号强度和其他小区基站信息并将其存储在特殊的数据库表中也是一个好主意。这将使您能够发现您的手机提供商的问题,并在需要时转向另一家。我使用这些信息发现我正在使用的基站似乎经常离线或出现技术问题,导致我的调制解调器消息吞吐量减慢。

祝你好运

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

命硬 2024-08-10 11:51:17

可以通过两种方式完成 1)GSM 调制解调器
2)http(服务提供商)(比调制解调器更快)

我使用过 http://www.ozekisms.com/ 网关服务

C# 代码发送 Http 请求以及如何添加用户名和密码 IP 地址和端口。

参考此代码希望对您有所帮助。

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;
        }
    }
}

谢谢。

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.

所有深爱都是秘密 2024-08-10 11:51:17

您需要使用 SMPP 协议与 SMSC 进行通信。您还可以使用 Kannel,它提供了与不同类型的 SMSC 配合使用的良好功能,包括 GSM 调制解调器以及 send-sms HTTP 服务等等。

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.

天气好吗我好吗 2024-08-10 11:51:17

嗯...根据您的要求,您将需要一个 GSM 调制解调器。使用它,您可以使用标准 AT 命令发送 SMS 消息。然后,您需要开发一个 HTTP 服务器来获取请求、处理请求并将 AT 命令发送到 GSM 调制解调器。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文