src/config src/db src/libs src/schemas src/simulator src/test src/testconfig.py
by Isaac Sanni-Thomas
src/config/gateway.ini | 30 +++
src/config/masteragent.ini | 6
src/config/masteragent_mysql_sample.ini | 10 +
src/config/routes.ini | 15 +
src/db/openussd.db |binary
src/libs/core/confighandler.py | 78 +++++++-
src/libs/core/confighandler.pyc |binary
src/libs/core/dbhandler.py | 70 ++++----
src/libs/core/dbhandler.pyc |binary
src/schemas/pgsql.sql | 22 ++
src/simulator/USSD_Simulator.ui | 19 ++
src/simulator/UssdSimulator.ui | 278 ++++++++++++++++++++++++++++++++
src/test/example.py | 82 ++++-----
src/test/example2.py | 82 ++++-----
src/test/loggertest.py | 15 +
src/testconfig.py | 23 ++
16 files changed, 601 insertions(+), 129 deletions(-)
New commits:
commit 3d7cb808b48be15adc4b16b809041029c7d10a50
Author: Isaac d3vnull Sanni-Thomas <d3vnull.r00t(a)gmail.com>
Date: Mon Mar 14 14:40:39 2011 +0000
Added generic db query function with test harness.
diff --git a/src/config/gateway.ini b/src/config/gateway.ini
new file mode 100644
index 0000000..82c883d
--- /dev/null
+++ b/src/config/gateway.ini
@@ -0,0 +1,30 @@
+[MTN]
+port=23333
+type=smpp
+role=client
+username=openussd
+password=openussd
+host=127.0.0.1
+
+
+[safaricom]
+type=xmlrpc
+role=server
+port=24444
+functions=ussd_message
+paramters=sessionid,msisdn,message,shortcode,session_status
+
+
+[airtel]
+port=23333
+type=soap
+role=server
+functions=ussd_message
+paramters=sessionid,msisdn,message,shortcode,session_status
+
+
+[vodafone]
+type=http-xml
+role=server
+port=24444
+tags=sessionid,msisdn,message,shortcode,session_status
diff --git a/src/config/masteragent.ini b/src/config/masteragent.ini
new file mode 100644
index 0000000..dc40840
--- /dev/null
+++ b/src/config/masteragent.ini
@@ -0,0 +1,6 @@
+[main]
+port=29999
+dbtype=sqlite
+
+[database]
+dbpath=/var/lib/openussd/openussd.db
diff --git a/src/config/masteragent_mysql_sample.ini b/src/config/masteragent_mysql_sample.ini
new file mode 100644
index 0000000..2f48fda
--- /dev/null
+++ b/src/config/masteragent_mysql_sample.ini
@@ -0,0 +1,10 @@
+[main]
+port=29999
+dbtype=sqlite
+
+[dbdetails]
+dbuser=openussd
+dbpass=openussddemo
+dbhost=localhost
+dbname=openussd
+dbpath=/var/lib/openussd/openussd.db
diff --git a/src/config/routes.ini b/src/config/routes.ini
new file mode 100644
index 0000000..e24ecaf
--- /dev/null
+++ b/src/config/routes.ini
@@ -0,0 +1,15 @@
+[MTN]
+shortcode=*
+method=http-post
+agent="http://open.ussd.com/openussd/mtnhandler.php"
+
+[safaricom]
+shortcode=*
+method=smpp
+port=3030
+
+[airtel]
+id=airtel
+shortcode=*
+method=http-get
+agent="http://fiifi.baidoo.com:2300/ussdproc/airtel.jsp"
diff --git a/src/db/openussd.db b/src/db/openussd.db
new file mode 100644
index 0000000..b78c367
Binary files /dev/null and b/src/db/openussd.db differ
diff --git a/src/libs/core/confighandler.py b/src/libs/core/confighandler.py
index dc3fe06..6088673 100644
--- a/src/libs/core/confighandler.py
+++ b/src/libs/core/confighandler.py
@@ -4,53 +4,99 @@ Created on Jan 24, 2011
@author: d3vnull
'''
-MASTERAGENT_CONFIG="configs/masteragent.ini"
+MASTERAGENT_CONFIG = "/etc/openussd/masteragent.ini"
-GATEWAY_CONFIG="configs/gateway.ini"
+GATEWAY_CONFIG = "/etc/openussd/gateway.ini"
-ROUTES_CONFIG="configs/routes.ini"
+ROUTES_CONFIG = "/etc/openussd/routes.ini"
from ConfigParser import SafeConfigParser
import ConfigParser
-class Confighandler:
+class Configs:
+ #DB CONFIGURATIONS
DB_USER=""
DB_PASS=""
DB_HOST=""
DB_NAME=""
DB_TYPE=""
+ DB_PATH=""
+ #MASTERAGENT PORT TO BE USED BY THE XML-RPC SERVER
MASTERAGENT_PORT=""
+
+ #Routes configuration
+ SHORTCODE = ""
+ METHOD = ""
+ AGENT = ""
+ PORT = ""
##########################################################################
#
#
##########################################################################
- def setConfigs(self):
- try:
- """ SetDBconfig reads the config file and set global values for
+ def SetMasterAgentConfigs(self):
+ """ SetDBconfig reads the config file and set global values for
use"""
+ try:
config = ConfigParser.RawConfigParser()
config.read(MASTERAGENT_CONFIG)
- # Settings with values are treated as before:
- self.DB_USER=config.get("main", "dbuser")
- self.DB_HOST=config.get("main", "dbhost")
- self.DB_PASS=config.get("main", "dbpass")
- self.DB_NAME=config.get("main", "dbname")
-
- self.DB_TYPE=config.get("main", "type")
-
- self.MASTERAGENT_PORT=config.get("main", "port")
+ #Set the port for masteragent to listen on
+ self.MASTERAGENT_PORT = config.get("main", "port")
+ #Check which DB the user selected and get settings
+ self.DB_TYPE = config.get("main", "dbtype")
+
+ #Parse the configuration file according to the type selected
+ if self.DB_TYPE.lower() == "sqlite":
+ print "Found SQLite in config file..\n"
+ self.DB_PATH = config.get("database","dbpath")
+
+ elif self.DB_TYPE.lower() == "postgresql" \
+ or self.DB_TYPE.lower() == "mysql":
+ # Settings with values are treated as before:
+ self.DB_USER=config.get("database", "dbuser")
+ self.DB_HOST=config.get("database", "dbhost")
+ self.DB_PASS=config.get("database", "dbpass")
+ self.DB_NAME=config.get("database", "dbname")
+ else:
+ print "No Appropriate DB selected"
+
except:
print "Error found parsing config file in masteragent.ini"
return 0
+
+ ##########################################################################
+ #
+ # Picks setting from the route config file and creates routes in memory
+ #
+ ###########################################################################
+ def SetRoutesConfigs(self):
+ """Sets the routing channels for each MNO in the routes config file"""
+ print "Checking routes config file"
+ routeconfig = ConfigParser.ConfigParser()
+ routeconfig.read(ROUTES_CONFIG)
+ routes = routeconfig.sections()
+
+
+ for route in routes:
+ ROUTE = routeconfig.get(route, "id")
+ SHORTCODE = routeconfig.get(route,"shortcode")
+ METHOD = routeconfig.get(route,"method")
+
+ if METHOD == "smpp":
+ PORT = routeconfig.get(route,"port")
+ print "\nROUTEID=%s METHOD=%s SHORTCODE=%s PORT=%s\n" % (ROUTE,METHOD,SHORTCODE,PORT)
+
+ else:
+ AGENT = routeconfig.get(route,"agent")
+ print "\nROUTEID=%s METHOD=%s SHORTCODE=%s AGENT=%s\n" % (ROUTE,METHOD,SHORTCODE,AGENT)
def xmlrpc(self):
diff --git a/src/libs/core/confighandler.pyc b/src/libs/core/confighandler.pyc
new file mode 100644
index 0000000..585214b
Binary files /dev/null and b/src/libs/core/confighandler.pyc differ
diff --git a/src/libs/core/dbhandler.py b/src/libs/core/dbhandler.py
index 35175ad..5b577ef 100644
--- a/src/libs/core/dbhandler.py
+++ b/src/libs/core/dbhandler.py
@@ -4,49 +4,57 @@ Created on Jan 24, 2011
@author: d3vnull
'''
import MySQLdb #for mysql users
-import psycopg2 #for postgresql users
+import psycopg2 #for postgresql users
+import sqlite3 #for SQLite3 users (recommended)
-from confighandler import Confighandler
+from confighandler import Configs
-
-configs=Confighandler()
+configs=Configs()
class dbhandler:
- configs.setConfigs() #Read the DB values into the DB params below
- DB_TYPE=configs.DB_TYPE
- DB_HOST=configs.DB_HOST
- DB_PASS=configs.DB_PASS
- DB_USER=configs.DB_PASS
- DB_NAME=configs.DB_NAME
-
- #CHECK WHICH CONNECTION WE HAVE AND RUN THE QUERY
- if(DB_TYPE=="postgresql"):
- print "Found postgresql in config.Openussd will attempt connection"
-
- elif(DB_TYPE=="mysql"):
- print "Found mysql in config. Openussd will attempt connection"
-
-
+ configs.SetMasterAgentConfigs()#Read the DB values into the DB params below
+ DB_TYPE = configs.DB_TYPE
+ DB_HOST = configs.DB_HOST
+ DB_PASS = configs.DB_PASS
+ DB_USER = configs.DB_PASS
+ DB_NAME = configs.DB_NAME
+ DB_PATH = configs.DB_PATH #for SQLITE
-
- ##########################################################################
+ ############################################################################
#
#
#
- ###########################################################################
+ ############################################################################
def query(self,query):
"""query functions runs a query and returns the result"""
-
- result=[]
-
-
-
+ cursor = None
+ result = []
+
+
+ #CHECK WHICH CONNECTION WE HAVE AND RUN THE QUERY
+ if(self.DB_TYPE.lower() == "postgresql"):
+ print "Found postgresql in config.Openussd will attempt connection\n"
+
+
+ elif(self.DB_TYPE.lower() == "mysql"):
+ print "Found mysql in config. Openussd will attempt connection\n"
+ db=MySQLdb.connect
+ (self.DB_HOST,self.DB_USER,self.DB_PASS,self.DB_NAME)
+ cursor = db.cursor()
+ cursor.execute(query)
+ result = cursor.fetchall()
-
-
-
-
+
+ elif(self.DB_TYPE.lower() == "sqlite"):
+ print "Found sqlite in config. Openussd will attempt connection\n"
+ db = sqlite3.connect(self.DB_PATH)
+ cursor = db.cursor()
+ cursor.execute(query)
+ result = cursor.fetchall()
+ db.commit()
+ db.close()
+
return result
\ No newline at end of file
diff --git a/src/libs/core/dbhandler.pyc b/src/libs/core/dbhandler.pyc
new file mode 100644
index 0000000..8d239ce
Binary files /dev/null and b/src/libs/core/dbhandler.pyc differ
diff --git a/src/schemas/mysql.sql b/src/schemas/mysql.sql
new file mode 100644
index 0000000..e69de29
diff --git a/src/schemas/pgsql.sql b/src/schemas/pgsql.sql
new file mode 100644
index 0000000..187f48f
--- /dev/null
+++ b/src/schemas/pgsql.sql
@@ -0,0 +1,22 @@
+CREATE table tab_authusers(
+user_id SERIAL,
+uname varchar(120)
+pass varchar(120)
+timeadded timestamp
+grantedBy varchar(120)
+access_level tinyint
+);
+
+
+
+CREATE table tab_ussdrequests(
+
+request_id SERIAL,
+route_id varchar(120)
+message TEXT
+serviceCode varchar(60)
+timeOfrequest timestamp
+);
+
+
+
diff --git a/src/simulator/USSD_Simulator.ui b/src/simulator/USSD_Simulator.ui
new file mode 100644
index 0000000..1bb7b88
--- /dev/null
+++ b/src/simulator/USSD_Simulator.ui
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>754</width>
+ <height>552</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/simulator/UssdSimulator.ui b/src/simulator/UssdSimulator.ui
new file mode 100644
index 0000000..203dbe1
--- /dev/null
+++ b/src/simulator/UssdSimulator.ui
@@ -0,0 +1,278 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>20</y>
+ <width>741</width>
+ <height>481</height>
+ </rect>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>Tab 1</string>
+ </attribute>
+ <widget class="QPushButton" name="pushButton_6">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>350</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>7</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_9">
+ <property name="geometry">
+ <rect>
+ <x>240</x>
+ <y>350</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>9</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_10">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>400</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>*</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>250</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>1</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_4">
+ <property name="geometry">
+ <rect>
+ <x>130</x>
+ <y>300</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>5</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_2">
+ <property name="geometry">
+ <rect>
+ <x>130</x>
+ <y>250</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>2</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_11">
+ <property name="geometry">
+ <rect>
+ <x>240</x>
+ <y>400</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>#</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_5">
+ <property name="geometry">
+ <rect>
+ <x>240</x>
+ <y>300</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>6</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_3">
+ <property name="geometry">
+ <rect>
+ <x>240</x>
+ <y>250</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>3</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_8">
+ <property name="geometry">
+ <rect>
+ <x>130</x>
+ <y>350</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>8</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_7">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>300</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>4</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_12">
+ <property name="geometry">
+ <rect>
+ <x>130</x>
+ <y>400</y>
+ <width>85</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>0</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_13">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>210</y>
+ <width>151</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_14">
+ <property name="geometry">
+ <rect>
+ <x>174</x>
+ <y>210</y>
+ <width>151</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>CANCEL</string>
+ </property>
+ </widget>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>10</y>
+ <width>301</width>
+ <height>181</height>
+ </rect>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>297</width>
+ <height>177</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string>Tab 2</string>
+ </attribute>
+ </widget>
+ </widget>
+ </widget>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>23</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>File</string>
+ </property>
+ <addaction name="actionClose"/>
+ <addaction name="actionQuit"/>
+ </widget>
+ <addaction name="menuFile"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="actionClose">
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </action>
+ <action name="actionQuit">
+ <property name="text">
+ <string>Quit</string>
+ </property>
+ </action>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/test/example.py b/src/test/example.py
index 32dec10..c7667ec 100644
--- a/src/test/example.py
+++ b/src/test/example.py
@@ -3,44 +3,44 @@
#
# SMPP Library usage example
#
-import smpplib
-
-
-def recv_handler(self, **args):
- print 'Message received:', args
-
-if __name__ == '__main__':
- client = smpplib.client.Client("10.12.51.38", 5100)
- client.connect()
- client.bind_transmitter(system_id="SYSPLAN", password='pass', system_type='TEST')
- msg = "This is a test message..........................................................................................................................................Part2"
- length = len(msg)
- splitat = 160
- parts = length/splitat +1
- if length > splitat:
- for k in range(parts):
- msgpart = msg[k*splitat:k*splitat+splitat]
- client.send_message(source_addr_ton=0,
- source_addr_npi = 5,
- source_addr='Me',
- dest_addr_ton=smpplib.command.SMPP_TON_UNK,
- dest_addr_npi = smpplib.command.SMPP_NPI_ISDN,
- destination_addr='27834323432',
- sar_msg_ref_num = 1,
- sar_total_segments = parts,
- sar_segment_seqnum = k+1,
- message_payload=msgpart)
- else:
- client.send_message(source_addr_ton=0,
- source_addr_npi = 5,
- source_addr='Me',
- dest_addr_ton=smpplib.command.SMPP_TON_UNK,
- dest_addr_npi = smpplib.command.SMPP_NPI_ISDN,
- destination_addr='27834323432',
- #protocol_id=smpplib.command.SMPP_PID_RIP,
- short_message=msg)
- print "Sent.."
-
- client.unbind()
-
- client.disconnect()
+#import smpplib
+#
+#
+#def recv_handler(self, **args):
+# print 'Message received:', args
+#
+#if __name__ == '__main__':
+# client = smpplib.client.Client("10.12.51.38", 5100)
+# client.connect()
+# client.bind_transmitter(system_id="SYSPLAN", password='pass', system_type='TEST')
+# msg = "This is a test message..........................................................................................................................................Part2"
+# length = len(msg)
+# splitat = 160
+# parts = length/splitat +1
+# if length > splitat:
+# for k in range(parts):
+# msgpart = msg[k*splitat:k*splitat+splitat]
+# client.send_message(source_addr_ton=0,
+# source_addr_npi = 5,
+# source_addr='Me',
+# dest_addr_ton=smpplib.command.SMPP_TON_UNK,
+# dest_addr_npi = smpplib.command.SMPP_NPI_ISDN,
+# destination_addr='27834323432',
+# sar_msg_ref_num = 1,
+# sar_total_segments = parts,
+# sar_segment_seqnum = k+1,
+# message_payload=msgpart)
+# else:
+# client.send_message(source_addr_ton=0,
+# source_addr_npi = 5,
+# source_addr='Me',
+# dest_addr_ton=smpplib.command.SMPP_TON_UNK,
+# dest_addr_npi = smpplib.command.SMPP_NPI_ISDN,
+# destination_addr='27834323432',
+# #protocol_id=smpplib.command.SMPP_PID_RIP,
+# short_message=msg)
+# print "Sent.."
+#
+# client.unbind()
+#
+# client.disconnect()
diff --git a/src/test/example2.py b/src/test/example2.py
index 32dec10..c7667ec 100644
--- a/src/test/example2.py
+++ b/src/test/example2.py
@@ -3,44 +3,44 @@
#
# SMPP Library usage example
#
-import smpplib
-
-
-def recv_handler(self, **args):
- print 'Message received:', args
-
-if __name__ == '__main__':
- client = smpplib.client.Client("10.12.51.38", 5100)
- client.connect()
- client.bind_transmitter(system_id="SYSPLAN", password='pass', system_type='TEST')
- msg = "This is a test message..........................................................................................................................................Part2"
- length = len(msg)
- splitat = 160
- parts = length/splitat +1
- if length > splitat:
- for k in range(parts):
- msgpart = msg[k*splitat:k*splitat+splitat]
- client.send_message(source_addr_ton=0,
- source_addr_npi = 5,
- source_addr='Me',
- dest_addr_ton=smpplib.command.SMPP_TON_UNK,
- dest_addr_npi = smpplib.command.SMPP_NPI_ISDN,
- destination_addr='27834323432',
- sar_msg_ref_num = 1,
- sar_total_segments = parts,
- sar_segment_seqnum = k+1,
- message_payload=msgpart)
- else:
- client.send_message(source_addr_ton=0,
- source_addr_npi = 5,
- source_addr='Me',
- dest_addr_ton=smpplib.command.SMPP_TON_UNK,
- dest_addr_npi = smpplib.command.SMPP_NPI_ISDN,
- destination_addr='27834323432',
- #protocol_id=smpplib.command.SMPP_PID_RIP,
- short_message=msg)
- print "Sent.."
-
- client.unbind()
-
- client.disconnect()
+#import smpplib
+#
+#
+#def recv_handler(self, **args):
+# print 'Message received:', args
+#
+#if __name__ == '__main__':
+# client = smpplib.client.Client("10.12.51.38", 5100)
+# client.connect()
+# client.bind_transmitter(system_id="SYSPLAN", password='pass', system_type='TEST')
+# msg = "This is a test message..........................................................................................................................................Part2"
+# length = len(msg)
+# splitat = 160
+# parts = length/splitat +1
+# if length > splitat:
+# for k in range(parts):
+# msgpart = msg[k*splitat:k*splitat+splitat]
+# client.send_message(source_addr_ton=0,
+# source_addr_npi = 5,
+# source_addr='Me',
+# dest_addr_ton=smpplib.command.SMPP_TON_UNK,
+# dest_addr_npi = smpplib.command.SMPP_NPI_ISDN,
+# destination_addr='27834323432',
+# sar_msg_ref_num = 1,
+# sar_total_segments = parts,
+# sar_segment_seqnum = k+1,
+# message_payload=msgpart)
+# else:
+# client.send_message(source_addr_ton=0,
+# source_addr_npi = 5,
+# source_addr='Me',
+# dest_addr_ton=smpplib.command.SMPP_TON_UNK,
+# dest_addr_npi = smpplib.command.SMPP_NPI_ISDN,
+# destination_addr='27834323432',
+# #protocol_id=smpplib.command.SMPP_PID_RIP,
+# short_message=msg)
+# print "Sent.."
+#
+# client.unbind()
+#
+# client.disconnect()
diff --git a/src/test/loggertest.py b/src/test/loggertest.py
new file mode 100644
index 0000000..1a8f58a
--- /dev/null
+++ b/src/test/loggertest.py
@@ -0,0 +1,15 @@
+'''
+Created on Jan 24, 2011
+
+@author: d3vnull
+'''
+
+from libs.core.loghandler import *
+
+
+
+if __name__=="__main__":
+
+ #logger("cli","Testing CLI logger.....")
+
+ logger("webui","Testing Webui logger.....")
\ No newline at end of file
diff --git a/src/testconfig.py b/src/testconfig.py
new file mode 100644
index 0000000..4e568d9
--- /dev/null
+++ b/src/testconfig.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+from libs.core.dbhandler import dbhandler
+from libs.core.dbhandler import Configs
+
+
+if __name__ == "__main__" :
+ db = dbhandler()
+ configs = Configs()
+
+ #result = db.query("""create table ROUTE(route_id INTEGER PRIMARY KEY AUTOINCREMENT,
+ #agent varchar(50), mno_id varchar(50),shortcode varchar(50));""")
+
+ #result = db.query("""insert into ROUTE(agent,mno_id,shortcode) values('http://open.ussd.com/openussd/airtelhandler.php','airtel','*');""")
+
+ result = db.query("""select * from ROUTE;""")
+
+
+ for res in result:
+ print "ROUTE ID=%s AGENT=%s MNO=%s SHORTCODE=%s\n\n" %\
+ (res[0], res[1],res[2],res[3])
+
+
+ configs.SetRoutesConfigs()
\ No newline at end of file
13 years, 1 month
Default DB for OpenUSSD masteragent
by Isaac Sanni-Thomas
Hello Team,
I wanted to keep you posted that we had agreed that the default engine
for the masteragent according to our
architecture be set to SQLite though we will be providing support for
Postgresql and MySQL.
We felt the selection of SQLite will improve the speed in routing and
make openUSSD as tiny as possible.
Kindly share your opinion on this.
BR(d3vnull);
13 years, 1 month