Skip Menu |

This queue is for tickets about the Asterisk-AMI CPAN distribution.

Report information
The Basics
Id: 71704
Status: resolved
Priority: 0/
Queue: Asterisk-AMI

People
Owner: GREENBEAN [...] cpan.org
Requestors: frank [...] digennaro.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: v0.2.5
Fixed in: v0.2.6



I am using Asterisk:AMI v 2.5 and Asterisk versions 1.4, 1.6.2, and 1.8 in different environments. I am also using perl version 5.8.8 and Linux CentOS. The problem I have is that when I dump the Asterisk astdb values using the db_show method, only some of the key/values are being returned. In one case, 190 of 447 key/values were returned, in another, 82 of 115 key/values were returned. I am including my test script. FSD use Carp; use strict; use Asterisk::AMI::Common; my $timeout = '5'; my $host = '127.0.0.1'; my $port = '5038'; my $manager = 'manager'; my $secret = 'insecure'; my $astman = Asterisk::AMI::Common->new(PeerAddr => "$host", PeerPort => "$port", Username => "$manager", Secret => "$secret" ); croak "Unable to connect to asterisk" unless ( $astman ); my $hashref = $astman->db_show( $timeout ); my %hash = %$hashref; foreach my $family ( keys %hash ) { for my $key ( keys %{ $hash{ $family } } ) { print "hash{$family}{$key} = $hash{$family}{$key}\n"; }; };
Subject: db_show missing data
Odd, this could be a bug with the regex we use to parse the 'database show' cli command output in combination with your dataset. I have attached two scripts. One just dumps the output of 'database show' and the other dumps db_show(). Could you run both and attach the outputs? If you do not wish to post the output here in the tracker please email it to me at rrb3942@gmail.com. Please send them as separate attachments and not in-line. Thanks.
Subject: db_show.pl
#!/usr/bin/env perl use strict; use warnings; use Asterisk::AMI::Common; use Data::Dumper; my $astman = Asterisk::AMI::Common->new( PeerAddr => '127.0.0.1', PeerPort => 5038, Username => 'manager', Secret => 'insecure' ); die "Could not connect to asterisk" unless ($astman); my $dbshow = $astman->db_show(); print Dumper $dbshow;
Subject: cmd_show.pl
#!/usr/bin/env perl use strict; use warnings; use Asterisk::AMI::Common; use Data::Dumper; my $astman = Asterisk::AMI::Common->new( PeerAddr => '127.0.0.1', PeerPort => 5038, Username => 'manager', Secret => 'insecure' ); die "Could not connect to asterisk" unless ($astman); my $dbshow = $astman->action({ Action => 'Command', Command => 'database show' }); print Dumper $dbshow;
From: frank [...] digennaro.com
Hello; I'm including both the outputs as attachments. One thing that I just saw was that many of the db key/value pairs had null values. It could be that db_show() skips over those keys, but I am not certain. I would think that even if a key existed without a value, db_show should show it. Thanks for looking into this. This is an extremely useful module. Regards; FSD
Subject: cmd_show.txt

Message body is not shown because it is too large.

