From 2cc2c0e3377f4745afa9f0948d1aec95ca184781 Mon Sep 17 00:00:00 2001 From: triatmoko Date: Tue, 19 Jul 2011 14:18:07 +0200 Subject: modified all SIP part (landline, sip, university sip) to work with Main Controller. --- For Weekly Test/20-07-2011/classController.py | 40 ++++++++++----------------- 1 file changed, 14 insertions(+), 26 deletions(-) (limited to 'For Weekly Test/20-07-2011/classController.py') diff --git a/For Weekly Test/20-07-2011/classController.py b/For Weekly Test/20-07-2011/classController.py index a9c5f82..b7e3bff 100644 --- a/For Weekly Test/20-07-2011/classController.py +++ b/For Weekly Test/20-07-2011/classController.py @@ -49,8 +49,8 @@ class test: print "" print "Connecting to Caller handler" - print "Caller handler status :", x.connect() - x.sendData('hello server please wakeup the handler and be caller') + x.connect() + x.sendData('be caller') else: # open SIP caller handler @@ -61,10 +61,7 @@ class test: sleep(5) if self.orig=="sipCall.py": - self.portOrig = 50097 - - if self.orig=="rz1Call.py": - self.portOrig = 50098 + self.portOrig = 50097 if self.orig == "landlineCall.py": self.portOrig = 50099 @@ -75,12 +72,13 @@ class test: x = classClient.Connection(self.origAdd,self.portOrig) print "" - print "Connecting to Caller handler", self.origAdd,self.portOrig - print "Caller handler status:", x.connect() + print "Connecting to Caller handler" + x.connect() # wait respond from origin handler signal.signal(signal.SIGALRM, timeout_handler) signal.alarm(60) + while 1: try: origHandler = x.receiveData(0) @@ -106,8 +104,8 @@ class test: y = classClient.Connection(self.destAdd, self.portDest) print "Connecting to Receiver handler" - print "Receiver handler status: ", y.connect() - y.sendData('hello server please wakeup the handler and be receiver') + y.connect() + y.sendData('receiver') else: command="--command=python " +self.dest @@ -118,22 +116,15 @@ class test: if self.dest=="SIPReceiver.py": self.portDest = 50104 - if self.dest=="gsmincom_.py": - self.portDest = 50105 - if self.dest == "landlineReceiver.py": self.portDest = 50106 if self.dest == "localsipReceiver.py": self.portDest = 50107 - - #mean external GSM - #print "not define yet" - #portDest = 50108 y = classClient.Connection(self.destAdd, self.portDest) print "Connecting to Receiver handler" - print "Receiver handler status:", y.connect() + y.connect() signal.signal(signal.SIGALRM, timeout_handler) @@ -152,14 +143,14 @@ class test: if destHandler == "ready": print "Receiver handler : Ready" - print "self.destNo" x.sendData("start|"+self.destNo)#send message to handler to start the call signal.signal(signal.SIGALRM, timeout_handler) - signal.alarm(1200) + signal.alarm(120) + print "" print "------------ Test Result ------------" print "" @@ -204,13 +195,13 @@ class test: if self.resultOrig == 486 or self.resultDest == 486: self.testResult = 486 - repeatTest = True + self.repeatTest = True print "Second test result origin: ", self.resultOrig print "Second test result Destination: ", self.resultDest else: self.testResult = 200 - return 200 + print "Second test result origin: ", self.resultOrig print "Second test result Destination: ", self.resultDest x.sendData('487') @@ -220,7 +211,7 @@ class test: self.testResult = 200 - print "Test Result origin: ", self.resultOrig + print "Test Result origin: ", self.resultOrig print "Test Result Destination: ", self.resultDest x.sendData('487') y.sendData('487') @@ -246,6 +237,3 @@ class test: testResult = 602 print "602 General Handler Error: Could not open Origin handler" - def testResult(self): - return 200 - -- cgit v1.2.3-55-g7522