-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathuSipB2Bua.py
More file actions
49 lines (44 loc) · 1.39 KB
/
uSipB2Bua.py
File metadata and controls
49 lines (44 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import uPySip.sipMachine
import sys
import utime
port = 5060
server = '192.168.1.1'
client1 = '192.168.1.113'
client2 = '192.168.1.119'
telId1 = '220'
telid2 = '225'
if sys.platform == 'linux':
client = client1
telId = telId1
else:
client = client2
telId = telid2
sipMachine = uPySip.sipMachine.SipMachine(user='relleum', pwd='jutkk7x1', telNr=telId,
userAgent="b2b.domain", userClient=client, proxyServer=server, proxyRegistrar=server)
loop = b'x00'
first = True
warte = False
while loop >= b'x00':
loop = sipMachine.loop()
if loop == sipMachine.RINGING:
if int(sipMachine.getTelNrB()) < 300:
sipMachine.acceptCall()
warte = False
elif sipMachine.IDLE == loop:
if first:
sipMachine.invite('222')
first = False
elif sipMachine.ON_CALL == loop:
if warte and utime.ticks_ms() % 5000 == 0:
sipMachine.play('/sd/warte.aLaw')
keyPressed = sipMachine.getKeyPressed()
if keyPressed != '':
if keyPressed == '0':
sipMachine.play('/sd/wilk.aLaw')
if keyPressed == '1':
sipMachine.play('/sd/info.aLaw')
if keyPressed == '2':
sipMachine.play('/sd/info.aLaw')
if keyPressed == '3':
sipMachine.play('/sd/warte.aLaw')
warte = True