AST_update_AMI2 Code Error ?

All installation and configuration problems and questions

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

AST_update_AMI2 Code Error ?

Postby nextdial » Thu Jan 11, 2024 4:19 am

Hi Guys,
In AST_update_AMI2.pl how it can be possible

Line 747
if ( $channel_ref->{'Channel'} =~ /^Local/ )
{
$cid_chan_hash{"$call_id"}->{'channel'} = $channel_ref->{'Channel'};
$cid_chan_hash{"$call_id"}->{'uniqueid'} = $channel_ref->{'Uniqueid'};
$cid_chan_hash{"$call_id"}->{'linkedid'} = $channel_ref->{'Linkedid'};
$cid_chan_hash{"$call_id"}->{'calleridname'} = $channel_ref->{'CallerIDName'};
$cid_chan_hash{"$call_id"}->{'connectedlinename'} = $channel_ref->{'ConnectedLineName'};
}
else
{
$cid_chan_hash{"$call_id"}->{'dest_channel'} = $channel_ref->{'Channel'};
$cid_chan_hash{"$call_id"}->{'dest_uniqueid'} = $channel_ref->{'Uniqueid'};
$cid_chan_hash{"$call_id"}->{'linkedid'} = $channel_ref->{'Linkedid'};
$cid_chan_hash{"$call_id"}->{'calleridname'} = $channel_ref->{'CallerIDName'};
$cid_chan_hash{"$call_id"}->{'connectedlinename'} = $channel_ref->{'ConnectedLineName'};
}

Line 993

( $cid_chan_hash{"$call_id"}->{'channel'} ne "" ) && ( $cid_chan_hash{"$call_id"}->{'dest_channel'} ne "" ) )

How $cid_chan_hash{"$call_id"}->{'channel'} AND $cid_chan_hash{"$call_id"}->{'dest_channel'} can be both not equal "" ?

we populate $cid_chan_hash{"$call_id"}->{'channel'} if /^Local/ AND $cid_chan_hash{"$call_id"}->{'dest_channel'} IF NOT /^Local/
nextdial
 
Posts: 4
Joined: Tue Dec 12, 2023 4:18 am

Re: AST_update_AMI2 Code Error ?

Postby mcargile » Fri Jan 12, 2024 9:01 am

I will have to dig into the code as I wrote this several years ago. There are two things to keep in mind though.

1. The AST_update_AMI2.pl script was a reimplementation of Matt's original AST_update.pl script. For the most part I kept the same logic as Matt's code if it did not break anything. Matt's code dates back to before Asterisk was even properly released. Originally it was only available via repository checkouts and was constantly being changed by the developers. He put code in there that dealt with weird situations that would pop up. It is quite possible that this is some of that code.

2. Asterisk is notorious for giving bad data. Even after it became stable and was released, under high load it will still give garbage results. Never assume that you got a valid channel data. Even in my testing on much newer versions I have run across situations where the data does not make sense. It is quite possible that in my testing on an overloaded Asterisk server that I got results back from Asterisk with a valid uniqueid but no channels.
Michael Cargile | Director of Engineering | ViciDialGroup | http://www.vicidial.com

The official source for VICIDIAL services and support. 1-888-894-VICI (8424)
mcargile
Site Admin
 
Posts: 617
Joined: Tue Jan 16, 2007 9:38 am


Return to Support

Who is online

Users browsing this forum: Fares MEHENI and 53 guests