EMG billing plugin


In order to enable EMG functionality for “price per message”, based on pricing information from EMG Portal, the billing plugin is needed.

The plugin is part of the EMG Portal distribution, written in Perl, and thereby requires the EMG perl distribution being correctly installed.

After correct installation and configuration the billing plugin will get called for every message received by EMG and price data will be looked up from the relevant EMG Portal tables.

For increased performance the billing plugin will cache the price data and on regular basis check whether data has been added or updated and then reload the price data.


Steps required to get billing plugin up and running:

  • Extract precompiled EMG Perl distribution to /opt/perl-5.12.2-emg.
  • Install additional CPAN modules required by script.
  • Copy billing plugin from EMG Portal dist to the EMG etc directory.
  • Modify database settings in billing plugin to match environment.
  • Add plugin entry to server.cfg and reference it from connectors where messages will be received.
  • Verify setup using “emgd -verify”.
  • Test it!

Sample transcript

Below is a transcript of commands being issued in a sample session to complete the above steps. We assume EMG and EMG Portal have been installed already and that both EMG and EMG Portal schemas have been applied to a MySQL database.

We assume that development tools “make” and “gcc” along with MySQL development package are installed. The utility “mysql_config” should be present in PATH.

Paths used below may need to be modified depending on where you have installed EMG (below /home/emg) and EMG Portal (below /var/www/html/emgportal).

You can run the commands as root or as the user that you choose as emg user during emg installation. Just ensure the user has permission to write to /opt/perl-5.12.2-emg and subdirectories.

cd /opt
wget http://www.nordicmessaging.se/files/perl-5.12.2-emg_linux_64bit.tar.gz
tar xvzf perl-5.12.2-emg_linux_64bit.tar.gz
/opt/perl-5.12.2-emg/bin/perl -MCPAN -e shell
install DBI
install DBD::mysql
install Carp::Assert
cp /var/www/html/emgportal/misc/billing.pl /home/emg/etc
# Update db info in billing.pl
vi /home/emg/etc/billing.pl
# Add plugin to server.cfg and reference plugin from connectors
vi /home/emg/etc/server.cfg
emgd -verify

Done! Time to test the setup in practice.

Sample plugin section for server.cfg:

PLUGIN billing <

Plugin is referenced like this from connector:

CONNECTOR smpp-in1 <