Asterisk Manager API SIPPeers - Permission Denied
-
26-09-2019 - |
Question
I'm wanting to use the asterisk manager api to show the status of all my SIP lines in a PHP web interface.
I thought I'd start simple and use telnet to see it working.
So I created a user in /etc/asterisk/manager.conf
[portal]
secret = password
read = all,system,call,log,verbose,command,agent,user
Then telnet to localhost on port 5038
This is what I get:
asterisk ~ # telnet localhost 5038
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Asterisk Call Manager/1.0
Action: login
Username: portal
Secret: 8u9sdgk
Events: off
Response: Success
Message: Authentication accepted
Action: SIPPeers
Response: Error
Message: Permission denied
Why am I getting permission denied? I thought the user has basically full access? Do I need to restart asterisk to make this work? I didn't restart it. On the other hand, I was able to log in which makes me think that the manager.conf has been reloaded as the portal user didn't exist before.
Any ideas?
Solution
For SIPPeers you need 'system, all' privileges. So just add 'write=system' after 'read' line
OTHER TIPS
You need to modify manager.conf, add follow:
read = all,ystem,call,user,dtmf
write = all,system,call
notice: must be add all after write