首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Asterisk::AMI模块

Asterisk::AMI模块
EN

Stack Overflow用户
提问于 2011-05-31 20:36:11
回答 2查看 2.2K关注 0票数 0

我正在学习perl中用于连接asterisk的Asterisk::AMI模块。运行以下程序时,我无法连接到asterisk。有人能给我解决这个问题的办法吗?

代码语言:javascript
复制
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;

提前谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-05-31 21:01:36

如果包含以下内容,则脚本应显示错误/警告:

代码语言:javascript
复制
use warnings;

在脚本的开头。

票数 2
EN

Stack Overflow用户

发布于 2011-09-08 13:27:12

我遇到了同样的问题,然后我发现我必须在/etc/asterisk/manager.conf文件中配置用户

就像这个示例http://www.voip-info.org/wiki/view/Asterisk+config+manager.conf

你会成功的;

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6187667

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档