Max Trunks on the basis of vicidial_auto_calls is faulty

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Max Trunks on the basis of vicidial_auto_calls is faulty

Postby marmu » Tue Jun 05, 2012 6:21 am

Hi guys,

I just want to let you know that we wondered about vicidial needing more trunks than our previous dialer. We found the following mistake in the calculation of used trunks within vicidial. I don't know if that is still present in the current vicidial version, in our it is.
In AST_VDauto_dial.pl:
Code: Select all
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$server_ip' and status IN('SENT','RINGING','LIVE','XFER','CLOSER','IVR');";

is used to calculated the used channels. We compared that to the number of channels from "sip show channels" on the CLI and the difference ranged from 30-80 channels. In a nutshell: Vicidial thought it was using up to 80 channels more than were actually used. Now we calculate that number based on "sip show channels" and are much much more productive.

"PATCH" idea using "Asterisk::AMI":
Code: Select all
use Asterisk::AMI;
my $astmgr = Asterisk::AMI->new(PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 'xxxxxx',
                                Username => 'user', Secret   => 'secret'
                               ) or die "Unable to connect to asterisk";
#
# ip's of the carriers used. They are used to determine the
# count of channels which are currently in call.
#
my @carrierips = ("xxx.xxx.xxx.xxx", "xxx.xxx.xxx.xxx");
#
# function to determine active phone lines per campaign
#    returns e.g.  {5067 => 32, 6025 => 97, total => 129}
sub getCarrierStatus($$) {
    my ($astmgr, $dbh) = @_;

    my $peerip;
    my $number;
    my @numbers = ();
    my $result;
    my $line;
    my %rethash;
    my $stmt;
    my $sth;
    my $vdm;
    my $count;
    my $campaign;
    my $total = 0;

    #
    # send 'sip show channels' to asterisk
    #
    $result = $astmgr->action({Action  => 'Command',
                                   Command => 'sip show channels'});
    foreach $line (@{$result->{CMD}}) {
        if ($line =~ m/(\d+\.\d+\.\d+\.\d+)\s+98(\d+)\s+/) {
            $peerip = $1;
            $number = $2;
            if ($peerip ~~ @carrierips) {
                push(@numbers, $number);
            }
        }
    }
    if (scalar(@numbers) > 0) {
        $stmt = "SELECT count(*) as cnt,campaign_id FROM vicidial_auto_calls where phone_number IN('" . join("','", @numbers) . "') group by campaign_id";
        $sth = $dbh->prepare($stmt) or die "preparing: ",$dbh->errstr;
        $sth->execute or die "executing: $stmt ", $dbh->errstr;

        while ($vdm = $sth->fetchrow_hashref) {
            $count = $vdm->{cnt};
            $campaign = $vdm->{campaign_id};
            $rethash{$campaign} = $count;
            $total += $count;
        }
        $rethash{total} = $total;
    }
    return %rethash;
}


Comment out the select statement mentioned above and use the new sub routine like that:
Code: Select all
my %astchannels = getCarrierStatus($astmgr, $dbhA);
$active_line_counter = $astchannels{total};


Hopefully this will help you get the most out of vicidial :)

Cheers,
Marcus
Vicibox redux 3.1.10 64 bit (ViciBox_Redux.x86_64-3.1.10.iso)
Admin-GUI: VERSION: 2.4-310a - BUILD: 110506-1537 - with some adaptions :)
Asterisk 1.4.39.2-vici | Single Server | wanpipe_voicetime
2x Intel(R) Xeon(R) X5650 | 12 GB | SAS 15k RAID1
marmu
 
Posts: 190
Joined: Fri Mar 12, 2010 6:57 am

Re: Max Trunks on the basis of vicidial_auto_calls is faulty

Postby mflorell » Tue Jun 05, 2012 9:56 am

I have no idea how you ended up with that kind of difference based upon the information in mention here. We haven't seen these kind of problems on our systems that we have installed.
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: Max Trunks on the basis of vicidial_auto_calls is faulty

Postby marmu » Wed Jun 06, 2012 3:11 am

have you ever compared the values from AST_VDauto_dial.pl with the ones from "sip show channels" on a running system? I can only tell you that we were about to order 30-60 more ISDN lines from our carrier and now we don't have to. The system works way better now. Perhaps others got that problem too, I don't know, I can only speak for our setup. But good to know that we might be the only ones having this kind of problem.
Vicibox redux 3.1.10 64 bit (ViciBox_Redux.x86_64-3.1.10.iso)
Admin-GUI: VERSION: 2.4-310a - BUILD: 110506-1537 - with some adaptions :)
Asterisk 1.4.39.2-vici | Single Server | wanpipe_voicetime
2x Intel(R) Xeon(R) X5650 | 12 GB | SAS 15k RAID1
marmu
 
Posts: 190
Joined: Fri Mar 12, 2010 6:57 am

Re: Max Trunks on the basis of vicidial_auto_calls is faulty

Postby mflorell » Wed Jun 06, 2012 6:26 am

Vicidial pulls it's call counts from vicidial_auto_calls, and if those are not accurate then there is probably something else going on with your system in terms of something configured improperly.
mflorell
Site Admin
 
Posts: 18387
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: Max Trunks on the basis of vicidial_auto_calls is faulty

Postby marmu » Thu Jun 07, 2012 5:10 am

hi matt,

my colleague said yesterday, that I can't say it is faulty. It is (kind of) correct but to delayed for the best utilization of the available channels. At least that is what we found out in our installation. I can't think of any misconfiguration, is there a common mistake we might have done?

All the best,
Marcus
Vicibox redux 3.1.10 64 bit (ViciBox_Redux.x86_64-3.1.10.iso)
Admin-GUI: VERSION: 2.4-310a - BUILD: 110506-1537 - with some adaptions :)
Asterisk 1.4.39.2-vici | Single Server | wanpipe_voicetime
2x Intel(R) Xeon(R) X5650 | 12 GB | SAS 15k RAID1
marmu
 
Posts: 190
Joined: Fri Mar 12, 2010 6:57 am


Return to Support

Who is online

Users browsing this forum: No registered users and 126 guests