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

TypePath
CGW applicationIn Linux :
/ismp/test/cgw/cgwapp/
Or “/ismp/produection/cgw/cgwapp/
In windows
“D:ismptestcgwcgwapp”
Or “D:ismpproductioncgwcgwapp”
CGW servicesIn Linux:
“/ismp/test/cgw/subscriptionservices
Or “/ismp/production/cgw/subscriptionservices
In Windows:
“D:ismptestcgwsubscriptionservices”
or“D:ismpproductioncgwsubscriptionservices”
CGW Web panelIn 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 NameDescription Example Values
DB_HOSTIP of CGW databaselocalhost
DB_USERCGW database’s usernameroot
DB_PASSWORDCGW database’s passwordmysqlpass
DB_NAMEName of CGW databaseCGW_1_0
DB_VERSIONLast part of the MySQL version3: for version 5.5.3
0: for version 5.5.0
LISTENING_PORTPort number at which CGW listen to incoming request3440
BILLING_HOSTIP of the machine where IN Requester is deployedlocalhost
BILLING_PORTPort number at which IN Requester listen to incoming request3650
LOG_LEVELDetermines 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_DESTINATIONDetermines 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_HOSTIP of the machine where Log Server is deployed10.183.16.198
LOG_PORTPort number at which Log Server listen to incoming request3470
LOG_COMPONENTName of the component in CGW suiteCGW
LOG_INSTANCEName of this particular instance of the componentCGW_2_0
SNMP_ENABLED To Enable SNMP interaction1 for Enable and 0 for Disable
SNMP_INSTANCE_NAME Name of this particular instance of the componentCGW
SNMP_MANAGER_HOST_IP To Which IP SNMP Msg will sentIP Address
SNMP_MANAGER_PORT_NO Remote SNMP server portPort
SNMP_LOCAL_IP All local interface IP0.0.0.0
SNMP_LOCAL_PORT Any port0
SNMP_AGENT_IP Which local ip will communicate with remote SNMP ServerLocal Interface IP
PARALLEL_BILLING_REQUEST To enable parallel charging requests.Should be 1.
SHOULD_USE_REMARKSThis 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 CGWapp1 for Enabled
RECV_TIMEOUT How much time will wait to get socket for Billing Interface5000 ms
PACKAGE_CHECK_ENABLED_SESSION To Call API For Session base Charging1 for Enable (Should be 0 to enable package checking from database)
PACKAGE_CHECK_ENABLED_SPECIFIC To Call API For Specific Charging1 for Enable (Should be 0 to enable package checking from database)
PREPAID_HOST_IP Prepaid package Checking ServerIP Address
PREPAID_HOST_PORT Port informationPrepaid service Port
POSTPAID_HOST_IP Postpaid package Checking ServerIP Address
POSTPAID_HOST_PORT Port informationPostpaid service Port
HEADERNOTAVAILABLE
DEBUG_GET_CONTENT To see output for any URL Calling1 for Enable
CHARGE_USING_WEBSERVICE_ENABLE To call web API1 for enable
CHARGING_WEBSERVICE_HOST_IP To which server web API, CGW will call for ChargingIP Address
CHARGING_WEBSERVICE_HOST_PORT Web Charging PortPort
DISCARD_PREFIX_OBDStarting Index Number of MSISDN for Outbound CallLike 01713404007 is a MSISDN and index will be 1
MSISDN_LENGTHLength of MSISDN10 for Bangladeshis Mobile number
REFUND_SESSIONTo refund unused Blance1 for enable
  1. Change the configuration in config.php file from subscriptionservices folder.
Field NameDescriptionExample Values
DB_HOSTIP of CGW databaselocalhost
DB_USERCGW database’s usernameroot
DB_PASSWORDCGW database’s passwordmysqlpass
DB_NAMEName of CGW databasecgw_2_0
$COMMONPHPLocation of common.phpcommon.php
$CALLFLOWLIBLocation of CallFlowLib.phpCallFlowLib.php
  1. Change the configuration in config.php file from cgwweb folder.
Field NameDescriptionExample Values
dbtypeType of Databasemysql
MYSERVERDatabase server IP192.168.5.129
MYUIDDB login IDroot
MYPASSWORDDB login passwordmysqlpass
MYDBName of CGW databaseCGW_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.
twittergoogle_plusFacebooklinkedinmail

We love to hear from you