Step By Step Guide to Deploy Charging Gateway

Pre Requisite of Deployment

Web server: Apache 2 or IIS 7
Database Server:  MySQL- 5.3
Other: php-5.3, php-mysql connector-5.3

Package Structure

  1. CGW Binary (cgw) – should be executable
  2. Configuration file – config.ini
  3. Postpaid.ini
  4. Prepaid.ini
  5. prepaid_ucip_command.ini
  6. webservice.ini
  7. SubscriptionServices config file-config.php
  8. Webpanel configuration file-config.php
  9. Database
  10. BIdummy

Directory Structure

Type Path
CGW application In Linux :
/ismp/test/cgw/cgwapp/
Or “/ismp/produection/cgw/cgwapp/
In windows
“D:ismptestcgwcgwapp”
Or “D:ismpproductioncgwcgwapp”
CGW services In Linux:
“/ismp/test/cgw/subscriptionservices
Or “/ismp/production/cgw/subscriptionservices
In Windows:
“D:ismptestcgwsubscriptionservices”
or“D:ismpproductioncgwsubscriptionservices”
CGW Web panel In Linux :
/ismp/test/cgw/cgwweb
/ismp/production/cgw/cgwweb”   In windows
“D:ismptestcgwcgwweb”
Or “D:ismpproductioncgwcgwweb”

Deployment Steps

  1. Place all package elements in one folder and copy that folder & deploy in defined directory structured folder
  2. Set execution permission on required binary file so that it can run from that folder
  3. Make changes in required configuration files
    1. config.ini located in CGW application.
    2. config.php located in CGW services
    3. config.php located in CGW Web
    4. Make aliases  /subscriptionservices_test in webserver root with “/ismp/test/cgw/subscriptionservices” or  Make aliases   /subscriptionservices  in webserver root with  “/ismp/production/cgw/subscriptionservices” in linux

Make aliases  /subscriptionservices_test  with
“D:ismptestcgwsubscriptionservices” or  Make aliases   /subscriptionservices   with  “D:ismpproductioncgwsubscriptionservices” in windows

  1. Make aliases  /cgw in webserver root with “/ismp/test/cgw/cgwweb” or  Make aliases   /cgw  in webserver root with  “/ismp/production/cgw/cgwweb” in linux

Make aliases  /cgw with
“D:ismptestcgwcgwweb” or  Make aliases   /cgw  with  “D:ismpproductioncgwcgwweb” in windows

  1. Create database with name cgw_2_0_test or cgw_2_0and load the CGW_DB.sql script to database

Configure CGW Application

  1. Change the configuration in config.ini file from cgwapp folder. Here is a sample of this file:

Description of each field and some possible values:

Field Name Description Example Values
DB_HOST IP of CGW database localhost
DB_USER CGW database’s username root
DB_PASSWORD CGW database’s password mysqlpass
DB_NAME Name of CGW database CGW_1_0
DB_VERSION Last part of the MySQL version 3: for version 5.5.3
0: for version 5.5.0
LISTENING_PORT Port number at which CGW listen to incoming request 3440
BILLING_HOST IP of the machine where IN Requester is deployed localhost
BILLING_PORT Port number at which IN Requester listen to incoming request 3650
LOG_LEVEL Determines which level(s) of log will go to the destination. Here is the list of all the log levels:
#define E_ALL     255
#define E_NONE    0
#define E_NOTICE  16
#define E_ERROR   8
#define E_INFO    4
#define E_WARNING 2
#define E_DEBUG_MAJOR      32
#define E_DEBUG_MINOR      64
#define E_MESSAGE 1
#define E_DEBUG   128
If we want more than one log level, we need to add the corresponding values.
If we want only ERRORs, then log level value would be 8.If we want ERROR, INFO and WARNINGs, then log level value would be 14.
LOG_DESTINATION Determines where all the logs will go to. Here is the list of all the log destinations:#define     LOG_TO_FILE      2
#define      LOG_TO_SERVER 4
#define      LOG_TO_SCREEN 8
If we want the logs to go to more than one destination, we need to add the corresponding values.
If we want the logs only to be displayed on the screen, log destination value would be 8.If we want the logs to be written into the files and to be sent to the LogServer as well,  log destination value would be 6.
LOG_HOST IP of the machine where Log Server is deployed 10.183.16.198
LOG_PORT Port number at which Log Server listen to incoming request 3470
LOG_COMPONENT Name of the component in CGW suite CGW
LOG_INSTANCE Name of this particular instance of the component CGW_2_0
SNMP_ENABLED To Enable SNMP interaction 1 for Enable and 0 for Disable
SNMP_INSTANCE_NAME Name of this particular instance of the component CGW
SNMP_MANAGER_HOST_IP To Which IP SNMP Msg will sent IP Address
SNMP_MANAGER_PORT_NO Remote SNMP server port Port
SNMP_LOCAL_IP All local interface IP 0.0.0.0
SNMP_LOCAL_PORT Any port 0
SNMP_AGENT_IP Which local ip will communicate with remote SNMP Server Local Interface IP
PARALLEL_BILLING_REQUEST To enable parallel charging requests. Should be 1.
SHOULD_USE_REMARKS This field is used to determine whether the remarks field ( 11th field of the incoming request to CGW) would be used by CGW to form the request string to IN Requester. 0 for GP
1 for BL
REGISTRATION_OUTPUT_ENABLED To Provide Subcription Status from CGWapp 1 for Enabled
RECV_TIMEOUT How much time will wait to get socket for Billing Interface 5000 ms
PACKAGE_CHECK_ENABLED_SESSION To Call API For Session base Charging 1 for Enable (Should be 0 to enable package checking from database)
PACKAGE_CHECK_ENABLED_SPECIFIC To Call API For Specific Charging 1 for Enable (Should be 0 to enable package checking from database)
PREPAID_HOST_IP Prepaid package Checking Server IP Address
PREPAID_HOST_PORT Port information Prepaid service Port
POSTPAID_HOST_IP Postpaid package Checking Server IP Address
POSTPAID_HOST_PORT Port information Postpaid service Port
HEADERNOTAVAILABLE
DEBUG_GET_CONTENT To see output for any URL Calling 1 for Enable
CHARGE_USING_WEBSERVICE_ENABLE To call web API 1 for enable
CHARGING_WEBSERVICE_HOST_IP To which server web API, CGW will call for Charging IP Address
CHARGING_WEBSERVICE_HOST_PORT Web Charging Port Port
DISCARD_PREFIX_OBD Starting Index Number of MSISDN for Outbound Call Like 01713404007 is a MSISDN and index will be 1
MSISDN_LENGTH Length of MSISDN 10 for Bangladeshis Mobile number
REFUND_SESSION To refund unused Blance 1 for enable
  1. Change the configuration in config.php file from subscriptionservices folder.
