Added experimental SIP event logging

git-svn-id: svn://192.168.202.10@3106 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2019-05-31 17:32:43 +00:00
parent 9b3009b6d8
commit 0b5049eb7e
17 changed files with 1746 additions and 49 deletions
+170
View File
@@ -0,0 +1,170 @@
SIP EVENT LOGGING DOC Started: 2019-05-30 Updated: 2019-05-30
!!!! THIS IS A WORK IN PROGRESS, NOT FINISHED !!!!
This document will go over the details of the new SIP event logging features that were added to VICIdial for use with patched versions of Asterisk 13
The purpose of this SIP event logging is to hopefully help to be able to better identify FAS(False Answer Supervision) and PDD(Post Dial Delay), as well as manual dial call progress updates to the agent.
IMPORTANT DATABASE SOFTWARE NOTE!!!
This new set of features is going to require database software from 2012 or newer, either MySQL 5.6(or higher) or MariaDB 5.3(or higher). That's when "microseconds" support was added in each. This is used for "DATETIME(6)" database fields that can store high-precision dates like so: "2019-05-30 15:29:22.374172".
Current VICIdial code requires only MySQL 5.1+(from 2005).
For more details:
https://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html
https://mariadb.com/kb/en/library/microseconds-in-mariadb/
IMPORTANT ASTERISK 13 PATCH NOTE!!!
This set of features requires a patch to Asterisk 13. It is included in the VICIdial codebase here: "extras/sip_logging.patch". We do not currently have a patched version of Asterisk for distribution, but we will soon.
IMPORTANT ASTERISK 13 CONF FILE NOTE!!!
You will need to add lines to the /etc/asterisk/manager.conf file to allow for the new SIP messages to arrive from Asterisk:
# to see a complete version of this file, look at the "docs/conf_examples/manager.conf.sample-13" file
# At the top(in the [general] section below "bindaddr = 0.0.0.0"):
timestampevents = yes
# At the bottom of the file, add:
[sipcron]
secret = 1234
read = call
write = command
eventfilter=Event: SIPInvite
eventfilter=Event: SIPResponse
IMPORTANT FEATURE ENABLING NOTE!!!
To enable the SIP event logging listener script, you will need to add 'S' to the "VARactive_keepalives" line in "/etc/astguiclient.conf" file on each dialer that you want these new features to be activated on.
You will also need to enable this feature in Admin -> System Settings
------------------- END OF IMPORTANT NOTES SECTION -----------------------------
Scripts modified/added:
- bin/AST_manager_listen_AMI2.pl
- bin/ADMIN_keepalive_ALL.pl
- bin/ADMIN_update_server_ip.pl
- bin/AST_flush_DBqueue.pl
- bin/ADMIN_archive_log_tables.pl
- install.pl
-------- SQL CHANGES FOR DOCUMENTATION PURPOSES ONLY !!!!!!!!!! ----------------
ALTER TABLE system_settings ADD sip_event_logging ENUM('0','1','2','3','4','5','6','7') default '0';
CREATE TABLE vicidial_sip_event_log (
sip_event_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
caller_code VARCHAR(30) NOT NULL,
channel VARCHAR(100),
server_ip VARCHAR(15),
uniqueid VARCHAR(20),
sip_call_id VARCHAR(256),
event_date DATETIME(6),
event VARCHAR(10),
index(caller_code),
index(event_date)
) ENGINE=MyISAM;
CREATE TABLE vicidial_sip_event_log_0 LIKE vicidial_sip_event_log;
ALTER TABLE vicidial_sip_event_log_0 MODIFY sip_event_id INT(9) UNSIGNED NOT NULL;
CREATE TABLE vicidial_sip_event_log_1 LIKE vicidial_sip_event_log;
ALTER TABLE vicidial_sip_event_log_1 MODIFY sip_event_id INT(9) UNSIGNED NOT NULL;
CREATE TABLE vicidial_sip_event_log_2 LIKE vicidial_sip_event_log;
ALTER TABLE vicidial_sip_event_log_2 MODIFY sip_event_id INT(9) UNSIGNED NOT NULL;
CREATE TABLE vicidial_sip_event_log_3 LIKE vicidial_sip_event_log;
ALTER TABLE vicidial_sip_event_log_3 MODIFY sip_event_id INT(9) UNSIGNED NOT NULL;
CREATE TABLE vicidial_sip_event_log_4 LIKE vicidial_sip_event_log;
ALTER TABLE vicidial_sip_event_log_4 MODIFY sip_event_id INT(9) UNSIGNED NOT NULL;
CREATE TABLE vicidial_sip_event_log_5 LIKE vicidial_sip_event_log;
ALTER TABLE vicidial_sip_event_log_5 MODIFY sip_event_id INT(9) UNSIGNED NOT NULL;
CREATE TABLE vicidial_sip_event_log_6 LIKE vicidial_sip_event_log;
ALTER TABLE vicidial_sip_event_log_6 MODIFY sip_event_id INT(9) UNSIGNED NOT NULL;
CREATE TABLE vicidial_sip_event_archive_details (
wday TINYINT(1) UNSIGNED PRIMARY KEY NOT NULL,
start_event_date DATETIME(6),
end_event_date DATETIME(6),
record_count INT(9) UNSIGNED default '0'
) ENGINE=MyISAM;
CREATE TABLE vicidial_sip_event_recent (
caller_code VARCHAR(20) default '',
channel VARCHAR(100),
server_ip VARCHAR(15),
uniqueid VARCHAR(20),
invite_date DATETIME(6),
first_100_date DATETIME(6),
first_180_date DATETIME(6),
first_183_date DATETIME(6),
last_100_date DATETIME(6),
last_180_date DATETIME(6),
last_183_date DATETIME(6),
200_date DATETIME(6),
error_date DATETIME(6),
processed ENUM('N','Y','U') default 'N',
index(caller_code),
index(invite_date),
index(processed)
) ENGINE=MyISAM;
CREATE TABLE vicidial_log_extended_sip (
call_date DATETIME(6),
caller_code VARCHAR(30) NOT NULL,
invite_to_ring DECIMAL(10,6) DEFAULT '0.000000',
ring_to_final DECIMAL(10,6) DEFAULT '0.000000',
invite_to_final DECIMAL(10,6) DEFAULT '0.000000',
last_event_code SMALLINT(3) default '0',
index(call_date),
index(caller_code)
) ENGINE=MyISAM;
CREATE TABLE vicidial_log_extended_sip_archive LIKE vicidial_log_extended_sip;
CREATE UNIQUE INDEX vlesa on vicidial_log_extended_sip_archive (caller_code,call_date);
MariaDB [asterisk]> SELECT * FROM vicidial_sip_event_log limit 10;
+--------------+----------------------+---------------------+----------------+-------------------+------------------------------------------------------+----------------------------+-----------+
| sip_event_id | caller_code | channel | server_ip | uniqueid | sip_call_id | event_date | sip_event |
+--------------+----------------------+---------------------+----------------+-------------------+------------------------------------------------------+----------------------------+-----------+
| 118753 | M5301113130609827030 | SIP/proxy1-00006875 | 192.168.201.77 | 1559229194.141493 | 4fb064702f741e0623b34dae6c8dd108@118.98.355.182:5060 | 2019-05-30 11:13:15.883335 | 183 |
| 118754 | M5301113120609740192 | SIP/proxy1-00006872 | 192.168.201.77 | 1559229192.141482 | 13de6de179d7d6b32858e4824f89cfbf@118.98.355.182:5060 | 2019-05-30 11:13:16.077451 | 183 |
| 118755 | M5301112560609853853 | SIP/proxy1-00006835 | 192.168.201.77 | 1559229176.141185 | 314c99633566c7ef6de23fb360156df2@118.98.355.182:5060 | 2019-05-30 11:13:16.079431 | 183 |
| 118756 | M5301113150609814022 | SIP/proxy1-0000687a | 192.168.201.77 | 1559229196.141522 | 2bcd9bfa0edef83f13f9aee22f6c0399@118.98.355.182:5060 | 2019-05-30 11:13:16.084397 | INVITE |
| 118757 | M5301113150609814022 | SIP/proxy1-0000687a | 192.168.201.77 | 1559229196.141522 | 2bcd9bfa0edef83f13f9aee22f6c0399@118.98.355.182:5060 | 2019-05-30 11:13:16.084989 | 100 |
| 118758 | M5301113150609814022 | SIP/proxy1-0000687a | 192.168.201.77 | 1559229196.141522 | 2bcd9bfa0edef83f13f9aee22f6c0399@118.98.355.182:5060 | 2019-05-30 11:13:16.085231 | 100 |
| 118759 | M5301112560609755273 | SIP/proxy1-00006838 | 192.168.201.77 | 1559229177.141198 | 6aa258ce5e0ba2085103ff2669d7e17b@118.98.355.182:5060 | 2019-05-30 11:13:16.244411 | 200 |
| 118760 | M5301113130609789654 | SIP/proxy1-00006874 | 192.168.201.77 | 1559229193.141488 | 7cd4c05546aeb95242b8d1196113ced8@118.98.355.182:5060 | 2019-05-30 11:13:16.291505 | 183 |
| 118761 | M5301113160609819452 | SIP/proxy1-0000687b | 192.168.201.77 | 1559229196.141527 | 5c3fc41572b6d91b04f1770d175f873d@118.98.355.182:5060 | 2019-05-30 11:13:16.292730 | INVITE |
| 118762 | M5301113160609819452 | SIP/proxy1-0000687b | 192.168.201.77 | 1559229196.141527 | 5c3fc41572b6d91b04f1770d175f873d@118.98.355.182:5060 | 2019-05-30 11:13:16.293336 | 100 |
+--------------+----------------------+---------------------+----------------+-------------------+------------------------------------------------------+----------------------------+-----------+
+14 -11
View File
@@ -480,34 +480,35 @@ exten => _138331*.,n,Hangup()
; VICIDIAL_auto_dialer transfer script for no-agent campaigns:
exten => 8364,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8364,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB)
exten => 8364,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB-----${CONNECTEDLINE(name)})
exten => 8364,n,Hangup()
; VICIDIAL_auto_dialer transfer script:
exten => 8365,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8365,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----SO)
exten => 8365,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----SO-----${CONNECTEDLINE(name)})
exten => 8365,n,Hangup()
; VICIDIAL_auto_dialer transfer script SURVEY at beginning:
exten => 8366,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8366,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB)
exten => 8366,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB-----${CONNECTEDLINE(name)})
exten => 8366,n,Hangup()
; VICIDIAL_auto_dialer transfer script Load Balance Overflow:
exten => 8367,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8367,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LO)
exten => 8367,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LO-----${CONNECTEDLINE(name)})
exten => 8367,n,Hangup()
; VICIDIAL_auto_dialer transfer script Load Balanced:
exten => 8368,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8368,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB)
exten => 8368,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB-----${CONNECTEDLINE(name)})
exten => 8368,n,Hangup()
; VICIDIAL_auto_dialer transfer script AMD with Load Balanced:
exten => 8369,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8369,n,Playback(sip-silence)
exten => 8369,n,AMD(2000,2000,1000,5000,120,50,4,256)
exten => 8369,n,AGI(VD_amd.agi,${EXTEN})
exten => 8369,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB)
exten => 8369,n,AGI(agi-VDAD_ALL_outbound.agi,NORMAL-----LB-----${CONNECTEDLINE(name)})
exten => 8369,n,Hangup()
; VICIDIAL auto-dial reminder script
@@ -517,31 +518,33 @@ exten => 8372,n,Hangup()
; VICIDIAL SURVEY transfer script AMD with Load Balanced:
exten => 8373,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8373,n,Playback(sip-silence)
exten => 8373,n,AMD(2000,2000,1000,5000,120,50,4,256)
exten => 8373,n,AGI(VD_amd.agi,${EXTEN})
exten => 8373,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB)
exten => 8373,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMP-----LB-----${CONNECTEDLINE(name)})
exten => 8373,n,Hangup()
; VICIDIAL SURVEY transfer script with Cepstral names:
exten => 8374,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8374,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMPCEP-----LB)
exten => 8374,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMPCEP-----LB-----${CONNECTEDLINE(name)})
exten => 8374,n,Hangup()
; VICIDIAL SURVEY transfer script AMD with Cepstral variables:
exten => 8375,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8375,n,Playback(sip-silence)
exten => 8375,n,AMD(2000,2000,1000,5000,120,50,4,256)
exten => 8375,n,AGI(VD_amd.agi,${EXTEN})
exten => 8375,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMPCEP-----LB)
exten => 8375,n,AGI(agi-VDAD_ALL_outbound.agi,SURVEYCAMPCEP-----LB-----${CONNECTEDLINE(name)})
exten => 8375,n,Hangup()
; BETA VICIDIAL_auto_dialer transfer script Load Balanced:
exten => 8377,1,AGI(agi://127.0.0.1:4577/call_log)
exten => 8377,n,Set(LRct=1)
exten => 8377,n,While($[${LRct} < 100])
exten => 8377,n,AGI(agi-VDAD_ALL_outboundBETA.agi,NORMAL-----LB)
exten => 8377,n,AGI(agi-VDAD_ALL_outboundBETA.agi,NORMAL-----LB-----${CONNECTEDLINE(name)})
exten => 8377,n,Set(LRct=$[${LRct} + 1])
exten => 8377,n,EndWhile()
exten => 8377,n,AGI(agi-VDAD_ALL_outboundBETA.agi,NORMAL-----LB)
exten => 8377,n,AGI(agi-VDAD_ALL_outboundBETA.agi,NORMAL-----LB-----${CONNECTEDLINE(name)})
exten => 8377,n,Hangup()
@@ -2,6 +2,7 @@
enabled = yes
port = 5038
bindaddr = 0.0.0.0
timestampevents = yes
[cron]
secret = 1234
@@ -34,3 +35,11 @@ eventfilter=!Event: HangupRequest
secret = 1234
read = command
write = system,call,log,verbose,command,agent,user,originate
[sipcron]
secret = 1234
read = call
write = command
eventfilter=Event: SIPInvite
eventfilter=Event: SIPResponse