Route messages

Navigation:  How to... >

Route messages

Previous pageReturn to chapter overviewNext page

Connector specific routing


The main routing procedure in Diafaan SMS Server is connector specific routing. For each connector you can choose if you want to use the available gateways to send and receive messages, send or receive only or not at all.

 

Each gateway can be designated as a primary gateway or as a backup gateway. Diafaan SMS Server will first try to send the message with one of the assigned primary gateways. If sending the message failed it will be repeated with a maximum of Max send Attempts for each primary gateway. If sending the message is still not successful on all primary gateways, the same procedure is used with the assigned backup gateway(s).

 

EditConnector2

 

 

Message specific routing using the Message Type


For each Gateway in the Connector Properties you can select if you want to use them only for messages with certain Message Types. In the example above the GSM Modem Gateway is only used for messages with a Message Type starting with "sms.". The Message Type filter can contain wild cards (* and ?) and can have multiple filters separated by semicolons (sms.text;sms.unicode). It is also possible to use a negative filter if it starts with a "-" character, for instance "-paging.*" meaning all messages with a Message Type that does not start with "paging.".

 

 

Message specific routing using the Gateway field


With most connectors you can use the Gateway field to specify a gateway list for each message. The gateway list can be a single gateway name or multiple gateway names separated by semicolons. Only gateways that are enabled in the connector specific routing options can be used, other gateway names are ignored. If a gateway is assigned as backup gateway it will still be used as a backup gateway.

 

In the example above you can use the GSM Modem on COM1 as a primary gateway and the Clickatell Gateway as the backup gateway by setting the Gateway field to GSM Modem on COM1;Clickatell Gateway. The gateway GSM Modem on COM10 is not used for this message.

 

Using message specific routing in the Web Connector:

http://localhost:9710/http/send-message?to=%2B44xxx&message=Message&gateway=GSM+Modem+on+COM1%3BClickatell+Gateway

 

 

Advanced routing


Only available in Diafaan SMS Server - basic and full editions.

 

The most flexible way to route messages is with a gateway script. Depending on the destination address, message type or message text a different gateway (list) can be used to send the messages. It is also possible to change the destination address, message type and message text before it is sent.

 

In the gateway skeleton script the message is routed with the PostDispatchMessage method.

 

private void PostDispatchMessage(

  string recordId, 

  string toAddress, 

  string fromAddress,

  string message, 

  string messageType, 

  string gateway,

  string backupGateway)

 

The gateway name list is set in the gateway and backupGateway parameters. An optional value can be added after the gateway name to specify the maximum number of send attempts that is used for that gateway, GSM Modem on COM10:4 for a maximum of 4 send attempts. E.g.:

 

private void OnMessageToSend(string recordId, string toAddress, string fromAddress, 

                             string message, string messageType)

{

  PostDispatchMessage(

    recordId, 

    toAddress, 

    fromAddress,

    "Dispatched: " + message, 

    messageType, 

    "GSM Modem on COM1;Clickatell Gateway",

    "GSM Modem on COM10:4");

}

 

See for a routing example the Dispatch SMS to gateway script.