Autoreply SMS using script
Ozeki SMS Gateway's Autoreply User can automatically reply to SMS messages or forward incoming messages. This guide explains how to install and configure your Autoreply User on SMS Gateway. Each Autoreply User is controlled by their own script. You will see example scripts too.
Autoreply Users can be easily installed and configured through Ozeki SMS Gateway's browser GUI.
After creating your own Autoreply User, the script is stored at C:\Program Files\Ozeki\Ozeki10\Data\NG\config\scripts
Installing Autoreply User
On the 'Management' console you can see a 'Users/Applications' panel. Click the 'Add' button on the top-right corner of the panel (Figure 1). You can click 'Users and applications/Add user or application' from the top menu bar as well.
On the new page you will see two panels. The left-hand panel is called 'Users/Applications' and the right-hand panel is called 'Add user or application'. While the right-hand panel is for adding new users, the left-hand panel is contains the userlist. On the bottom of the userlist you can see the number of users plus applications currently installed on your Ozeki SMS Gateway. Keep in mind that each user and application must have a unique username.
Now look at the right-hand panel which contains usertypes and brief descriptions. Search Autoreply User and click the blue 'install' link next to it (Figure 2).
On the next page, please provide a unique username for your Autoreply User and click 'Ok'.
Configuring Autoreply User
The 'Autoreply script' tabpage should open up (Figure 3), which is the most important tabpage on the Autoreply User's Configuration panel. The autoreply script is the programcode of the Autoreply User.
This tabpage contains two textboxes:
The upper textbox is the 'AutoReply script file'. This contains the filename of the script which is 'autoreply_NameOfUser.txt' as default. You can find this file at C:\Program Files\Ozeki\Ozeki10\Data\NG\config\scripts, which is it's default path. You can modify the file from outside sources, so it is very useful to know the path. For example you can rewrite the file from your own application. You can leave this textbox unchanged if you prefer.
The lower textbox contains the editable script stored in the file. It contains a few examples to show you the basics of programming SMS messaging for Ozeki SMS Gateway. The script is capable to set SMS messaging rules, like replying and forwarding. You can include comments by placing a hashmark (#) on the beginning of each line. As you can see, all lines are commented as default, but you can delete some hashmarks and insert real phone numbers to see how it works.What is the structure of the SMS messaging script
The Autoreply User's SMS messaging script always consist of filter-action pairs, which is similar to an if-then structure used in other programming languages. The filter selects the SMS messages to perform the action on. The filter can identify phone numbers and text fragments, so it can react with an action accordingly. Actions are used for replying and forwarding SMS messages to certain GSM numbers. You can place several filter-action pairs in a simple code as seen in the following examples below, but keep in mind to finish the script with a 'STOP'. The interpreter will not go further the 'STOP' line.
Example Scripts for the Autoreply User
These are the same example scripts shown in the 'Autoreply script' tabpage of your Autoreply User (Figure 3 above).
Replies with a pre-written text to all incoming messagesReply script:
Interpretation: The sender of each message will get a pre-written text as a reply.
Forwards incoming SMS messages to +3620123223Forward script:
Interpretation: Each received message will be forwarded to +3620123223.
Forwards SMS messages from +362000001 to +3620123223Forward script:
Interpretation: Messages from +362000001 will be forwarded to +3620123223.
Forwards SMS messages starting with 'important' to +3620123223 and +3670322321Forward script:
Interpretation: If the beginning of the message is: 'important', it will be forwarded to +3620123223 and +3670322321.
Configuring user Log Generation
Check out the 'Logging' tabpage on the Autreply User's 'Configuration' panel. If you place a tick in both checkboxes (Figure 4), it helps you to debug communication problems. It is capable to log the SMS message flow that has been applied by the Autoreply script (see above) and can also log low level communication related to the Autoreply User.
Below the checkbox you can find the 'Log file settings' groupbox with file related settings. The default log directory is C:\Program Files\Ozeki\Ozeki10\Data\NG\Logs, but you can always modify it. The maximum size of each log file and the maximum number of log files can also be set. If a log file gets bigger than the maximum file size, Ozeki SMS Gateway creates a new File. If the maximum number of log files have been reached, the oldest file should be replaced. This is why the corresponding textbox is called 'Number of rotated files'.'Logging' tabpage's default values:
If you like these default values, please do not change the boxes.
These settings can be reached by clicking on the 'Advanced' tabpage (Figure 5). Here you can set the user's login details for Ozeki SMS Gateway, which are the username and password pair. You should also specify the sender's address.
In the middle section you can change the 'Type of Addressbook' to SQL, LDAP or File then configure it on your left-hand.
In the lower section you can set the 'Max. number of responses' option, which prevents sending too much SMS responses to the same number. You can also 'Enable accounting for this user' which applies the credit limit for this Autoreply User. A cost of a single SMS is one credit. You can add credits by clicking 'Settings' on the left hand panel.
You can schedule when the Autoreply User will reply or forward incoming messages. It is turned off as default as you can see it on Figure 6. If it is turned on, SMS messages received before or after the schedule will not be replied.
If the Autoreply User have been configured, please click 'OK' to save it.
You can always come back to check events or modify configuration. You can do this by selecting your user on the 'Users/Applications' panel and clicking appropriate button on the left hand panel (Figure 7)