文章目录
- FreeSWITCH使用MySQL数据库
- 填坑 就是自动生成的表结构不对,要自己删除表,运行一下sql
- 适用于Freeswitch1.2以上版本
- 1.编译下 mod_odbc_cdr:在fs源码文件夹的/src/mod/event_handlers/mod_odbc_cdr下,make&&make install
- 2.\autoload_configs\modules.conf.xml文件中添加下面文件
- 3.在autoload_configs文件夹下新建odbc_cdr.conf.xml文件,内容如下:
- 4:重启FreeSWITCH后即可保存通话记录到到表中
FreeSWITCH使用MySQL数据库
填坑 就是自动生成的表结构不对,要自己删除表,运行一下sql
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for aliases
-- ----------------------------
DROP TABLE IF EXISTS `aliases`;
CREATE TABLE `aliases` (
`sticky` int(11) NULL DEFAULT NULL,
`alias` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`command` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `alias1`(`alias`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for calls
-- ----------------------------
DROP TABLE IF EXISTS `calls`;
CREATE TABLE `calls` (
`call_uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`call_created` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`call_created_epoch` int(11) NULL DEFAULT NULL,
`caller_uuid` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`callee_uuid` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `calls1`(`hostname`) USING BTREE,
INDEX `callsidx1`(`hostname`) USING BTREE,
INDEX `eruuindex`(`caller_uuid`, `hostname`) USING BTREE,
INDEX `eeuuindex`(`callee_uuid`) USING BTREE,
INDEX `eeuuindex2`(`call_uuid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for cdr_table_a
-- ----------------------------
DROP TABLE IF EXISTS `cdr_table_a`;
CREATE TABLE `cdr_table_a` (
`uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '唯一ID',
`call_uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联ID,同主叫方UUID',
`caller_id_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主叫方昵称',
`caller_id_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主叫号码',
`destination_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' 被叫号码',
`start_stamp` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '呼叫发起的日期/时间',
`answer_stamp` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实际应答呼叫远端的日期/时间 如果未接听电话,则为空字符串',
`end_stamp` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '呼叫终止的日期/时间',
`uduration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '总呼叫持续时间(以微秒为单位)',
`billsec` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '可计费的通话时长(秒)可计费时间不包括在远端接听电话之前在“早期媒体”中花费的通话时间',
`hangup_cause` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '挂断原因',
`sip_network_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网络IP',
`depart_guid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for cdr_table_ab
-- ----------------------------
DROP TABLE IF EXISTS `cdr_table_ab`;
CREATE TABLE `cdr_table_ab` (
`guid` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '唯一ID',
`call_uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联ID,同主叫方UUID',
`caller_id_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主叫方昵称',
`caller_id_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主叫号码',
`destination_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' 被叫号码',
`start_stamp` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '呼叫发起的日期/时间',
`answer_stamp` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实际应答呼叫远端的日期/时间 如果未接听电话,则为空字符串',
`end_stamp` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '呼叫终止的日期/时间',
`uduration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '总呼叫持续时间(以微秒为单位)',
`billsec` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '可计费的通话时长(秒)可计费时间不包括在远端接听电话之前在“早期媒体”中花费的通话时间',
`hangup_cause` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '挂断原因',
`sip_network_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网络IP',
`depart_guid` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`guid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4818708 AVG_ROW_LENGTH = 1820 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for cdr_table_b
-- ----------------------------
DROP TABLE IF EXISTS `cdr_table_b`;
CREATE TABLE `cdr_table_b` (
`uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '唯一ID',
`call_uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关联ID,同主叫方UUID',
`caller_id_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主叫方昵称',
`caller_id_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '主叫号码',
`destination_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT ' 被叫号码',
`start_stamp` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '呼叫发起的日期/时间',
`answer_stamp` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '实际应答呼叫远端的日期/时间 如果未接听电话,则为空字符串',
`end_stamp` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '呼叫终止的日期/时间',
`uduration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '总呼叫持续时间(以微秒为单位)',
`billsec` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '可计费的通话时长(秒)可计费时间不包括在远端接听电话之前在“早期媒体”中花费的通话时间',
`hangup_cause` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '挂断原因',
`sip_network_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网络IP',
`depart_guid` int(11) NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for channels
-- ----------------------------
DROP TABLE IF EXISTS `channels`;
CREATE TABLE `channels` (
`uuid` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`direction` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`created` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`created_epoch` int(11) NULL DEFAULT NULL,
`name` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`state` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`cid_name` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`cid_num` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`ip_addr` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`dest` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`application` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`application_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`dialplan` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`context` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`read_codec` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`read_rate` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`read_bit_rate` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`write_codec` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`write_rate` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`write_bit_rate` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`secure` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`presence_id` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`presence_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`accountcode` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`callstate` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`callee_name` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`callee_num` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`callee_direction` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`call_uuid` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sent_callee_name` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sent_callee_num` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`initial_cid_name` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`initial_cid_num` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`initial_ip_addr` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`initial_dest` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`initial_dialplan` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`initial_context` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `channels1`(`hostname`) USING BTREE,
INDEX `chidx1`(`hostname`) USING BTREE,
INDEX `uuindex`(`uuid`, `hostname`) USING BTREE,
INDEX `uuindex2`(`call_uuid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for complete
-- ----------------------------
DROP TABLE IF EXISTS `complete`;
CREATE TABLE `complete` (
`sticky` int(11) NULL DEFAULT NULL,
`a1` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`a2` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`a3` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`a4` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`a5` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`a6` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`a7` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`a8` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`a9` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`a10` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `complete1`(`a1`, `hostname`) USING BTREE,
INDEX `complete2`(`a2`, `hostname`) USING BTREE,
INDEX `complete3`(`a3`, `hostname`) USING BTREE,
INDEX `complete4`(`a4`, `hostname`) USING BTREE,
INDEX `complete5`(`a5`, `hostname`) USING BTREE,
INDEX `complete6`(`a6`, `hostname`) USING BTREE,
INDEX `complete7`(`a7`, `hostname`) USING BTREE,
INDEX `complete8`(`a8`, `hostname`) USING BTREE,
INDEX `complete9`(`a9`, `hostname`) USING BTREE,
INDEX `complete10`(`a10`, `hostname`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for db_data
-- ----------------------------
DROP TABLE IF EXISTS `db_data`;
CREATE TABLE `db_data` (
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`realm` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`data_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`data` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
UNIQUE INDEX `dd_data_key_realm`(`data_key`, `realm`) USING BTREE,
INDEX `dd_realm`(`realm`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for fifo_bridge
-- ----------------------------
DROP TABLE IF EXISTS `fifo_bridge`;
CREATE TABLE `fifo_bridge` (
`fifo_name` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`caller_uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`caller_caller_id_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`caller_caller_id_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`consumer_uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`consumer_outgoing_uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`bridge_start` int(11) NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for fifo_callers
-- ----------------------------
DROP TABLE IF EXISTS `fifo_callers`;
CREATE TABLE `fifo_callers` (
`fifo_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`caller_caller_id_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`caller_caller_id_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`timestamp` int(11) NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for fifo_outbound
-- ----------------------------
DROP TABLE IF EXISTS `fifo_outbound`;
CREATE TABLE `fifo_outbound` (
`uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`fifo_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`originate_string` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`simo_count` int(11) NULL DEFAULT NULL,
`use_count` int(11) NULL DEFAULT NULL,
`timeout` int(11) NULL DEFAULT NULL,
`lag` int(11) NULL DEFAULT NULL,
`next_avail` int(11) NOT NULL DEFAULT 0,
`expires` int(11) NOT NULL DEFAULT 0,
`static` int(11) NOT NULL DEFAULT 0,
`outbound_call_count` int(11) NOT NULL DEFAULT 0,
`outbound_fail_count` int(11) NOT NULL DEFAULT 0,
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`taking_calls` int(11) NOT NULL DEFAULT 1,
`status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`outbound_call_total_count` int(11) NOT NULL DEFAULT 0,
`outbound_fail_total_count` int(11) NOT NULL DEFAULT 0,
`active_time` int(11) NOT NULL DEFAULT 0,
`inactive_time` int(11) NOT NULL DEFAULT 0,
`manual_calls_out_count` int(11) NOT NULL DEFAULT 0,
`manual_calls_in_count` int(11) NOT NULL DEFAULT 0,
`manual_calls_out_total_count` int(11) NOT NULL DEFAULT 0,
`manual_calls_in_total_count` int(11) NOT NULL DEFAULT 0,
`ring_count` int(11) NOT NULL DEFAULT 0,
`start_time` int(11) NOT NULL DEFAULT 0,
`stop_time` int(11) NOT NULL DEFAULT 0
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for group_data
-- ----------------------------
DROP TABLE IF EXISTS `group_data`;
CREATE TABLE `group_data` (
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`groupname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `gd_groupname`(`groupname`) USING BTREE,
INDEX `gd_url`(`url`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for interfaces
-- ----------------------------
DROP TABLE IF EXISTS `interfaces`;
CREATE TABLE `interfaces` (
`type` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`name` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`description` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`ikey` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`filename` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`syntax` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for json_store
-- ----------------------------
DROP TABLE IF EXISTS `json_store`;
CREATE TABLE `json_store` (
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for limit_data
-- ----------------------------
DROP TABLE IF EXISTS `limit_data`;
CREATE TABLE `limit_data` (
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`realm` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `ld_hostname`(`hostname`) USING BTREE,
INDEX `ld_uuid`(`uuid`) USING BTREE,
INDEX `ld_realm`(`realm`) USING BTREE,
INDEX `ld_id`(`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for nat
-- ----------------------------
DROP TABLE IF EXISTS `nat`;
CREATE TABLE `nat` (
`sticky` int(11) NULL DEFAULT NULL,
`port` int(11) NULL DEFAULT NULL,
`proto` int(11) NULL DEFAULT NULL,
`hostname` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `nat_map_port_proto`(`port`, `proto`, `hostname`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for recovery
-- ----------------------------
DROP TABLE IF EXISTS `recovery`;
CREATE TABLE `recovery` (
`runtime_uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`technology` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`profile_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`metadata` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
INDEX `recovery1`(`technology`) USING BTREE,
INDEX `recovery2`(`profile_name`) USING BTREE,
INDEX `recovery3`(`uuid`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for registrations
-- ----------------------------
DROP TABLE IF EXISTS `registrations`;
CREATE TABLE `registrations` (
`reg_user` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`realm` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`token` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`url` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
`expires` int(11) NULL DEFAULT NULL,
`network_ip` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`network_port` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`network_proto` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`metadata` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `regindex1`(`reg_user`, `realm`, `hostname`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sip_authentication
-- ----------------------------
DROP TABLE IF EXISTS `sip_authentication`;
CREATE TABLE `sip_authentication` (
`nonce` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`expires` bigint(20) NULL DEFAULT NULL,
`profile_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`last_nc` int(11) NULL DEFAULT NULL,
INDEX `sa_nonce`(`nonce`) USING BTREE,
INDEX `sa_hostname`(`hostname`) USING BTREE,
INDEX `sa_expires`(`expires`) USING BTREE,
INDEX `sa_last_nc`(`last_nc`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sip_dialogs
-- ----------------------------
DROP TABLE IF EXISTS `sip_dialogs`;
CREATE TABLE `sip_dialogs` (
`call_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_to_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_to_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_from_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_from_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`contact_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`contact_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`state` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`direction` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`user_agent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`profile_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`contact` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`presence_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`presence_data` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`call_info` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`call_info_state` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '',
`expires` bigint(20) NULL DEFAULT 0,
`status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`rpid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_to_tag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_from_tag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`rcd` int(11) NOT NULL DEFAULT 0,
INDEX `sd_uuid`(`uuid`) USING BTREE,
INDEX `sd_hostname`(`hostname`) USING BTREE,
INDEX `sd_presence_data`(`presence_data`) USING BTREE,
INDEX `sd_call_info`(`call_info`) USING BTREE,
INDEX `sd_call_info_state`(`call_info_state`) USING BTREE,
INDEX `sd_expires`(`expires`) USING BTREE,
INDEX `sd_rcd`(`rcd`) USING BTREE,
INDEX `sd_sip_to_tag`(`sip_to_tag`) USING BTREE,
INDEX `sd_sip_from_user`(`sip_from_user`) USING BTREE,
INDEX `sd_sip_from_host`(`sip_from_host`) USING BTREE,
INDEX `sd_sip_to_host`(`sip_to_host`) USING BTREE,
INDEX `sd_presence_id`(`presence_id`) USING BTREE,
INDEX `sd_call_id`(`call_id`) USING BTREE,
INDEX `sd_sip_from_tag`(`sip_from_tag`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sip_presence
-- ----------------------------
DROP TABLE IF EXISTS `sip_presence`;
CREATE TABLE `sip_presence` (
`sip_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`rpid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`expires` bigint(20) NULL DEFAULT NULL,
`user_agent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`profile_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`network_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`network_port` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`open_closed` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `sp_hostname`(`hostname`) USING BTREE,
INDEX `sp_open_closed`(`open_closed`) USING BTREE,
INDEX `sp_sip_user`(`sip_user`) USING BTREE,
INDEX `sp_sip_host`(`sip_host`) USING BTREE,
INDEX `sp_profile_name`(`profile_name`) USING BTREE,
INDEX `sp_expires`(`expires`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sip_registrations
-- ----------------------------
DROP TABLE IF EXISTS `sip_registrations`;
CREATE TABLE `sip_registrations` (
`call_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`presence_hosts` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`contact` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`ping_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`ping_count` int(11) NULL DEFAULT NULL,
`ping_time` bigint(20) NULL DEFAULT NULL,
`force_ping` int(11) NULL DEFAULT NULL,
`rpid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`expires` bigint(20) NULL DEFAULT NULL,
`ping_expires` int(11) NOT NULL DEFAULT 0,
`user_agent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`server_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`server_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`profile_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`network_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`network_port` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_realm` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`mwi_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`mwi_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`orig_server_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`orig_hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sub_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `sr_call_id`(`call_id`) USING BTREE,
INDEX `sr_sip_user`(`sip_user`) USING BTREE,
INDEX `sr_sip_host`(`sip_host`) USING BTREE,
INDEX `sr_sub_host`(`sub_host`) USING BTREE,
INDEX `sr_mwi_user`(`mwi_user`) USING BTREE,
INDEX `sr_mwi_host`(`mwi_host`) USING BTREE,
INDEX `sr_profile_name`(`profile_name`) USING BTREE,
INDEX `sr_presence_hosts`(`presence_hosts`) USING BTREE,
INDEX `sr_expires`(`expires`) USING BTREE,
INDEX `sr_ping_expires`(`ping_expires`) USING BTREE,
INDEX `sr_hostname`(`hostname`) USING BTREE,
INDEX `sr_status`(`status`) USING BTREE,
INDEX `sr_ping_status`(`ping_status`) USING BTREE,
INDEX `sr_network_ip`(`network_ip`) USING BTREE,
INDEX `sr_network_port`(`network_port`) USING BTREE,
INDEX `sr_sip_username`(`sip_username`) USING BTREE,
INDEX `sr_sip_realm`(`sip_realm`) USING BTREE,
INDEX `sr_orig_server_host`(`orig_server_host`) USING BTREE,
INDEX `sr_orig_hostname`(`orig_hostname`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sip_shared_appearance_dialogs
-- ----------------------------
DROP TABLE IF EXISTS `sip_shared_appearance_dialogs`;
CREATE TABLE `sip_shared_appearance_dialogs` (
`profile_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`contact_str` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`call_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`network_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`expires` bigint(20) NULL DEFAULT NULL,
INDEX `ssd_profile_name`(`profile_name`) USING BTREE,
INDEX `ssd_hostname`(`hostname`) USING BTREE,
INDEX `ssd_contact_str`(`contact_str`) USING BTREE,
INDEX `ssd_call_id`(`call_id`) USING BTREE,
INDEX `ssd_expires`(`expires`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sip_shared_appearance_subscriptions
-- ----------------------------
DROP TABLE IF EXISTS `sip_shared_appearance_subscriptions`;
CREATE TABLE `sip_shared_appearance_subscriptions` (
`subscriber` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`call_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`aor` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`profile_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`contact_str` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`network_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `ssa_hostname`(`hostname`) USING BTREE,
INDEX `ssa_network_ip`(`network_ip`) USING BTREE,
INDEX `ssa_subscriber`(`subscriber`) USING BTREE,
INDEX `ssa_profile_name`(`profile_name`) USING BTREE,
INDEX `ssa_aor`(`aor`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for sip_subscriptions
-- ----------------------------
DROP TABLE IF EXISTS `sip_subscriptions`;
CREATE TABLE `sip_subscriptions` (
`proto` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sip_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sub_to_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`sub_to_host` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`presence_hosts` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`event` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`contact` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`call_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`full_from` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`full_via` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`expires` bigint(20) NULL DEFAULT NULL,
`user_agent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`accept` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`profile_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`hostname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`network_port` varchar(6) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`network_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`version` int(11) NOT NULL DEFAULT 0,
`orig_proto` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`full_to` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `ss_call_id`(`call_id`) USING BTREE,
INDEX `ss_multi`(`call_id`, `profile_name`, `hostname`) USING BTREE,
INDEX `ss_hostname`(`hostname`) USING BTREE,
INDEX `ss_network_ip`(`network_ip`) USING BTREE,
INDEX `ss_sip_user`(`sip_user`) USING BTREE,
INDEX `ss_sip_host`(`sip_host`) USING BTREE,
INDEX `ss_presence_hosts`(`presence_hosts`) USING BTREE,
INDEX `ss_event`(`event`) USING BTREE,
INDEX `ss_proto`(`proto`) USING BTREE,
INDEX `ss_sub_to_user`(`sub_to_user`) USING BTREE,
INDEX `ss_sub_to_host`(`sub_to_host`) USING BTREE,
INDEX `ss_expires`(`expires`) USING BTREE,
INDEX `ss_orig_proto`(`orig_proto`) USING BTREE,
INDEX `ss_network_port`(`network_port`) USING BTREE,
INDEX `ss_profile_name`(`profile_name`) USING BTREE,
INDEX `ss_version`(`version`) USING BTREE,
INDEX `ss_full_from`(`full_from`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for tasks
-- ----------------------------
DROP TABLE IF EXISTS `tasks`;
CREATE TABLE `tasks` (
`task_id` int(11) NULL DEFAULT NULL,
`task_desc` varchar(4096) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`task_group` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`task_runtime` bigint(20) NULL DEFAULT NULL,
`task_sql_manager` int(11) NULL DEFAULT NULL,
`hostname` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `tasks1`(`hostname`, `task_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for voicemail_msgs
-- ----------------------------
DROP TABLE IF EXISTS `voicemail_msgs`;
CREATE TABLE `voicemail_msgs` (
`created_epoch` int(11) NULL DEFAULT NULL,
`read_epoch` int(11) NULL DEFAULT NULL,
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`domain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`cid_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`cid_number` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`in_folder` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`message_len` int(11) NULL DEFAULT NULL,
`flags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`read_flags` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`forwarded_by` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `voicemail_msgs_idx1`(`created_epoch`) USING BTREE,
INDEX `voicemail_msgs_idx2`(`username`) USING BTREE,
INDEX `voicemail_msgs_idx3`(`domain`) USING BTREE,
INDEX `voicemail_msgs_idx4`(`uuid`) USING BTREE,
INDEX `voicemail_msgs_idx5`(`in_folder`) USING BTREE,
INDEX `voicemail_msgs_idx6`(`read_flags`) USING BTREE,
INDEX `voicemail_msgs_idx7`(`forwarded_by`) USING BTREE,
INDEX `voicemail_msgs_idx8`(`read_epoch`) USING BTREE,
INDEX `voicemail_msgs_idx9`(`flags`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for voicemail_prefs
-- ----------------------------
DROP TABLE IF EXISTS `voicemail_prefs`;
CREATE TABLE `voicemail_prefs` (
`username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`domain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`name_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`greeting_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
INDEX `voicemail_prefs_idx1`(`username`) USING BTREE,
INDEX `voicemail_prefs_idx2`(`domain`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- View structure for basic_calls
-- ----------------------------
DROP VIEW IF EXISTS `basic_calls`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `basic_calls` AS select `a`.`uuid` AS `uuid`,`a`.`direction` AS `direction`,`a`.`created` AS `created`,`a`.`created_epoch` AS `created_epoch`,`a`.`name` AS `name`,`a`.`state` AS `state`,`a`.`cid_name` AS `cid_name`,`a`.`cid_num` AS `cid_num`,`a`.`ip_addr` AS `ip_addr`,`a`.`dest` AS `dest`,`a`.`presence_id` AS `presence_id`,`a`.`presence_data` AS `presence_data`,`a`.`accountcode` AS `accountcode`,`a`.`callstate` AS `callstate`,`a`.`callee_name` AS `callee_name`,`a`.`callee_num` AS `callee_num`,`a`.`callee_direction` AS `callee_direction`,`a`.`call_uuid` AS `call_uuid`,`a`.`hostname` AS `hostname`,`a`.`sent_callee_name` AS `sent_callee_name`,`a`.`sent_callee_num` AS `sent_callee_num`,`b`.`uuid` AS `b_uuid`,`b`.`direction` AS `b_direction`,`b`.`created` AS `b_created`,`b`.`created_epoch` AS `b_created_epoch`,`b`.`name` AS `b_name`,`b`.`state` AS `b_state`,`b`.`cid_name` AS `b_cid_name`,`b`.`cid_num` AS `b_cid_num`,`b`.`ip_addr` AS `b_ip_addr`,`b`.`dest` AS `b_dest`,`b`.`presence_id` AS `b_presence_id`,`b`.`presence_data` AS `b_presence_data`,`b`.`accountcode` AS `b_accountcode`,`b`.`callstate` AS `b_callstate`,`b`.`callee_name` AS `b_callee_name`,`b`.`callee_num` AS `b_callee_num`,`b`.`callee_direction` AS `b_callee_direction`,`b`.`sent_callee_name` AS `b_sent_callee_name`,`b`.`sent_callee_num` AS `b_sent_callee_num`,`c`.`call_created_epoch` AS `call_created_epoch` from ((`channels` `a` left join `calls` `c` on(((`a`.`uuid` = `c`.`caller_uuid`) and (`a`.`hostname` = `c`.`hostname`)))) left join `channels` `b` on(((`b`.`uuid` = `c`.`callee_uuid`) and (`b`.`hostname` = `c`.`hostname`)))) where ((`a`.`uuid` = `c`.`caller_uuid`) or (not(`a`.`uuid` in (select `calls`.`callee_uuid` from `calls`))));
-- ----------------------------
-- View structure for detailed_calls
-- ----------------------------
DROP VIEW IF EXISTS `detailed_calls`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `detailed_calls` AS select `a`.`uuid` AS `uuid`,`a`.`direction` AS `direction`,`a`.`created` AS `created`,`a`.`created_epoch` AS `created_epoch`,`a`.`name` AS `name`,`a`.`state` AS `state`,`a`.`cid_name` AS `cid_name`,`a`.`cid_num` AS `cid_num`,`a`.`ip_addr` AS `ip_addr`,`a`.`dest` AS `dest`,`a`.`application` AS `application`,`a`.`application_data` AS `application_data`,`a`.`dialplan` AS `dialplan`,`a`.`context` AS `context`,`a`.`read_codec` AS `read_codec`,`a`.`read_rate` AS `read_rate`,`a`.`read_bit_rate` AS `read_bit_rate`,`a`.`write_codec` AS `write_codec`,`a`.`write_rate` AS `write_rate`,`a`.`write_bit_rate` AS `write_bit_rate`,`a`.`secure` AS `secure`,`a`.`hostname` AS `hostname`,`a`.`presence_id` AS `presence_id`,`a`.`presence_data` AS `presence_data`,`a`.`accountcode` AS `accountcode`,`a`.`callstate` AS `callstate`,`a`.`callee_name` AS `callee_name`,`a`.`callee_num` AS `callee_num`,`a`.`callee_direction` AS `callee_direction`,`a`.`call_uuid` AS `call_uuid`,`a`.`sent_callee_name` AS `sent_callee_name`,`a`.`sent_callee_num` AS `sent_callee_num`,`b`.`uuid` AS `b_uuid`,`b`.`direction` AS `b_direction`,`b`.`created` AS `b_created`,`b`.`created_epoch` AS `b_created_epoch`,`b`.`name` AS `b_name`,`b`.`state` AS `b_state`,`b`.`cid_name` AS `b_cid_name`,`b`.`cid_num` AS `b_cid_num`,`b`.`ip_addr` AS `b_ip_addr`,`b`.`dest` AS `b_dest`,`b`.`application` AS `b_application`,`b`.`application_data` AS `b_application_data`,`b`.`dialplan` AS `b_dialplan`,`b`.`context` AS `b_context`,`b`.`read_codec` AS `b_read_codec`,`b`.`read_rate` AS `b_read_rate`,`b`.`read_bit_rate` AS `b_read_bit_rate`,`b`.`write_codec` AS `b_write_codec`,`b`.`write_rate` AS `b_write_rate`,`b`.`write_bit_rate` AS `b_write_bit_rate`,`b`.`secure` AS `b_secure`,`b`.`hostname` AS `b_hostname`,`b`.`presence_id` AS `b_presence_id`,`b`.`presence_data` AS `b_presence_data`,`b`.`accountcode` AS `b_accountcode`,`b`.`callstate` AS `b_callstate`,`b`.`callee_name` AS `b_callee_name`,`b`.`callee_num` AS `b_callee_num`,`b`.`callee_direction` AS `b_callee_direction`,`b`.`call_uuid` AS `b_call_uuid`,`b`.`sent_callee_name` AS `b_sent_callee_name`,`b`.`sent_callee_num` AS `b_sent_callee_num`,`c`.`call_created_epoch` AS `call_created_epoch` from ((`channels` `a` left join `calls` `c` on(((`a`.`uuid` = `c`.`caller_uuid`) and (`a`.`hostname` = `c`.`hostname`)))) left join `channels` `b` on(((`b`.`uuid` = `c`.`callee_uuid`) and (`b`.`hostname` = `c`.`hostname`)))) where ((`a`.`uuid` = `c`.`caller_uuid`) or (not(`a`.`uuid` in (select `calls`.`callee_uuid` from `calls`))));
SET FOREIGN_KEY_CHECKS = 1;
适用于Freeswitch1.2以上版本
1.编译下 mod_odbc_cdr:在fs源码文件夹的/src/mod/event_handlers/mod_odbc_cdr下,make&&make install
2.\autoload_configs\modules.conf.xml文件中添加下面文件
<load module="mod_odbc_cdr"/>
3.在autoload_configs文件夹下新建odbc_cdr.conf.xml文件,内容如下:
<configuration name="odbc_cdr.conf" description="ODBC CDR Configuration">
<settings>
<!-- <param name="odbc-dsn" value="database:username:password"/> -->
<!-- ODBC数据源名称:数据库用户名:数据库密码 -->
<param name="odbc-dsn" value="freeswitch:root:password"/>
<!-- global value can be "a-leg", "b-leg", "both" (default is "both") -->
<param name="log-leg" value="both"/>
<!-- value can be "always", "never", "on-db-fail" -->
<param name="write-csv" value="on-db-fail"/>
<!-- location to store csv copy of CDR -->
<param name="csv-path" value="/usr/local/freeswitch/log/odbc_cdr"/>
<!-- if "csv-path-on-fail" is set, failed INSERTs will be placed here as CSV files otherwise they will be placed in "csv-path" -->
<param name="csv-path-on-fail" value="/usr/local/freeswitch/log/odbc_cdr/failed"/>
<!-- dump SQL statement after leg ends -->
<param name="debug-sql" value="false"/>
</settings>
<tables>
<!-- 三张表需要先手动创建 -->
<!-- only a-legs will be inserted into this table -->
<!-- 保存呼叫数据 -->
<table name="cdr_table_a" log-leg="a-leg">
<field name="uuid" chan-var-name="uuid"/>
<field name="call_uuid" chan-var-name="call_uuid"/>
<field name="caller_id_name" chan-var-name="caller_id_name"/>
<field name="caller_id_number" chan-var-name="caller_id_number"/>
<field name="destination_number" chan-var-name="destination_number"/>
<field name="start_stamp" chan-var-name="start_stamp"/>
<field name="answer_stamp" chan-var-name="answer_stamp"/>
<field name="end_stamp" chan-var-name="end_stamp"/>
<field name="uduration" chan-var-name="uduration"/>
<field name="billsec" chan-var-name="billsec"/>
<field name="hangup_cause" chan-var-name="hangup_cause"/>
<field name="sip_network_ip" chan-var-name="sip_network_ip"/>
</table>
<!-- only b-legs will be inserted into this table -->
<!-- 保存接听数据 -->
<table name="cdr_table_b" log-leg="b-leg">
<field name="uuid" chan-var-name="uuid"/>
<field name="call_uuid" chan-var-name="call_uuid"/>
<field name="caller_id_name" chan-var-name="caller_id_name"/>
<field name="caller_id_number" chan-var-name="caller_id_number"/>
<field name="destination_number" chan-var-name="destination_number"/>
<field name="start_stamp" chan-var-name="start_stamp"/>
<field name="answer_stamp" chan-var-name="answer_stamp"/>
<field name="end_stamp" chan-var-name="end_stamp"/>
<field name="uduration" chan-var-name="uduration"/>
<field name="billsec" chan-var-name="billsec"/>
<field name="hangup_cause" chan-var-name="hangup_cause"/>
<field name="sip_network_ip" chan-var-name="sip_network_ip"/>
</table>
<!-- both legs will be inserted into this table -->
<!-- 保存所有通话数据 -->
<table name="cdr_table_ab">
<field name="uuid" chan-var-name="uuid"/>
<field name="call_uuid" chan-var-name="call_uuid"/>
<field name="caller_id_name" chan-var-name="caller_id_name"/>
<field name="caller_id_number" chan-var-name="caller_id_number"/>
<field name="destination_number" chan-var-name="destination_number"/>
<field name="start_stamp" chan-var-name="start_stamp"/>
<field name="answer_stamp" chan-var-name="answer_stamp"/>
<field name="end_stamp" chan-var-name="end_stamp"/>
<field name="uduration" chan-var-name="uduration"/>
<field name="billsec" chan-var-name="billsec"/>
<field name="hangup_cause" chan-var-name="hangup_cause"/>
<field name="sip_network_ip" chan-var-name="sip_network_ip"/>
</table>
</tables>
</configuration>
表字段说明:(三张表需要先手动创建)
direction:话单类型outbound主叫话单,inbound被叫话单
uuid: 唯一ID
call_uuid: 关联ID,同主叫方UUID
caller_id_name: 主叫方昵称
caller_id_number: 主叫号码
destination_number: 被叫号码
start_stamp: 呼叫发起的日期/时间
answer_stamp: 实际应答呼叫远端的日期/时间 如果未接听电话,则为空字符串
end_stamp: 呼叫终止的日期/时间
uduration: 总呼叫持续时间(以微秒为单位)
billsec: 可计费的通话时长(秒)可计费时间不包括在远端接听电话之前在“早期媒体”中花费的通话时间
hangup_cause: 挂断原因
sip_network_ip:网络IP
4:重启FreeSWITCH后即可保存通话记录到到表中
<configuration name="odbc_cdr.conf" description="ODBC CDR Configuration">
<settings>
<!-- <param name="odbc-dsn" value="database:username:password"/> -->
<!-- ODBC数据源名称:数据库用户名:数据库密码 -->
<param name="odbc-dsn" value="freeswitch:root:密码"/>
<!-- global value can be "a-leg", "b-leg", "both" (default is "both") -->
<param name="log-leg" value="both"/>
<!-- value can be "always", "never", "on-db-fail" -->
<param name="write-csv" value="on-db-fail"/>
<!-- location to store csv copy of CDR -->
<param name="csv-path" value="/usr/local/freeswitch/log/odbc_cdr"/>
<!-- if "csv-path-on-fail" is set, failed INSERTs will be placed here as CSV files otherwise they will be placed in "csv-path" -->
<param name="csv-path-on-fail" value="/usr/local/freeswitch/log/odbc_cdr/failed"/>
<!-- dump SQL statement after leg ends -->
<param name="debug-sql" value="false"/>
</settings>
<tables>
<!-- 三张表需要先手动创建 -->
<!-- only a-legs will be inserted into this table -->
<!-- 保存呼叫数据 -->
<table name="cdr_table_a" log-leg="a-leg">
<field name="uuid" chan-var-name="uuid"/>
<field name="call_uuid" chan-var-name="call_uuid"/>
<field name="caller_id_name" chan-var-name="caller_id_name"/>
<field name="caller_id_number" chan-var-name="caller_id_number"/>
<field name="destination_number" chan-var-name="destination_number"/>
<field name="start_stamp" chan-var-name="start_stamp"/>
<field name="answer_stamp" chan-var-name="answer_stamp"/>
<field name="end_stamp" chan-var-name="end_stamp"/>
<field name="uduration" chan-var-name="uduration"/>
<field name="billsec" chan-var-name="billsec"/>
<field name="hangup_cause" chan-var-name="hangup_cause"/>
<field name="sip_network_ip" chan-var-name="sip_network_ip"/>
</table>
<!-- only b-legs will be inserted into this table -->
<!-- 保存接听数据 -->
<table name="cdr_table_b" log-leg="b-leg">
<field name="uuid" chan-var-name="uuid"/>
<field name="call_uuid" chan-var-name="call_uuid"/>
<field name="caller_id_name" chan-var-name="caller_id_name"/>
<field name="caller_id_number" chan-var-name="caller_id_number"/>
<field name="destination_number" chan-var-name="destination_number"/>
<field name="start_stamp" chan-var-name="start_stamp"/>
<field name="answer_stamp" chan-var-name="answer_stamp"/>
<field name="end_stamp" chan-var-name="end_stamp"/>
<field name="uduration" chan-var-name="uduration"/>
<field name="billsec" chan-var-name="billsec"/>
<field name="hangup_cause" chan-var-name="hangup_cause"/>
<field name="sip_network_ip" chan-var-name="sip_network_ip"/>
</table>
<!-- both legs will be inserted into this table -->
<!-- 保存所有通话数据 -->
<table name="cdr_table_ab">
<field name="uuid" chan-var-name="uuid"/>
<field name="call_uuid" chan-var-name="call_uuid"/>
<field name="caller_id_name" chan-var-name="caller_id_name"/>
<field name="caller_id_number" chan-var-name="caller_id_number"/>
<field name="destination_number" chan-var-name="destination_number"/>
<field name="start_stamp" chan-var-name="start_stamp"/>
<field name="answer_stamp" chan-var-name="answer_stamp"/>
<field name="end_stamp" chan-var-name="end_stamp"/>
<field name="uduration" chan-var-name="uduration"/>
<field name="billsec" chan-var-name="billsec"/>
<field name="hangup_cause" chan-var-name="hangup_cause"/>
<field name="sip_network_ip" chan-var-name="sip_network_ip"/>
</table>
</tables>
</configuration>