Field Name Description Example Values
DB_HOST IP of CGW database localhost
DB_USER CGW database’s username root
DB_PASSWORD CGW database’s password mysqlpass
DB_NAME Name of CGW database cgw_2_0
$COMMONPHP Location of common.php common.php
$CALLFLOWLIB Location of CallFlowLib.php CallFlowLib.php
  1. Change the configuration in config.php file from cgwweb folder.
Field Name Description Example Values
dbtype Type of Database mysql
MYSERVER Database server IP 192.168.5.129
MYUID DB login ID root
MYPASSWORD DB login password mysqlpass
MYDB Name of CGW database CGW_2_0_

How to run CGW

From linux console

  1. Go to cgwapp directory
  2. Type ./cgwapp
  3. Press enter

Check process

  1. Type ps –ef|grep cgwapp
  2. Press enter
  3. Following status will show in screen

From webmin

    1. Create three custom button like following.

  1. Click Start->CGW-1-101 button

Check Process

  1. Click CGW-Status button
  2. Following output will show in panel

From Windows console

  1. Go to the cgwapp location
  2. DoubleClick on the cgwapp.exe

Check process

  1. Go to taskmanager
  2. Click process tab.  We will found cgw process as follows:

From AppMonitor

    1. Configure cgwapp in appmonitor as follows:

  1. Click Start

How to test charging

Without IN

  1. Configure rate for your service so that CGW will not forward request to IN.

Using CMDID

  1. telnet localhost 3440
  2. Type following string

appid=Subscription&apppass=nopass&cmdid=SPECIFIC_CHARGE&cmdparam=1714086512|2580|0|LifestyleWeekly|19690730012013133026|0|0|
appid=VSDP&apppass=NOPASS&cmdid=END_CALL&cmdparam=1714086512|2580|0|Lifestyle|601330012013133410|6|33|

Using Webservice

We can also check cgw working status by calling webservice to deduct a specific amount for a service.

  1. Type following url in the web browser address bar

http://192.168.5.130/subscriptionservices_test/ChargeSpecificAmount.php?ano=1713404007&bno=Ssdtivr&subscriptiongroupid=SsdtivrWeekly&cgwenable=1

  1. output will be :

2 or 0 (2 for charging failed)

With BIdummy

  1. all the CGW by using CGW API
  2. CGW determined whether the request send to IN send via IN Requester or not by checking Package
  3. For prepaid package, CGW will send the request to IN
  4. For postpaid, CGW will generate CDR in database and ETL or JETL will write the CDR to file. And operator will collect the flat cdr file via ftp or sftp.

CGW Logs

cgw will generate logs according to Log enable number. Example log is attached.

CGW2|2014-04-21 19:01:51|702921042014190210|receiveFromThirdParty|request received: <appid=VSDP&apppass=NOPASS&cmdid=AUTH_CALL&cmdparam=1778412765|2580|0|Ssdtivr|702921042014190210|0|0|>
CGW2|2014-04-21 19:01:51|702921042014190210|GetRateAndBillingNode|calling GetRateAndBillingNode: <CALL GetRateAndBillingNode(‘702921042014190210’, ‘1778412765’, ‘2580’,’0′,’SESSION_START’,’Ssdtivr’,’0′,@Rateid,@amount,@pulsesize,@BillingPort,@BillingURL,@SubscriptionStatus,”)>
CGW2|2014-04-21 19:01:51|702921042014190210|GetRateAndBillingNode|output from GetRateAndBillingNode: rateid=’Zero_Lifestyle_000paisapermin’, amount=’0′, pulsesize=’60’, subscriptionstatus=’2′
CGW2|2014-04-21 19:01:51|702921042014190210|generateRequestString|GetRateAndBillingNode response delay[10]

Further Readings

  1. How to Integrate with Operator IN and Postpaid Billing
  2. Step By Step Guide to Deploy Subscription Renewal Application
  3. Step By Step Guide to Deploy ETL
  4. Step By Step Guide to Deploy JETL
  5. How to configure custom button in webmin
  6. How to configure Application Monitor to run an application.
[feather_share size="24" show="twitter, google_plus, facebook, linkedin, mail " hide="reddit, pinterest, tumblr"]

We love to hear from you