summaryrefslogtreecommitdiffstats
path: root/Handler
diff options
context:
space:
mode:
authortriatmoko2011-07-18 16:15:35 +0200
committertriatmoko2011-07-18 16:15:35 +0200
commit7b2c90066692566044ac80ec421e15a1aee7ab25 (patch)
treeebe71e8809059d40b1d02569514ad173572bfb72 /Handler
parentJust two scripts that test the GSM2GSM system! (diff)
downloadgsm-selftest-7b2c90066692566044ac80ec421e15a1aee7ab25.tar.gz
gsm-selftest-7b2c90066692566044ac80ec421e15a1aee7ab25.tar.xz
gsm-selftest-7b2c90066692566044ac80ec421e15a1aee7ab25.zip
fixed bugs for calling part on sip.
Diffstat (limited to 'Handler')
-rw-r--r--Handler/sipCall.py29
-rw-r--r--Handler/sipReceiver.py10
2 files changed, 17 insertions, 22 deletions
diff --git a/Handler/sipCall.py b/Handler/sipCall.py
index 3f7b2ca..f41756d 100644
--- a/Handler/sipCall.py
+++ b/Handler/sipCall.py
@@ -4,8 +4,6 @@ import classServer
from time import sleep
-
-# Logging
def log_cb(level, str, len):
print str, "SIP log"
@@ -15,26 +13,23 @@ class MyCallCallback(pj.CallCallback):
def on_state(self):
global current_call
- if self.call.info().state <> pj.CallState.DISCONNECTED:
- if self.call.info().state_text == "CONNECTING":
- print "CONNECTING CALL"
-
- print "CALL CONFIRMED and ESTABLISH", self.call.info().state_text
- sleep(1)
- current_call.hangup()
+ if self.call.info().state <> pj.CallState.DISCONNECTED:
+ if self.call.info().state_text == "CONNECTING":
+ print "CALL : ", self.call.info().state_text
+ sleep(1)
+ if self.call.info().state <> pj.CallState.DISCONNECTED:
+ current_call.hangup()
- server.sendData('200')
- else:
- sleep(0.5)
+ server.sendData('200')
+ else:
+ sleep(0.5)
-
- if self.call.info().last_reason <> "":
if self.call.info().last_reason == "Busy Here":
server.sendData('486')
- if self.call.info().state == pj.CallState.DISCONNECTED:
- current_call = None
+ if self.call.info().state == pj.CallState.DISCONNECTED:
+ current_call = None
def make_call(uri):
@@ -69,8 +64,6 @@ while stop <> True:
try:
acc_cfg = pj.AccountConfig("132.230.4.8","mpselftest1","1mpselftest")
acc = lib.create_account(acc_cfg, cb=pj.AccountCallback())
-
- sleep(5)
if acc.info().reg_status < 700:
diff --git a/Handler/sipReceiver.py b/Handler/sipReceiver.py
index add5281..b58990b 100644
--- a/Handler/sipReceiver.py
+++ b/Handler/sipReceiver.py
@@ -12,20 +12,22 @@ def log_cb(level, str, len):
class MyAccountCallback(pj.AccountCallback):
def on_incoming_call(self, call):
- global current_call
+
+ current_call = call
sleep(0.5)
call.answer(200)
- sleep(1.5)
- call.hangup()
+ sleep(0.5)
+
+ if current_call <> None:
+ call.hangup()
server.sendData('200')
lib = pj.Lib()
stop = False
-current_call = None
try: