Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
allned7690ring
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Franco (nextime) Lanza
allned7690ring
Commits
bc935095
Commit
bc935095
authored
May 01, 2015
by
nextime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first commit
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
allnet7690ring.conf
allnet7690ring.conf
+5
-0
allnet7690ring.py
allnet7690ring.py
+63
-0
No files found.
allnet7690ring.conf
0 → 100644
View file @
bc935095
[
307
]
user
:
admin
pass
:
password
ip
:
172
.
18
.
100
.
107
allnet7690ring.py
0 → 100755
View file @
bc935095
#!/usr/bin/env python
import
urllib2
,
sys
,
ConfigParser
,
os
,
urllib
from
threading
import
Thread
import
signal
#>>> p=a.urlencode({'ring1': 1})
#>>> f=a.urlopen('http://admin:12345678@phone2.nexlab.thc:9999/phone.htm', p)
def
alarmHandler
(
*
args
):
raise
"TimeOut"
class
changeThread
(
Thread
):
def
__init__
(
self
,
cfg
,
exten
,
ring
):
Thread
.
__init__
(
self
)
self
.
cfg
=
cfg
self
.
exten
=
exten
self
.
ring
=
ring
def
run
(
self
):
ip
=
self
.
cfg
.
get
(
self
.
exten
,
'ip'
)
user
=
self
.
cfg
.
get
(
self
.
exten
,
'user'
)
pwd
=
self
.
cfg
.
get
(
self
.
exten
,
'pass'
)
p
=
urllib
.
urlencode
({
'ring1'
:
int
(
self
.
ring
)})
try
:
#print 'START', ip, self.exten
signal
.
alarm
(
1
)
f
=
urllib
.
urlopen
(
'http://'
+
user
+
':'
+
pwd
+
'@'
+
ip
+
':9999/phone.htm'
,
p
)
f
.
close
()
#print 'OK', ip, self.exten
except
"TimeOut"
:
pass
#print 'TimeOut', ip, self.exten
#signal.alarm(0)
class
changeRing
:
def
__init__
(
self
):
self
.
cfg
=
ConfigParser
.
ConfigParser
()
self
.
cfg
.
read
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'allnet7690ring.conf'
))
if
int
(
sys
.
argv
[
2
])
in
range
(
8
):
self
.
change
(
str
(
sys
.
argv
[
1
]),
str
(
sys
.
argv
[
2
]))
def
_change
(
self
,
exten
,
ring
):
act
=
changeThread
(
self
.
cfg
,
exten
,
ring
)
act
.
start
()
def
change
(
self
,
exten
,
ring
):
if
len
(
str
(
exten
)
.
strip
()
.
split
(
','
))
>
1
:
for
ext
in
str
(
exten
)
.
strip
()
.
split
(
','
):
if
str
(
ext
)
in
self
.
cfg
.
sections
():
self
.
_change
(
ext
,
ring
)
else
:
if
str
(
exten
)
in
self
.
cfg
.
sections
():
self
.
_change
(
exten
,
ring
)
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
>
2
:
changeRing
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment