2011-05-31 58 views
0

我正在學習有關連接到星號的perl中的Asterisk :: AMI模塊。在運行以下程序時,我無法連接到星號。任何人都可以給我解決方案來解決這個問題?Asterisk :: AMI模塊

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; 

在此先感謝。

+0

我們正在嘗試啓動一個電話堆棧交換站點,如果您有興趣,請考慮提交:[StackExchange Telephony Beta](http://area51.stackexchange.com/proposals/12932/telephony?referrer=t19aZKsEkDYFK9yUPwMC_g2) – Jacinda 2011-06-03 16:08:36

回答

2

你的腳本應該顯示錯誤/警告,如果您有:

use warnings; 

在腳本的開始。

0

您在這裏失蹤comman:
'$行動= $ astman - >({...'
應該
'$行動= $ astman-> send_action({...'

相關問題