我正在学习perl中用于连接asterisk的Asterisk::AMI模块。运行以下程序时,我无法连接到asterisk。有人能给我解决这个问题的办法吗?
use Asterisk::AMI;
my $astman = Asterisk::AMI->new(PeerAddr => '127.0.0.1', #Remote host address
PeerPort => '5038', #Remote host port
#AMI is available on TCP port 5038 if you enable it in manager.conf.
Username => 'admin', #Username to access the AMI
Secret => 'supersecret' #Secret used to connect to AMI
);
die "Unable to connect to asterisk" unless ($astman);
my $action = $astman->({ Action => 'Command',
Command => 'sip show peers'
});
print $action;提前谢谢。
发布于 2011-05-31 21:01:36
如果包含以下内容,则脚本应显示错误/警告:
use warnings;在脚本的开头。
发布于 2011-09-08 13:27:12
我遇到了同样的问题,然后我发现我必须在/etc/asterisk/manager.conf文件中配置用户
就像这个示例http://www.voip-info.org/wiki/view/Asterisk+config+manager.conf
你会成功的;
https://stackoverflow.com/questions/6187667
复制相似问题