CDRS working syslog and mysql - sql is disabled missing field

This commit is contained in:
2024-09-15 18:20:30 +02:00
parent a9d82aabc5
commit 6dde648852
2 changed files with 23 additions and 12 deletions

View File

@@ -28,7 +28,7 @@ loadmodule "db_flatstore.so"
cfgengine "native" cfgengine "native"
fork=yes fork=yes
children=4 children=4
#debug=3 debug=3
log_facility=LOG_LOCAL0 log_facility=LOG_LOCAL0
log_prefix="{$mt $hdr(CSeq) $ci} " log_prefix="{$mt $hdr(CSeq) $ci} "
# RTPProxy settings # RTPProxy settings
@@ -63,11 +63,8 @@ modparam("dialog", "dlg_flag", DLG_FLAG)
# ACC # ACC
# -- cdr accounting to database # -- cdr accounting to database
#modparam("acc", "db_extra", "from_user=$fU; from_domain=$fd; src_ip=$si; ruri_user=$rU; ruri_domain=$rd ; callid=$ci; cidhash=$dlg_var(cidhash)") modparam("acc", "db_url", "mysql://kamailio:kamailiow@localhost/kamailio")
#modparam("acc", "cdr_extra","src_user=$fU;src_domain=$fd;src_ip=$si;dst_user=$rU;dst_ouser=$tU;dst_domain=$rd;sip_code=$rs;sip_reason=$rr;callid=$dlg(callid);dst_ip=$Ri") modparam("acc", "cdrs_table", "acc_cdrs")
# -- cdr accounting to database
modparam("acc", "db_url", "flatstore:/var/log/acc")
modparam("acc", "cdrs_table", "kam_users_cdrs")
modparam("acc", "cdr_enable", 1) modparam("acc", "cdr_enable", 1)
modparam("acc", "cdr_skip", "nocdr") modparam("acc", "cdr_skip", "nocdr")
modparam("acc", "cdr_extra_nullable", 1) modparam("acc", "cdr_extra_nullable", 1)
@@ -76,7 +73,7 @@ modparam("acc", "cdr_on_failed", 1)
modparam("acc", "cdr_expired_dlg_enable", 1) modparam("acc", "cdr_expired_dlg_enable", 1)
modparam("acc", "cdr_start_on_confirmed", 1) modparam("acc", "cdr_start_on_confirmed", 1)
modparam("acc", "cdr_facility", "LOG_LOCAL2") modparam("acc", "cdr_facility", "LOG_LOCAL2")
modparam("acc", "cdr_extra","src_user=$fU;src_domain=$fd;src_ip=$si;dst_user=$rU;dst_ouser=$tU;dst_domain=$rd;sip_code=$rs;sip_reason=$rr;callid=$dlg(callid);dst_ip=$Ri") modparam("acc", "cdr_extra","src_user=$fU;src_domain=$fd;src_ip=$si;dst_user=$rU;dst_ouser=$tU;dst_domain=$rd;callid=$dlg(callid);dst_ip=$Ri;direction=$avp(direction)")
# DIALOG # DIALOG
modparam("dialog", "dlg_flag", DLG_FLAG) modparam("dialog", "dlg_flag", DLG_FLAG)
@@ -157,7 +154,9 @@ route[RELAY] {
# update $du to set the destination address for proxying based on caller IP # update $du to set the destination address for proxying based on caller IP
if ($siz==$avp(sip1) || $siz==$avp(sip2)) { if ($siz==$avp(sip1) || $siz==$avp(sip2)) {
$du = "sip:" + $avp(customerpbxip); $du = "sip:" + $avp(customerpbxip);
$avp(direction)="inbound";
} else { } else {
$avp(direction)="outbound";
ds_select_dst("1","9"); ds_select_dst("1","9");
} }
# If auth is required perform it # If auth is required perform it

View File

@@ -56,7 +56,15 @@ CREATE TABLE `acc_cdrs` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`start_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00', `start_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
`end_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00', `end_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
`duration` float(10,3) NOT NULL DEFAULT 0.000, `duration` float(10,3) DEFAULT NULL,
`src_user` varchar(32) DEFAULT NULL,
`src_domain` varchar(64) DEFAULT NULL,
`src_ip` varchar(39) DEFAULT NULL,
`dst_user` varchar(64) DEFAULT NULL,
`dst_ouser` varchar(64) DEFAULT NULL,
`dst_domain` varchar(64) DEFAULT NULL,
`callid` varchar(128) DEFAULT NULL,
`dst_ip` varchar(39) DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `start_time_idx` (`start_time`) KEY `start_time_idx` (`start_time`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
@@ -460,7 +468,7 @@ CREATE TABLE `dispatcher` (
`attrs` varchar(128) NOT NULL DEFAULT '', `attrs` varchar(128) NOT NULL DEFAULT '',
`description` varchar(64) NOT NULL DEFAULT '', `description` varchar(64) NOT NULL DEFAULT '',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
-- --
@@ -469,6 +477,9 @@ CREATE TABLE `dispatcher` (
LOCK TABLES `dispatcher` WRITE; LOCK TABLES `dispatcher` WRITE;
/*!40000 ALTER TABLE `dispatcher` DISABLE KEYS */; /*!40000 ALTER TABLE `dispatcher` DISABLE KEYS */;
INSERT INTO `dispatcher` VALUES
(1,1,'sip:10.0.5.7:5060',0,1,'','SIP Provider'),
(2,1,'sip:10.0.5.5:5060',0,0,'','SIP Provider2');
/*!40000 ALTER TABLE `dispatcher` ENABLE KEYS */; /*!40000 ALTER TABLE `dispatcher` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
@@ -1806,7 +1817,7 @@ CREATE TABLE `uacreg` (
`socket` varchar(128) NOT NULL DEFAULT '', `socket` varchar(128) NOT NULL DEFAULT '',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `l_uuid_idx` (`l_uuid`) UNIQUE KEY `l_uuid_idx` (`l_uuid`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
-- --
@@ -1816,7 +1827,8 @@ CREATE TABLE `uacreg` (
LOCK TABLES `uacreg` WRITE; LOCK TABLES `uacreg` WRITE;
/*!40000 ALTER TABLE `uacreg` DISABLE KEYS */; /*!40000 ALTER TABLE `uacreg` DISABLE KEYS */;
INSERT INTO `uacreg` VALUES INSERT INTO `uacreg` VALUES
(1,'kamailio','kamailio','10.0.5.7','kamailio','10.0.5.7','asterisk','kam','kam','','sip:10.0.5.7:5060',1800,0,0,'10.0.5.6:5060',''); (1,'kamailio','kamailio','10.0.5.7','kamailio','10.0.5.7','asterisk','kam','kam','','sip:10.0.5.7:5060',1800,0,0,'10.0.5.6:5060',''),
(2,'kamailio2','kamailio','10.0.5.5','kamailio','10.0.5.5','asterisk','kam','kam','','sip:10.0.5.5:5060',1800,0,0,'10.0.5.6:5060','');
/*!40000 ALTER TABLE `uacreg` ENABLE KEYS */; /*!40000 ALTER TABLE `uacreg` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
@@ -2279,4 +2291,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2024-09-06 10:12:59 -- Dump completed on 2024-09-15 18:19:52