-
Notifications
You must be signed in to change notification settings - Fork 102
asteriks authenticate problem #61
Copy link
Copy link
Open
Description
I run this code
"""
Example to get list of active channels
"""
import asterisk.manager
import sys
manager = asterisk.manager.Manager()
try:
# connect to the manager
try:
manager.connect('localhost')
manager.login('muhammet', '123456')
# get a status report
response = manager.status()
print(response)
response = manager.command('core show channels concise')
print(response.data)
manager.logoff()
except asterisk.manager.ManagerSocketException as e:
print ("Error connecting to the manager: %s" % e.strerror)
sys.exit(1)
except asterisk.manager.ManagerAuthException as e:
print ("Error logging in to the manager: %s" % e.strerror)
sys.exit(1)
except asterisk.manager.ManagerException as e:
print ("Error: %s" % e.strerror)
sys.exit(1)
finally:
# remember to clean up
manager.close()
Add this line
[muhammet]
secret = 123456
deny = 0.0.0.0/0.0.0.0
permit = 192.168.0.0/255.255.255.0
read = all
write = all
writetimeout = 5000
in /etc/manager.conf file but I take this error :
Traceback (most recent call last):
File "asteriksornek.py", line 27, in <module>
print ("Error logging in to the manager: %s" % e.strerror)
AttributeError: 'ManagerAuthException' object has no attribute 'strerror'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "asteriksornek.py", line 35, in <module>
manager.close()
File "/home/mert/.local/lib/python3.8/site-packages/asterisk/manager.py", line 500, in close
self.logoff()
File "/home/mert/.local/lib/python3.8/site-packages/asterisk/manager.py", line 541, in logoff
response = self.send_action(cdict)
File "/home/mert/.local/lib/python3.8/site-packages/asterisk/manager.py", line 283, in send_action
self._sock.write(command.encode('utf8','ignore'))
File "/usr/lib/python3.8/socket.py", line 684, in write
self._checkClosed()
ValueError: I/O operation on closed file.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels