Short message route communication method and system
Technical Field
The invention belongs to the field of short message service, and particularly relates to a short message routing communication method and a short message routing communication system.
Background
At present, a plurality of clients are accessed in the short message service system, the mobile phone number, signature and content sent by each client are all various, meanwhile, a plurality of operator gateways are also accessed in the short message service system, each operator gateway can support different mobile phone numbers, signatures and contents to be sent, meanwhile, the unit price and charging modes of the clients and the operator gateways are also different, in the short message service system, the routing strategy is simpler, the complex operation requirement cannot be satisfied, the arrival rate of the short message is influenced, and the operation cost is improved.
In the application, a routing method is specially designed, and the current best matched short message gateway can be preferentially identified according to user attributes, mobile phone numbers, short message content and related data analysis sent recently, so that the effects of reducing cost, enhancing efficiency, reducing short message time delay and improving short message arrival rate are achieved.
Disclosure of Invention
The invention provides a short message routing communication method and a short message routing communication system, which solve the problems of high short message cost and low short message arrival rate in the prior art.
The technical scheme of the invention is realized in such a way that the method for routing and communicating the short message comprises the following steps:
s1, receiving a user short message through a short message service end, and storing received short message data into a storage medium;
S2, the short message routing center collects received data from the storage medium and invokes a routing method to obtain a routing result, if the routing result is a short message gateway, the step S4 is entered for short message issuing, if the routing result is that manual intervention is needed, the step S3 is entered, and if the routing result is interception, the step S5 is entered;
S3, manually checking the short message, if the checking result is a short message gateway, entering a next step S4, and if the checking result is interception, jumping to the step S5;
s4, the short message gateway transmits the short message and obtains a short message state, if the short message state is successful, the next step S5 is carried out, if the short message state is failed, the short message state is stored in a storage medium and jumps to the step S2, and the short message routing center carries out subsequent operation;
And S5, returning the short message state to the user.
The file receives data through the short message service and stores the received data into the storage medium. The short message routing center collects the data returned by the short message gateway from the storage medium, intelligently judges whether retransmission is needed according to the short message state, routes to the proper short message gateway if retransmission is needed, and returns the final state to the user if retransmission is not needed.
Further, the short message routing center performs intelligent routing on the short message submitted for the first time, and screens a proper gateway group according to the short message attribute, wherein the gateway groups are all sets of gateways matched with the short message attribute.
Further, the short message attributes can be divided into verification code short messages, industry notification short messages, member marketing short messages and the like, and account attributes can be dynamically added and deleted according to actual service scenes.
Further, a gateway group is a group of one or more gateways with the same attribute, and the gateway group generally has the same attribute, such as all the verification code gateways, all the gateways supporting the same expansion bit number, all the gateways with lower unit price, and the like.
Further, the short message status is generally classified into success and failure. The routing center has an automatic failure retransmission function, can perform failure retransmission processing according to failure status codes, sometimes has a lot of failure status codes, and the short message routing center can classify the status codes and perform failure retransmission processing according to a certain class.
Further, the short message routing center can perform routing judgment according to the number of times of sending the mobile phone number in a certain period, if the mobile phone number exceeds a certain number of times in a set period, the mobile phone number is judged to be a risk number, and the mobile phone number is manually interfered or directly intercepted, and can be intercepted during manual interference or be assigned to a short message gateway for issuing.
Further, when the short message routing center processes the failed retransmission, different rules can be routed according to the short message attribute, if the short message is a verification code short message, the time efficiency requirement is generally not more than 1 minute or 30 seconds, if the time efficiency requirement is more than a set timeout time, the failed retransmission is not performed, the interception is directly performed, and if the time efficiency is not more than the set timeout time, the short message routing center routes to a proper short message gateway and performs the failed retransmission processing.
Further, when the short message routing center processes the failed retransmission, different rules are routed according to the number of failed retransmissions, if the number of failed retransmissions exceeds the set number of failed retransmissions, the short message routing center directly intercepts the short message, and if the number of failed retransmissions does not exceed the set number of failed retransmissions, the short message routing center routes the short message to a proper short message gateway to perform the failed retransmission processing.
Further, when the short message routing center processes the failed retransmission, if the short message is the long message, the long message is automatically combined, and if one of the status codes in the long message is failed, the long message is processed as the failure.
As a preferred embodiment, the storage medium includes a database, a cache database, and message queue middleware, wherein the message queue middleware adopts an asynchronous transmission mechanism distributed cluster architecture and supports lateral dynamic expansion. The storage medium comprises a database, a cache database and message queue middleware, wherein the message queue middleware adopts an asynchronous transmission mechanism distributed cluster architecture and supports transverse dynamic expansion. Message queue middleware is a service for managing and sending messages that can store received messages in a distributed cluster and send messages to multiple clients as needed. When a new message is sent, the message queue middleware firstly checks whether the old message is out of date, if so, the old message is discarded, and new data is updated into the cache library after the new message arrives. Such an architecture may improve the performance and scalability of the system and may provide better quality of service. A database is a commonly used storage device that can store large amounts of data and can be used for querying and processing. The cache database is a device for pre-storing data, and when the data needs to be used, the data can be directly read from the cache. Message queue middleware and databases and caches are specifically designed for managing and sending messages. Unlike databases and caches, message queue middleware does not need to store large amounts of data, but rather uses asynchronous transport mechanisms to handle highly concurrent queries and transmissions. Such an architecture may provide better performance and higher reliability, and support lateral dynamic expansion.
As a preferred embodiment, the storage medium is a transfer medium, and the transfer medium receives data storage from the short message service end and the short message routing center and provides data for reading by the short message service end and the short message routing center. The storage medium is a transit medium, meaning that there is an intermediate node between two different networks, which may be a server or a terminal device. The intermediate node can be used for storing and inquiring data, and can also be used as a transit port between the short message service end and the short message routing center. When the short message service end needs to store and inquire data, it can directly read data from the transferring medium, or can use API (such as IPSec) of the short message service end or the short message service end server of the third party to read data. Thus, the short message service end and the short message routing center can directly interact data without complex forwarding or storing processes. The design of the transfer medium can improve the network transmission efficiency and stability because it does not need to go through complicated forwarding or storing processes, but directly stores the data in the transfer medium, which can reduce the transmission pressure and delay in the network. Meanwhile, the transfer medium can also be used as a transfer port between the short message service end and the short message routing center so as to read and inquire data.
As a preferred embodiment, the routing rule of the short message routing center dynamically changes according to the current short message sending situation, so as to prevent the rule set before from not meeting the current sending requirement.
As a preferred implementation manner, the short message routing center uses a cache database dis to store short message data. Redis is a distributed cache database, which can be used for storing a large amount of data, and can also be used as a cache between a short message service end and a short message routing center. Therefore, the data storage efficiency can be improved, the delay of data transmission and delay can be reduced, and the expandability of the system can be improved. The short message routing center stores the short message data of the user into the Redis, and updates the data by periodically performing read-write operation on the Redis.
As a preferred implementation manner, the short message routing center adopts a distributed cluster architecture design to support transverse dynamic expansion. This means that the short message routing center can extend its functionality through the distributed cluster architecture to meet the growing short message demands. The cluster architecture may combine multiple machines into a complete server or client, providing higher processing power and performance. In addition, the distributed cluster architecture may also support lateral dynamic expansion, i.e., machines may be added or removed as needed to accommodate changes in business requirements.
The short message routing communication method and system comprises a user side, a short message service side, a storage medium, a short message gateway and a short message routing center, wherein the short message service side receives a short message sent by the user side and stores the short message into the storage medium, the short message routing center invokes data in the storage medium to conduct intelligent routing, after routing to the short message gateway, the short message gateway conducts short message sending, the short message gateway obtains a short message sending state at the same time and feeds a result back to the storage medium, the short message routing center obtains the short message sending state from the storage medium, intelligently judges whether retransmission is needed according to a mobile phone number, content, sending time delay and sending times, routes to an appropriate short message gateway to conduct sending if retransmission is needed, stores the final state into the storage medium if retransmission is not needed, and the short message service side obtains a short message sending result from the storage medium and feeds the short message sending result back to the user side.
By adopting the technical scheme, compared with the traditional short message sending method, the method has the advantages that the routing rule can be dynamically adjusted, the proper short message gateway can be better routed, or the short message content which does not need to be sent can be intercepted in time, and the short message arrival rate can be remarkably improved because the short message is automatically resent due to failure.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the invention, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
Fig. 1 is a flowchart of a method and a system for short message routing communication according to an embodiment of the present invention;
fig. 2 is a diagram of a short message routing communication method and a system frame according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Embodiment one:
As shown in fig. 1, the method comprises the steps of:
Step S1, a short message server receives a short message and stores the short message into a storage medium
And S2, the short message routing center acquires the short message from the storage medium and performs routing processing.
The short message routing center also provides a combined long message method, which comprises the following steps:
And judging whether the message is a long message or not according to tp_ udhi, if the value is 1, the message is the long message, and if the value is 0, the message is the common message.
Judging whether the long short messages are combined according to tp_pid, pk_total and pk_number, and when the number of the short messages is equal to pk_total and the pk_number is completely assembled, merging the long short messages.
The short message routing center firstly acquires a corresponding gateway or gateway group according to the short message attribute, for example, if the short message attribute is a notification type short message, the notification type gateway group is acquired, a group of gateways with related attributes are integrated in the gateway group, priority and weight strategies can be configured for the gateways in the gateway group, and the short message routing center can automatically adjust the priority and weight of the gateways according to the actual downloading situation.
The short message routing center routes according to the mobile phone number, the mobile phone number can be divided into mobile, communication and telecommunication, and in addition, the mobile phone number can be configured with a blacklist and a whitelist. The blacklist is that the mobile phone number does not need to send short messages to the mobile phone number for some reasons, so that the blacklist is configured, the short message routing center can intercept the blacklist mobile phone number directly and not send the short messages to the gateway, the whitelist is that the mobile phone number can send a plurality of times for business reasons, such as a hundred thousand alarming short messages of a business system, a certain mobile phone number can receive hundreds of short messages, if the whitelist is not set, the mobile phone number can be intercepted, and if the whitelist is set, the short message routing center can release the mobile phone number and send the short messages normally.
The short message routing center routes according to the short message content, the short message content is matched with a template, the template can be bound with a gateway or a gateway group, the short message content which is not matched with the template can be directly intercepted according to a strategy and is not subjected to short message issuing, and the short message content which is matched with the template is routed to the gateway or the gateway group bound with the template for short message issuing.
Step S3, manually checking the short message, if the checking result is a short message gateway, entering a next step S4, and if the checking result is interception, jumping to the step S5
Step S4, the short message gateway transmits the short message and obtains a short message state, if the short message state is successful, the next step S5 is entered, if the short message state is failed, the short message state is stored in a storage medium and jumps to the step S2, and the short message routing center carries out subsequent operation;
the short message routing center also provides a short message failure retransmitting method, which comprises the following steps:
The method comprises the steps of carrying out short message failure retransmission according to the failed short message state codes, configuring the maximum retransmission times of each state code by a short message routing center, retransmitting a gateway or a gateway group and overtime time, if the failed short message has overtime, not carrying out failure retransmission, directly entering step S5, if the failed short message retransmission times exceed the maximum retransmission times, not carrying out failure retransmission, directly entering step S5, and if the failed short message has neither overtime nor exceeds the maximum retransmission times, carrying out retransmission according to the bound retransmission gateway or gateway group.
The short message failed retransmission is carried out according to the number of times of the short message retransmission, the short message routing center configures the maximum number of times of the retransmission, if the number of times of the retransmission exceeds the maximum number of times of the retransmission, the step S5 is directly carried out without carrying out the failed retransmission, otherwise, the failed retransmission is carried out
And (5) performing short message failure retransmission according to the short message timeout time, configuring the failure retransmission timeout time of different short message attributes by the short message routing center, and directly entering step S5 without performing failure retransmission if the failure retransmission timeout time exceeds the failure retransmission timeout time, otherwise, performing failure retransmission.
And step S5, returning the short message state to the user.
Example two
The short message routing communication system comprises a user side, a short message service side, a storage medium, a short message gateway and a short message routing center, wherein the short message service side receives a short message sent by the user side and stores the short message in the storage medium, the short message routing center invokes data in the storage medium to carry out intelligent routing distribution, and feeds back results to the storage medium, the short message gateway carries out short message sending, and stores the short message sending results in the storage medium, the short message routing center invokes data in the storage medium to carry out failed short message retransmission, and the short message service side acquires the short message sending results from the storage medium and feeds back the short message sending results to the user side.
The storage medium is a transfer medium and comprises a traditional database, a cache database and a message queue middleware, and is used for receiving data storage from the short message service end, the short message gateway and the short message routing center and providing data for the short message service end, the short message gateway and the short message routing center to read.
The short message routing center acquires the short message from the storage medium, firstly judges whether the short message fails, if so, retransmits the failed short message, if not, normally routes the short message, and finally stores the routing result into the storage medium.
The embodiment of the invention provides a short message routing communication method and a short message routing communication system, which comprise modules and system architectures which are designed into distributed clusters, and have the advantages of high availability, expandability and convenience in maintenance. And an asynchronous processing mechanism of the message queue middleware and a cache database are introduced, so that the performance is greatly improved.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, alternatives, and improvements that fall within the spirit and scope of the invention.