diff --git a/kamailio.cfg b/kamailio.cfg index 7d2a21e..7561e38 100644 --- a/kamailio.cfg +++ b/kamailio.cfg @@ -28,7 +28,7 @@ loadmodule "db_flatstore.so" cfgengine "native" fork=yes children=4 -#debug=3 +debug=3 log_facility=LOG_LOCAL0 log_prefix="{$mt $hdr(CSeq) $ci} " # RTPProxy settings @@ -63,11 +63,8 @@ modparam("dialog", "dlg_flag", DLG_FLAG) # ACC # -- 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", "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") -# -- cdr accounting to database -modparam("acc", "db_url", "flatstore:/var/log/acc") -modparam("acc", "cdrs_table", "kam_users_cdrs") +modparam("acc", "db_url", "mysql://kamailio:kamailiow@localhost/kamailio") +modparam("acc", "cdrs_table", "acc_cdrs") modparam("acc", "cdr_enable", 1) modparam("acc", "cdr_skip", "nocdr") 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_start_on_confirmed", 1) 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 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 if ($siz==$avp(sip1) || $siz==$avp(sip2)) { $du = "sip:" + $avp(customerpbxip); + $avp(direction)="inbound"; } else { + $avp(direction)="outbound"; ds_select_dst("1","9"); } # If auth is required perform it diff --git a/kamailio.sql b/kamailio.sql index 7a2db90..46994db 100644 --- a/kamailio.sql +++ b/kamailio.sql @@ -56,7 +56,15 @@ CREATE TABLE `acc_cdrs` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `start_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`), KEY `start_time_idx` (`start_time`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; @@ -460,7 +468,7 @@ CREATE TABLE `dispatcher` ( `attrs` varchar(128) NOT NULL DEFAULT '', `description` varchar(64) NOT NULL DEFAULT '', 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 */; -- @@ -469,6 +477,9 @@ CREATE TABLE `dispatcher` ( LOCK TABLES `dispatcher` WRITE; /*!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 */; UNLOCK TABLES; @@ -1806,7 +1817,7 @@ CREATE TABLE `uacreg` ( `socket` varchar(128) NOT NULL DEFAULT '', PRIMARY KEY (`id`), 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 */; -- @@ -1816,7 +1827,8 @@ CREATE TABLE `uacreg` ( LOCK TABLES `uacreg` WRITE; /*!40000 ALTER TABLE `uacreg` DISABLE KEYS */; 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 */; UNLOCK TABLES; @@ -2279,4 +2291,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!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