From b0744de0bd21de2714f77e61e2aab7d186ca39d7 Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 3 Jan 2022 21:28:52 +0000 Subject: [PATCH] Added timeout fix for manual dial calls, set the CAMPDTO dialplan variable git-svn-id: svn://192.168.202.10@3550 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/FastAGI_log.pl | 17 +++++++++++++++-- docs/PJSIP_SUPPORT.txt | 4 ++-- extras/MySQL_AST_CREATE_tables.sql | 6 +++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/bin/FastAGI_log.pl b/bin/FastAGI_log.pl index a4abf7b7..f0d6b16c 100644 --- a/bin/FastAGI_log.pl +++ b/bin/FastAGI_log.pl @@ -25,7 +25,7 @@ # exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME}) # # -# Copyright (C) 2021 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2022 Matt Florell LICENSE: AGPLv2 # # CHANGELOG: # 61010-1007 - First test build @@ -92,6 +92,7 @@ # 210719-1521 - Added additional state override methods for call_limit_24hour # 210827-0936 - Added PJSIP compatibility # 210907-0841 - Added KHOMP code (install JSON::PP Perl module and remove '#UC#' in the code to enable) +# 220103-1520 - Added timeout fix for manual dial calls, set the CAMPDTO dialplan variable # # defaults for PreFork @@ -715,7 +716,7 @@ sub process_request $sthA->finish(); ### get campaign settings - $stmtA = "SELECT amd_type,campaign_vdad_exten FROM vicidial_campaigns where campaign_id = '$campaign';"; + $stmtA = "SELECT amd_type,campaign_vdad_exten,dial_timeout,manual_dial_timeout FROM vicidial_campaigns where campaign_id = '$campaign';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -724,6 +725,8 @@ sub process_request @aryA = $sthA->fetchrow_array; $amd_type = $aryA[0]; $campaign_vdad_exten = $aryA[1]; + $dial_timeout = $aryA[2]; + $man_dial_timeout = $aryA[3]; } $sthA->finish(); @@ -734,6 +737,16 @@ sub process_request if ($AGILOG) {$agi_string = "|CAMPCUST: $CAMPCUST|$callerid|"; &agi_output;} } + ### on manual dial calls set the CAMPDTO dialplan variable + if ($callerid =~ /^M/) + { + if (length($man_dial_timeout) > 0) + { + $dial_timeout = $man_dial_timeout; + } + $AGI->exec("EXEC Set(_CAMPDTO=$dial_timeout)"); + if ($AGILOG) {$agi_string = "|CAMPDTO: $dial_timeout|$callerid|"; &agi_output;} + } ### BEGIN OpenSIPs CallerIDname code ### ### get system_settings diff --git a/docs/PJSIP_SUPPORT.txt b/docs/PJSIP_SUPPORT.txt index 7e61bdb1..8f012396 100644 --- a/docs/PJSIP_SUPPORT.txt +++ b/docs/PJSIP_SUPPORT.txt @@ -1,4 +1,4 @@ -PJSIP SUPPORT IN ASTERISK Started: 2021-01-12 Updated: 2021-08-31 +PJSIP SUPPORT IN ASTERISK Started: 2021-01-12 Updated: 2022-01-03 * NOTE: Full PJSIP support was added to VICIdial in svn/trunk revision 3511. @@ -99,6 +99,6 @@ aors = PJSIPCARRIER DIALPLAN ENTRY: exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log) -exten => _91NXXNXXXXXX,n,Dial(PJSIP/${EXTEN:1}@PJSIPCARRIER,,To) +exten => _91NXXNXXXXXX,n,Dial(PJSIP/${EXTEN:1}@PJSIPCARRIER,${CAMPDTO},To) exten => _91NXXNXXXXXX,n,Hangup() diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index c6d54f67..c0a375c7 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -4769,9 +4769,9 @@ INSERT INTO vicidial_shifts SET shift_id='24HRMIDNIGHT',shift_name='24 hours 7 d INSERT INTO vicidial_conf_templates SET template_id='SIP_generic',template_name='SIP phone generic',template_contents="type=friend\nhost=dynamic\ncanreinvite=no\ncontext=default"; INSERT INTO vicidial_conf_templates SET template_id='IAX_generic',template_name='IAX phone generic',template_contents="type=friend\nhost=dynamic\nmaxauthreq=10\nauth=md5,plaintext,rsa\ncontext=default"; -INSERT INTO vicidial_server_carriers SET carrier_id='PARAXIP', carrier_name='TEST ParaXip CPD example',registration_string='', template_id='--NONE--', account_entry="[paraxip]\ndisallow=all\nallow=ulaw\ntype=peer\nusername=paraxip\nfromuser=paraxip\nsecret=test\nfromdomain=10.10.10.16\nhost=10.10.10.15\ninsecure=port,invite\noutboundproxy=10.0.0.7", protocol='SIP', globals_string='TESTSIPTRUNKP = SIP/paraxip', dialplan_entry="exten => _5591999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)\nexten => _5591999NXXXXXX,2,Dial(${TESTSIPTRUNKP}/${EXTEN:4},,To)\nexten => _5591999NXXXXXX,3,Hangup", server_ip='10.10.10.15', active='N'; -INSERT INTO vicidial_server_carriers SET carrier_id='SIPEXAMPLE', carrier_name='TEST SIP carrier example',registration_string='register => testcarrier:test@10.10.10.15:5060', template_id='--NONE--', account_entry="[testcarrier]\ndisallow=all\nallow=ulaw\ntype=friend\nusername=testcarrier\nsecret=test\nhost=dynamic\ndtmfmode=rfc2833\ncontext=trunkinbound\n", protocol='SIP', globals_string='TESTSIPTRUNK = SIP/testcarrier', dialplan_entry="exten => _91999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)\nexten => _91999NXXXXXX,2,Dial(${TESTSIPTRUNK}/${EXTEN:2},,To)\nexten => _91999NXXXXXX,3,Hangup\n", server_ip='10.10.10.15', active='N'; -INSERT INTO vicidial_server_carriers SET carrier_id='IAXEXAMPLE', carrier_name='TEST IAX carrier example',registration_string='register => testcarrier:test@10.10.10.15:4569', template_id='--NONE--', account_entry="[testcarrier]\ndisallow=all\nallow=ulaw\ntype=friend\naccountcode=testcarrier\nsecret=test\nhost=dynamic\ncontext=trunkinbound\n", protocol='IAX2', globals_string='TESTIAXTRUNK = IAX2/testcarrier', dialplan_entry="exten => _71999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)\nexten => _71999NXXXXXX,2,Dial(${TESTIAXTRUNK}/${EXTEN:2},,To)\nexten => _71999NXXXXXX,3,Hangup\n", server_ip='10.10.10.15', active='N'; +INSERT INTO vicidial_server_carriers SET carrier_id='PARAXIP', carrier_name='TEST ParaXip CPD example',registration_string='', template_id='--NONE--', account_entry="[paraxip]\ndisallow=all\nallow=ulaw\ntype=peer\nusername=paraxip\nfromuser=paraxip\nsecret=test\nfromdomain=10.10.10.16\nhost=10.10.10.15\ninsecure=port,invite\noutboundproxy=10.0.0.7", protocol='SIP', globals_string='TESTSIPTRUNKP = SIP/paraxip', dialplan_entry="exten => _5591999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)\nexten => _5591999NXXXXXX,2,Dial(${TESTSIPTRUNKP}/${EXTEN:4},${CAMPDTO},To)\nexten => _5591999NXXXXXX,3,Hangup", server_ip='10.10.10.15', active='N'; +INSERT INTO vicidial_server_carriers SET carrier_id='SIPEXAMPLE', carrier_name='TEST SIP carrier example',registration_string='register => testcarrier:test@10.10.10.15:5060', template_id='--NONE--', account_entry="[testcarrier]\ndisallow=all\nallow=ulaw\ntype=friend\nusername=testcarrier\nsecret=test\nhost=dynamic\ndtmfmode=rfc2833\ncontext=trunkinbound\n", protocol='SIP', globals_string='TESTSIPTRUNK = SIP/testcarrier', dialplan_entry="exten => _91999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)\nexten => _91999NXXXXXX,2,Dial(${TESTSIPTRUNK}/${EXTEN:2},${CAMPDTO},To)\nexten => _91999NXXXXXX,3,Hangup\n", server_ip='10.10.10.15', active='N'; +INSERT INTO vicidial_server_carriers SET carrier_id='IAXEXAMPLE', carrier_name='TEST IAX carrier example',registration_string='register => testcarrier:test@10.10.10.15:4569', template_id='--NONE--', account_entry="[testcarrier]\ndisallow=all\nallow=ulaw\ntype=friend\naccountcode=testcarrier\nsecret=test\nhost=dynamic\ncontext=trunkinbound\n", protocol='IAX2', globals_string='TESTIAXTRUNK = IAX2/testcarrier', dialplan_entry="exten => _71999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)\nexten => _71999NXXXXXX,2,Dial(${TESTIAXTRUNK}/${EXTEN:2},${CAMPDTO},To)\nexten => _71999NXXXXXX,3,Hangup\n", server_ip='10.10.10.15', active='N'; INSERT INTO vicidial_inbound_dids SET did_pattern='default', did_description='Default DID', did_active='Y', did_route='EXTEN', extension='9998811112', exten_context='default';