Subject: db_show.txt
$VAR1 = { 'VBS/200' => { 'autodelete' => '0', 'MOR' => '0', 'MOH' => '0', 'email_recording_always' => '0', 'MOHCLASS' => 'default', 'REPEATDIAL' => '300', 'CALLTRACE' => '2402153479', 'MORCLASS' => 'default' }, 'TL/EXTEN/201' => { 'mailbox' => '201', 'phone' => 'SIP/201' }, 'Fax/DID/' => { 'receivedir' => 'faxadmin', 'owner' => 'faxadmin', 'destformat' => 'pdf', 'dest' => 'email' }, 'dundi' => { 'secretexpiry' => '1318776869', 'secret' => 'odpWKAFBCSPgUJwLPhplTg==;5uBiDM1OciHxjsYBCOJXGw==' }, 'TL/EXTEN/225' => { 'mailbox' => '225', 'phone' => 'SIP/225' }, 'TL/EXTEN/200' => { 'mailbox' => '200', 'phone' => 'SIP/200' }, 'VBS/201' => { 'MOR' => '0', 'MOHCLASS' => 'default', 'MOH' => '0', 'MORCLASS' => 'default', 'CALLTRACE' => '2402153479' }, 'TL/CONF/203' => { 'adminpin' => '204', 'options' => 'wMsciTor', 'moh' => 'default', 'status' => '1', 'userpin' => '203' }, 'VBS/225' => { 'MOR' => '0', 'MOHCLASS' => 'default', 'MOH' => '0', 'MORCLASS' => 'default' }, 'TL/MOH' => { 'default' => 'default' }, 'TL/200' => { 'CFAN' => '201', 'CFNAT1' => '15', 'CFNAOKN1' => '2402153479', 'CFNAAN' => '1', 'VM' => '1', 'CFNATALL' => '20', 'CFA' => '0', 'CFNAT0' => '15', 'BLOCKNCID' => '0', 'SCREEN' => '0', 'RECORD' => '2', 'BLOCKDEST' => '0', 'CFNATGROUP' => '15', 'CFNAT5' => '15', 'CFNAT2' => '15', 'CFB' => '0', 'BLOCK' => '0', 'VMT0' => '5', 'CFNASTRAT' => '0', 'CFNA' => '0', 'BLOCKALL' => '0', 'CFNAT3' => '15', 'CFNAN1' => '2403675124', 'CFRETAINCLI' => '1', 'CFNAT4' => '15', 'CFBN' => '202', 'CFNAEXT' => '2' }, 'VBS/2402153479' => { 'REPEATDIAL' => '2403675124' }, 'TL/EXTEN/203' => { 'mailbox' => '203', 'phone' => 'SIP/203' }, 'TL/CONF/201' => { 'adminpin' => '202', 'options' => 'wMsciTor', 'moh' => 'default', 'status' => '1', 'userpin' => '201' }, 'VBS/203' => { 'MOR' => '0', 'MOHCLASS' => 'default', 'MOH' => '0', 'MORCLASS' => 'default' }, 'TL/225' => { 'CFNAT1' => '15', 'CFNAAN' => '1', 'VM' => '1', 'CFNATALL' => '20', 'CFA' => '0', 'CFNAT0' => '15', 'BLOCKNCID' => '0', 'SCREEN' => '0', 'BLOCKDEST' => '0', 'CFNATGROUP' => '15', 'CFNAT5' => '15', 'CFNAT2' => '15', 'CFB' => '0', 'BLOCK' => '0', 'VMT0' => '20', 'CFNASTRAT' => '0', 'CFNA' => '0', 'BLOCKALL' => '0', 'CFNAT3' => '15', 'CFRETAINCLI' => '1', 'CFNAT4' => '15', 'CFNAEXT' => '2' }, 'TL/CONF/225' => { 'adminpin' => '226', 'options' => 'wMsciTor', 'moh' => 'default', 'status' => '1', 'userpin' => '225', 'maxusers' => '10' }, 'TL/202' => { 'CFNAT1' => '15', 'CFNAAN' => '1', 'VM' => '1', 'CFNATALL' => '20', 'CFA' => '0', 'CFNAT0' => '15', 'BLOCKNCID' => '0', 'SCREEN' => '0', 'RECORD' => '2', 'BLOCKDEST' => '0', 'CFNATGROUP' => '15', 'CFNAT5' => '15', 'CFNAT2' => '15', 'CFB' => '0', 'BLOCK' => '0', 'VMT0' => '20', 'CFNASTRAT' => '0', 'CFNA' => '0', 'BLOCKALL' => '0', 'CFNAT3' => '15', 'CFRETAINCLI' => '1', 'CFNAT4' => '15', 'CFNAEXT' => '2' }, 'TL' => { 'allow_original_callerid' => '1' }, 'VBS/202' => { 'MOR' => '0', 'MOHCLASS' => 'default', 'MOH' => '0', 'MORCLASS' => 'default' }, 'TL/201' => { 'CFNAT1' => '15', 'CFNAAN' => '1', 'VM' => '1', 'CFNATALL' => '20', 'CFA' => '0', 'CFNAT0' => '15', 'BLOCKNCID' => '0', 'SCREEN' => '0', 'RECORD' => '2', 'BLOCKDEST' => '0', 'CFNATGROUP' => '15', 'CFNAT5' => '15', 'CFNAT2' => '15', 'CFB' => '0', 'BLOCK' => '0', 'VMT0' => '20', 'CFNASTRAT' => '0', 'CFNA' => '0', 'BLOCKALL' => '0', 'CFNAT3' => '15', 'CFRETAINCLI' => '1', 'CFNAT4' => '15', 'CFNAEXT' => '2' }, 'TL/CONF/202' => { 'adminpin' => '203', 'options' => 'wMsciTor', 'moh' => 'default', 'status' => '1', 'userpin' => '202' }, 'TL/EXTEN/202' => { 'mailbox' => '202', 'phone' => 'SIP/202' }, 'TL/CONF/200' => { 'adminpin' => '201', 'options' => 'wMsciTor', 'moh' => 'default', 'status' => '1', 'userpin' => '200' }, 'TL/203' => { 'CFNAT1' => '15', 'CFNAAN' => '1', 'VM' => '1', 'CFNATALL' => '20', 'CFA' => '0', 'CFNAT0' => '15', 'BLOCKNCID' => '0', 'SCREEN' => '0', 'RECORD' => '2', 'BLOCKDEST' => '0', 'CFNATGROUP' => '15', 'CFNAT5' => '15', 'CFNAT2' => '15', 'CFB' => '0', 'BLOCK' => '0', 'VMT0' => '20', 'CFNASTRAT' => '0', 'CFNA' => '0', 'BLOCKALL' => '0', 'CFNAT3' => '15', 'CFRETAINCLI' => '1', 'CFNAT4' => '15', 'CFNAEXT' => '2' }, 'Fax' => { 'pbxtype' => 'thirdlane', 'localcontext' => 'from-inside' } };
Subject: Re: [rt.cpan.org #71704] db_show() is missing entries from astdb
Date: Sun, 16 Oct 2011 14:54:29 -0700
To: bug-Asterisk-AMI [...] rt.cpan.org
From: Ryan Bullock <rrb3942 [...] gmail.com>

Message body is not shown because it is too large.

From: frank [...] digennaro.com
I tried it using Asterisk 1.4 and 1.8 and everything looks good. Thank You; FSD