summaryrefslogtreecommitdiffstats
path: root/For Weekly Test
diff options
context:
space:
mode:
authorMac-Linux2011-07-26 14:58:39 +0200
committerMac-Linux2011-07-26 14:58:39 +0200
commit544295f0dc4615e779a340c0626af4e33444f561 (patch)
treec7663b8232dbd7c4ca56747118cee325c008e016 /For Weekly Test
parentdelete bad file (diff)
downloadgsm-selftest-544295f0dc4615e779a340c0626af4e33444f561.tar.gz
gsm-selftest-544295f0dc4615e779a340c0626af4e33444f561.tar.xz
gsm-selftest-544295f0dc4615e779a340c0626af4e33444f561.zip
clean the folder test weekly for 30 June
Diffstat (limited to 'For Weekly Test')
-rw-r--r--For Weekly Test/30-07-2011/2classController.log0
-rw-r--r--For Weekly Test/30-07-2011/AccClass.py40
-rw-r--r--For Weekly Test/30-07-2011/AccClass.pycbin1426 -> 0 bytes
-rw-r--r--For Weekly Test/30-07-2011/CallClass.py30
-rw-r--r--For Weekly Test/30-07-2011/CallClass.pycbin1160 -> 0 bytes
-rw-r--r--For Weekly Test/30-07-2011/ClientClass.pycbin3601 -> 3637 bytes
-rw-r--r--For Weekly Test/30-07-2011/ControllerClass.pycbin5799 -> 5839 bytes
-rw-r--r--For Weekly Test/30-07-2011/DbClass.pycbin7029 -> 7513 bytes
-rw-r--r--For Weekly Test/30-07-2011/LogFileClass.pycbin1494 -> 1514 bytes
-rw-r--r--For Weekly Test/30-07-2011/PingClass.pycbin1251 -> 1267 bytes
-rw-r--r--For Weekly Test/30-07-2011/callorigFR.py172
-rw-r--r--For Weekly Test/30-07-2011/classCheck.pycbin1081 -> 1093 bytes
-rw-r--r--For Weekly Test/30-07-2011/dbClass.py271
-rw-r--r--For Weekly Test/30-07-2011/dbClass.pycbin7453 -> 0 bytes
-rw-r--r--For Weekly Test/30-07-2011/sipHandler.log97
-rw-r--r--For Weekly Test/30-07-2011/sipHandler.py201
-rw-r--r--For Weekly Test/30-07-2011/sipHandler3.py139
-rw-r--r--For Weekly Test/30-07-2011/test.py7
-rw-r--r--For Weekly Test/30-07-2011/test2.py7
-rw-r--r--For Weekly Test/30-07-2011/test3.py31
-rw-r--r--For Weekly Test/30-07-2011/test4.py26
-rw-r--r--For Weekly Test/30-07-2011/test5.py6
-rw-r--r--For Weekly Test/30-07-2011/test6.py35
-rw-r--r--For Weekly Test/DBProblem/test3.py15
24 files changed, 10 insertions, 1067 deletions
diff --git a/For Weekly Test/30-07-2011/2classController.log b/For Weekly Test/30-07-2011/2classController.log
deleted file mode 100644
index e69de29..0000000
--- a/For Weekly Test/30-07-2011/2classController.log
+++ /dev/null
diff --git a/For Weekly Test/30-07-2011/AccClass.py b/For Weekly Test/30-07-2011/AccClass.py
deleted file mode 100644
index 9a3425d..0000000
--- a/For Weekly Test/30-07-2011/AccClass.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import CallClass
-import pjsua as pj
-
-class Account(pj.AccountCallback):
-
- def __init__(self, account=None):
- pj.AccountCallback.__init__(self, account)
-# self.server = server
- self.current_call = None
- self.call_cb = None
- self.statuss = None
- self.status = None
-
- def on_incoming_call(self, call):
- global statuss
- self.current_call = call
- self.call_cb = CallClass.Calling(self.current_call)
- self.current_call.set_callback(self.call_cb)
-
- #sleep(0.5)
- print "1"
- call.answer(200)
- self.statuss = 200
- #gger.logEvent("Answer call")
- #sleep(0.5)
-
- if self.current_call <> None:
- #logger.logEvent("Hangup call")
- print "2"
- call.hangup()
- #logger.logEvent('CALL OK')
- return 200
-
- def result(self):
- if self.statuss == 200:
- self.status == 'CALL OK'
- else:
- self.status == 'CALL NOT OK'
-
-
diff --git a/For Weekly Test/30-07-2011/AccClass.pyc b/For Weekly Test/30-07-2011/AccClass.pyc
deleted file mode 100644
index c32fa94..0000000
--- a/For Weekly Test/30-07-2011/AccClass.pyc
+++ /dev/null
Binary files differ
diff --git a/For Weekly Test/30-07-2011/CallClass.py b/For Weekly Test/30-07-2011/CallClass.py
deleted file mode 100644
index ced8e3e..0000000
--- a/For Weekly Test/30-07-2011/CallClass.py
+++ /dev/null
@@ -1,30 +0,0 @@
-import pjsua as pj
-import AccClass
-
-class Calling(pj.CallCallback):
-
- def __init__(self, call=None):
- pj.CallCallback.__init__(self, call)
- #self.server = server
-
- def on_state(self):
- global current_call
-
- if self.call.info().state <> pj.CallState.DISCONNECTED:
- if self.call.info().state_text == "CONNECTING":
- #logger.logEvent("Call Connecting")
- #logger.logEvent('200')
- #self.server.sendData('CALL OK')
- print "Connect"
-
- if self.call.info().last_reason == "Busy Here":
- #logger.logEvent('Number busy or Offline')
- #server.sendData('CALL NOT OK')
- #logger.logEvent('CALL NOT OK')
- print "busy"
-
- if self.call.info().state == pj.CallState.DISCONNECTED:
- #logger.logEvent('Call Disconnected')
- current_call = None
- print "discon"
-
diff --git a/For Weekly Test/30-07-2011/CallClass.pyc b/For Weekly Test/30-07-2011/CallClass.pyc
deleted file mode 100644
index a05a25a..0000000
--- a/For Weekly Test/30-07-2011/CallClass.pyc
+++ /dev/null
Binary files differ
diff --git a/For Weekly Test/30-07-2011/ClientClass.pyc b/For Weekly Test/30-07-2011/ClientClass.pyc
index 7cdfa60..99656f8 100644
--- a/For Weekly Test/30-07-2011/ClientClass.pyc
+++ b/For Weekly Test/30-07-2011/ClientClass.pyc
Binary files differ
diff --git a/For Weekly Test/30-07-2011/ControllerClass.pyc b/For Weekly Test/30-07-2011/ControllerClass.pyc
index 855e630..234bf41 100644
--- a/For Weekly Test/30-07-2011/ControllerClass.pyc
+++ b/For Weekly Test/30-07-2011/ControllerClass.pyc
Binary files differ
diff --git a/For Weekly Test/30-07-2011/DbClass.pyc b/For Weekly Test/30-07-2011/DbClass.pyc
index 2b125c7..95d56f2 100644
--- a/For Weekly Test/30-07-2011/DbClass.pyc
+++ b/For Weekly Test/30-07-2011/DbClass.pyc
Binary files differ
diff --git a/For Weekly Test/30-07-2011/LogFileClass.pyc b/For Weekly Test/30-07-2011/LogFileClass.pyc
index 52fd946..6c2ecdc 100644
--- a/For Weekly Test/30-07-2011/LogFileClass.pyc
+++ b/For Weekly Test/30-07-2011/LogFileClass.pyc
Binary files differ
diff --git a/For Weekly Test/30-07-2011/PingClass.pyc b/For Weekly Test/30-07-2011/PingClass.pyc
index 9ac5c4b..2252892 100644
--- a/For Weekly Test/30-07-2011/PingClass.pyc
+++ b/For Weekly Test/30-07-2011/PingClass.pyc
Binary files differ
diff --git a/For Weekly Test/30-07-2011/callorigFR.py b/For Weekly Test/30-07-2011/callorigFR.py
deleted file mode 100644
index 10e492b..0000000
--- a/For Weekly Test/30-07-2011/callorigFR.py
+++ /dev/null
@@ -1,172 +0,0 @@
-# $Id$
-#
-# SIP call sample.
-#
-# Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-import sys
-import pjsua as pj
-
-LOG_LEVEL=3
-current_call = None
-
-# Logging callback
-def log_cb(level, str, len):
- print str,
-
-
-# Callback to receive events from account
-class MyAccountCallback(pj.AccountCallback):
-
- def __init__(self, account=None):
- pj.AccountCallback.__init__(self, account)
-
- # Notification on incoming call
- def on_incoming_call(self, call):
- global current_call
- if current_call:
- call.answer(486, "Busy")
- return
-
- print "Incoming call from ", call.info().remote_uri
- print "Press 'a' to answer"
-
- current_call = call
-
- call_cb = MyCallCallback(current_call)
- current_call.set_callback(call_cb)
-
- current_call.answer(180)
-
-
-# Callback to receive events from Call
-class MyCallCallback(pj.CallCallback):
-
- def __init__(self, call=None):
- pj.CallCallback.__init__(self, call)
-
- # Notification when call state has changed
- def on_state(self):
- global current_call
- print "Call with", self.call.info().remote_uri,
- print "is", self.call.info().state_text,
- print "last code =", self.call.info().last_code,
- print "(" + self.call.info().last_reason + ")"
-
- if self.call.info().state == pj.CallState.DISCONNECTED:
- current_call = None
- print 'Current call is', current_call
-
- # Notification when call's media state has changed.
- def on_media_state(self):
- if self.call.info().media_state == pj.MediaState.ACTIVE:
- # Connect the call to sound device
- call_slot = self.call.info().conf_slot
- pj.Lib.instance().conf_connect(call_slot, 0)
- pj.Lib.instance().conf_connect(0, call_slot)
- print "Media is now active"
- else:
- print "Media is inactive"
-
-# Function to make call
-def make_call(uri):
- try:
- print "Making call to", uri
- return acc.make_call(uri, cb=MyCallCallback())
- except pj.Error, e:
- print "Exception: " + str(e)
- return None
-
-
-# Create library instance
-lib = pj.Lib()
-
-try:
- # Init library with default config and some customized
- # logging config.
- lib.init(log_cfg = pj.LogConfig(level=LOG_LEVEL, callback=log_cb))
-
- # Create UDP transport which listens to any available port
- transport = lib.create_transport(pj.TransportType.UDP,
- pj.TransportConfig(0))
- print "\nListening on", transport.info().host,
- print "port", transport.info().port, "\n"
-
- # Start the library
- lib.start()
- lib.set_null_snd_dev()
-
- # Create local account
- acc_cfg = pj.AccountConfig("132.230.4.8", "mpselftest3", "3mpselftest")
- acc = lib.create_account(acc_cfg, cb=MyAccountCallback())
-
- # If argument is specified then make call to the URI
- if len(sys.argv) > 1:
- lck = lib.auto_lock()
- current_call = make_call(sys.argv[1])
- print 'Current call is', current_call
- del lck
-
- my_sip_uri = "sip:" + transport.info().host + \
- ":" + str(transport.info().port)
-
- # Menu loop
- while True:
- print "My SIP URI is", my_sip_uri, acc.info().reg_status
- print "Menu: m=make call, h=hangup call, a=answer call, q=quit"
-
- input = sys.stdin.readline().rstrip("\r\n")
- if input == "m":
- if current_call:
- print "Already have another call"
- continue
- print "Enter destination URI to call: ",
- input = sys.stdin.readline().rstrip("\r\n")
- if input == "":
- continue
- lck = lib.auto_lock()
- number = "sip:"+input+"@132.230.4.8"
- current_call = make_call(number)
- del lck
-
- elif input == "h":
- if not current_call:
- print "There is no call"
- continue
- current_call.hangup()
-
- elif input == "a":
- if not current_call:
- print "There is no call"
- continue
- current_call.answer(200)
-
- elif input == "q":
- break
-
- # Shutdown the library
- transport = None
- acc.delete()
- acc = None
- lib.destroy()
- lib = None
-
-except pj.Error, e:
- print "Exception: " + str(e)
- lib.destroy()
- lib = None
-
diff --git a/For Weekly Test/30-07-2011/classCheck.pyc b/For Weekly Test/30-07-2011/classCheck.pyc
index d36941a..2d0e213 100644
--- a/For Weekly Test/30-07-2011/classCheck.pyc
+++ b/For Weekly Test/30-07-2011/classCheck.pyc
Binary files differ
diff --git a/For Weekly Test/30-07-2011/dbClass.py b/For Weekly Test/30-07-2011/dbClass.py
deleted file mode 100644
index dc7ca41..0000000
--- a/For Weekly Test/30-07-2011/dbClass.py
+++ /dev/null
@@ -1,271 +0,0 @@
-import MySQLdb
-import string
-
-class DBMySQLConnection:
- def __init__(self, username, password, host, dbname):
- #initialize at the start all the user parameters
- self.usern = username
- self.passw = password
- self.host = host
- self.db = dbname
- self.connectionCreated = 0
- self.tasksList = list()
- global debugMode
- debugMode = 0
-
- def connectDB(self):
- try:
- #try the connection
- self.datBaseConn=MySQLdb.connect(self.host,self.usern, self.passw,self.db)
- self.datBaseConn.paramstyle = 'format'
- self.cur = self.datBaseConn.cursor() #make the cursor, used for sending queries
- self.connectionCreated = 1 #use it as an indicator that the connection was created
- return 1
-
- except MySQLdb.Error, e:
- #if we have an error then try to catch it
- error=str(e)
- if error[1:5] == '1045':
- #wrong username or password
- return 0
- elif error[1:5] == '2002':
- #can't connect to mysql, mysql shutdown or wrong host
- return 2
- else:
- if debugMode == 1:
- print error
- return 3
-
- def closeDBConn(self):
- #close the connection to the database here
- if self.connectionCreated == 1:
- try:
- #close the cursor and then the connection to the DB
- self.cur.close()
- self.datBaseConn.close()
- return 1
- except MySQLdb.Error, e:
- #in case of an error
- if debugMode == 1:
- error = str(e)
- print error
- return 3
- else:
- #I never really had a connection
- return 0
-
- def anyTasksToDo(self):
- #see are there any jobs to be executed and make a list out of it
- if self.connectionCreated == 1:
- try:
- self.cur.execute("SELECT * FROM TempTaskTable")
- output = self.cur.fetchall() #get the mysql response
- #parse the output from the mysql by creating a list
- #with lists where each attribue(column) gets independent
- #element of the list
- for record in output:
- columns = list()
- for entry in record:
- columns.append(str(entry))
- self.tasksList.append(columns)
- return 1
- except MySQLdb.Error, e:
- error = str(e)
- if error[1:5] == '1146':
- return 2 #the table doesn't exist
- if debugMode == 1:
- print str(e)
- return 3
- else:
- return 0
-
- def cleanTasksList(self):
- if self.connectionCreated == 1:
- del self.tasksList[:]
- return 1
- else:
- return 0
-
- def removeTaskFromList(self, taskID):
- #remove only one task from the task list
- if self.connectionCreated == 1:
- for index in range(len(self.tasksList)):
- item = self.tasksList[index]
- if item[0] == str(taskID):
- #self.tasksList.remove(index)
- #print 'found it'
- del self.tasksList[index]
- return 1 #deleted taskID
-
- return 2 #didn't find that taskID
- else:
- return 0
-
- def deviceAddress(self,deviceName):
- if self.connectionCreated == 1:
- try:
- successful = self.cur.execute("SELECT `deviceIP` FROM DeviceAddress where `deviceName`=%s", deviceName)
- #self.cur.execute()
- output = self.cur.fetchall() #get the mysql response
- #parse the output from the mysql by creating a list
- #with lists where each attribue(column) gets independent
- #element of the list
- deviceAddr = ''
- for record in output:
- columns = list()
- for entry in record:
- deviceAddr = str(entry)
- return deviceAddr
- except MySQLdb.Error, e:
- error = str(e)
- if error[1:5] == '1146':
- return 2 #the table doesn't exist
- if debugMode == 1:
- print str(e)
- return 3 #some error happened
- else:
- return 0 #I am not connected
-
- def updateTaskResult(self, taskID, status):
- if self.connectionCreated == 1:
- try:
- successful = self.cur.execute("UPDATE TaskTable SET status=%i WHERE taskID=%i"%(int(status), int(taskID)))
- output = self.cur.fetchone()
-
- if debugMode == 1:
- print output
- if successful == 0:
- return 1 #update successful
- else:
- return 4 #taskID doesn't exist
-
- except MySQLdb.Error, e:
- if debugMode == 1:
- print str(e)
- return 3
- else:
- return 0
-
- def updatePingResult(self, taskNo, sipServer, sipGate, sipLoc, gsmBox1, gsmBox2):
- if self.connectionCreated == 1:
- try:
- successful = self.cur.execute("UPDATE PingResultTable SET sipServer=%i, sipGate=%i, sipLoc=%i, gsmBox1=%i, gsmBox2=%i WHERE taskNo=%i"%(int(sipServer), int(sipGate), int(sipLoc), int(gsmBox1), int(gsmBox2), int(taskNo)))
- output = self.cur.fetchone()
-
- if debugMode == 1:
- print output
- if successful == 0:
- return 1 #ping table updated
- else:
- return 4 #the taskNo didn't exist
-
-
- except MySQLdb.Error, e:
- if debugMode == 1:
- print str(e)
- return 3
- else:
- return 0
-
- def deleteTempTask(self, taskID):
- if self.connectionCreated == 1:
- try:
- successful = self.cur.execute("DELETE FROM TempTaskTable WHERE taskID=%i"%(int(taskID)))
- output = self.cur.fetchone()
-
- if debugMode == 1:
- print output
-
- if successful == 1:
- return 1 #deleted it
- else:
- return 4 #that taskID didn't exist or something else
- except MySQLdb.Error, e:
- if debugMode == 1:
- print str(e)
- return 3
-
- else:
- return 0
-
- def addResult(self, taskID, result):
- if self.connectionCreated == 1:
- try:
- successful = self.cur.execute("INSERT INTO ResultTable(taskID, result) VALUES ('%i', '%i')"%(int(taskID), int(result)))
- output = self.cur.fetchone()
-
- if debugMode == 1:
- print output
- if successful == 1:
- return 1 #successfully added the result
- else:
- return 4 #hmmm
- except MySQLdb.Error, e:
- error = str(e)
- if error[1:5] == '1062':
- return 2 #duplicate entry for the key
- if debugMode == 1:
- print str(e)
- return 3
- else:
- return 0
-
-
- def insertTaskIn2(self, fromDevice, toDevice, taskNo):
- if self.connectionCreated == 1:
- try:
- #I used here a transaction since I want the mysql to execute a few commands and tell me was it successful rather than to execute some and there happens a mistake and one part is updated and the other isn't
- newQuery = "START TRANSACTION; INSERT INTO `TaskTable` (`taskNo`, `from`, `to`, `status`) VALUES ('" + str(taskNo) + "', '" + str(fromDevice) + "', '" + str(toDevice) +"', '0'); SELECT @taskID := LAST_INSERT_ID(); INSERT INTO `TempTaskTable` (`taskID`, `taskNo`, `from`, `to`) VALUES (@taskID, '" + str(taskNo) + "', '" + str(fromDevice) + "', '"+ str(toDevice) + "'); COMMIT;"
-
-
- successful = self.cur.execute(newQuery)
- output = self.cur.fetchone()
-
-
- #without closing the cursos we get a MySQL error, the mistake is an internal mistak of the MySQLdb python library
- # self.cur.close()
- # self.cur = self.datBaseConn.cursor()
-
- while self.cur.nextset() is not None: pass
-
- newQuery1 = 'SELECT taskID FROM `TempTaskTable` ORDER BY taskID DESC LIMIT 1';
- successful1 = self.cur.execute(newQuery1)
- record = self.cur.fetchone()
-
- columns = list()
- for entry in record:
- columns.append(str(entry))
-
- columns.append(str(taskNo))
- columns.append(str(fromDevice))
- columns.append(str(toDevice))
- self.tasksList.append(columns)
-
- return 1
-
- if debugMode == 1:
- print output
-
- except MySQLdb.Error, e:
- error = str(e)
- if debugMode == 1:
- print str(e)
- if error[1:5] == '1062':
- return 2 #duplicate entry for the key
- return 3
- else:
- return 0
-
-
- def searchTaskList(self, fromDevice, toDevice):
- if self.connectionCreated == 1:
- for item in self.tasksList:
- taskID = item[0]
- taskNo = item[1]
- callFrom = item[2]
- callTo = item [3]
- if callFrom == fromDevice and callTo == toDevice:
- return 1 #that task was found
- return 2 #that task wasn't found
- else:
- return 0
diff --git a/For Weekly Test/30-07-2011/dbClass.pyc b/For Weekly Test/30-07-2011/dbClass.pyc
deleted file mode 100644
index d51d30e..0000000
--- a/For Weekly Test/30-07-2011/dbClass.pyc
+++ /dev/null
Binary files differ
diff --git a/For Weekly Test/30-07-2011/sipHandler.log b/For Weekly Test/30-07-2011/sipHandler.log
deleted file mode 100644
index 791ab71..0000000
--- a/For Weekly Test/30-07-2011/sipHandler.log
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-------------------STARTED THE LOGGING 2011-07-25 17:57:47.509760 ------------------
-On: 2011-07-25 17:57:47.522766 Event: try to Connect to Controller
-On: 2011-07-25 17:57:50.343605 Event: Beeing SIP
-On: 2011-07-25 17:57:50.343770 Event: init state
-On: 2011-07-25 17:57:50.343852 Event: Register Account to SIP server
-On: 2011-07-25 17:57:50.344370 Event: 100
-On: 2011-07-25 17:57:50.344446 Event: Caller Handler Ready
-On: 2011-07-25 17:57:53.351950 Event: CALL START
-On: 2011-07-25 17:57:53.352014 Event: Make a call to: 076120397897
-
-
-------------------STARTED THE LOGGING 2011-07-25 17:57:50.505922 ------------------
-On: 2011-07-25 17:57:50.517415 Event: try to Connect to Controller
-On: 2011-07-25 17:57:53.350822 Event: Beeing University SIP
-On: 2011-07-25 17:57:53.350960 Event: init state
-On: 2011-07-25 17:57:53.351018 Event: Register Account to SIP server
-On: 2011-07-25 17:57:53.351557 Event: 100
-On: 2011-07-25 17:57:53.351633 Event: Receiver Handler Ready
-
-
-------------------STARTED THE LOGGING 2011-07-25 17:59:44.765028 ------------------
-On: 2011-07-25 17:59:44.778015 Event: try to Connect to Controller
-On: 2011-07-25 17:59:47.601914 Event: Beeing University SIP
-On: 2011-07-25 17:59:47.602094 Event: init state
-On: 2011-07-25 17:59:47.602164 Event: Register Account to SIP server
-On: 2011-07-25 17:59:47.602681 Event: 100
-On: 2011-07-25 17:59:47.602758 Event: Receiver Handler Ready
-
-
-------------------STARTED THE LOGGING 2011-07-25 17:59:41.779127 ------------------
-On: 2011-07-25 17:59:41.793337 Event: try to Connect to Controller
-On: 2011-07-25 17:59:44.595237 Event: Beeing SIP
-On: 2011-07-25 17:59:44.595365 Event: init state
-On: 2011-07-25 17:59:44.595429 Event: Register Account to SIP server
-On: 2011-07-25 17:59:44.595945 Event: 100
-On: 2011-07-25 17:59:44.596022 Event: Caller Handler Ready
-On: 2011-07-25 17:59:47.603081 Event: CALL START
-On: 2011-07-25 17:59:47.603134 Event: Make a call to: 076120397897
-
-
-------------------STARTED THE LOGGING 2011-07-25 18:00:03.241267 ------------------
-On: 2011-07-25 18:00:03.252248 Event: try to Connect to Controller
-
-
-------------------STARTED THE LOGGING 2011-07-25 18:02:42.276369 ------------------
-On: 2011-07-25 18:02:42.286340 Event: try to Connect to Controller
-On: 2011-07-25 18:02:45.125394 Event: Beeing SIP
-On: 2011-07-25 18:02:45.125556 Event: init state
-On: 2011-07-25 18:02:45.125618 Event: Register Account to SIP server
-On: 2011-07-25 18:02:45.126161 Event: 100
-On: 2011-07-25 18:02:45.126236 Event: Caller Handler Ready
-On: 2011-07-25 18:02:48.135874 Event: CALL START
-On: 2011-07-25 18:02:48.135942 Event: Make a call to: 076120397897
-
-
-------------------STARTED THE LOGGING 2011-07-25 18:02:45.295371 ------------------
-On: 2011-07-25 18:02:45.305258 Event: try to Connect to Controller
-On: 2011-07-25 18:02:48.133570 Event: Beeing University SIP
-On: 2011-07-25 18:02:48.133713 Event: init state
-On: 2011-07-25 18:02:48.133772 Event: Register Account to SIP server
-On: 2011-07-25 18:02:48.134299 Event: 100
-On: 2011-07-25 18:02:48.134371 Event: Receiver Handler Ready
-
-
-------------------STARTED THE LOGGING 2011-07-25 18:04:51.427991 ------------------
-On: 2011-07-25 18:04:51.439521 Event: try to Connect to Controller
-On: 2011-07-25 18:04:54.266406 Event: Beeing SIP
-On: 2011-07-25 18:04:54.266591 Event: init state
-On: 2011-07-25 18:04:54.266679 Event: Register Account to SIP server
-On: 2011-07-25 18:04:54.267218 Event: 100
-On: 2011-07-25 18:04:54.267313 Event: Caller Handler Ready
-On: 2011-07-25 18:04:57.276583 Event: CALL START
-On: 2011-07-25 18:04:57.276623 Event: Make a call to: 076145875681
-On: 2011-07-25 18:05:01.503218 Event: Call Connecting
-On: 2011-07-25 18:05:01.503291 Event: 200
-On: 2011-07-25 18:05:01.504517 Event: Terminate
-On: 2011-07-25 18:05:01.504576 Event: Goodbye
-
-
-------------------STARTED THE LOGGING 2011-07-25 18:04:54.429321 ------------------
-On: 2011-07-25 18:04:54.439093 Event: try to Connect to Controller
-On: 2011-07-25 18:04:57.274706 Event: Beeing Landline
-On: 2011-07-25 18:04:57.274764 Event: init state
-On: 2011-07-25 18:04:57.274781 Event: Register Account to SIP server
-On: 2011-07-25 18:04:57.276195 Event: 100
-On: 2011-07-25 18:04:57.276296 Event: Receiver Handler Ready
-On: 2011-07-25 18:05:00.242406 Event: {Call "anonymous" <sip:anonymous@sipgate.de>}
-On: 2011-07-25 18:05:00.743816 Event: Call Connecting
-On: 2011-07-25 18:05:00.743886 Event: 200
-On: 2011-07-25 18:05:00.744082 Event: Answer call
-On: 2011-07-25 18:05:01.244752 Event: Hangup call
-On: 2011-07-25 18:05:01.245120 Event: CALL OK
-On: 2011-07-25 18:05:01.296246 Event: Call Disconnected
-On: 2011-07-25 18:05:01.503947 Event: Terminate
-On: 2011-07-25 18:05:01.504015 Event: Goodbye
diff --git a/For Weekly Test/30-07-2011/sipHandler.py b/For Weekly Test/30-07-2011/sipHandler.py
deleted file mode 100644
index 9144856..0000000
--- a/For Weekly Test/30-07-2011/sipHandler.py
+++ /dev/null
@@ -1,201 +0,0 @@
-import sys
-import string
-import pjsua as pj
-import ServerClass
-import LogFileClass
-
-from time import sleep
-
-def log_cb(level, str, len):
- print "--------starting Handler--------"
-
-# Receive events from incoming Call
-class Account(pj.AccountCallback):
-
- def on_incoming_call(self, call):
- global current_call
-
- current_call = call
- call_cb = Calling(current_call)
- current_call.set_callback(call_cb)
-
- logger.logEvent(current_call)
- sleep(0.5)
-
- call.answer(200)
- logger.logEvent("Answer call")
- sleep(0.5)
-
- if current_call <> None:
- logger.logEvent("Hangup call")
- call.hangup()
-
- logger.logEvent('CALL OK')
-
-class Calling(pj.CallCallback):
-
- def __init__(self, call=None):
- pj.CallCallback.__init__(self, call)
-
- def on_state(self):
- global current_call
-
- if self.call.info().state <> pj.CallState.DISCONNECTED:
- if self.call.info().state_text == "CONNECTING":
- logger.logEvent("Call Connecting")
- logger.logEvent('200')
- server.sendData('CALL OK')
-
- if self.call.info().last_reason == "Busy Here":
- logger.logEvent('Number busy or Offline')
- server.sendData('CALL NOT OK')
- logger.logEvent('CALL NOT OK')
-
- if self.call.info().state == pj.CallState.DISCONNECTED:
- logger.logEvent('Call Disconnected')
- current_call = None
-
-
-def make_call(uri):
-
- try:
-
- cb=Calling()
- return acc.make_call(uri, cb)
-
- except pj.Error, e:
- print "408 " + str(e)
- logger.logEvent('408')
- return None
-
-global acc_cfg
-global handler
-global state
-
-handler = sys.argv[1]
-port = sys.argv[2]
-
-lib = pj.Lib()
-stop = False
-
-logger = LogFileClass.Logging('sipHandler.log')
-logger.logEvent('')
-
-while stop <> True:
-
- acc_cfg = None
-
- lib.init(log_cfg = pj.LogConfig(level=1, callback=log_cb))
- transport = lib.create_transport(pj.TransportType.UDP, pj.TransportConfig(0))
-
- lib.start()
- lib.set_null_snd_dev()
-
- server = ServerClass.ServerHandler(port)
- logger.logEvent('Connect to Controller')
- conn = server.openSocket()
-
- if server.receiveData(30) == 'HELLO HANDLER':
- server.sendData('HELLO CONTROLLER')
-
- message = server.receiveData(30)
-
- if message == 'RECEIVER':
- state = 'RECEIVER'
-
- elif message[0:6] == 'CALLER':
- state = 'CALLER'
- num = message[7:]
-
- if handler == 'sip':
- logger.logEvent('Beeing SIP')
- acc_cfg = pj.AccountConfig("132.230.4.8","mpselftest1","1mpselftest")
-
- elif handler == 'landline':
- logger.logEvent('Beeing Landline')
- acc_cfg = pj.AccountConfig("sipgate.de","1289459","MMW9AX")
-
- elif handler == 'unisip':
- logger.logEvent('Beeing University SIP')
- acc_cfg = pj.AccountConfig("132.230.252.228", "4976120397897", "hB8M3WyFt61C")
-
- else:
- logger.logEvent('Unknown Message')
- server.sendData('Unknown Message')
- server.closeConnection()
- sys.exit(1)
-
- try:
-
- logger.logEvent('Register Account to SIP server')
- acc = lib.create_account(acc_cfg, cb=Account())
-
-
- if acc.info().reg_status < 700:
-
- if state =='RECEIVER':
- logger.logEvent(acc.info().reg_status)
- server.sendData('RECEIVER READY')
- logger.logEvent('Receiver Handler Ready')
- print "1"
-
- while 1:
-
- data = server.receiveData(3)
- print "here"
- if data == 'RECEIVE START':
- logger.logEvent(data)
-
- elif data == "TERMINATE CONNECTION":
- logger.logEvent(data)
- stop = True
- break
-
- elif state =='CALLER':
- logger.logEvent(acc.info().reg_status)
- server.sendData('CALLER READY')
- logger.logEvent('Caller Handler Ready')
-
- while 1:
-
- data = server.receiveData(3)
- print "here2"
- if event == "CALL START":
- if num <> "":
-
- logger.logEvent(event)
- print "here3"
- sleep(5) # waiting 5 second before call to waiting unisip get authentification from server
- logger.logEvent('Make a call to: ' + num)
- number = "sip:"+num+"@132.230.4.8"
- make_call(number)
- else:
- logger.logEvent('No number to call')
- logger.logEvent('CALL NOT OK')
-
- if data == "TERMINATE CONNECTION":
- stop = True
- logger.logEvent('Terminate')
- break
-
- else:
- logger.logEvent('Unknow Message')
- server.sendData('Unknow Message')
- server.closeConnection()
- sys.exit(1)
-
- else:
- logger.logEvent("488 Not Acceptable Here")
- lib.destroy()
-
- except ValueError:
- print "401 Unauthorized " + str(e)
- logger.logEvent("401 Unauthorized ")
-
-logger.logEvent("Goodbye")
-acc.delete()
-lib.destroy()
-server.closeConnection()
-lib = None
-acc = None
-
diff --git a/For Weekly Test/30-07-2011/sipHandler3.py b/For Weekly Test/30-07-2011/sipHandler3.py
deleted file mode 100644
index 511bf43..0000000
--- a/For Weekly Test/30-07-2011/sipHandler3.py
+++ /dev/null
@@ -1,139 +0,0 @@
-import sys
-import string
-import pjsua as pj
-import ServerClass
-import LogFileClass
-import AccClass
-import CallClass
-
-from time import sleep
-
-def log_cb(level, str, len):
- print "--------starting Handler--------"
-
-# Receive events from incoming Call
-
-
-def make_call(uri):
-
- try:
-
- cb=CallClass.Calling()
- return acc.make_call(uri, cb)
-
- except pj.Error, e:
- print "408 " + str(e)
- logger.logEvent('408')
- return None
-
-def greeting():
- global server
- global status
- server = None
- status = None
-
- server = ServerClass.ServerHandler(50009)
- logger.logEvent('Connect to Controller')
- conn = server.openSocket()
- server.sendData('RECEIVER READY')
-
-def initHandler():
- global acc_cfg
- global handler
-
- handler = 'sip' #sys.argv[1]
- #port = sys.argv[2]
-
- if handler == 'sip':
- logger.logEvent('Beeing SIP')
- acc_cfg = pj.AccountConfig("132.230.4.8","mpselftest1","1mpselftest")
-
- elif handler == 'landline':
- logger.logEvent('Beeing Landline')
- acc_cfg = pj.AccountConfig("sipgate.de","1289459","MMW9AX")
-
- elif handler == 'unisip':
- logger.logEvent('Beeing University SIP')
- acc_cfg = pj.AccountConfig("132.230.252.228", "4976120397897", "hB8M3WyFt61C")
-
- else:
- logger.logEvent('Unknown Message')
- server.sendData('Unknown Message')
- server.closeConnection()
- sys.exit(1)
-
-
-
-lib = pj.Lib()
-stop = False
-
-logger = LogFileClass.Logging('sipHandler.log')
-logger.logEvent('')
-
-while stop <> True:
-
- acc_cfg = None
-
- lib.init(log_cfg = pj.LogConfig(level=1, callback=log_cb))
- transport = lib.create_transport(pj.TransportType.UDP, pj.TransportConfig(0))
-
- lib.start()
- lib.set_null_snd_dev()
-
- status = 'NOT OK'
- #greeting()
- initHandler()
- state = 'RECEIVER'
-
- try:
- #initState()
- logger.logEvent('Register Account to SIP server')
- cb1=AccClass.Account()
- acc = lib.create_account(acc_cfg, cb=cb1)
-
- print cb1
-
- if acc.info().reg_status < 700:
-
- if state =='RECEIVER':
- logger.logEvent(acc.info().reg_status)
- #server.sendData('RECEIVER READY')
- logger.logEvent('Receiver Handler Ready')
-
- while 1:
-
- #data = server.receiveData(3)
- data = 'hjk'
- print cb1.result()
- sleep(2)
- if cb1.status <> None:
- print cb1.statuss
- if data == 'RECEIVER START':
- logger.logEvent(data)
-
- if data == 'TERMINATE CONNECTION':
- logger.logEvent('Terminate')
- stop = True
- break
-
- else:
- logger.logEvent('Unknow Message')
- #server.sendData('Unknow Message')
- #server.closeConnection()
- sys.exit(1)
-
- else:
- logger.logEvent("488 Not Acceptable Here")
- lib.destroy()
-
- except ValueError:
- print "401 Unauthorized " + str(e)
- logger.logEvent("401 Unauthorized ")
-
-logger.logEvent("Goodbye")
-acc.delete()
-lib.destroy()
-#server.closeConnection()
-lib = None
-acc = None
-
diff --git a/For Weekly Test/30-07-2011/test.py b/For Weekly Test/30-07-2011/test.py
deleted file mode 100644
index 8a875a4..0000000
--- a/For Weekly Test/30-07-2011/test.py
+++ /dev/null
@@ -1,7 +0,0 @@
-class MyClass(object):
- def __init__(self):
- print "never called in this case"
-
-
-obj = MyClass()
-print obj
diff --git a/For Weekly Test/30-07-2011/test2.py b/For Weekly Test/30-07-2011/test2.py
deleted file mode 100644
index 414e491..0000000
--- a/For Weekly Test/30-07-2011/test2.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import sys
-import os
-import subprocess
-import test
-
-
-print "hallo"
diff --git a/For Weekly Test/30-07-2011/test3.py b/For Weekly Test/30-07-2011/test3.py
deleted file mode 100644
index bd759ca..0000000
--- a/For Weekly Test/30-07-2011/test3.py
+++ /dev/null
@@ -1,31 +0,0 @@
-import sys
-import ClientClass
-import DbClass
-import ControllerClass
-import classCheck
-from time import sleep
-
-
-db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting')
-db.connectDB()
-dbStatus = db.connectDB()
-db.anyTasksToDo()
-if db.anyTasksToDo() == 1:
- templist = db.tasksList
- for item in templist:
- taskID = item[0]
- taskNo = item[1]
- callFrom = item[2]
- callTo = item[3]
-
- print "Test ID : " , taskID
- print "Caller : " , callFrom
- print "Receiver : " , callTo
- #templist.remove(item)
- #print item
- #db.deleteTempTask(taskID)
- if callTo == 'sip':
- db.insertTaskIn2(callTo,callFrom,taskNo)
-
-else:
- print "No job at all"
diff --git a/For Weekly Test/30-07-2011/test4.py b/For Weekly Test/30-07-2011/test4.py
deleted file mode 100644
index f12163d..0000000
--- a/For Weekly Test/30-07-2011/test4.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import dbClass
-user = 'root'
-passw = 'randompasswordSQL'
-host = 'localhost'
-dbname = 'gsmselftesting'
-
-x = dbClass.DBMySQLConnection(user, passw, host, dbname)
-print "connected to the DB ", x.connectDB()
-print "do i have anything to do", x.anyTasksToDo()
-temp = x.tasksList[:]
-for index in range(len(temp)):
- item = temp[index]
- taskID = item[0]
- if item[0] == '17' or item[0] =='18' or item[0]=='19':
- print "delete a task from temp table", x.deleteTempTask(taskID)
- x.tasksList.remove(item)
-
-for item in x.tasksList[:]:
- taskID = item[0]
- taskNo = item[1]
- callFrom = item[2]
- callTo = item[3]
- print "call from to ", taskID , callFrom , callTo, taskNo
-print "close connection to the DB", x.closeDBConn()
-
-del x
diff --git a/For Weekly Test/30-07-2011/test5.py b/For Weekly Test/30-07-2011/test5.py
deleted file mode 100644
index 3f11e79..0000000
--- a/For Weekly Test/30-07-2011/test5.py
+++ /dev/null
@@ -1,6 +0,0 @@
-lista = ['a', 'b', 'c', 'd']
-templist = lista[:]
-for item in templist:
- print item
- lista.remove(item)
-
diff --git a/For Weekly Test/30-07-2011/test6.py b/For Weekly Test/30-07-2011/test6.py
deleted file mode 100644
index fa17798..0000000
--- a/For Weekly Test/30-07-2011/test6.py
+++ /dev/null
@@ -1,35 +0,0 @@
-import sys
-import pjsua as pj
-import os
-import re
-import time
-import MySQLdb
-import subprocess
-from time import sleep
-from datetime import datetime
-
-
-try:
- mydb = MySQLdb.connect('localhost', 'root', 'randompasswordSQL','gsmselftesting');
- db=mydb.cursor()
-except MySQLdb.Error, e:
- print "Error %d: %s" % (e.args[0],e.args[1])
- sys.exit(1)
-
-db.execute("SELECT * FROM TempTaskTable")
-rows = db.fetchall()
-
-global tasksList
-tasksList = list()
-print rows
-for row in rows:
- columns = list()
- print row
- for rowe in rows:
- columns.append(str(row))
- print tasksList.append(columns)
- #print taskList
-# print "%s, %s" % (row[0], row[1])
-# print "Number of rows returned: %d" % db.rowcount
-
-
diff --git a/For Weekly Test/DBProblem/test3.py b/For Weekly Test/DBProblem/test3.py
index bd759ca..d600124 100644
--- a/For Weekly Test/DBProblem/test3.py
+++ b/For Weekly Test/DBProblem/test3.py
@@ -1,14 +1,18 @@
import sys
-import ClientClass
+#import ClientClass
import DbClass
-import ControllerClass
-import classCheck
+#import ControllerClass
+#import classCheck
from time import sleep
db = DbClass.DBMySQLConnection('root', 'randompasswordSQL', 'localhost', 'gsmselftesting')
db.connectDB()
dbStatus = db.connectDB()
+print 'i am inserting into the table something', db.insertTaskIn2('gsm4','sip8',2)
+print 'i am inserting into the table something', db.insertTaskIn2('gsm4','sip8',2)
+print 'i am inserting into the table something', db.insertTaskIn2('gsm4','sip8',2)
+print 'i am inserting into the table something', db.insertTaskIn2('gsm4','sip8',2)
db.anyTasksToDo()
if db.anyTasksToDo() == 1:
templist = db.tasksList
@@ -21,11 +25,12 @@ if db.anyTasksToDo() == 1:
print "Test ID : " , taskID
print "Caller : " , callFrom
print "Receiver : " , callTo
- #templist.remove(item)
+ templist.remove(item)
#print item
- #db.deleteTempTask(taskID)
+ db.deleteTempTask(taskID)
if callTo == 'sip':
db.insertTaskIn2(callTo,callFrom,taskNo)
+
else:
print "No job at all"