summaryrefslogtreecommitdiffstats
path: root/notFinishedCode
diff options
context:
space:
mode:
authoraa1112011-07-15 18:06:40 +0200
committeraa1112011-07-15 18:06:40 +0200
commit883f5e5f9d6ec643d14894d782d50f35f7f24882 (patch)
tree394c56911db7daa93119d9049859a42072781c3e /notFinishedCode
parentAdded a function that searches for a task inside the task list! (diff)
downloadgsm-selftest-883f5e5f9d6ec643d14894d782d50f35f7f24882.tar.gz
gsm-selftest-883f5e5f9d6ec643d14894d782d50f35f7f24882.tar.xz
gsm-selftest-883f5e5f9d6ec643d14894d782d50f35f7f24882.zip
moving files.
Diffstat (limited to 'notFinishedCode')
-rw-r--r--notFinishedCode/landlineCall.py149
1 files changed, 0 insertions, 149 deletions
diff --git a/notFinishedCode/landlineCall.py b/notFinishedCode/landlineCall.py
deleted file mode 100644
index 58ad851..0000000
--- a/notFinishedCode/landlineCall.py
+++ /dev/null
@@ -1,149 +0,0 @@
-import sys
-import pjsua as pj
-from time import sleep
-import string
-
-server = "sipgate.de"
-username = "1289459"
-password = "MMW9AX"
-number = "00497612034661455"
-
-LOG_LEVEL = 2
-current_call = None
-is486 = False
-isConfirmed = False
-isRinging = False
-isConnected = False
-TIMEOUT_LIMIT = 30
-userInput = ""
-
-# 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)
-
-# 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
- global isConfirmed
- global isConnected
- global isRinging
- global is486
-
- if self.call.info().state == pj.CallState.CALLING:
- print "CALLING..."
-
- if self.call.info().last_code == 486:
- is486 = True
-
- if self.call.info().state == pj.CallState.EARLY:
- isRinging = True
-
- if self.call.info().state == pj.CallState.CONFIRMED:
- isConfirmed = True
- isConnected = True
- isRinging = False
-
- if self.call.info().state == pj.CallState.DISCONNECTED:
- current_call = None
- isConnected = False
-
-
-def make_call(uri):
- try:
- print "Making call to", uri
- cb=MyCallCallback()
- return acc.make_call(uri, cb)
- except pj.Error, e:
- print "Exception: " + str(e)
- return None
-
-
-lib = pj.Lib()
-lib.init(log_cfg = pj.LogConfig(level=LOG_LEVEL, callback=log_cb))
-transport = lib.create_transport(pj.TransportType.UDP, pj.TransportConfig(0))
-lib.start()
-lib.set_null_snd_dev()
-
-try:
- acc_cfg = pj.AccountConfig(server,username,password)
- acc = lib.create_account(acc_cfg, cb=MyAccountCallback())
-
-except ValueError:
- print "Exception: " + str(e)
-
-print "You want to call then."
-
-
-while userInput <> "quit":
-
- timeCounterRinging = 0
- firstTimeRinging = True
-
- if acc.info().reg_status < 700:
- numberToCall = "sip:"+number+"@"+server
- current_call = make_call(numberToCall)
-
- while 1:
-
- if isRinging:
- sleep(1)
- timeCounterRinging = timeCounterRinging + 1
- if firstTimeRinging:
- print "RINGING..."
- firstTimeRinging = False
- if is486:
- print "THE NUMBER THAT YOU'VE DIALLED IS BUSY!!"
- isConfirmed = False
- isConnected = False
- isRinging = False
- is486 = False
- break
-
- if isConnected and isConfirmed:
- print "CALL SUCCESSFULLY ESTABLISHED!!"
- sleep(5)
- current_call.hangup()
- print "CALL SUCCESSFULLY TERMINATED!!"
- isConfirmed = False
- isConnected = False
- isRinging = False
- is486 = False
- break
-
- if timeCounterRinging == TIMEOUT_LIMIT and isRinging:
- current_call.hangup()
- print "THE NUMBER THAT YOU'VE DIALLED IS NOT ANSWERING!!"
- isConfirmed = False
- isConnected = False
- isRinging = False
- is486 = False
- break
-
- else:
- print "REGISTRATION ERROR!!!"
- lib.destroy()
- lib = None
- acc = None
-
- userInput = sys.stdin.readline().rstrip("\r\n")
-
-sleep(2)
-print "LOGGING OUT..."
-acc.delete()
-lib.destroy()
-lib = None
-acc = None
-print "LOGOUT WAS SUCCESSFULL!!"
-