所以这是我为我的伙伴公司客户支持编写的脚本。基本上,它所做的是使用脚本中的 IP 电话进行呼叫,它可以工作,但有问题。这是代码:
import urllib, urllib2, sys
num = sys.argv[1]
print 'Calling'
phones = [
'http://phone1/index.htm',
'http://phone2/index.htm',
'https://phone3/index.htm',
'https://phone4/index.htm',
'https://phone5/index.htm'
]
data = urllib.urlencode({"NUMBER":num, "DIAL":"Dial", "active_line":1})
while 1:
for phone in phones:
try:
urllib2.urlopen(phone,data) # make call
urllib2.urlopen(phone+"?dialeddel=0") # clear logs
except: pass
第一个问题是它只使用电话一...现在它被设置为不断调用,出于调试目的,我似乎只接到电话一...第二个问题是脚本不会终止。ctrl+c 不起作用...终止它的唯一方法(据我所知)是结束 ssh 会话。现在,我是 python 新手,所以这两个可能只是愚蠢的错误,所以希望有人能提供帮助。谢谢!