summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--For Weekly Test/20-07-2011/Controller.py2
-rw-r--r--For Weekly Test/20-07-2011/classClient.py8
-rw-r--r--For Weekly Test/20-07-2011/classClient.pycbin2884 -> 2791 bytes
-rw-r--r--For Weekly Test/20-07-2011/classController.py8
-rw-r--r--For Weekly Test/20-07-2011/classController.pycbin5346 -> 5353 bytes
-rw-r--r--For Weekly Test/20-07-2011/sipCall.py21
-rw-r--r--Handler/gsmcall_.py95
-rw-r--r--Handler/gsmincom_.py135
8 files changed, 13 insertions, 256 deletions
diff --git a/For Weekly Test/20-07-2011/Controller.py b/For Weekly Test/20-07-2011/Controller.py
index a4e64f1..5d4367c 100644
--- a/For Weekly Test/20-07-2011/Controller.py
+++ b/For Weekly Test/20-07-2011/Controller.py
@@ -100,6 +100,8 @@ if dbStatus == 1:
else:
x = classController.test(sipCall, "localhost", "Box1", "132.0.0.2","404")
x.FuncTest()
+ print ""
+ sleep(10)
db.addResult(taskID, testResult)
if repeatTest == "true":
#select temporary table, if there are have test from gsmrz to sip then skip
diff --git a/For Weekly Test/20-07-2011/classClient.py b/For Weekly Test/20-07-2011/classClient.py
index 625e48e..ce02d19 100644
--- a/For Weekly Test/20-07-2011/classClient.py
+++ b/For Weekly Test/20-07-2011/classClient.py
@@ -64,11 +64,3 @@ class Connection:
else:
return 0
-#MAIN PART
-x = Connection('localhost',50008)
-print x.connect()
-x.sendData('hello server :)')
-print x.receiveData()
-x.sendData('I send you another message')
-x.closeConnection()
-
diff --git a/For Weekly Test/20-07-2011/classClient.pyc b/For Weekly Test/20-07-2011/classClient.pyc
index 85f1aa7..9255493 100644
--- a/For Weekly Test/20-07-2011/classClient.pyc
+++ b/For Weekly Test/20-07-2011/classClient.pyc
Binary files differ
diff --git a/For Weekly Test/20-07-2011/classController.py b/For Weekly Test/20-07-2011/classController.py
index e26250d..f39aafb 100644
--- a/For Weekly Test/20-07-2011/classController.py
+++ b/For Weekly Test/20-07-2011/classController.py
@@ -161,9 +161,7 @@ class test:
print "Receiver handler : Ready"
print ""
- x.sendData("start")#send message to handler to start the call
- sleep(0.5)
- x.sendData(self.destNo)
+ x.sendData("start|"+self.destNo)#send message to handler to start the call
x.closeConnection()
x.connect()
@@ -194,9 +192,7 @@ class test:
#if failed, tell everybody to try one more time
if resultOrig == 486 or resultDest == 486:
- x.sendData("start")
- sleep(0.5)
- x.sendData(self.destNo)
+ x.sendData("start|"+self.destNo)
x.closeConnection()
x.connect()
diff --git a/For Weekly Test/20-07-2011/classController.pyc b/For Weekly Test/20-07-2011/classController.pyc
index 6abfa92..3104b8a 100644
--- a/For Weekly Test/20-07-2011/classController.pyc
+++ b/For Weekly Test/20-07-2011/classController.pyc
Binary files differ
diff --git a/For Weekly Test/20-07-2011/sipCall.py b/For Weekly Test/20-07-2011/sipCall.py
index f41756d..a863ce8 100644
--- a/For Weekly Test/20-07-2011/sipCall.py
+++ b/For Weekly Test/20-07-2011/sipCall.py
@@ -24,7 +24,6 @@ class MyCallCallback(pj.CallCallback):
else:
sleep(0.5)
-
if self.call.info().last_reason == "Busy Here":
server.sendData('486')
@@ -73,17 +72,15 @@ while stop <> True:
while 1:
try:
data = server.receiveData()
-
- if data == "start":
-
- while 1:
-
- num = server.receiveData()
- if num <> "":
-
- number = "sip:"+num+"@132.230.4.8"
- current_call = make_call(number)
- break
+ event = data[0:5]
+ num = data[6:]
+ if event == "start" and num <> "":
+
+ server.closeConnection()
+ tried = server.openSocket()
+
+ number = "sip:"+num+"@132.230.4.8"
+ current_call = make_call(number)
if data == "487":
stop = True
diff --git a/Handler/gsmcall_.py b/Handler/gsmcall_.py
deleted file mode 100644
index 1e2a010..0000000
--- a/Handler/gsmcall_.py
+++ /dev/null
@@ -1,95 +0,0 @@
-import sys
-import pjsua as pj
-import socket
-import time
-import MySQLdb
-import subprocess
-
-import classServer
-
-from time import sleep
-from datetime import datetime
-import string
-
-
-stop ="false"
-
-LOG_LEVEL=2
-current_call = None
-success = ""
-
-
-
-while stop <> "true":
-
-
- try:
- global ser
- portAddress = '/dev/ttyUSB1'
- portName = portAddress[-4:]
- portExist = os.popen('dmesg | grep ' + portName).read()
-
- if portExist == '':
- print 'The serial port does not exist'
- sys.exit()
-
- ser = Serial(
- port=portAddress,
- baudrate=19200,
- bytesize=EIGHTBITS,
- parity=PARITY_NONE,
- stopbits=STOPBITS_ONE)
- ser.open()
-
-
- server = classServer.ServerHandler(50097)
- tried = server.openSocket()
-
- if server.error != 'No error':
- print server.error
- if server.error == '[Errno 98] Address already in use':
- print 'one should try to kill the port'
- print server.killPort()
- server.closeConection()
-
-
- server.sendData('I am ready')#send message to controller
- print "here:", server.connected
-
- while 1:
- try:
- data = server.receiveData() # waiting mode, until receiver start message or terminate message
-
- if data == "start": # if receiver start message, handler start to call destination
-
- while 1:
-
- num = server.receiveData() # waiting destination number
- if num <> "":
-
- callBackNumber=
- ser.write('ATD' + num + ';\r')
- sleep(5)
- server.sendData('success')
- ser.write('AT+CHUP\r')
- break
-
- if data == "terminated": # will terminate the handler if controller send terminate message
- stop = "true"
- break
-
- except ValueError:
- print "error when sending message"
- server.closeConnection()
- del server
- ser.close()
-
- server.closeConnection()
- del server
- ser.close()
-
- except ValueError:
- print "Exception: " + str(e)
-
-print "Goodbye"
-sleep(3)
diff --git a/Handler/gsmincom_.py b/Handler/gsmincom_.py
deleted file mode 100644
index 0c0d5a3..0000000
--- a/Handler/gsmincom_.py
+++ /dev/null
@@ -1,135 +0,0 @@
-import sys
-import pjsua as pj
-import socket
-import time
-import os
-import string
-import classServer
-
-from time import sleep
-from datetime import datetime
-
-stop ="false"
-
-
-success = ""
-
-
-
-
-try:
-
- global ser
- portAddress = '/dev/ttyACM0'
- portName = portAddress[-4:]
- portExist = os.popen('dmesg | grep ' + portName).read()
-
-
- ser = Serial(
- port=portAddress,
- baudrate=19200,
- bytesize=EIGHTBITS,
- parity=PARITY_NONE,
- stopbits=STOPBITS_ONE)
- ser.open()
-
- server = classServer.ServerHandler(50105)
- tried = server.openSocket()
-
- if server.error != 'No error':
- print server.error
- if server.error == '[Errno 98] Address already in use':
- print 'one should try to kill the port'
- print server.killPort()
- server.closeConection()
-
-
- print "here:", server.connected
-
-
- if server.connected == 1:
-
- server.sendData('I am ready')
-
- while stop <> "true":
-
- data = server.receiveData()
- if data == "terminated":
- print "I will", data
- break
-
- buffer = buffer + ser.read(ser.inWaiting())
- if '\n' in buffer:
- lines = buffer.split('\n')
- last_received = lines.pop(0)
-
- buffer = '\n'.join(lines)
-
- last_received=last_received.split('\n')
- line = last_received[0].replace(chr(13), '')
-
-
- if len(line) > 0:
-
- if line=='RING':
- if pickUp == 0:
-
- print "Somebody calling"
- sleep(1)
- ser.write('ATA\r')
-
- sleep(1)
- ser.write('AT+CSQ\r')
-
- sleep(2)
- ser.write('AT+CLCC\r')
- line=''
-
- if line[0:5] == '+CSQ:':
-
- space = int(string.find(line,' '))+1
- coma = int(string.find(line,','))
- signalStr = (int(line[space:coma])*2)-113
-
- line=''
-
- if line[0:6]=='+CLCC:':
-
- pickUp = 1
-
- print "I will hangup the call"
- sleep(5)
-
- ser.write('AT+CHUP\r')
- pickUp = 0
-
- quotation1 = int(string.find(line,'"'))+1
- lineTemp = line[quotation1:]
-
- quotation2 = int(string.find(lineTemp,'"'))
- numberOfCaller = line[quotation1:quotation1+quotation2]
-
- server.sendData('I got call from' +numberOfCaller)
- print "caller number", numberOfCaller
- sleep(1)
- server.sendData('success')
- sleep (3)
- ser.close()
-
-
- server.closeConnection()
- del server
- else:
-
- print "not connected"
-
- del server
-
- ser.close()
-except ValueError:
- print "Exception: " + str(e)
- server.closeConnection()
- del server
-
-print "GOODBYE"
-sleep(5)