无法通过 Telnet 连接到 Asterisk

无法通过 Telnet 连接到 Asterisk

我正在尝试通过 telnet 连接到 asterisk。为了让 PHPAGI 使用某些命令,它必须能够执行相同的操作。所以我省去了中间人并手动测试。我确定 asterisk 不允许任何东西通过 localhost 连接到它。

我正在按照以下步骤操作http://the-asterisk-book.com/1.6/asterisk-manager-api.html在我的服务器上。

以下是我得到的结果:

> telnet 127.0.0.1 5038

Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Asterisk Call Manager/1.3
Action: Login
ActionID: 1
Username: admin
Password: abc123

Response: Error
ActionID: 1
Message: Authentication failed

我的 /etc/asterisk/manager.conf 文件包含:

[general]
enabled = yes
port = 5038
bindaddr = 127.0.0.1

#include "manager.d/*.conf"

并且 /etc/asterisk/manager.d/admin.conf 包含:

[admin]
secret = abc123
#Trying just about everything...
permit = 127.0.0.1/255.255.255.255
permit = 127.0.0.1/255.255.255.0
permit = 23.239.27.80/255.255.255.255
permit = 23.239.27.80/255.255.255.0
permit = 192.168.0.1/255.255.255.0
permit = 192.168.0.1/255.255.255.255
read = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate
write = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate

我不确定为什么它无法验证。有什么猜测吗?(注意:我在更改 .conf 文件后重新启动了 asterisk)

答案1

得到答案了。我的 manager.conf 现在如下所示:

[general]
enabled=yes
port=5038
bindaddr=0.0.0.0
displayconnects=yes ;only effects 1.6+

[admin]
secret = abc123
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user,originate
write = system,call,log,verbose,command,agent,user,originate

另外,在进行身份验证时,我删除了“ActionID”。因此:

> telnet 127.0.0.1 5038

Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Asterisk Call Manager/1.3
Action: Login
Username: admin
Secret: abc123

Response: Success
Message: Authentication accepted

Event: FullyBooted
Privilege: system,all
Status: Fully Booted

相关内容