Dynamic SMPP parameters from database

By using a database user, you are allowed to dynamically set source_addr_ton, source_addr_npi, dest_addr_ton, dest_addr_npi, esm_class and data_coding SMPP parameters dynamically by saving them into the appropriate database records. This guide explains how you can set SMPP parameters dynamically by using a database user - note that this feature is only available in Ozeki NG SMS Gateway 4.2.5 or above.

You can read about dynamic SMPP parameter settings here: Dynamic SMPP parameters

You can read about the database user here: Database users

Setting SMPP parameters from database

First, you need to create the database user's table for sending so it can contain values for SMPP parameters too. Have a look at the example below.

CREATE TABLE IF NOT EXISTS 'ozekimessageout' (
  	'id' int(11) NOT NULL AUTO_INCREMENT,
  	'sender' varchar(255) DEFAULT NULL,
 	'receiver' varchar(255) DEFAULT NULL,
  	'msg' text,
  	'senttime' varchar(100) DEFAULT NULL,
  	'receivedtime' varchar(100) DEFAULT NULL,
  	'reference' varchar(100) DEFAULT NULL,
  	'status' varchar(20) DEFAULT NULL,
  	'msgtype' varchar(160) DEFAULT NULL,
  	'operator' varchar(100) DEFAULT NULL,
  	'errormsg' varchar(250) DEFAULT NULL,
  	'source_addr_ton' int(3),
	'source_addr_npi` int(3),
	'dest_addr_ton' int(3),
	'dest_addr_npi' int(3),
	'esm_class' int(3),
  	'data_coding' int(3)
  	PRIMARY KEY ('id'),
  	KEY 'id' ('id')
)

After preparing the database table, you need to update the SELECT statement in the database user's configuration - you need to add the appropriate field names to the SQL statement (Figure 1).

updating the select statement
Figure 1 - Updating the SELECT statement for polling

After these steps, the database user can send messages with dynamically set SMPP parameter values. Note, that the database records must contain decimal values (or NULL, if you don't want to dynamically set SMPP parameters).

When sending a message, if the message's record contains a value for an SMPP parameter, the message will be sent with that parameter value. If the record has a blank field for a parameter value then the SMPP service's configured value will be used (Figure 2).

smpp parameter settings
Figure 2 - SMPP parameter settings

If you have left these fields blank, default values will be used.

More information