scriptinggateway Scripting gateway

<< Click to Display Table of Contents >>

Navigation:  Reference > Gateway properties >

scriptinggateway Scripting gateway

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


Edit gateway script

Click on the Edit C# Script or Edit Visual Basic .Net Script link to edit the script. Use the Compile button to check if the script has syntax errors.




If the script uses functions that are not in the System.dll assembly, a reference to the required assembly DLL must be added in the comment section at the top of the script. For instance to add a reference to the System.Data.dll assembly in a C# script you can insert:


// AddReference System.Data.dll


At line 3 in the script.


The reference can be the full path name of the DLL file if it is not a standard .NET assembly.


Advanced properties


Log all trace log communication to file. You can use this option in combination with the PostTraceLog script function to debug your script. If enabled, the status windows of the Scripting gateway provides a link to the location on the hard disk where the file is stored.



The maximum number of messages this gateway will process in one batch. If this value is higher than one and a number of messages are sent at the same time, the gateway loads multiple messages concurrently. This increases the speed in which the messages are sent. Leave the MaximumBatchSize on 1 if the script is processor heavy or takes a long time to send a message (more than a few seconds). For small scripts you can increase this value to speed up handling multiple messages.



A list of 24 hour numbers (separated with semicolons) when sending messages with this gateway is paused. The hour number can be appended with .1, .2, .3 or .4 to specify the first, second, third or fourth quarter of the hour. If the messages cannot be sent with another gateway, they stay in the send queue until the quiet hours are over and this gateway resumes message sending.

00;01;23 pauses message sending from 23:00:00 to 01:59:59.

12.1;12.2;18.1;18.2 pauses message sending from 12:00:00 to 12:29:59 and from 18:00:00 to 18:29:59.



Enable or disable HTTP callbacks for this gateway. This option is only available when the HTTP callback option is enabled in the general options.



Gateway skeleton script

The gateway skeleton script that is installed after adding the gateway makes it easier to handle events and provides a number of methods you can use to send messages, enter received messages and add log entries.





OnMessageToSend is called when there is a message the script should send out.


OnStatusRequest is called when the script should query the status of a previously sent message.





PostSendResult sets the send result of a previous handled OnMessageToSend message.


PostSendResultUpdate updates the send result of a previously handled OnMessageToSend message.


PostDispatchMessage dispatches the OnMessageToSend message to a different gateway.


PostReceiveMessage adds a new received message.


PostEventLog adds a line to the event log.


PostTraceLog Adds a line to the communication file.