-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmltest.py
More file actions
61 lines (45 loc) · 1.53 KB
/
xmltest.py
File metadata and controls
61 lines (45 loc) · 1.53 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
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/python
connectString = "http://freeswitch:[email protected]:8080"
##########################
from xmlrpc.client import ServerProxy
import re
#########################
server = ServerProxy(connectString)
ServerStatus = server.freeswitch.api("status","")
ShowRegistrations = server.freeswitch.api("show","registrations").split("\n")
ShowChannels = server.freeswitch.api("show","channels").split("\n")
print (ServerStatus)
pTotal = re.compile('\d+ total.')
print ("Registration List =======")
for regStr in ShowRegistrations:
if regStr == '0 total.':
print ("No Registered Users")
break
elif regStr == '' or regStr[0:8] == 'reg_user':
continue
elif pTotal.match(regStr):
continue
regLine = regStr.split(',')
print (
"User: " + regLine[0] + "@" + regLine[1] + " " + regLine[7] +
" " + regLine[5] + ":" + regLine[6])
print ("\nChannel List ============")
for chanStr in ShowChannels:
if chanStr == '0 total.':
print("No Open Channels")
break
elif chanStr == '' or chanStr[0:4] == 'uuid':
continue
elif pTotal.match(chanStr):
continue
chanLine = chanStr.split(',')
print (
chanLine[2] + " UUID: " + chanLine[0] + " Direction: " +
chanLine[1])
print (
" " + chanLine[6] + " ( " + chanLine[7] + " ) Src IP: " +
chanLine[8] + " >> Dest " + chanLine[9] + " [Codec " +
chanLine[17] + "]")
print (
" Application: " + chanLine[10] +
" (" + chanLine[11] + ")")