Potential bug in agi_VDAD_local_optimize.agi
Posted: Tue Jul 13, 2021 12:17 am
I had Answered calls dropped by agi_VDAD_local_optimize.agi. I found a problem and a quick solution.
We are chaining providers in dial plan like that
exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXXX,n,Dial(SIP/provider1/${EXTEN:1},60,tTo)
exten => _91NXXNXXXXXX,n,Dial(SIP/provider2/${EXTEN:1},60,tTo)
I'm not sure if its a correct way or its not recommended with vicidial. Nevertheless, if provider1 fails and call answered by provider2 the agi_VDAD_local_optimize.agi will drop the call due to wrong channel picked by query:
# find the local channel's real channel
my $stmtA = "SELECT dest_channel FROM $cid_channels_recent where (caller_id_name = '$cid_name' or connected_line_name = '$connected_line_name' or caller_id_name = '$connected_line_name' or connected_line_name = '$cid_name') and ( linkedid = '$uniqueid' or dest_uniqueid = '$uniqueid' or uniqueid = '$uniqueid') and call_date > '$SQL2mindate'";
since SIP/provider1 will be in the $cid_channels_recent at earlier time then SIP/provider2 the script will pick the wrong (NON EXISTENT NOW) channel to redirect the call.
easy fix would be to modify query appending 'order by call_date desc' so the LATEST used channel will be picked.
this is
Last Changed Author: mattf
Last Changed Rev: 3478
Last Changed Date: 2021-07-07 18:59:24 -0400 (miƩ, 07 jul 2021)
Thank you
We are chaining providers in dial plan like that
exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXXX,n,Dial(SIP/provider1/${EXTEN:1},60,tTo)
exten => _91NXXNXXXXXX,n,Dial(SIP/provider2/${EXTEN:1},60,tTo)
I'm not sure if its a correct way or its not recommended with vicidial. Nevertheless, if provider1 fails and call answered by provider2 the agi_VDAD_local_optimize.agi will drop the call due to wrong channel picked by query:
# find the local channel's real channel
my $stmtA = "SELECT dest_channel FROM $cid_channels_recent where (caller_id_name = '$cid_name' or connected_line_name = '$connected_line_name' or caller_id_name = '$connected_line_name' or connected_line_name = '$cid_name') and ( linkedid = '$uniqueid' or dest_uniqueid = '$uniqueid' or uniqueid = '$uniqueid') and call_date > '$SQL2mindate'";
since SIP/provider1 will be in the $cid_channels_recent at earlier time then SIP/provider2 the script will pick the wrong (NON EXISTENT NOW) channel to redirect the call.
easy fix would be to modify query appending 'order by call_date desc' so the LATEST used channel will be picked.
this is
Last Changed Author: mattf
Last Changed Rev: 3478
Last Changed Date: 2021-07-07 18:59:24 -0400 (miƩ, 07 jul 2021)
Thank you