我们已将服务器配置为实时监听呼叫。问题是通话结束后我们会收到响应。我们需要实时接听电话。
#!/bin/python
# To test the cdr realtime sending function
import string
from urllib.request import urlopen
import time
import socket
port = 5855;
def test():
server = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
address = ('172.16.1.179', int(port))
server.bind(address)
server.listen(10)
while 1:
s,addr = server.accept()
data = s.recv(2048)
print (data)
s.close()
test()