Fixes for systems with overloaded Khomp servers on outbound auto-dialing

git-svn-id: svn://192.168.202.10@4019 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2026-09-02 20:09:25 +00:00
parent f33a3dca7f
commit d5a90e49f3
3 changed files with 28 additions and 2 deletions
+10 -1
View File
@@ -45,7 +45,7 @@
#exten => 8366,4,AGI(agi-VDAD_ALL_outbound.agi,SURVEY-----LB-----US_pol_survey_hello-----1238-----8-----US_pol_survey_transfer-----US_thanks_no_contact-----OPTOUT-----DNC)
#exten => 8366,5,Hangup
#
# Copyright (C) 2025 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2026 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# changes:
# 80218-2027 - First Build
@@ -136,6 +136,7 @@
# 250924-2150 - Added code for deprecation of "Monitor" application after Asterisk 20
# 251001-1837 - Fix for rare Stereo recording filename issue
# 251020-0835 - Added code for recording_dtmf_muting, fix for stereo call recording
# 260902-1607 - Fix for systems with overloaded Khomp servers
#
$script = 'agi-VDAD_ALL_outbound.agi';
@@ -7216,6 +7217,14 @@ sub khomp_json_api
$agi_string = "-- KHOMP RESPONSE JSON: |$message|"; &agi_output;
}
$test503 = $message;
$test503 =~ s/\n|\r|\t//gi;
if ($test503 =~ /503 Service Not Available/)
{
$agi_string = "-- KHOMP API REJECTED OUR REQUEST!!! forcing fake timeout response"; &agi_output;
$message = '{"id":0,"jsonrpc":"2.0","result":{"calls":[{"disconnected":false,"fields":{"analyzer_action":"Connect","analyzer_conclusion":"Khomp Reject","analyzer_pattern":"","analyzer_stamp":"9999999999","answer_stamp":"9999999999","audio_stamp":"9999999999","end_stamp":"","hangup_cause":"","hangup_cause_sent":"","hangup_origin":"","sip_header:call-id":"","start_stamp":"1788358771462"}}]}}';
}
#UC# $json = JSON::PP->new->ascii->pretty->allow_nonref;
#UC# $result = $json->decode($message);
+8
View File
@@ -107,6 +107,7 @@
# 260327-0824 - Fixes for PJSIP compatibility
# 260424-1644 - Fix for rare Auto-Alt Dial issue
# 260515-1936 - Added internal logging
# 260902-1608 - Fix for systems with overloaded Khomp servers
#
# defaults for PreFork
@@ -3847,6 +3848,13 @@ sub khomp_json_api
$agi_string = "-- KHOMP JSON : |$khomp_json|"; &agi_output;
$agi_string = "-- KHOMP RESPONSE JSON: |$message|"; &agi_output;
}
$test503 = $message;
$test503 =~ s/\n|\r|\t//gi;
if ($test503 =~ /503 Service Not Available/)
{
$agi_string = "-- KHOMP API REJECTED OUR REQUEST!!! forcing fake timeout response"; &agi_output;
$message = '{"id":0,"jsonrpc":"2.0","result":{"calls":[{"disconnected":false,"fields":{"analyzer_action":"Connect","analyzer_conclusion":"Khomp Reject","analyzer_pattern":"","analyzer_stamp":"9999999999","answer_stamp":"9999999999","audio_stamp":"9999999999","end_stamp":"","hangup_cause":"","hangup_cause_sent":"","hangup_origin":"","sip_header:call-id":"","start_stamp":"1788358771462"}}]}}';
}
#UC# $json = JSON::PP->new->ascii->pretty->allow_nonref;
#UC# $result = $json->decode($message);
@@ -136,7 +136,8 @@ package AGIHandlers::VDAD_ALL_outbound;
# 251001-1837 - Fix for rare Stereo recording filename issue
# 251020-0835 - Added code for recording_dtmf_muting, fix for stereo call recording
# 260805-1057 - Converted to a PM file for the FastAGIServer system
# 260902-1606 - Fix for systems with overloaded Khomp servers
#
our $fagi_channel = '';
our $AGI = '';
@@ -7318,6 +7319,14 @@ sub khomp_json_api
$agi_string = "-- KHOMP RESPONSE JSON: |$message|"; &agi_output;
}
$test503 = $message;
$test503 =~ s/\n|\r|\t//gi;
if ($test503 =~ /503 Service Not Available/)
{
$agi_string = "-- KHOMP API REJECTED OUR REQUEST!!! forcing fake timeout response"; &agi_output;
$message = '{"id":0,"jsonrpc":"2.0","result":{"calls":[{"disconnected":false,"fields":{"analyzer_action":"Connect","analyzer_conclusion":"Khomp Reject","analyzer_pattern":"","analyzer_stamp":"9999999999","answer_stamp":"9999999999","audio_stamp":"9999999999","end_stamp":"","hangup_cause":"","hangup_cause_sent":"","hangup_origin":"","sip_header:call-id":"","start_stamp":"1788358771462"}}]}}';
}
$json = JSON::PP->new->ascii->pretty->allow_nonref;
$result = $json->decode($message);